~bigbes/lethe

ref: f0f651bfc74681988f56bd610074e1dce6dbee1c lethe/web/src/routes/settings.tsx -rw-r--r-- 1.2 KiB
f0f651bf — Eugene Blikh feat: add search data layer — adapter, highlight helper, hook, and tests 23 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { createFileRoute } from '@tanstack/react-router'
import React, { useState } from 'react'
import { Tag } from '../primitives'
import { SubBar } from '../shell/SubBar'
import { SectionRail } from '../features/settings/SectionRail'
import { SavedSearchesSection } from '../features/settings/SavedSearchesSection'
import { DisplaySection } from '../features/settings/DisplaySection'
import '../styles/settings.css'

type SectionKey = 'saved-searches' | 'display'

const SECTIONS: { key: SectionKey; label: string }[] = [
  { key: 'saved-searches', label: 'Saved searches' },
  { key: 'display', label: 'Display' },
]

export const Route = createFileRoute('/settings')({
  component: SettingsRoute,
})

function SettingsRoute(): React.JSX.Element {
  const [active, setActive] = useState<SectionKey>('saved-searches')

  return (
    <>
      <SubBar>
        <Tag kind="neutral">settings</Tag>
      </SubBar>
      <div className="settings-shell">
        <SectionRail sections={SECTIONS} active={active} onSelect={setActive} />
        <div className="settings-panel">
          {active === 'saved-searches' && <SavedSearchesSection />}
          {active === 'display' && <DisplaySection />}
        </div>
      </div>
    </>
  )
}