Skip to content

Commit

Permalink
flashy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
zarSou9 committed Jun 17, 2024
1 parent 8f1d784 commit 063236a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions app/routes/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function App() {
const [chatSettings, setChatSettings] = useState({mode: 'default'} as ChatSettings)
const question = params.get('question') || undefined
const {selected: questions} = useOnSiteQuestions()
const [flash, setFlash] = useState(true)

useEffect(() => {
setChatSettings(
Expand All @@ -26,21 +27,25 @@ export default function App() {
)
}, [params])

const ModeButton = ({name, mode}: {name: string; mode: Mode}) => {
return (
<Button
className={chatSettings.mode === mode ? 'secondary-selected' : 'secondary'}
action={() => {
if (chatSettings.mode !== mode) {
setTimeout(() => setShowSettings(false), 300)
setChatSettings({...chatSettings, mode})
}
}}
>
{name}
</Button>
)
}
const ModeButton = ({name, mode}: {name: string; mode: Mode}) => (
<Button
className={chatSettings.mode === mode && flash ? 'secondary-selected' : 'secondary'}
action={() => {
if (chatSettings.mode === mode) return
setChatSettings({...chatSettings, mode})
const interval = setInterval(() => {
setFlash((v) => !v)
}, 85)
setTimeout(() => {
clearInterval(interval)
setFlash(true)
setTimeout(() => setShowSettings(false), 235)
}, 370)
}}
>
{name}
</Button>
)

return (
<Page noFooter>
Expand Down

0 comments on commit 063236a

Please sign in to comment.