jan/web/screens/Settings/index.tsx
Faisal Amir a6a0cb325b
feat: local engine management (#4334)
* feat: local engine management

* chore: move remote engine into engine page instead extension page

* chore: set default engine from extension

* chore: update endpoint update engine

* chore: update event onEngineUpdate

* chore: filter out engine download

* chore: update version env

* chore: select default engine variant base on user device specs

* chore: symlink engine variants

* chore: rolldown.config in mjs format

* chore: binary codesign

* fix: download state in footer bar and variant status

* chore: update yarn.lock

* fix: rimraf failure

* fix: setup-node@v3 for built-in cache

* fix: cov pipeline

* fix: build syntax

* chore: fix build step

* fix: create engines folder on launch

* chore: update ui delete engine variant with modal confirmation

* chore: fix linter

* chore: add installing progress for Local Engine download

* chore: wording

---------

Co-authored-by: Louis <louis@jan.ai>
2024-12-30 17:27:51 +07:00

48 lines
1.2 KiB
TypeScript

import { useEffect } from 'react'
import { useSetAtom } from 'jotai'
import CenterPanelContainer from '@/containers/CenterPanelContainer'
import SettingDetail from '@/screens/Settings/SettingDetail'
import SettingLeftPanel from '@/screens/Settings/SettingLeftPanel'
import { SUCCESS_SET_NEW_DESTINATION } from './Advanced/DataFolder'
import { selectedSettingAtom } from '@/helpers/atoms/Setting.atom'
export const SettingScreenList = [
'My Models',
'Preferences',
'Keyboard Shortcuts',
'Privacy',
'Advanced Settings',
'Engines',
'Extensions',
] as const
export type SettingScreenTuple = typeof SettingScreenList
export type SettingScreen = SettingScreenTuple[number]
const SettingsScreen = () => {
const setSelectedSettingScreen = useSetAtom(selectedSettingAtom)
useEffect(() => {
if (localStorage.getItem(SUCCESS_SET_NEW_DESTINATION) === 'true') {
setSelectedSettingScreen('Advanced Settings')
localStorage.removeItem(SUCCESS_SET_NEW_DESTINATION)
}
}, [setSelectedSettingScreen])
return (
<div data-testid="testid-setting-description" className="flex h-full">
<SettingLeftPanel />
<CenterPanelContainer>
<SettingDetail />
</CenterPanelContainer>
</div>
)
}
export default SettingsScreen