Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: adjustment dragable app window

Faisal Amir7c8185022f33
diff --git a/web-app/src/components/left-sidebar/index.tsx b/web-app/src/components/left-sidebar/index.tsx
index f27b1bb19..aad4ff256 100644
--- a/web-app/src/components/left-sidebar/index.tsx
+++ b/web-app/src/components/left-sidebar/index.tsx
@@ -15,22 +15,24 @@ import { cn } from '@/lib/utils'
export function LeftSidebar() {
return (
- <Sidebar variant="floating" collapsible="offcanvas">
- <SidebarHeader className="flex px-1">
- <div className={cn("flex items-center w-full justify-between", IS_MACOS && "justify-end")}>
- {!IS_MACOS && <span className="ml-2 font-medium font-studio">Jan</span>}
- <SidebarTrigger className="text-muted-foreground rounded-full hover:bg-sidebar-foreground/8! -mt-0.5" />
- </div>
- <NavMain />
- </SidebarHeader>
- <SidebarContent className="mask-b-from-95% mask-t-from-98%">
- <NavProjects />
- <NavChats />
- </SidebarContent>
- <SidebarFooter>
- <DownloadManagement />
- </SidebarFooter>
- <SidebarRail />
- </Sidebar>
+ <div className='relative z-50'>
+ <Sidebar variant="floating" collapsible="offcanvas">
+ <SidebarHeader className="flex px-1">
+ <div className={cn("flex items-center w-full justify-between", IS_MACOS && "justify-end")}>
+ {!IS_MACOS && <span className="ml-2 font-medium font-studio">Jan</span>}
+ <SidebarTrigger className="text-muted-foreground rounded-full hover:bg-sidebar-foreground/8! -mt-0.5 relative z-50" />
+ </div>
+ <NavMain />
+ </SidebarHeader>
+ <SidebarContent className="mask-b-from-95% mask-t-from-98%">
+ <NavProjects />
+ <NavChats />
+ </SidebarContent>
+ <SidebarFooter>
+ <DownloadManagement />
+ </SidebarFooter>
+ <SidebarRail />
+ </Sidebar>
+ </div>
)
}
diff --git a/web-app/src/containers/DropdownModelProvider.tsx b/web-app/src/containers/DropdownModelProvider.tsx
index faaa39893..d5898d28a 100644
--- a/web-app/src/containers/DropdownModelProvider.tsx
+++ b/web-app/src/containers/DropdownModelProvider.tsx
@@ -433,43 +433,43 @@ const DropdownModelProvider = memo(function DropdownModelProvider({
return (
<Popover open={open} onOpenChange={onOpenChange}>
- <div className="border px-4 py-1.5 flex items-center gap-1.5 rounded-full">
<PopoverTrigger asChild>
- <button
- type="button"
- className="font-medium cursor-pointer flex items-center gap-1.5 relative z-20 max-w-50"
- >
- {provider && (
- <div className="shrink-0">
- <ProvidersAvatar provider={provider} />
- </div>
- )}
- <span
- className={cn(
- 'text-foreground truncate leading-normal',
- !selectedModel?.id && 'text-muted-foreground'
- )}
+ <div className="border relative z-20 px-4 py-1.5 flex items-center gap-1.5 rounded-full">
+ <button
+ type="button"
+ className="font-medium cursor-pointer flex items-center gap-1.5 relative z-20 max-w-50"
>
- {displayModel}
- </span>
- <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground" />
- </button>
+ {provider && (
+ <div className="shrink-0">
+ <ProvidersAvatar provider={provider} />
+ </div>
+ )}
+ <span
+ className={cn(
+ 'text-foreground truncate leading-normal',
+ !selectedModel?.id && 'text-muted-foreground'
+ )}
+ >
+ {displayModel}
+ </span>
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground" />
+ </button>
+ {currentModel?.settings &&
+ provider &&
+ provider.provider === 'llamacpp' && (
+ <ModelSetting
+ model={currentModel as Model}
+ provider={provider}
+ />
+ )}
+ <ModelSupportStatus
+ modelId={selectedModel?.id}
+ provider={selectedProvider}
+ contextSize={getContextSize()}
+ className="ml-0.5 shrink-0"
+ />
+ </div>
</PopoverTrigger>
- {currentModel?.settings &&
- provider &&
- provider.provider === 'llamacpp' && (
- <ModelSetting
- model={currentModel as Model}
- provider={provider}
- />
- )}
- <ModelSupportStatus
- modelId={selectedModel?.id}
- provider={selectedProvider}
- contextSize={getContextSize()}
- className="ml-0.5 shrink-0"
- />
- </div>
<PopoverContent
className={cn(
@@ -477,8 +477,8 @@ const DropdownModelProvider = memo(function DropdownModelProvider({
searchValue.length === 0 && 'h-80'
)}
align="start"
- sideOffset={16}
- alignOffset={-10}
+ // sideOffset={16}
+ // alignOffset={-10}
side="bottom"
avoidCollisions={searchValue.length === 0 ? true : false}
>
diff --git a/web-app/src/containers/HeaderPage.tsx b/web-app/src/containers/HeaderPage.tsx
index c2bdd795d..534197659 100644
--- a/web-app/src/containers/HeaderPage.tsx
+++ b/web-app/src/containers/HeaderPage.tsx
@@ -29,7 +29,7 @@ const HeaderPage = memo(function HeaderPage({ children }: HeaderPageProps) {
<Button
variant="ghost"
size="icon-sm"
- className='rounded-full'
+ className='rounded-full relative z-50'
onClick={() => setLeftPanel(!open)}
aria-label="Toggle sidebar"
>
diff --git a/web-app/src/routes/__root.tsx b/web-app/src/routes/__root.tsx
index 030a09e3d..a6395244e 100644
--- a/web-app/src/routes/__root.tsx
+++ b/web-app/src/routes/__root.tsx
@@ -56,7 +56,7 @@ const AppLayout = () => {
<KeyboardShortcutsProvider />
{/* Fake absolute panel top to enable window drag */}
{!IS_MACOS && <WindowControls />}
- <div className="fixed w-full h-3 z-20 top-0" data-tauri-drag-region />
+ <div className="fixed w-full h-12 z-20 top-0" data-tauri-drag-region />
<DialogAppUpdater />
<BackendUpdater />
<LeftSidebar />
diff --git a/web-app/src/routes/settings/hardware.tsx b/web-app/src/routes/settings/hardware.tsx
index 9e6d0b14e..99915c5ef 100644
--- a/web-app/src/routes/settings/hardware.tsx
+++ b/web-app/src/routes/settings/hardware.tsx
@@ -124,9 +124,9 @@ function HardwareContent() {
<div className={cn("flex items-center justify-between w-full mr-2 pr-3", !IS_MACOS && "pr-30")}>
<span className='font-medium text-base font-studio'>{t('common:settings')}</span>
<Button
- variant="secondary"
+ variant="outline"
size="sm"
- className="flex items-center gap-2"
+ className="flex items-center gap-2 relative z-50"
onClick={handleClickSystemMonitor}
>
<IconDeviceDesktopAnalytics className="text-muted-foreground size-5" />
diff --git a/web-app/src/routes/settings/mcp-servers.tsx b/web-app/src/routes/settings/mcp-servers.tsx
index 0ab424bbc..e3c5b4dcd 100644
--- a/web-app/src/routes/settings/mcp-servers.tsx
+++ b/web-app/src/routes/settings/mcp-servers.tsx
@@ -366,7 +366,7 @@ function MCPServersDesktop() {
<HeaderPage>
<div className={cn("flex items-center justify-between w-full mr-2 pr-3", !IS_MACOS && "pr-30")}>
<span className='font-medium text-base font-studio'>{t('common:settings')}</span>
- <Button variant="outline" size="sm" onClick={() => handleOpenDialog()}>
+ <Button variant="outline" size="sm" onClick={() => handleOpenDialog()} className="relative z-50">
<IconPlus size={18} className="text-muted-foreground" />
{t('mcp-servers:addServer')}
</Button>
diff --git a/web-app/src/routes/settings/providers/__tests__/index.test.tsx b/web-app/src/routes/settings/providers/__tests__/index.test.tsx
index 767775b64..0882c1b7f 100644
--- a/web-app/src/routes/settings/providers/__tests__/index.test.tsx
+++ b/web-app/src/routes/settings/providers/__tests__/index.test.tsx
@@ -58,8 +58,10 @@ vi.mock('@/i18n/react-i18next-compat', () => ({
vi.mock('@/lib/utils', () => ({
getProviderTitle: (provider: string) => `${provider} Provider`,
+ cn: (...args: any[]) => args.filter(Boolean).join(' '),
}))
+
vi.mock('@tanstack/react-router', () => ({
createFileRoute: (path: string) => (config: any) => ({
...config,
diff --git a/web-app/src/routes/settings/providers/index.tsx b/web-app/src/routes/settings/providers/index.tsx
index f7e887d90..918bf6470 100644
--- a/web-app/src/routes/settings/providers/index.tsx
+++ b/web-app/src/routes/settings/providers/index.tsx
@@ -8,7 +8,7 @@ import { useTranslation } from '@/i18n/react-i18next-compat'
import { useModelProvider } from '@/hooks/useModelProvider'
import { useNavigate } from '@tanstack/react-router'
import { IconCirclePlus, IconSettings } from '@tabler/icons-react'
-import { getProviderTitle } from '@/lib/utils'
+import { cn, getProviderTitle } from '@/lib/utils'
import ProvidersAvatar from '@/containers/ProvidersAvatar'
import { AddProviderDialog } from '@/containers/dialogs'
import { Switch } from '@/components/ui/switch'
@@ -61,8 +61,18 @@ function ModelProviders() {
return (
<div className="flex flex-col h-svh w-full">
<HeaderPage>
- <div className="flex items-center gap-2 w-full">
+ <div className={cn("flex items-center justify-between w-full mr-2 pr-3", !IS_MACOS && "pr-30")}>
<span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ <AddProviderDialog onCreateProvider={createProvider}>
+ <Button
+ variant="outline"
+ size="sm"
+ className="flex items-center gap-2 relative z-20"
+ >
+ <IconCirclePlus size={16} />
+ <span>{t('provider:addProvider')}</span>
+ </Button>
+ </AddProviderDialog>
</div>
</HeaderPage>
<div className="flex h-[calc(100%-60px)]">
@@ -76,16 +86,6 @@ function ModelProviders() {
<span className="font-medium text-base font-studio text-foreground">
{t('common:modelProviders')}
</span>
- <AddProviderDialog onCreateProvider={createProvider}>
- <Button
- variant="secondary"
- size="sm"
- className="flex items-center gap-2"
- >
- <IconCirclePlus size={16} />
- <span>{t('provider:addProvider')}</span>
- </Button>
- </AddProviderDialog>
</div>
}
>