Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Dekstop Revamp #2877

Merged
merged 47 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift click to select a range
98bc86b
feat: desktop revamp
urmauur May 6, 2024
f73f4e4
feat: refactor system monitor
urmauur May 7, 2024
78d2621
fix linter CI
urmauur May 8, 2024
27a5838
remove unused import component
urmauur May 8, 2024
c140c5f
added responsive and resizeable component
urmauur May 10, 2024
023dd9d
responsive and resizeable local server page
urmauur May 10, 2024
0091c3b
finalize responsive and resizeable component
urmauur May 10, 2024
1a3ceab
fix scroll custom ui
urmauur May 10, 2024
22c4470
remove react scroll to bottom from modal troubleshoot
urmauur May 10, 2024
a19ecfe
fix modal troubleshoot ui
urmauur May 12, 2024
0b59e38
fix setting gpu list
urmauur May 12, 2024
3efd394
text area custom scroll bar
urmauur May 12, 2024
a59b82d
fix padding message input
urmauur May 12, 2024
f923ba8
cleanup classname
urmauur May 13, 2024
e1c76d1
update inference engine model dropdown
urmauur May 13, 2024
49ef1f5
update loader style
urmauur May 13, 2024
aff17bb
update quick ask ui
urmauur May 13, 2024
a5c9a29
prepare theme provider
urmauur May 13, 2024
c979f5c
update dark theme
urmauur May 13, 2024
ced890a
remove update hotkey list model and navigation
urmauur May 13, 2024
aaaf184
fix: cleanup hardcode classname
urmauur May 13, 2024
3e5b709
fix: update feedback
urmauur May 14, 2024
87b4bce
Set native theme electron
urmauur May 14, 2024
a1a8445
update destop ui revamp from feedback
urmauur May 15, 2024
68c12c9
update button icon component insider icon chat input message
urmauur May 16, 2024
d13d4a2
update model dropdown ui
urmauur May 16, 2024
cf89c39
update tranaparent baclground
urmauur May 20, 2024
b332d3a
update logo model provider
urmauur May 20, 2024
04c8740
fix: set background material acrylic support to blur background windows
urmauur May 21, 2024
aaecf70
fix: update tranparent left and right panel
urmauur May 22, 2024
45e9ee2
fix: linter CI
urmauur May 22, 2024
d7fdb5c
update app using frameless window
urmauur May 22, 2024
df9a010
styling custom style minimize, maximize and close app
urmauur May 23, 2024
9be000d
temporary hidden maximize window
urmauur May 23, 2024
89b88f0
fix: responsive left and right panel
urmauur May 23, 2024
287c364
fix: enable click outside when leftpanel responsive
urmauur May 23, 2024
20019e6
fix: remove unused import
urmauur May 23, 2024
a84f195
update transparent variable css windows
urmauur May 24, 2024
2d4fc4e
fix: ui import model
urmauur May 24, 2024
d653ea2
feat: Support Theme system (#2946)
urmauur May 27, 2024
5fa8bb6
fix: update feedback missing state when refrash app
urmauur May 27, 2024
d95930a
fix: error test CI
urmauur May 27, 2024
062ac6b
chore: refactor useLoadThemes
urmauur May 28, 2024
aa6b9a5
chore: cleanup unused vars
urmauur May 28, 2024
1f240bf
fix: revert back menubar windows
urmauur May 28, 2024
f7d1b80
fix minor ui
urmauur May 28, 2024
331c1ba
fix: minor ui
urmauur May 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update tranaparent baclground
  • Loading branch information
urmauur committed May 27, 2024
commit cf89c39de2225a9e2a6668bb3ac36618bd4f5bd9
4 changes: 3 additions & 1 deletion electron/managers/mainWindowConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 5,7 @@ export const mainWindowConfig: Electron.BrowserWindowConstructorOptions = {
minWidth: DEFAULT_MIN_WIDTH,
show: true,
titleBarStyle: 'hiddenInset',
vibrancy: 'sidebar',
transparent: true,
vibrancy: 'fullscreen-ui',
visualEffectState: 'active',
}
2 changes: 1 addition & 1 deletion web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 13,7 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html lang="en" suppressHydrationWarning>
<body className="h-screen bg-[hsla(var(--app-bg))] font-sans text-sm antialiased">
<body className="h-screen font-sans text-sm antialiased">
<div className="dragable-bar" />
{children}
</body>
Expand Down
11 changes: 11 additions & 0 deletions web/containers/CenterPanelContainer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 1,11 @@
import { PropsWithChildren } from 'react'

const CenterPanelContainer = ({ children }: PropsWithChildren) => {
return (
<div className="h-full w-full bg-[hsla(var(--center-panel-bg))]">
{children}
</div>
)
}

export default CenterPanelContainer
12 changes: 6 additions & 6 deletions web/containers/Layout/BottomPanel/SystemMonitor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 77,11 @@ const SystemMonitor = () => {
<div
ref={setElementExpand}
className={twMerge(
'fixed bottom-9 left-12 z-50 flex w-[calc(100%-48px)] flex-shrink-0 flex-col border-t border-[hsla(var(--bottom-panel-border))] bg-[hsla(var(--app-bg))]',
'fixed bottom-9 left-[49px] z-50 flex w-[calc(100%-48px-10px)] flex-shrink-0 flex-col rounded-b-lg border-t border-[hsla(var(--app-border))] bg-[hsla(var(--app-bg))]',
showFullScreen && 'h-[calc(100%-63px)]'
)}
>
<div className="flex h-8 flex-shrink-0 items-center justify-between border-b border-[hsla(var(--bottom-panel-border))] px-4">
<div className="flex h-8 flex-shrink-0 items-center justify-between border-b border-[hsla(var(--app-border))] px-4">
<h6 className="font-medium text-[hsla(var(--text-primary))]">
Running Models
</h6>
Expand Down Expand Up @@ -113,15 113,15 @@ const SystemMonitor = () => {
<div className="flex h-full gap-4">
<TableActiveModel />

<div className="w-1/2 border-l border-[hsla(var(--bottom-panel-border))] p-4">
<div className="mb-4 border-b border-[hsla(var(--bottom-panel-border))] pb-4">
<div className="w-1/2 border-l border-[hsla(var(--app-border))] p-4">
<div className="mb-4 border-b border-[hsla(var(--app-border))] pb-4">
<h6 className="font-bold">CPU</h6>
<div className="flex items-center gap-x-4">
<Progress value={cpuUsage} className="w-full" size="small" />
<span className="flex-shrink-0 ">{cpuUsage}%</span>
</div>
</div>
<div className="mb-4 border-b border-[hsla(var(--bottom-panel-border))] pb-4">
<div className="mb-4 border-b border-[hsla(var(--app-border))] pb-4">
<div className="flex items-center justify-between gap-2">
<h6 className="font-bold">Memory</h6>
<span className="text-sm ">
Expand All @@ -140,7 140,7 @@ const SystemMonitor = () => {
</div>

{gpus.length > 0 && (
<div className="mb-4 border-b border-[hsla(var(--bottom-panel-border))] pb-4 last:border-none">
<div className="mb-4 border-b border-[hsla(var(--app-border))] pb-4 last:border-none">
{gpus.map((gpu, index) => (
<div key={index} className="mt-4 flex flex-col gap-x-2">
<div className="flex w-full items-start justify-between">
Expand Down
2 changes: 1 addition & 1 deletion web/containers/Layout/BottomPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 14,7 @@ const BottomPanel = () => {
const progress = useAtomValue(appDownloadProgressAtom)

return (
<div className="fixed bottom-0 left-0 z-50 flex h-9 w-full items-center justify-between border-t border-[hsla(var(--bottom-panel-border))] bg-[hsla(var(--bottom-panel-bg))] px-3 text-xs">
<div className="fixed bottom-0 left-12 z-50 flex h-9 w-[calc(100%-48px)] items-center justify-between border-t border-[hsla(var(--bottom-panel-border))] bg-[hsla(var(--bottom-panel-bg))] px-3 text-xs">
<div className="flex flex-shrink-0 items-center gap-x-2">
<div className="flex items-center space-x-2">
{progress && progress > 0 ? (
Expand Down
2 changes: 1 addition & 1 deletion web/containers/Layout/RibbonPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 52,7 @@ export default function RibbonPanel() {
]

return (
<div className="flex w-12 flex-shrink-0 flex-col items-center border-r border-[hsla(var(--ribbon-panel-border))] bg-[hsla(var(--ribbon-panel-bg))] py-2">
<div className="relative flex h-[calc(100% 36px)] w-12 flex-shrink-0 flex-col items-center border-r border-[hsla(var(--ribbon-panel-border))] bg-[hsla(var(--ribbon-panel-bg))] py-2">
{RibbonNavMenus.filter((menu) => !!menu).map((menu, i) => {
const isActive = mainViewState === menu.state
return (
Expand Down
2 changes: 1 addition & 1 deletion web/containers/Layout/TopPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 47,7 @@ const TopPanel = () => {
return (
<div
className={twMerge(
'fixed z-50 flex h-9 w-full items-center border-y border-[hsla(var(--top-panel-border))] bg-[hsla(var(--top-panel-bg))] px-4 backdrop-blur-md',
'fixed z-50 flex h-9 w-full items-center border-y border-[hsla(var(--top-panel-border))] bg-[hsla(var(--top-panel-bg))] px-4 backdrop-blur-lg',
isMac && 'border-t-0 pl-20'
)}
>
Expand Down
6 changes: 3 additions & 3 deletions web/containers/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 52,14 @@ const BaseLayout = () => {
return (
<Fragment>
<TopPanel />
<div className="relative top-9 flex h-[calc(100vh-(36px 36px))] w-screen overflow-hidden">
<div className="relative top-9 flex h-[calc(100vh-(36px 36px))] w-screen">
<RibbonPanel />
<div className="relative flex w-full bg-[hsla(var(--app-bg))]">
<div className="relative flex w-full bg-[hsla(var(--app-bg-transparent))] pr-2">
<div className="w-full">
<m.div
key={mainViewState}
initial={{ opacity: 0, y: -8 }}
className="h-full"
className="h-full overflow-hidden rounded-lg border border-[hsla(var(--app-border))] shadow"
animate={{
opacity: 1,
y: 0,
Expand Down
2 changes: 1 addition & 1 deletion web/containers/ModelDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 231,7 @@ const ModelDropdown = ({ chatInputMode, strictedThread = true }: Props) => {
className={twMerge(
'w=80 absolute right-0 z-20 mt-2 max-h-80 w-full overflow-hidden rounded-lg border border-[hsla(var(--app-border))] bg-[hsla(var(--app-bg))] shadow-sm',
open ? 'flex' : 'hidden',
chatInputMode && 'bottom-8 left-0 w-80'
chatInputMode && 'bottom-8 left-0 w-72'
)}
ref={setDropdownOptions}
>
Expand Down
67 changes: 35 additions & 32 deletions web/screens/Hub/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 7,7 @@ import { ScrollArea, Button, Select } from '@janhq/joi'
import { useAtomValue, useSetAtom } from 'jotai'
import { UploadIcon } from 'lucide-react'

import CenterPanelContainer from '@/containers/CenterPanelContainer'
import ModelSearch from '@/containers/ModelSearch'

import { setImportModelStageAtom } from '@/hooks/useImportModel'
Expand Down Expand Up @@ -66,42 67,44 @@ const HubScreen = () => {
}, [])

return (
<ScrollArea data-testid="hub-container-test-id" className="h-full w-full">
<div className="relative h-40 p-4 sm:h-auto">
<Image
src="./images/hub-banner.png"
alt="Hub Banner"
width={800}
height={800}
className="h-full w-full rounded-lg object-cover"
/>
<div className="absolute left-1/2 top-1/2 mx-auto w-4/5 -translate-x-1/2 -translate-y-1/2 sm:w-1/2">
<div className="flex flex-col items-center justify-between gap-2 sm:flex-row">
<div className="w-full">
<ModelSearch onSearchLocal={onSearchUpdate} />
</div>
<div className="flex-shrink-0">
<Button onClick={onImportModelClick}>
<UploadIcon size={16} className="mr-2" />
<span>Import Model</span>
</Button>
<CenterPanelContainer>
<ScrollArea data-testid="hub-container-test-id" className="h-full w-full">
<div className="relative h-40 p-4 sm:h-auto">
<Image
src="./images/hub-banner.png"
alt="Hub Banner"
width={800}
height={800}
className="h-full w-full rounded-lg object-cover"
/>
<div className="absolute left-1/2 top-1/2 mx-auto w-4/5 -translate-x-1/2 -translate-y-1/2 sm:w-1/2">
<div className="flex flex-col items-center justify-between gap-2 sm:flex-row">
<div className="w-full">
<ModelSearch onSearchLocal={onSearchUpdate} />
</div>
<div className="flex-shrink-0">
<Button onClick={onImportModelClick}>
<UploadIcon size={16} className="mr-2" />
<span>Import Model</span>
</Button>
</div>
</div>
</div>
</div>
</div>
<div className="p-4 py-0 sm:px-16">
<div className="mb-4 flex w-full justify-end">
<Select
value={sortSelected}
onValueChange={(value) => {
setSortSelected(value)
}}
options={sortMenus}
/>
<div className="p-4 py-0 sm:px-16">
<div className="mb-4 flex w-full justify-end">
<Select
value={sortSelected}
onValueChange={(value) => {
setSortSelected(value)
}}
options={sortMenus}
/>
</div>
<ModelList models={filteredModels} />
</div>
<ModelList models={filteredModels} />
</div>
</ScrollArea>
</ScrollArea>
</CenterPanelContainer>
)
}

Expand Down
97 changes: 50 additions & 47 deletions web/screens/LocalServer/LocalServerCenterPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,7 @@ import { CodeIcon, Paintbrush } from 'lucide-react'

import { InfoIcon } from 'lucide-react'

import CenterPanelContainer from '@/containers/CenterPanelContainer'
import ServerLogs from '@/containers/ServerLogs'

import { useLogs } from '@/hooks/useLogs'
Expand All @@ -24,57 25,59 @@ const LocalServerCenterPanel = () => {
}, [firstTimeVisitAPIServer])

return (
<div className="flex h-full w-full flex-col overflow-hidden bg-[hsla(var(--app-bg))]">
<div className="sticky top-0 flex items-center justify-between border-b border-[hsla(var(--app-border))] px-4 py-2">
<h2 className="font-bold">Server Logs</h2>
<div className="space-x-2">
<Button
theme="ghost"
variant="outline"
onClick={() => openServerLog()}
>
<CodeIcon size={16} className="mr-2" />
Open Logs
</Button>
<Button
theme="ghost"
variant="outline"
onClick={() => clearServerLog()}
>
<Paintbrush size={16} className="mr-2" />
Clear
</Button>
<CenterPanelContainer>
<div className="flex h-full w-full flex-col overflow-hidden bg-[hsla(var(--app-bg))]">
<div className="sticky top-0 flex items-center justify-between border-b border-[hsla(var(--app-border))] px-4 py-2">
<h2 className="font-bold">Server Logs</h2>
<div className="space-x-2">
<Button
theme="ghost"
variant="outline"
onClick={() => openServerLog()}
>
<CodeIcon size={16} className="mr-2" />
Open Logs
</Button>
<Button
theme="ghost"
variant="outline"
onClick={() => clearServerLog()}
>
<Paintbrush size={16} className="mr-2" />
Clear
</Button>
</div>
</div>
</div>
{firstTimeVisitAPIServer ? (
<div className="flex h-full items-center justify-center">
<div className="w-[335px] rounded-lg border border-[hsla(var(--app-border))] p-6">
<div className="item-start flex gap-x-4">
<InfoIcon className="flex-shrink-0 text-[hsla(var(--info-bg))]" />
<div>
<h6 className="font-medium">
Once you start the server, you cannot chat with your
assistant.
</h6>
<Button
className="mt-4"
onClick={() => {
localStorage.setItem(FIRST_TIME_VISIT_API_SERVER, 'false')
setFirstTimeVisitAPIServer(false)
}}
>
Got it
</Button>
{firstTimeVisitAPIServer ? (
<div className="flex h-full items-center justify-center">
<div className="w-[335px] rounded-lg border border-[hsla(var(--app-border))] p-6">
<div className="item-start flex gap-x-4">
<InfoIcon className="flex-shrink-0 text-[hsla(var(--info-bg))]" />
<div>
<h6 className="font-medium">
Once you start the server, you cannot chat with your
assistant.
</h6>
<Button
className="mt-4"
onClick={() => {
localStorage.setItem(FIRST_TIME_VISIT_API_SERVER, 'false')
setFirstTimeVisitAPIServer(false)
}}
>
Got it
</Button>
</div>
</div>
</div>
</div>
</div>
) : (
<ScrollArea className="h-full w-full">
<ServerLogs />
</ScrollArea>
)}
</div>
) : (
<ScrollArea className="h-full w-full">
<ServerLogs />
</ScrollArea>
)}
</div>
</CenterPanelContainer>
)
}

Expand Down
3 changes: 2 additions & 1 deletion web/screens/Settings/MyModels/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 11,7 @@ import { UploadCloudIcon, UploadIcon } from 'lucide-react'

import { twMerge } from 'tailwind-merge'

import CenterPanelContainer from '@/containers/CenterPanelContainer'
import ModelSearch from '@/containers/ModelSearch'

import SetupRemoteModel from '@/containers/SetupRemoteModel'
Expand Down Expand Up @@ -59,7 60,7 @@ const MyModels = () => {
})

return (
<div {...getRootProps()} className="w-full">
<div {...getRootProps()} className="h-full w-full">
<ScrollArea className="h-full w-full">
{isDragActive && (
<div className="absolute z-50 mx-auto h-full w-full bg-[hsla(var(--app-bg))]/50 p-8 backdrop-blur-lg">
Expand Down
6 changes: 5 additions & 1 deletion web/screens/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 2,8 @@ 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'

Expand Down Expand Up @@ -35,7 37,9 @@ const SettingsScreen = () => {
className="flex h-full bg-[hsla(var(--app-bg))]"
>
<SettingLeftPanel />
<SettingDetail />
<CenterPanelContainer>
<SettingDetail />
</CenterPanelContainer>
</div>
)
}
Expand Down
Loading