mirror of
				https://litchi.icu/ngc2207/judge.git
				synced 2025-10-31 22:54:07 +00:00 
			
		
		
		
	refactor: comment out unused code in font-size-slider and update dependencies in editor-panel and chat components
This commit is contained in:
		
							parent
							
								
									ae396dfde1
								
							
						
					
					
						commit
						e6445dbed0
					
				| @ -1,49 +1,49 @@ | ||||
| import { cn } from "@/lib/utils"; | ||||
| import { Slider } from "@/components/ui/slider"; | ||||
| import { useCodeEditorStore } from "@/store/useCodeEditorStore"; | ||||
| import { MAX_FONT_SIZE, MIN_FONT_SIZE } from "@/constants/editor/options"; | ||||
| // import { cn } from "@/lib/utils";
 | ||||
| // import { Slider } from "@/components/ui/slider";
 | ||||
| // import { useCodeEditorStore } from "@/store/useCodeEditorStore";
 | ||||
| // import { MAX_FONT_SIZE, MIN_FONT_SIZE } from "@/constants/editor/options";
 | ||||
| 
 | ||||
| export default function FontSizeSlider() { | ||||
|   const skipInterval = 2; | ||||
|   const ticks = [...Array(MAX_FONT_SIZE - MIN_FONT_SIZE + 1)].map( | ||||
|     (_, i) => i + MIN_FONT_SIZE | ||||
|   ); | ||||
|   const { fontSize, setFontSize } = useCodeEditorStore(); | ||||
| // export default function FontSizeSlider() {
 | ||||
| //   const skipInterval = 2;
 | ||||
| //   const ticks = [...Array(MAX_FONT_SIZE - MIN_FONT_SIZE + 1)].map(
 | ||||
| //     (_, i) => i + MIN_FONT_SIZE
 | ||||
| //   );
 | ||||
| //   const { fontSize, setFontSize } = useCodeEditorStore();
 | ||||
| 
 | ||||
|   const handleSliderChange = (value: number[]) => { | ||||
|     setFontSize(value[0]); | ||||
|   }; | ||||
| //   const handleSliderChange = (value: number[]) => {
 | ||||
| //     setFontSize(value[0]);
 | ||||
| //   };
 | ||||
| 
 | ||||
|   return ( | ||||
|     <div className="w-48 h-8"> | ||||
|       <Slider | ||||
|         value={[fontSize]} | ||||
|         min={MIN_FONT_SIZE} | ||||
|         max={MAX_FONT_SIZE} | ||||
|         onValueChange={handleSliderChange} | ||||
|         aria-label="Slider with ticks" | ||||
|       /> | ||||
|       <span | ||||
|         className="mt-3 flex w-full items-center justify-between gap-1 px-2.5 text-xs font-medium text-muted-foreground" | ||||
|         aria-hidden="true" | ||||
|       > | ||||
|         {ticks.map((tick, i) => ( | ||||
|           <span | ||||
|             key={i} | ||||
|             className="flex w-0 flex-col items-center justify-center gap-2" | ||||
|           > | ||||
|             <span | ||||
|               className={cn( | ||||
|                 "h-1 w-px bg-muted-foreground/70", | ||||
|                 i % skipInterval !== 0 && "h-0.5" | ||||
|               )} | ||||
|             /> | ||||
|             <span className={cn(i % skipInterval !== 0 && "opacity-0")}> | ||||
|               {tick} | ||||
|             </span> | ||||
|           </span> | ||||
|         ))} | ||||
|       </span> | ||||
|     </div> | ||||
|   ); | ||||
| } | ||||
| //   return (
 | ||||
| //     <div className="w-48 h-8">
 | ||||
| //       <Slider
 | ||||
| //         value={[fontSize]}
 | ||||
| //         min={MIN_FONT_SIZE}
 | ||||
| //         max={MAX_FONT_SIZE}
 | ||||
| //         onValueChange={handleSliderChange}
 | ||||
| //         aria-label="Slider with ticks"
 | ||||
| //       />
 | ||||
| //       <span
 | ||||
| //         className="mt-3 flex w-full items-center justify-between gap-1 px-2.5 text-xs font-medium text-muted-foreground"
 | ||||
| //         aria-hidden="true"
 | ||||
| //       >
 | ||||
| //         {ticks.map((tick, i) => (
 | ||||
| //           <span
 | ||||
| //             key={i}
 | ||||
| //             className="flex w-0 flex-col items-center justify-center gap-2"
 | ||||
| //           >
 | ||||
| //             <span
 | ||||
| //               className={cn(
 | ||||
| //                 "h-1 w-px bg-muted-foreground/70",
 | ||||
| //                 i % skipInterval !== 0 && "h-0.5"
 | ||||
| //               )}
 | ||||
| //             />
 | ||||
| //             <span className={cn(i % skipInterval !== 0 && "opacity-0")}>
 | ||||
| //               {tick}
 | ||||
| //             </span>
 | ||||
| //           </span>
 | ||||
| //         ))}
 | ||||
| //       </span>
 | ||||
| //     </div>
 | ||||
| //   );
 | ||||
| // }
 | ||||
|  | ||||
| @ -5,6 +5,7 @@ import { useEditorStore } from "@/store/useEditorStore"; | ||||
| 
 | ||||
| export default function EditorPanel() { | ||||
|   const { setLanguage, setCode } = useEditorStore(); | ||||
| 
 | ||||
|   useEffect(() => { | ||||
|     const handleMessage = (event: MessageEvent) => { | ||||
|       if (event.origin === "https://editor.litchi.icu") { | ||||
| @ -20,7 +21,7 @@ export default function EditorPanel() { | ||||
|     return () => { | ||||
|       window.removeEventListener("message", handleMessage); | ||||
|     }; | ||||
|   }, []); | ||||
|   }, [setLanguage, setCode]); | ||||
| 
 | ||||
|   return <iframe src="https://editor.litchi.icu" className="w-full h-full" />; | ||||
| } | ||||
|  | ||||
| @ -2,6 +2,7 @@ import * as React from "react"; | ||||
| import { Textarea } from "@/components/ui/textarea"; | ||||
| import { cn } from "@/lib/utils"; | ||||
| 
 | ||||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type
 | ||||
| interface ChatInputProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement>{} | ||||
| 
 | ||||
| const ChatInput = React.forwardRef<HTMLTextAreaElement, ChatInputProps>( | ||||
|  | ||||
| @ -8,10 +8,12 @@ interface ChatMessageListProps extends React.HTMLAttributes<HTMLDivElement> { | ||||
| } | ||||
| 
 | ||||
| const ChatMessageList = React.forwardRef<HTMLDivElement, ChatMessageListProps>( | ||||
|   // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|   ({ className, children, smooth = false, ...props }, _ref) => { | ||||
|     const { | ||||
|       scrollRef, | ||||
|       isAtBottom, | ||||
|       // eslint-disable-next-line @typescript-eslint/no-unused-vars
 | ||||
|       autoScrollEnabled, | ||||
|       scrollToBottom, | ||||
|       disableAutoScroll, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user