* 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>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { useCallback } from 'react'
|
|
|
|
import { useAtom } from 'jotai'
|
|
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
import { selectedSettingAtom } from '@/helpers/atoms/Setting.atom'
|
|
|
|
type Props = {
|
|
name: string
|
|
setting: string
|
|
}
|
|
|
|
const SettingItem = ({ name, setting }: Props) => {
|
|
const [selectedSetting, setSelectedSetting] = useAtom(selectedSettingAtom)
|
|
const isActive = selectedSetting === setting
|
|
|
|
const onSettingItemClick = useCallback(() => {
|
|
setSelectedSetting(setting)
|
|
}, [setting, setSelectedSetting])
|
|
|
|
return (
|
|
<div
|
|
className={twMerge(
|
|
'relative my-0.5 block cursor-pointer rounded-lg px-2 py-1.5 hover:bg-[hsla(var(--left-panel-menu-hover))]',
|
|
isActive && 'rounded-lg bg-[hsla(var(--left-panel-icon-active-bg))]'
|
|
)}
|
|
onClick={onSettingItemClick}
|
|
>
|
|
<span
|
|
className={twMerge(
|
|
'p-1.5 font-medium text-[hsla(var(--left-panel-menu))]',
|
|
isActive && 'relative z-10 text-[hsla(var(--left-panel-menu-active))]'
|
|
)}
|
|
>
|
|
{name}
|
|
</span>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default SettingItem
|