From e6445dbed0d9f2bd9feee403b3d8b9b0bde4393c Mon Sep 17 00:00:00 2001 From: ngc2207 Date: Wed, 8 Jan 2025 17:07:07 +0800 Subject: [PATCH] refactor: comment out unused code in font-size-slider and update dependencies in editor-panel and chat components --- .../(main)/components/font-size-slider.tsx | 92 +++++++++---------- src/app/playground/layout/editor-panel.tsx | 3 +- src/components/ui/chat/chat-input.tsx | 1 + src/components/ui/chat/chat-message-list.tsx | 2 + 4 files changed, 51 insertions(+), 47 deletions(-) diff --git a/src/app/(main)/components/font-size-slider.tsx b/src/app/(main)/components/font-size-slider.tsx index ce3fa3c..df2156a 100644 --- a/src/app/(main)/components/font-size-slider.tsx +++ b/src/app/(main)/components/font-size-slider.tsx @@ -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 ( -
- -
- ); -} +// return ( +//
+// +//
+// ); +// } diff --git a/src/app/playground/layout/editor-panel.tsx b/src/app/playground/layout/editor-panel.tsx index cfd5497..17fccfd 100644 --- a/src/app/playground/layout/editor-panel.tsx +++ b/src/app/playground/layout/editor-panel.tsx @@ -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