refactor: rearrange early return for better readability in CommentInstance
This commit is contained in:
parent
6524d77490
commit
ae7f33c485
|
@ -10,7 +10,6 @@ function CommentInstance({ comment }: { comment: CommentSchema }) {
|
||||||
const [selectedComment, setSelectedComment] = useState<CommentSchema | null>(null);
|
const [selectedComment, setSelectedComment] = useState<CommentSchema | null>(null);
|
||||||
const [transformMode, setTransformMode] = useState<"translate" | "rotate" | null>(null);
|
const [transformMode, setTransformMode] = useState<"translate" | "rotate" | null>(null);
|
||||||
|
|
||||||
if (comment.state === 'inactive' || isPlaying) return null;
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
@ -28,6 +27,8 @@ function CommentInstance({ comment }: { comment: CommentSchema }) {
|
||||||
return () => window.removeEventListener("keydown", handleKeyDown);
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
||||||
}, [selectedComment]);
|
}, [selectedComment]);
|
||||||
|
|
||||||
|
if (comment.state === 'inactive' || isPlaying) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<>
|
<>
|
||||||
|
|
Loading…
Reference in New Issue