import { FormattedMessage } from "react-intl"; import StepHeader from "./step-header"; import { DefaultButton } from "@/element/buttons"; import { DefaultProvider } from "@/providers"; import { useEffect, useState } from "react"; import { useLocation, useNavigate } from "react-router-dom"; import CategoryInput from "@/element/stream-editor/category-input"; import { GameInfo } from "@/service/game-database"; import { extractGameTag, sortStreamTags } from "@/utils"; import { appendDedupe } from "@snort/shared"; export default function DashboardIntroStep2() { const navigate = useNavigate(); const location = useLocation(); const [game, setGame] = useState(); const [gameId, setGameId] = useState(); const [tags, setTags] = useState>([]); useEffect(() => { DefaultProvider.info().then(i => { const { regularTags, prefixedTags } = sortStreamTags(i.streamInfo?.tags ?? []); const { gameInfo, gameId } = extractGameTag(prefixedTags); setGame(gameInfo); setGameId(gameId); setTags(regularTags); }); }, []); return (

{ const newState = { ...location.state, tags: appendDedupe(tags, gameId ? [gameId] : undefined), }; await DefaultProvider.updateStream(newState); navigate("/dashboard/step-3", { state: newState, }); }}>
); }