* feat: adding create bot functionality Signed-off-by: James <james@jan.ai> * update the temperature progress bar Signed-off-by: James <james@jan.ai> * WIP baselayout * Mapping plugins with available preferences * Added loader component * WIP working another screen * Cleanup types and avoid import one by one * Prepare bottom bar * Add css variables colors to enable user select the accent * Enable change accent color * Seperate css variable * Fix conflict * Add blank state of my model empty * Restyle explore models page * Enable user config left sidebar * Restyle my models page * WIP styling chat page * Restyling chat message * Fix conflict * Adde form preferences setting plugins * Fixed form bot info * Sidebar bot chat * Showing rightbar for both setting when user created bot * Fix style bot info * Using overflow auto intead of scroll * Remove script built UI from root package * Fix missig import * Resolve error linter * fix e2e tests Signed-off-by: James <james@jan.ai> --------- Signed-off-by: James <james@jan.ai> Co-authored-by: James <james@jan.ai>
64 lines
1.4 KiB
TypeScript
64 lines
1.4 KiB
TypeScript
import React from 'react'
|
|
import { useUserConfigs } from '@hooks/useUserConfigs'
|
|
import { motion as m } from 'framer-motion'
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
type AccentOption = {
|
|
value: Accent
|
|
class: string
|
|
}
|
|
|
|
const accentOptions: AccentOption[] = [
|
|
{
|
|
value: 'accent-blue',
|
|
class: 'bg-blue-500',
|
|
},
|
|
{
|
|
value: 'accent-red',
|
|
class: 'bg-red-500',
|
|
},
|
|
{
|
|
value: 'accent-green',
|
|
class: 'bg-green-500',
|
|
},
|
|
{
|
|
value: 'accent-orange',
|
|
class: 'bg-orange-500',
|
|
},
|
|
]
|
|
|
|
const ToggleAccent = () => {
|
|
const [config, setUserConfig] = useUserConfigs()
|
|
|
|
const handleChangeAccent = (accent: Accent) => {
|
|
setUserConfig({ ...config, accent })
|
|
}
|
|
|
|
return (
|
|
<div className="flex items-center">
|
|
{accentOptions.map((option, i) => {
|
|
const isActive = config.accent === option.value
|
|
return (
|
|
<div
|
|
className="relative flex h-6 w-6 items-center justify-center"
|
|
key={i}
|
|
>
|
|
<button
|
|
className={twMerge('h-3.5 w-3.5 rounded-full', option.class)}
|
|
onClick={() => handleChangeAccent(option.value)}
|
|
/>
|
|
{isActive ? (
|
|
<m.div
|
|
className="border-accent/50 bg-accent/20 absolute inset-0 h-full w-full rounded-full border"
|
|
layoutId="active-accent-menu"
|
|
/>
|
|
) : null}
|
|
</div>
|
|
)
|
|
})}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ToggleAccent
|