Add authenticated login and SSO protection

This commit is contained in:
inman
2026-05-29 15:54:13 +08:00
parent e36f28a668
commit 0648874801
50 changed files with 1853 additions and 63 deletions

View File

@@ -68,7 +68,7 @@ export function CreateStudio({ initialMode = "image" }: { initialMode?: StudioMo
const [videoDuration, setVideoDuration] = useState(VIDEO_DURATION_DEFAULT);
const [videoResolution, setVideoResolution] = useState("720p");
const [mentionState, setMentionState] = useState<MentionState | null>(null);
const [activeMentionIndex, setActiveMentionIndex] = useState(0);
const [activeMentionIndex, setActiveMentionIndex] = useState<number | null>(null);
const [promptScrollTop, setPromptScrollTop] = useState(0);
const [materialPage, setMaterialPage] = useState(1);
const studioRef = useRef<HTMLDivElement | null>(null);
@@ -90,7 +90,7 @@ export function CreateStudio({ initialMode = "image" }: { initialMode?: StudioMo
}, [materials, mentionState]);
useEffect(() => {
setActiveMentionIndex(0);
setActiveMentionIndex(null);
}, [mentionState?.query, mentionSuggestions.length]);
useEffect(() => {
@@ -240,15 +240,15 @@ export function CreateStudio({ initialMode = "image" }: { initialMode?: StudioMo
if (!mentionSuggestions.length) return;
if (event.key === "ArrowDown") {
event.preventDefault();
setActiveMentionIndex((index) => (index + 1) % mentionSuggestions.length);
setActiveMentionIndex((index) => index === null ? 0 : (index + 1) % mentionSuggestions.length);
}
if (event.key === "ArrowUp") {
event.preventDefault();
setActiveMentionIndex((index) => (index - 1 + mentionSuggestions.length) % mentionSuggestions.length);
setActiveMentionIndex((index) => index === null ? mentionSuggestions.length - 1 : (index - 1 + mentionSuggestions.length) % mentionSuggestions.length);
}
if (event.key === "Enter" || event.key === "Tab") {
event.preventDefault();
selectMention(mentionSuggestions[activeMentionIndex] || mentionSuggestions[0]);
selectMention(mentionSuggestions[activeMentionIndex ?? 0] || mentionSuggestions[0]);
}
}