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