jan/web/containers/Topbar/index.tsx
Faisal Amir 539b467141
ui: interface revamp (#429)
* 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>
2023-10-24 10:59:12 +07:00

52 lines
1.7 KiB
TypeScript

import React from 'react'
import { useAtomValue, useSetAtom } from 'jotai'
import { useUserConfigs } from '@hooks/useUserConfigs'
import { getMainViewStateAtom } from '@helpers/atoms/MainView.atom'
import { MainViewState } from '@helpers/atoms/MainView.atom'
import { rightSideBarExpandStateAtom } from '@helpers/atoms/SideBarExpand.atom'
import { PanelLeftClose, PanelLeftOpen, PanelRightOpen } from 'lucide-react'
import { twMerge } from 'tailwind-merge'
const Topbar = () => {
const [config, setConfig] = useUserConfigs()
const viewState = useAtomValue(getMainViewStateAtom)
const setRightSideBarVisibility = useSetAtom(rightSideBarExpandStateAtom)
return (
<div className="fixed left-0 top-0 z-50 flex h-8 w-full justify-between">
<div
className={twMerge(
'unset-drag fixed top-2 block',
config.sidebarLeftExpand ? 'left-[180px]' : 'left-20'
)}
>
{config.sidebarLeftExpand ? (
<PanelLeftClose
size={18}
onClick={() => setConfig({ ...config, sidebarLeftExpand: false })}
className="dark:text-gray-400"
/>
) : (
<PanelLeftOpen
size={18}
onClick={() => setConfig({ ...config, sidebarLeftExpand: true })}
className="dark:text-gray-400"
/>
)}
</div>
{viewState === MainViewState.BotInfo && (
<div className="unset-drag fixed right-4 top-2 block">
<PanelRightOpen
size={18}
onClick={() => setRightSideBarVisibility((prev) => !prev)}
className="dark:text-gray-400"
/>
</div>
)}
</div>
)
}
export default Topbar