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.

ui: revamp layout

Faisal Amir92b2de422cb9
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index e0a7a6041..ffb5e62d1 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -15,10 +15,10 @@
{
"label": "main",
"title": "Jan",
- "width": 1024,
- "minWidth": 375,
- "minHeight": 667,
+ "width": 1200,
+ "minWidth": 1024,
"height": 800,
+ "minHeight": 740,
"resizable": true,
"fullscreen": false,
"zoomHotkeysEnabled": true,
@@ -26,8 +26,8 @@
"hiddenTitle": true,
"transparent": true,
"trafficLightPosition": {
- "x": 12,
- "y": 25
+ "x": 20,
+ "y": 32
},
"decorations": true,
"titleBarStyle": "Overlay",
diff --git a/web-app/index.html b/web-app/index.html
index c61173796..5a128e9cf 100644
--- a/web-app/index.html
+++ b/web-app/index.html
@@ -2,12 +2,19 @@
<html lang="en" class="bg-app">
<head>
<meta charset="UTF-8" />
+ <link rel="preconnect" href="https://fonts.googleapis.com" />
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
+ <link
+ href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap"
+ rel="stylesheet"
+ />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="/images/jan-logo.png"
/>
+
<link
rel="icon"
type="image/png"
diff --git a/web-app/package.json b/web-app/package.json
index 4cd1a621c..a480e92b2 100644
--- a/web-app/package.json
+++ b/web-app/package.json
@@ -29,16 +29,18 @@
"@janhq/interfaces": "0.0.2",
"@radix-ui/react-accordion": "1.2.11",
"@radix-ui/react-avatar": "1.1.10",
- "@radix-ui/react-dialog": "1.1.15",
- "@radix-ui/react-dropdown-menu": "2.1.16",
- "@radix-ui/react-hover-card": "1.1.14",
+ "@radix-ui/react-collapsible": "^1.1.12",
+ "@radix-ui/react-dialog": "^1.1.15",
+ "@radix-ui/react-dropdown-menu": "^2.1.16",
+ "@radix-ui/react-hover-card": "^1.1.15",
"@radix-ui/react-popover": "1.1.14",
"@radix-ui/react-progress": "1.1.4",
- "@radix-ui/react-radio-group": "1.3.8",
- "@radix-ui/react-slider": "1.3.2",
- "@radix-ui/react-slot": "1.2.0",
+ "@radix-ui/react-radio-group": "^1.3.8",
+ "@radix-ui/react-separator": "^1.1.8",
+ "@radix-ui/react-slider": "^1.3.6",
+ "@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-switch": "1.2.2",
- "@radix-ui/react-tooltip": "1.2.4",
+ "@radix-ui/react-tooltip": "^1.2.8",
"@streamdown/cjk": "^1.0.1",
"@streamdown/code": "^1.0.1",
"@streamdown/math": "^1.0.1",
@@ -59,7 +61,7 @@
"@types/uuid": "10.0.0",
"@uiw/react-textarea-code-editor": "3.1.1",
"ai": "5.0.121",
- "class-variance-authority": "0.7.1",
+ "class-variance-authority": "^0.7.1",
"culori": "4.0.1",
"emoji-picker-react": "4.12.2",
"framer-motion": "12.23.12",
@@ -69,8 +71,8 @@
"katex": "0.16.22",
"lodash.clonedeep": "4.5.0",
"lodash.debounce": "4.0.8",
- "lucide-react": "0.536.0",
- "motion": "12.18.1",
+ "lucide-react": "^0.563.0",
+ "motion": "^12.29.2",
"next-themes": "0.4.6",
"posthog-js": "1.255.1",
"react": "19.0.0",
@@ -99,7 +101,7 @@
"unist-util-visit": "^5.0.0",
"use-stick-to-bottom": "^1.0.48",
"uuid": "11.1.0",
- "vaul": "1.1.2",
+ "vaul": "^1.1.2",
"zod": "^4.1.13",
"zustand": "5.0.3"
},
diff --git a/web-app/src/components/TokenCounter.tsx b/web-app/src/components/TokenCounter.tsx
index 0863176c7..b23141651 100644
--- a/web-app/src/components/TokenCounter.tsx
+++ b/web-app/src/components/TokenCounter.tsx
@@ -26,7 +26,6 @@ interface TokenCounterProps {
export const TokenCounter = ({
messages = [],
className,
- compact = false,
additionalTokens = 0,
uploadedFiles = [],
}: TokenCounterProps) => {
@@ -107,177 +106,126 @@ export const TokenCounter = ({
return num.toString()
}
- if (compact) {
- return (
- <TooltipProvider delayDuration={isUpdating ? 1200 : 400}>
- <Tooltip>
- <TooltipTrigger asChild>
- <div
- className={cn('relative cursor-pointer', className)}
- onClick={handleCalculateTokens}
- >
- {/* Main compact display */}
- <div className="flex items-center gap-2 px-2 py-1 rounded-md bg-main-view border border-main-view-fg/10">
- <span
- className={cn(
- 'text-xs font-medium tabular-nums transition-all duration-500 ease-out',
- isOverLimit ? 'text-destructive' : 'text-accent',
- isAnimating && 'scale-110'
- )}
- >
- {adjustedPercentage?.toFixed(1) || '0.0'}%
- </span>
-
- <div className="relative w-4 h-4 flex-shrink-0">
- <svg
- className="w-4 h-4 transform -rotate-90"
- viewBox="0 0 16 16"
- >
- <circle
- cx="8"
- cy="8"
- r="6"
- stroke="currentColor"
- strokeWidth="1.5"
- fill="none"
- className="text-main-view-fg/20"
- />
- <circle
- cx="8"
- cy="8"
- r="6"
- stroke="currentColor"
- strokeWidth="1.5"
- fill="none"
- strokeDasharray={`${2 * Math.PI * 6}`}
- strokeDashoffset={`${2 * Math.PI * 6 * (1 - (adjustedPercentage || 0) / 100)}`}
- className={cn(
- 'transition-all duration-500 ease-out',
- isOverLimit ? 'stroke-destructive' : 'stroke-accent'
- )}
- style={{
- transformOrigin: 'center',
- }}
- />
- </svg>
- </div>
- </div>
- </div>
- </TooltipTrigger>
- <TooltipContent
- side="bottom"
- align="center"
- sideOffset={5}
- showArrow={false}
- className="min-w-[240px] max-w-[240px] bg-main-view border border-main-view-fg/10 "
+ return (
+ <TooltipProvider delayDuration={isUpdating ? 1200 : 400}>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div
+ className={cn('relative cursor-pointer', className)}
+ onClick={handleCalculateTokens}
>
- {/* Detailed breakdown panel */}
- <>
- {/* Header with percentage and progress bar */}
- <div className="mb-3">
- <div className="flex items-center justify-between mb-2">
- <span
- className={cn(
- 'text-lg font-semibold tabular-nums',
- isOverLimit ? 'text-destructive' : 'text-accent'
- )}
- >
- {adjustedPercentage?.toFixed(1) || '0.0'}%
- </span>
- <span className="text-sm text-main-view-fg/60 font-mono">
- {formatNumber(totalTokens)} /{' '}
- {formatNumber(tokenData.maxTokens || 0)}
- </span>
- </div>
+ {/* Main compact display */}
+ <div className="flex items-center gap-2 px-2 py-1 rounded-md bg-background border border-border">
+ <span
+ className={cn(
+ 'text-xs font-medium tabular-nums transition-all duration-500 ease-out',
+ isOverLimit ? 'text-destructive' : 'text-primary',
+ isAnimating && 'scale-110'
+ )}
+ >
+ {adjustedPercentage?.toFixed(1) || '0.0'}%
+ </span>
- {/* Progress bar */}
- <div className="w-full h-2 bg-main-view-fg/10 rounded-full overflow-hidden">
- <div
+ <div className="relative size-4 shrink-0">
+ <svg
+ className="size-4 transform -rotate-90"
+ viewBox="0 0 16 16"
+ >
+ <circle
+ cx="8"
+ cy="8"
+ r="6"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ fill="none"
+ className="text-muted-foreground"
+ />
+ <circle
+ cx="8"
+ cy="8"
+ r="6"
+ stroke="currentColor"
+ strokeWidth="1.5"
+ fill="none"
+ strokeDasharray={`${2 * Math.PI * 6}`}
+ strokeDashoffset={`${2 * Math.PI * 6 * (1 - (adjustedPercentage || 0) / 100)}`}
className={cn(
- 'h-2 rounded-full transition-all duration-500 ease-out',
- isOverLimit ? 'bg-destructive' : 'bg-accent'
+ 'transition-all duration-500 ease-out',
+ isOverLimit ? 'stroke-destructive' : 'stroke-primary'
)}
style={{
- width: `${Math.min(adjustedPercentage || 0, 100)}%`,
+ transformOrigin: 'center',
}}
/>
- </div>
+ </svg>
+ </div>
+ </div>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent
+ side="bottom"
+ align="center"
+ sideOffset={5}
+ showArrow={false}
+ className="min-w-60 max-w-60 bg-background border"
+ >
+ {/* Detailed breakdown panel */}
+ <>
+ {/* Header with percentage and progress bar */}
+ <div className="mb-3">
+ <div className="flex items-center justify-between mb-2">
+ <span
+ className={cn(
+ 'text-lg font-semibold tabular-nums',
+ isOverLimit ? 'text-destructive' : 'text-primary'
+ )}
+ >
+ {adjustedPercentage?.toFixed(1) || '0.0'}%
+ </span>
+ <span className="text-sm text-muted-foreground font-mono">
+ {formatNumber(totalTokens)} /{' '}
+ {formatNumber(tokenData.maxTokens || 0)}
+ </span>
</div>
- {/* Token breakdown */}
- <div className="space-y-2 mb-3">
- <div className="flex items-center justify-between text-sm">
- <span className="text-main-view-fg/60">Text</span>
- <span className="text-main-view-fg font-mono">
- {formatNumber(Math.max(0, tokenData.tokenCount))}
- </span>
- </div>
+ {/* Progress bar */}
+ <div className="w-full h-2 bg-secondary/20 rounded-full overflow-hidden">
+ <div
+ className={cn(
+ 'h-2 rounded-full transition-all duration-500 ease-out',
+ isOverLimit ? 'bg-destructive' : 'bg-primary'
+ )}
+ style={{
+ width: `${Math.min(adjustedPercentage || 0, 100)}%`,
+ }}
+ />
</div>
+ </div>
- {/* Remaining tokens */}
- <div className="border-t border-main-view-fg/10 pt-2">
- <div className="flex items-center justify-between text-sm">
- <span className="text-main-view-fg/60">Remaining</span>
- <span className="text-main-view-fg font-semibold font-mono">
- {formatNumber(
- Math.max(0, (tokenData.maxTokens || 0) - totalTokens)
- )}
- </span>
- </div>
+ {/* Token breakdown */}
+ <div className="space-y-2 mb-3">
+ <div className="flex items-center justify-between text-sm">
+ <span className="text-muted-foreground">Text</span>
+ <span className="text-foreground font-mono">
+ {formatNumber(Math.max(0, tokenData.tokenCount))}
+ </span>
</div>
- </>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- )
- }
+ </div>
- // Non-compact: Simple inline display
- return (
- <div
- className={cn(
- 'flex items-center w-full justify-between gap-2 py-1 text-xs text-main-view-fg/50',
- className
- )}
- >
- <div className="space-x-0.5">
- <span>Context&nbsp;</span>
- <span
- className={cn(
- 'font-mono font-bold transition-all duration-500 ease-out',
- isAnimating && 'scale-110'
- )}
- >
- {formatNumber(totalTokens)}
- </span>
- {tokenData.maxTokens && (
- <>
- <span>/</span>
- <span
- className={cn(
- 'font-mono font-bold transition-all duration-500 ease-out',
- isAnimating && 'scale-110'
- )}
- >
- {formatNumber(tokenData.maxTokens)}
- </span>
- <span
- className={cn(
- 'ml-1 font-mono font-bold transition-all duration-500 ease-out',
- isOverLimit ? 'text-destructive' : 'text-accent',
- isAnimating && 'scale-110'
- )}
- >
- ({adjustedPercentage?.toFixed(1) || '0.0'}%)
- </span>
- {isOverLimit && (
- <span className="text-xs text-main-view-fg/40">
- &nbsp;{isOverLimit ? '⚠️ Over limit' : 'Tokens used'}
- </span>
- )}
+ {/* Remaining tokens */}
+ <div className="border-t border-border pt-2">
+ <div className="flex items-center justify-between text-sm">
+ <span className="text-muted-foreground">Remaining</span>
+ <span className="text-foreground font-semibold font-mono">
+ {formatNumber(
+ Math.max(0, (tokenData.maxTokens || 0) - totalTokens)
+ )}
+ </span>
+ </div>
+ </div>
</>
- )}
- </div>
- </div>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
)
}
diff --git a/web-app/src/ai-elements/code-block.tsx b/web-app/src/components/ai-elements/code-block.tsx
similarity index 98%
rename from web-app/src/ai-elements/code-block.tsx
rename to web-app/src/components/ai-elements/code-block.tsx
index 2a9134ab1..d65d931b2 100644
--- a/web-app/src/ai-elements/code-block.tsx
+++ b/web-app/src/components/ai-elements/code-block.tsx
@@ -1,7 +1,7 @@
/* eslint-disable react-refresh/only-export-components */
-import { Button } from "../ui/button";
-import { cn } from "../lib/utils";
+import { Button } from "@/components/ui/button";
+import { cn } from "@/lib/utils";
import { CheckIcon, CopyIcon } from "lucide-react";
import {
type ComponentProps,
diff --git a/web-app/src/ai-elements/conversation.tsx b/web-app/src/components/ai-elements/conversation.tsx
similarity index 97%
rename from web-app/src/ai-elements/conversation.tsx
rename to web-app/src/components/ai-elements/conversation.tsx
index d617a8748..ac7e113cf 100644
--- a/web-app/src/ai-elements/conversation.tsx
+++ b/web-app/src/components/ai-elements/conversation.tsx
@@ -24,7 +24,7 @@ export const ConversationContent = ({
...props
}: ConversationContentProps) => (
<StickToBottom.Content
- className={cn('flex flex-col gap-x-8 p-4', className)}
+ className={cn('flex flex-col gap-x-8 gap-y-2 px-2', className)}
{...props}
/>
)
diff --git a/web-app/src/ai-elements/reasoning.tsx b/web-app/src/components/ai-elements/reasoning.tsx
similarity index 97%
rename from web-app/src/ai-elements/reasoning.tsx
rename to web-app/src/components/ai-elements/reasoning.tsx
index 9650cdae7..2aa135525 100644
--- a/web-app/src/ai-elements/reasoning.tsx
+++ b/web-app/src/components/ai-elements/reasoning.tsx
@@ -4,8 +4,8 @@ import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
-} from '../ui/collapsible'
-import { cn } from '../lib/utils'
+} from '@/components/ui/collapsible'
+import { cn } from '@/lib/utils'
import { BrainIcon, ChevronDownIcon } from 'lucide-react'
import type { ComponentProps, ReactNode } from 'react'
import {
@@ -178,7 +178,7 @@ export const ReasoningContent = memo(
)}
{...props}
>
- <div className="ml-2 pl-4 border-l-2 border-dotted border-main-view-fg/10">
+ <div className="ml-2 pl-4 border-l-2 border-dotted">
<Streamdown animate={true} animationDuration={500} {...props}>
{children}
</Streamdown>
diff --git a/web-app/src/ai-elements/shimmer.tsx b/web-app/src/components/ai-elements/shimmer.tsx
similarity index 97%
rename from web-app/src/ai-elements/shimmer.tsx
rename to web-app/src/components/ai-elements/shimmer.tsx
index 0b5312f42..ea7c98502 100644
--- a/web-app/src/ai-elements/shimmer.tsx
+++ b/web-app/src/components/ai-elements/shimmer.tsx
@@ -1,4 +1,4 @@
-import { cn } from "../lib/utils";
+import { cn } from "@/lib/utils";
import { motion } from "motion/react";
import {
type CSSProperties,
diff --git a/web-app/src/ai-elements/tool.tsx b/web-app/src/components/ai-elements/tool.tsx
similarity index 93%
rename from web-app/src/ai-elements/tool.tsx
rename to web-app/src/components/ai-elements/tool.tsx
index f56cdf1a4..71206951e 100644
--- a/web-app/src/ai-elements/tool.tsx
+++ b/web-app/src/components/ai-elements/tool.tsx
@@ -4,8 +4,8 @@ import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
-} from '../ui/collapsible'
-import { cn } from '../lib/utils'
+} from '@/components/ui/collapsible'
+import { cn } from '@/lib/utils'
import type { ToolUIPart } from 'ai'
import { ChevronDownIcon, WrenchIcon } from 'lucide-react'
import type { ComponentProps, ReactNode } from 'react'
@@ -137,7 +137,7 @@ export const ToolContent = memo(
)}
{...props}
>
- <div className="ml-2 pl-4 border-l-2 border-dotted border-main-view-fg/10">
+ <div className="ml-2 pl-4 border-l-2 border-dotted">
{children}
</div>
</CollapsibleContent>
@@ -155,7 +155,7 @@ export const ToolInput = memo(
<h4 className="font-medium text-muted-foreground text-xs uppercase tracking-wide">
Parameters
</h4>
- <div className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 ">
+ <div className="rounded-md max-h-40 overflow-auto border ">
<CodeBlock code={JSON.stringify(input, null, 2)} language="json" />
</div>
</div>
@@ -204,7 +204,7 @@ const ToolImage = memo(({ data, index }: ToolImageProps) => {
<img
src={preparedUrl}
alt="Tool output"
- className="max-w-full max-h-96 w-auto h-auto object-contain rounded-md border border-main-view-fg/10"
+ className="max-w-full max-h-96 w-auto h-auto object-contain rounded-md border"
/>
</div>
)
@@ -226,7 +226,7 @@ export const ToolOutput = memo(
// Handle string output
if (typeof output === 'string') {
return (
- <div className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 ">
+ <div className="max-h-40 overflow-auto rounded-md border ">
<CodeBlock code={output} language="json" />
</div>
)
@@ -257,7 +257,7 @@ export const ToolOutput = memo(
{textItems.map((item, index) => (
<div
key={index}
- className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 "
+ className="rounded-md max-h-40 overflow-auto border "
>
<CodeBlock code={item.text || ''} language="markdown" />
</div>
@@ -295,7 +295,7 @@ export const ToolOutput = memo(
return (
<div className="space-y-4">
{nonImageOutput.length > 0 && (
- <div className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 ">
+ <div className="rounded-md max-h-40 overflow-auto rounded-md border ">
<CodeBlock
code={JSON.stringify(nonImageOutput, null, 2)}
language="json"
@@ -320,7 +320,7 @@ export const ToolOutput = memo(
}
return (
- <div className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 ">
+ <div className="rounded-md max-h-40 overflow-auto border ">
<CodeBlock
code={JSON.stringify(output, null, 2)}
language="json"
@@ -331,7 +331,7 @@ export const ToolOutput = memo(
// Handle regular object
return (
- <div className="rounded-md max-h-40 overflow-auto rounded-md border border-main-view-fg/10 ">
+ <div className="rounded-md max-h-40 overflow-auto border ">
<CodeBlock code={JSON.stringify(output, null, 2)} language="json" />
</div>
)
diff --git a/web-app/src/components/animated-icon/blocks.tsx b/web-app/src/components/animated-icon/blocks.tsx
new file mode 100644
index 000000000..08d959784
--- /dev/null
+++ b/web-app/src/components/animated-icon/blocks.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface BlocksIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface BlocksIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const VARIANTS: Variants = {
+ normal: { translateX: 0, translateY: 0 },
+ animate: { translateX: -4, translateY: 4 },
+};
+
+const BlocksIcon = forwardRef<BlocksIconHandle, BlocksIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3" />
+ <motion.path
+ animate={controls}
+ d="M14 3h7v7h-7z"
+ variants={VARIANTS}
+ />
+ </svg>
+ </div>
+ );
+ }
+);
+
+BlocksIcon.displayName = "BlocksIcon";
+
+export { BlocksIcon };
diff --git a/web-app/src/components/animated-icon/folder-open.tsx b/web-app/src/components/animated-icon/folder-open.tsx
new file mode 100644
index 000000000..9b5a90e49
--- /dev/null
+++ b/web-app/src/components/animated-icon/folder-open.tsx
@@ -0,0 +1,98 @@
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes, MouseEvent } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface FolderOpenIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface FolderOpenIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const VARIANTS: Variants = {
+ normal: { rotate: 0 },
+ animate: {
+ rotate: [0, -8, 6, -4, 0],
+ transition: {
+ ease: "easeInOut",
+ rotate: {
+ duration: 0.6,
+ },
+ },
+ },
+};
+
+const FolderOpenIcon = forwardRef<FolderOpenIconHandle, FolderOpenIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <motion.svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <motion.path
+ animate={controls}
+ d="m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2"
+ initial="normal"
+ style={{ transformOrigin: "12px 12px" }}
+ variants={VARIANTS}
+ />
+ </motion.svg>
+ </div>
+ );
+ }
+);
+
+FolderOpenIcon.displayName = "FolderOpenIcon";
+
+export { FolderOpenIcon };
diff --git a/web-app/src/components/animated-icon/folder-plus.tsx b/web-app/src/components/animated-icon/folder-plus.tsx
new file mode 100644
index 000000000..7aa5908ba
--- /dev/null
+++ b/web-app/src/components/animated-icon/folder-plus.tsx
@@ -0,0 +1,109 @@
+"use client";
+
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface FolderPlusIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface FolderPlusIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const PATH_VARIANTS: Variants = {
+ normal: { pathLength: 1, opacity: 1 },
+ animate: (custom: number) => ({
+ pathLength: [0, 1],
+ opacity: [0, 1],
+ transition: {
+ duration: 0.4,
+ ease: "easeInOut",
+ delay: custom * 0.1,
+ opacity: { delay: custom * 0.1 },
+ },
+ }),
+};
+
+const FolderPlusIcon = forwardRef<FolderPlusIconHandle, FolderPlusIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" />
+ <motion.path
+ animate={controls}
+ custom={1}
+ d="M12 10v6"
+ initial="normal"
+ variants={PATH_VARIANTS}
+ />
+ <motion.path
+ animate={controls}
+ custom={0}
+ d="M9 13h6"
+ initial="normal"
+ variants={PATH_VARIANTS}
+ />
+ </svg>
+ </div>
+ );
+ }
+);
+
+FolderPlusIcon.displayName = "FolderPlusIcon";
+
+export { FolderPlusIcon };
diff --git a/web-app/src/components/animated-icon/folders.tsx b/web-app/src/components/animated-icon/folders.tsx
new file mode 100644
index 000000000..0430a4b74
--- /dev/null
+++ b/web-app/src/components/animated-icon/folders.tsx
@@ -0,0 +1,122 @@
+"use client";
+
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface FoldersIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface FoldersIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const FoldersIcon = forwardRef<FoldersIconHandle, FoldersIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <motion.path
+ animate={controls}
+ d="M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z"
+ transition={{
+ type: "spring",
+ stiffness: 250,
+ damping: 25,
+ }}
+ variants={{
+ normal: {
+ translateX: 0,
+ translateY: 0,
+ },
+ animate: {
+ translateX: -2,
+ translateY: 2,
+ },
+ }}
+ />
+ <motion.path
+ animate={controls}
+ d="M2 8v11a2 2 0 0 0 2 2h14"
+ transition={{
+ type: "spring",
+ stiffness: 250,
+ damping: 25,
+ }}
+ variants={{
+ normal: {
+ translateX: 0,
+ translateY: 0,
+ opacity: 1,
+ scale: 1,
+ },
+ animate: {
+ translateX: 2,
+ translateY: -2,
+ opacity: 0,
+ scale: 0.9,
+ },
+ }}
+ />
+ </svg>
+ </div>
+ );
+ }
+);
+
+FoldersIcon.displayName = "FoldersIcon";
+
+export { FoldersIcon };
diff --git a/web-app/src/components/animated-icon/gallery-vertical-end.tsx b/web-app/src/components/animated-icon/gallery-vertical-end.tsx
new file mode 100644
index 000000000..ed88af726
--- /dev/null
+++ b/web-app/src/components/animated-icon/gallery-vertical-end.tsx
@@ -0,0 +1,115 @@
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface GalleryVerticalEndIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface GalleryVerticalEndIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const PATH_VARIANTS: Variants = {
+ normal: {
+ y: 0,
+ opacity: 1,
+ transition: {
+ type: "tween",
+ stiffness: 200,
+ damping: 13,
+ },
+ },
+ animate: (i: number) => ({
+ y: [2 * i, 0],
+ opacity: [0, 1],
+ transition: {
+ delay: 0.25 * (2 - i),
+ type: "tween",
+ stiffness: 200,
+ damping: 13,
+ },
+ }),
+};
+
+const GalleryVerticalEndIcon = forwardRef<
+ GalleryVerticalEndIconHandle,
+ GalleryVerticalEndIconProps
+>(({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <motion.path
+ animate={controls}
+ custom={1}
+ d="M7 2h10"
+ variants={PATH_VARIANTS}
+ />
+ <motion.path
+ animate={controls}
+ custom={2}
+ d="M5 6h14"
+ variants={PATH_VARIANTS}
+ />
+ <rect height="12" rx="2" width="18" x="3" y="10" />
+ </svg>
+ </div>
+ );
+});
+
+GalleryVerticalEndIcon.displayName = "GalleryVerticalEndIcon";
+
+export { GalleryVerticalEndIcon };
diff --git a/web-app/src/components/animated-icon/message-circle-more.tsx b/web-app/src/components/animated-icon/message-circle-more.tsx
new file mode 100644
index 000000000..2aa247b50
--- /dev/null
+++ b/web-app/src/components/animated-icon/message-circle-more.tsx
@@ -0,0 +1,125 @@
+"use client";
+
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface MessageCircleMoreIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface MessageCircleMoreIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const DOT_VARIANTS: Variants = {
+ normal: {
+ opacity: 1,
+ },
+ animate: (custom: number) => ({
+ opacity: [1, 0, 0, 1, 1, 0, 0, 1],
+ transition: {
+ opacity: {
+ times: [
+ 0,
+ 0.1,
+ 0.1 + custom * 0.1,
+ 0.1 + custom * 0.1 + 0.1,
+ 0.5,
+ 0.6,
+ 0.6 + custom * 0.1,
+ 0.6 + custom * 0.1 + 0.1,
+ ],
+ duration: 1.5,
+ },
+ },
+ }),
+};
+
+const MessageCircleMoreIcon = forwardRef<
+ MessageCircleMoreIconHandle,
+ MessageCircleMoreIconProps
+>(({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <svg
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z" />
+ <motion.path
+ animate={controls}
+ custom={0}
+ d="M8 12h.01"
+ variants={DOT_VARIANTS}
+ />
+ <motion.path
+ animate={controls}
+ custom={1}
+ d="M12 12h.01"
+ variants={DOT_VARIANTS}
+ />
+ <motion.path
+ animate={controls}
+ custom={2}
+ d="M16 12h.01"
+ variants={DOT_VARIANTS}
+ />
+ </svg>
+ </div>
+ );
+});
+
+MessageCircleMoreIcon.displayName = "MessageCircleMoreIcon";
+
+export { MessageCircleMoreIcon };
diff --git a/web-app/src/components/animated-icon/message-circle.tsx b/web-app/src/components/animated-icon/message-circle.tsx
new file mode 100644
index 000000000..d4f4bdccf
--- /dev/null
+++ b/web-app/src/components/animated-icon/message-circle.tsx
@@ -0,0 +1,107 @@
+"use client";
+
+import type { Variants } from "motion/react";
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface MessageCircleIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface MessageCircleIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const ICON_VARIANTS: Variants = {
+ normal: {
+ scale: 1,
+ rotate: 0,
+ },
+ animate: {
+ scale: 1.05,
+ rotate: [0, -7, 7, 0],
+ transition: {
+ rotate: {
+ duration: 0.5,
+ ease: "easeInOut",
+ },
+ scale: {
+ type: "spring",
+ stiffness: 400,
+ damping: 10,
+ },
+ },
+ },
+};
+
+const MessageCircleIcon = forwardRef<
+ MessageCircleIconHandle,
+ MessageCircleIconProps
+>(({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <motion.svg
+ animate={controls}
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ variants={ICON_VARIANTS}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z" />
+ </motion.svg>
+ </div>
+ );
+});
+
+MessageCircleIcon.displayName = "MessageCircleIcon";
+
+export { MessageCircleIcon };
diff --git a/web-app/src/components/animated-icon/search.tsx b/web-app/src/components/animated-icon/search.tsx
new file mode 100644
index 000000000..bd707fa83
--- /dev/null
+++ b/web-app/src/components/animated-icon/search.tsx
@@ -0,0 +1,94 @@
+"use client";
+
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface SearchIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface SearchIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const SearchIcon = forwardRef<SearchIconHandle, SearchIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <motion.svg
+ animate={controls}
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ transition={{
+ duration: 1,
+ bounce: 0.3,
+ }}
+ variants={{
+ normal: { x: 0, y: 0 },
+ animate: {
+ x: [0, 0, -3, 0],
+ y: [0, -4, 0, 0],
+ },
+ }}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <circle cx="11" cy="11" r="8" />
+ <path d="m21 21-4.3-4.3" />
+ </motion.svg>
+ </div>
+ );
+ }
+);
+
+SearchIcon.displayName = "SearchIcon";
+
+export { SearchIcon };
diff --git a/web-app/src/components/animated-icon/settings.tsx b/web-app/src/components/animated-icon/settings.tsx
new file mode 100644
index 000000000..933de5b18
--- /dev/null
+++ b/web-app/src/components/animated-icon/settings.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface SettingsIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface SettingsIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const SettingsIcon = forwardRef<SettingsIconHandle, SettingsIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <motion.svg
+ animate={controls}
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ transition={{ type: "spring", stiffness: 50, damping: 10 }}
+ variants={{
+ normal: {
+ rotate: 0,
+ },
+ animate: {
+ rotate: 180,
+ },
+ }}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
+ <circle cx="12" cy="12" r="3" />
+ </motion.svg>
+ </div>
+ );
+ }
+);
+
+SettingsIcon.displayName = "SettingsIcon";
+
+export { SettingsIcon };
diff --git a/web-app/src/components/left-sidebar/NavChats.tsx b/web-app/src/components/left-sidebar/NavChats.tsx
new file mode 100644
index 000000000..4e9d287f9
--- /dev/null
+++ b/web-app/src/components/left-sidebar/NavChats.tsx
@@ -0,0 +1,31 @@
+import {
+ SidebarGroup,
+ SidebarGroupLabel,
+ SidebarMenu,
+} from "@/components/ui/sidebar"
+import { useMemo } from "react"
+import { useThreads } from "@/hooks/useThreads"
+import ThreadList from "@/containers/ThreadList"
+
+export function NavChats() {
+ const getFilteredThreads = useThreads((state) => state.getFilteredThreads)
+ const threads = useThreads((state) => state.threads)
+
+ const threadsWithoutProject = useMemo(() => {
+ return getFilteredThreads('').filter((thread) => !thread.metadata?.project)
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [getFilteredThreads, threads])
+
+ if (threadsWithoutProject.length === 0) {
+ return null
+ }
+
+ return (
+ <SidebarGroup className="group-data-[collapsible=icon]:hidden">
+ <SidebarGroupLabel>Chats</SidebarGroupLabel>
+ <SidebarMenu>
+ <ThreadList threads={threadsWithoutProject} />
+ </SidebarMenu>
+ </SidebarGroup>
+ )
+}
diff --git a/web-app/src/components/left-sidebar/NavMain.tsx b/web-app/src/components/left-sidebar/NavMain.tsx
new file mode 100644
index 000000000..1cd0e3bd4
--- /dev/null
+++ b/web-app/src/components/left-sidebar/NavMain.tsx
@@ -0,0 +1,184 @@
+import { LucideIcon } from "lucide-react"
+import { route } from '@/constants/routes'
+
+import {
+ SidebarMenu,
+ SidebarMenuButton,
+ SidebarMenuItem,
+} from "@/components/ui/sidebar"
+import { Kbd, KbdGroup } from "@/components/ui/kbd"
+import { useTranslation } from "@/i18n/react-i18next-compat"
+
+import { Link, useNavigate } from "@tanstack/react-router"
+import { PlatformMetaKey } from "@/containers/PlatformMetaKey"
+import React, { useRef, useState } from "react"
+import { SearchIcon, type SearchIconHandle } from "@/components/animated-icon/search"
+import { FolderPlusIcon, type FolderPlusIconHandle } from "@/components/animated-icon/folder-plus"
+import { MessageCircleIcon, type MessageCircleIconHandle } from "@/components/animated-icon/message-circle"
+import { SettingsIcon, type SettingsIconHandle } from "@/components/animated-icon/settings"
+import { BlocksIcon, type BlocksIconHandle } from "../animated-icon/blocks"
+import AddProjectDialog from "@/containers/dialogs/AddProjectDialog"
+import { SearchDialog } from "@/containers/dialogs/SearchDialog"
+import { useThreadManagement } from "@/hooks/useThreadManagement"
+import { useSearchDialog } from "@/hooks/useSearchDialog"
+
+type AnimatedIconHandle = SearchIconHandle | FolderPlusIconHandle | MessageCircleIconHandle | SettingsIconHandle | BlocksIconHandle
+
+type NavMainItem = {
+ title: string
+ url?: string
+ icon?: LucideIcon | React.ComponentType<{ className?: string }>
+ animatedIcon?: React.ForwardRefExoticComponent<
+ { className?: string; size?: number } & React.RefAttributes<AnimatedIconHandle>
+ >
+ isActive?: boolean
+ shortcut?: React.ReactNode
+ onClick?: () => void
+}
+
+const getNavMainItems = (onNewProject: () => void, onSearch: () => void): NavMainItem[] => [
+ {
+ title: 'common:newChat',
+ url: route.home,
+ animatedIcon: MessageCircleIcon,
+ shortcut: (
+ <KbdGroup className="ml-auto scale-90">
+ <Kbd><PlatformMetaKey /></Kbd>
+ <Kbd>N</Kbd>
+ </KbdGroup>
+ ),
+ },
+ {
+ title: "common:projects.new",
+ animatedIcon: FolderPlusIcon,
+ onClick: onNewProject,
+ },
+ {
+ title: "common:search",
+ animatedIcon: SearchIcon,
+ onClick: onSearch,
+ shortcut: (
+ <KbdGroup className="ml-auto scale-90">
+ <Kbd><PlatformMetaKey /></Kbd>
+ <Kbd>K</Kbd>
+ </KbdGroup>
+ ),
+ },
+ {
+ title: "common:hub",
+ url: route.hub.index,
+ animatedIcon: BlocksIcon,
+ },
+ {
+ title: "common:settings",
+ url: route.settings.general,
+ animatedIcon: SettingsIcon,
+ }
+]
+
+function NavMainItemWithAnimatedIcon({
+ item,
+ label
+}: {
+ item: NavMainItem
+ label: string
+}) {
+ const iconRef = useRef<AnimatedIconHandle>(null)
+ const AnimatedIcon = item.animatedIcon!
+
+ const content = (
+ <>
+ <AnimatedIcon ref={iconRef} className="text-foreground/70" size={16} />
+ <span>{label}</span>
+ {item.shortcut}
+ </>
+ )
+
+ return (
+ <SidebarMenuItem>
+ <SidebarMenuButton
+ asChild={!!item.url}
+ isActive={item.isActive}
+ onMouseEnter={() => iconRef.current?.startAnimation()}
+ onMouseLeave={() => iconRef.current?.stopAnimation()}
+ onClick={item.onClick}
+ >
+ {item.url ? (
+ <Link to={item.url}>{content}</Link>
+ ) : (
+ content
+ )}
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ )
+}
+
+export function NavMain() {
+ const { t } = useTranslation()
+ const navigate = useNavigate()
+ const [projectDialogOpen, setProjectDialogOpen] = useState(false)
+ const { addFolder } = useThreadManagement()
+ const { open: searchOpen, setOpen: setSearchOpen } = useSearchDialog()
+
+ const navMainItems = getNavMainItems(
+ () => setProjectDialogOpen(true),
+ () => setSearchOpen(true)
+ )
+
+ const handleCreateProject = async (name: string) => {
+ const newProject = await addFolder(name)
+ setProjectDialogOpen(false)
+ navigate({ to: '/project/$projectId', params: { projectId: newProject.id } })
+ }
+
+ return (
+ <>
+ <SidebarMenu>
+ {navMainItems.map((item) => {
+ if (item.animatedIcon) {
+ return (
+ <NavMainItemWithAnimatedIcon
+ key={item.title}
+ item={item}
+ label={t(item.title)}
+ />
+ )
+ }
+
+ const Icon = item.icon
+ return (
+ <SidebarMenuItem key={item.title}>
+ <SidebarMenuButton asChild={!!item.url} isActive={item.isActive} onClick={item.onClick}>
+ {item.url ? (
+ <Link to={item.url}>
+ {Icon && <Icon className="text-foreground/70" />}
+ <span>{t(item.title)}</span>
+ {item.shortcut}
+ </Link>
+ ) : (
+ <>
+ {Icon && <Icon className="text-foreground/70" />}
+ <span>{t(item.title)}</span>
+ {item.shortcut}
+ </>
+ )}
+ </SidebarMenuButton>
+ </SidebarMenuItem>
+ )
+ })}
+ </SidebarMenu>
+
+ <AddProjectDialog
+ open={projectDialogOpen}
+ onOpenChange={setProjectDialogOpen}
+ editingKey={null}
+ onSave={handleCreateProject}
+ />
+
+ <SearchDialog
+ open={searchOpen}
+ onOpenChange={setSearchOpen}
+ />
+ </>
+ )
+}
diff --git a/web-app/src/components/left-sidebar/NavProjects.tsx b/web-app/src/components/left-sidebar/NavProjects.tsx
new file mode 100644
index 000000000..08c517a25
--- /dev/null
+++ b/web-app/src/components/left-sidebar/NavProjects.tsx
@@ -0,0 +1,155 @@
+import {
+ FolderEditIcon,
+ FolderOpenIcon,
+ MoreHorizontal,
+ Trash2,
+} from "lucide-react"
+
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+import {
+ SidebarGroup,
+ SidebarGroupLabel,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ useSidebar,
+} from "@/components/ui/sidebar"
+import { useThreadManagement } from "@/hooks/useThreadManagement"
+import { Link, useNavigate } from "@tanstack/react-router"
+import { FoldersIcon, type FoldersIconHandle } from "@/components/animated-icon/folders"
+import { useRef, useState } from "react"
+import type { ThreadFolder } from "@/services/projects/types"
+import AddProjectDialog from "@/containers/dialogs/AddProjectDialog"
+import { DeleteProjectDialog } from "@/containers/dialogs/DeleteProjectDialog"
+
+function ProjectItem({
+ item,
+ isMobile,
+ onEdit,
+ onDelete,
+}: {
+ item: ThreadFolder
+ isMobile: boolean
+ onEdit: (project: ThreadFolder) => void
+ onDelete: (project: ThreadFolder) => void
+}) {
+ const iconRef = useRef<FoldersIconHandle>(null)
+ const navigate = useNavigate()
+
+ return (
+ <SidebarMenuItem>
+ <SidebarMenuButton asChild>
+ <Link
+ to="/project/$projectId"
+ params={{ projectId: item.id }}
+ onMouseEnter={() => iconRef.current?.startAnimation()}
+ onMouseLeave={() => iconRef.current?.stopAnimation()}
+ >
+ <FoldersIcon ref={iconRef} className="text-foreground/70" size={16} />
+ <span>{item.name}</span>
+ </Link>
+ </SidebarMenuButton>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuAction showOnHover className="hover:bg-sidebar-foreground/8">
+ <MoreHorizontal />
+ <span className="sr-only">More</span>
+ </SidebarMenuAction>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-48"
+ side={isMobile ? "bottom" : "right"}
+ align={isMobile ? "end" : "start"}
+ >
+ <DropdownMenuItem onSelect={() => {
+ navigate({ to: '/project/$projectId', params: { projectId: item.id } })
+ }}>
+ <FolderOpenIcon className="text-muted-foreground" />
+ <span>View Project</span>
+ </DropdownMenuItem>
+ <DropdownMenuItem onSelect={() => onEdit(item)}>
+ <FolderEditIcon className="text-muted-foreground" />
+ <span>Edit Project</span>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem variant="destructive" onSelect={() => onDelete(item)}>
+ <Trash2 />
+ <span>Delete Project</span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </SidebarMenuItem>
+ )
+}
+
+export function NavProjects() {
+ const { isMobile } = useSidebar()
+ const { folders, updateFolder } = useThreadManagement()
+
+ const [editDialogOpen, setEditDialogOpen] = useState(false)
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState(false)
+ const [selectedProject, setSelectedProject] = useState<ThreadFolder | null>(null)
+
+ const handleEdit = (project: ThreadFolder) => {
+ setSelectedProject(project)
+ setEditDialogOpen(true)
+ }
+
+ const handleDelete = (project: ThreadFolder) => {
+ setSelectedProject(project)
+ setDeleteDialogOpen(true)
+ }
+
+ const handleSaveEdit = async (name: string) => {
+ if (selectedProject) {
+ await updateFolder(selectedProject.id, name)
+ setEditDialogOpen(false)
+ setSelectedProject(null)
+ }
+ }
+
+ if (folders.length === 0) {
+ return null
+ }
+
+ return (
+ <>
+ <SidebarGroup className="group-data-[collapsible=icon]:hidden">
+ <SidebarGroupLabel>Projects</SidebarGroupLabel>
+ <SidebarMenu>
+ {folders.map((item) => (
+ <ProjectItem
+ key={item.id}
+ item={item}
+ isMobile={isMobile}
+ onEdit={handleEdit}
+ onDelete={handleDelete}
+ />
+ ))}
+ </SidebarMenu>
+ </SidebarGroup>
+
+ <AddProjectDialog
+ open={editDialogOpen}
+ onOpenChange={setEditDialogOpen}
+ editingKey={selectedProject?.id ?? null}
+ initialData={selectedProject ?? undefined}
+ onSave={handleSaveEdit}
+ />
+
+ <DeleteProjectDialog
+ open={deleteDialogOpen}
+ onOpenChange={setDeleteDialogOpen}
+ projectId={selectedProject?.id}
+ projectName={selectedProject?.name}
+ />
+ </>
+ )
+}
diff --git a/web-app/src/components/left-sidebar/index.tsx b/web-app/src/components/left-sidebar/index.tsx
new file mode 100644
index 000000000..0add71c86
--- /dev/null
+++ b/web-app/src/components/left-sidebar/index.tsx
@@ -0,0 +1,32 @@
+import { DownloadManagement } from "@/containers/DownloadManegement"
+import { NavChats } from "./NavChats"
+import { NavMain } from "./NavMain"
+import { NavProjects } from "./NavProjects"
+
+import {
+ Sidebar,
+ SidebarContent,
+ SidebarFooter,
+ SidebarTrigger,
+ SidebarHeader,
+ SidebarRail,
+} from "@/components/ui/sidebar"
+
+export function LeftSidebar() {
+ return (
+ <Sidebar variant="floating" collapsible="offcanvas">
+ <SidebarHeader className="flex items-end px-1">
+ <SidebarTrigger className="text-muted-foreground rounded-full hover:bg-sidebar-foreground/8!" />
+ <NavMain />
+ </SidebarHeader>
+ <SidebarContent className="mask-b-from-95% mask-t-from-98%">
+ <NavProjects />
+ <NavChats />
+ </SidebarContent>
+ <SidebarFooter >
+ <DownloadManagement />
+ </SidebarFooter >
+ <SidebarRail />
+ </Sidebar>
+ )
+}
\ No newline at end of file
diff --git a/web-app/src/components/ui/__tests__/button.test.tsx b/web-app/src/components/ui/__tests__/button.test.tsx
index 219e7d8a1..1054edbeb 100644
--- a/web-app/src/components/ui/__tests__/button.test.tsx
+++ b/web-app/src/components/ui/__tests__/button.test.tsx
@@ -19,7 +19,7 @@ describe('Button', () => {
const button = screen.getByRole('button')
expect(button).toHaveClass(
'bg-primary',
- 'text-primary-fg',
+ 'text-primary-foreground',
'hover:bg-primary/90'
)
})
@@ -30,7 +30,7 @@ describe('Button', () => {
const button = screen.getByRole('button')
expect(button).toHaveClass(
'bg-destructive',
- 'text-destructive-fg',
+ 'text-white',
'hover:bg-destructive/90'
)
})
@@ -39,35 +39,35 @@ describe('Button', () => {
render(<Button variant="link">Link Button</Button>)
const button = screen.getByRole('button')
- expect(button).toHaveClass('underline-offset-4', 'hover:no-underline')
+ expect(button).toHaveClass('underline-offset-4', 'hover:underline')
})
it('applies default size classes', () => {
render(<Button>Default Size</Button>)
const button = screen.getByRole('button')
- expect(button).toHaveClass('h-7', 'px-3', 'py-2')
+ expect(button).toHaveClass('h-9', 'px-4', 'py-2')
})
it('applies small size classes', () => {
render(<Button size="sm">Small Button</Button>)
const button = screen.getByRole('button')
- expect(button).toHaveClass('h-6', 'px-2')
+ expect(button).toHaveClass('h-8', 'px-3')
})
it('applies large size classes', () => {
render(<Button size="lg">Large Button</Button>)
const button = screen.getByRole('button')
- expect(button).toHaveClass('h-9', 'rounded-md', 'px-4')
+ expect(button).toHaveClass('h-10', 'rounded-md', 'px-6')
})
it('applies icon size classes', () => {
render(<Button size="icon">Icon</Button>)
const button = screen.getByRole('button')
- expect(button).toHaveClass('size-8')
+ expect(button).toHaveClass('size-9')
})
it('handles click events', async () => {
@@ -142,7 +142,7 @@ describe('Button', () => {
const link = screen.getByRole('link')
expect(link).toHaveAttribute('href', '/test')
- expect(link).toHaveClass('bg-primary', 'text-primary-fg') // Should inherit button classes
+ expect(link).toHaveClass('bg-primary', 'text-primary-foreground') // Should inherit button classes
})
it('combines variant and size classes correctly', () => {
@@ -153,8 +153,8 @@ describe('Button', () => {
)
const button = screen.getByRole('button')
- expect(button).toHaveClass('bg-destructive', 'text-destructive-fg') // destructive variant
- expect(button).toHaveClass('h-9', 'rounded-md', 'px-4') // large size
+ expect(button).toHaveClass('bg-destructive', 'text-white') // destructive variant
+ expect(button).toHaveClass('h-10', 'rounded-md', 'px-6') // large size
})
it('handles keyboard events', () => {
@@ -195,9 +195,9 @@ describe('Button', () => {
const button = screen.getByRole('button')
expect(button).toHaveClass(
- 'focus-visible:border-primary',
- 'focus-visible:ring-2',
- 'focus-visible:ring-primary/60'
+ 'focus-visible:border-ring',
+ 'focus-visible:ring-[3px]',
+ 'focus-visible:ring-ring/50'
)
})
})
diff --git a/web-app/src/components/ui/__tests__/dialog.test.tsx b/web-app/src/components/ui/__tests__/dialog.test.tsx
index aeb0cbf52..34e2d53dc 100644
--- a/web-app/src/components/ui/__tests__/dialog.test.tsx
+++ b/web-app/src/components/ui/__tests__/dialog.test.tsx
@@ -134,15 +134,13 @@ describe('Dialog Components', () => {
const dialogContent = screen.getByRole('dialog')
expect(dialogContent).toHaveClass(
- 'bg-main-view',
- 'max-h-[calc(100%-80px)]',
- 'overflow-auto',
- 'border-main-view-fg/10',
- 'text-main-view-fg',
+ 'bg-background',
+ 'max-h-[85vh]',
+ 'overflow-y-auto',
'fixed',
'top-[50%]',
'left-[50%]',
- 'z-[90]',
+ 'z-50',
'grid',
'w-full',
'max-w-[calc(100%-2rem)]',
@@ -200,7 +198,7 @@ describe('Dialog Components', () => {
it('applies proper classes to dialog description', async () => {
const user = userEvent.setup()
-
+
render(
<Dialog>
<DialogTrigger>Open Dialog</DialogTrigger>
@@ -212,11 +210,11 @@ describe('Dialog Components', () => {
</DialogContent>
</Dialog>
)
-
+
await user.click(screen.getByText('Open Dialog'))
-
+
const dialogDescription = screen.getByText('Dialog description')
- expect(dialogDescription).toHaveClass('text-main-view-fg/80', 'text-sm')
+ expect(dialogDescription).toHaveClass('text-muted-foreground', 'text-sm')
})
it('applies proper classes to dialog footer', async () => {
diff --git a/web-app/src/components/ui/__tests__/dropdown-menu.test.tsx b/web-app/src/components/ui/__tests__/dropdown-menu.test.tsx
index 541ae0f93..1c7799004 100644
--- a/web-app/src/components/ui/__tests__/dropdown-menu.test.tsx
+++ b/web-app/src/components/ui/__tests__/dropdown-menu.test.tsx
@@ -81,11 +81,10 @@ describe('DropdownMenu Components', () => {
</DropdownMenuContent>
</DropdownMenu>
)
-
+
const trigger = screen.getByRole('button', { name: 'Open Menu' })
expect(trigger).toBeInTheDocument()
expect(trigger).toHaveAttribute('data-slot', 'dropdown-menu-trigger')
- expect(trigger).toHaveClass('outline-none')
})
it('opens dropdown menu when clicked', async () => {
@@ -112,7 +111,7 @@ describe('DropdownMenu Components', () => {
describe('DropdownMenuContent', () => {
it('renders DropdownMenuContent with correct styling and data-slot', async () => {
const user = userEvent.setup()
-
+
render(
<DropdownMenu>
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
@@ -121,14 +120,14 @@ describe('DropdownMenu Components', () => {
</DropdownMenuContent>
</DropdownMenu>
)
-
+
await user.click(screen.getByRole('button'))
-
+
await waitFor(() => {
const content = document.querySelector('[data-slot="dropdown-menu-content"]')
expect(content).toBeInTheDocument()
- expect(content).toHaveClass('bg-main-view')
- expect(content).toHaveClass('text-main-view-fg')
+ expect(content).toHaveClass('bg-popover')
+ expect(content).toHaveClass('text-popover-foreground')
})
})
@@ -522,7 +521,7 @@ describe('DropdownMenu Components', () => {
describe('DropdownMenuSeparator', () => {
it('renders DropdownMenuSeparator with correct styling and data-slot', async () => {
const user = userEvent.setup()
-
+
render(
<DropdownMenu>
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
@@ -533,14 +532,14 @@ describe('DropdownMenu Components', () => {
</DropdownMenuContent>
</DropdownMenu>
)
-
+
await user.click(screen.getByRole('button'))
-
+
await waitFor(() => {
const separator = document.querySelector('[data-slot="dropdown-menu-separator"]')
expect(separator).toBeInTheDocument()
expect(separator).toHaveClass('h-px')
- expect(separator).toHaveClass('bg-main-view-fg/5')
+ expect(separator).toHaveClass('bg-border')
})
})
@@ -733,7 +732,7 @@ describe('DropdownMenu Components', () => {
describe('DropdownMenuSubContent', () => {
it('renders DropdownMenuSubContent with correct styling and data-slot', async () => {
const user = userEvent.setup()
-
+
render(
<DropdownMenu>
<DropdownMenuTrigger>Open</DropdownMenuTrigger>
@@ -747,22 +746,22 @@ describe('DropdownMenu Components', () => {
</DropdownMenuContent>
</DropdownMenu>
)
-
+
await user.click(screen.getByRole('button'))
-
+
await waitFor(() => {
const subTrigger = screen.getByText('Sub Menu')
expect(subTrigger).toBeInTheDocument()
})
-
+
// Hover over sub trigger to open sub content
await user.hover(screen.getByText('Sub Menu'))
-
+
await waitFor(() => {
const subContent = document.querySelector('[data-slot="dropdown-menu-sub-content"]')
expect(subContent).toBeInTheDocument()
- expect(subContent).toHaveClass('bg-main-view')
- expect(subContent).toHaveClass('text-main-view-fg')
+ expect(subContent).toHaveClass('bg-popover')
+ expect(subContent).toHaveClass('text-popover-foreground')
})
})
diff --git a/web-app/src/components/ui/__tests__/dropdrawer.test.tsx b/web-app/src/components/ui/__tests__/dropdrawer.test.tsx
index cef88b9d9..642fadddf 100644
--- a/web-app/src/components/ui/__tests__/dropdrawer.test.tsx
+++ b/web-app/src/components/ui/__tests__/dropdrawer.test.tsx
@@ -17,10 +17,10 @@ import {
DropDrawerTrigger,
} from '../dropdrawer'
-// Mock the media query hook
-const mockUseSmallScreen = vi.fn()
-vi.mock('@/hooks/useMediaQuery', () => ({
- useSmallScreen: () => mockUseSmallScreen(),
+// Mock the mobile hook
+const mockUseIsMobile = vi.fn()
+vi.mock('@/hooks/use-mobile', () => ({
+ useIsMobile: () => mockUseIsMobile(),
}))
// Mock framer-motion to avoid animation complexity in tests
@@ -53,7 +53,7 @@ describe('DropDrawer Component', () => {
describe('Desktop Mode', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
})
it('renders dropdown menu on desktop', () => {
@@ -119,7 +119,7 @@ describe('DropDrawer Component', () => {
describe('Mobile Mode', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
})
it('renders drawer on mobile', () => {
@@ -186,7 +186,7 @@ describe('DropDrawer Component', () => {
describe('DropDrawerItem', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
})
it('can be structured with click handlers', () => {
@@ -257,7 +257,7 @@ describe('DropDrawer Component', () => {
describe('DropDrawerGroup', () => {
it('structures groups in desktop mode', () => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
render(
<DropDrawer>
@@ -276,7 +276,7 @@ describe('DropDrawer Component', () => {
})
it('structures groups in mobile mode', () => {
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
render(
<DropDrawer>
@@ -297,7 +297,7 @@ describe('DropDrawer Component', () => {
describe('DropDrawerFooter', () => {
it('structures footer in desktop mode', () => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
render(
<DropDrawer>
@@ -314,7 +314,7 @@ describe('DropDrawer Component', () => {
})
it('structures footer in mobile mode', () => {
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
render(
<DropDrawer>
@@ -333,7 +333,7 @@ describe('DropDrawer Component', () => {
describe('Submenu Components', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
})
it('structures submenu in desktop mode', () => {
@@ -356,7 +356,7 @@ describe('DropDrawer Component', () => {
})
it('structures submenu in mobile mode', () => {
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
render(
<DropDrawer>
@@ -379,7 +379,7 @@ describe('DropDrawer Component', () => {
})
it('handles submenu content correctly in mobile mode', () => {
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
render(
<DropDrawer>
@@ -402,7 +402,7 @@ describe('DropDrawer Component', () => {
describe('Accessibility', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
})
it('maintains proper ARIA attributes on triggers', () => {
@@ -424,7 +424,7 @@ describe('DropDrawer Component', () => {
it('supports disabled state', () => {
const handleClick = vi.fn()
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
render(
<DropDrawer>
@@ -458,7 +458,7 @@ describe('DropDrawer Component', () => {
describe('Custom Props and Styling', () => {
beforeEach(() => {
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
})
it('applies custom className', () => {
@@ -502,7 +502,7 @@ describe('DropDrawer Component', () => {
)
// Desktop mode
- mockUseSmallScreen.mockReturnValue(false)
+ mockUseIsMobile.mockReturnValue(false)
rerender(
<DropDrawer>
<DropDrawerTrigger>Responsive Trigger</DropDrawerTrigger>
@@ -516,7 +516,7 @@ describe('DropDrawer Component', () => {
expect(trigger).toHaveAttribute('aria-haspopup', 'menu')
// Mobile mode
- mockUseSmallScreen.mockReturnValue(true)
+ mockUseIsMobile.mockReturnValue(true)
rerender(
<DropDrawer>
<DropDrawerTrigger>Responsive Trigger</DropDrawerTrigger>
diff --git a/web-app/src/components/ui/__tests__/hover-card.test.tsx b/web-app/src/components/ui/__tests__/hover-card.test.tsx
index 5e0a39628..67da7cee9 100644
--- a/web-app/src/components/ui/__tests__/hover-card.test.tsx
+++ b/web-app/src/components/ui/__tests__/hover-card.test.tsx
@@ -113,8 +113,8 @@ describe('HoverCard Components', () => {
)
const content = screen.getByTestId('hover-card-content')
- expect(content.className).toContain('bg-main-view')
- expect(content.className).toContain('text-main-view-fg/70')
+ expect(content.className).toContain('bg-popover')
+ expect(content.className).toContain('text-popover-foreground')
expect(content.className).toContain('rounded-md')
expect(content.className).toContain('border')
expect(content.className).toContain('shadow-md')
@@ -128,7 +128,7 @@ describe('HoverCard Components', () => {
)
const content = screen.getByTestId('hover-card-content')
- expect(content.className).toContain('bg-main-view')
+ expect(content.className).toContain('bg-popover')
expect(content.className).toContain('my-custom-class')
})
diff --git a/web-app/src/components/ui/__tests__/input.test.tsx b/web-app/src/components/ui/__tests__/input.test.tsx
index ddf2fa7db..1bdde5eed 100644
--- a/web-app/src/components/ui/__tests__/input.test.tsx
+++ b/web-app/src/components/ui/__tests__/input.test.tsx
@@ -64,9 +64,8 @@ describe('Input', () => {
it('renders with default styling classes', () => {
render(<Input />)
-
+
const input = screen.getByRole('textbox')
- expect(input).toHaveClass('flex')
expect(input).toHaveClass('h-9')
expect(input).toHaveClass('w-full')
expect(input).toHaveClass('rounded-md')
diff --git a/web-app/src/components/ui/__tests__/popover.test.tsx b/web-app/src/components/ui/__tests__/popover.test.tsx
index b76d1ce04..6219e855c 100644
--- a/web-app/src/components/ui/__tests__/popover.test.tsx
+++ b/web-app/src/components/ui/__tests__/popover.test.tsx
@@ -88,21 +88,21 @@ describe('Popover Components', () => {
describe('PopoverContent', () => {
it('renders PopoverContent with correct styling and data-slot', async () => {
const user = userEvent.setup()
-
+
render(
<Popover>
<PopoverTrigger>Open</PopoverTrigger>
<PopoverContent>Popover Content</PopoverContent>
</Popover>
)
-
+
await user.click(screen.getByRole('button'))
-
+
await waitFor(() => {
const content = document.querySelector('[data-slot="popover-content"]')
expect(content).toBeInTheDocument()
- expect(content).toHaveClass('bg-main-view')
- expect(content).toHaveClass('text-main-view-fg')
+ expect(content).toHaveClass('bg-background')
+ expect(content).toHaveClass('text-foreground')
expect(content).toHaveClass('w-72')
expect(content).toHaveClass('rounded-md')
expect(content).toHaveClass('border')
diff --git a/web-app/src/components/ui/__tests__/progress.test.tsx b/web-app/src/components/ui/__tests__/progress.test.tsx
index 90a7bc70f..cef44a04e 100644
--- a/web-app/src/components/ui/__tests__/progress.test.tsx
+++ b/web-app/src/components/ui/__tests__/progress.test.tsx
@@ -41,9 +41,9 @@ describe('Progress', () => {
it('renders with default styling classes', () => {
render(<Progress value={50} />)
-
+
const progress = document.querySelector('[data-slot="progress"]')
- expect(progress).toHaveClass('bg-accent/30')
+ expect(progress).toHaveClass('bg-secondary')
expect(progress).toHaveClass('relative')
expect(progress).toHaveClass('h-2')
expect(progress).toHaveClass('w-full')
@@ -53,9 +53,9 @@ describe('Progress', () => {
it('renders indicator with correct styling', () => {
render(<Progress value={50} />)
-
+
const indicator = document.querySelector('[data-slot="progress-indicator"]')
- expect(indicator).toHaveClass('bg-accent')
+ expect(indicator).toHaveClass('bg-primary')
expect(indicator).toHaveClass('h-full')
expect(indicator).toHaveClass('w-full')
expect(indicator).toHaveClass('flex-1')
diff --git a/web-app/src/components/ui/__tests__/sheet.test.tsx b/web-app/src/components/ui/__tests__/sheet.test.tsx
index 988e512c0..ff759b202 100644
--- a/web-app/src/components/ui/__tests__/sheet.test.tsx
+++ b/web-app/src/components/ui/__tests__/sheet.test.tsx
@@ -157,7 +157,7 @@ describe('Sheet Components', () => {
const title = document.querySelector('[data-slot="sheet-title"]')
expect(title).toBeInTheDocument()
expect(title).toHaveTextContent('Sheet Title')
- expect(title).toHaveClass('font-medium')
+ expect(title).toHaveClass('font-semibold')
})
it('renders SheetDescription', () => {
@@ -169,11 +169,11 @@ describe('Sheet Components', () => {
</SheetContent>
</Sheet>
)
-
+
const description = document.querySelector('[data-slot="sheet-description"]')
expect(description).toBeInTheDocument()
expect(description).toHaveTextContent('Sheet Description')
- expect(description).toHaveClass('text-main-view-fg/70', 'text-sm')
+ expect(description).toHaveClass('text-muted-foreground', 'text-sm')
})
it('renders close button with proper styling', () => {
@@ -205,7 +205,7 @@ describe('Sheet Components', () => {
const overlay = document.querySelector('[data-slot="sheet-overlay"]')
expect(overlay).toBeInTheDocument()
- expect(overlay).toHaveClass('fixed', 'inset-0', 'z-50', 'bg-main-view/50', 'backdrop-blur-xs')
+ expect(overlay).toHaveClass('fixed', 'inset-0', 'z-50', 'bg-black/50', 'backdrop-blur')
})
it('renders SheetClose component', () => {
@@ -254,10 +254,11 @@ describe('Sheet Components', () => {
</SheetContent>
</Sheet>
)
-
+
expect(screen.getByText('Test Sheet')).toBeInTheDocument()
expect(screen.getByText('Test Description')).toBeInTheDocument()
expect(screen.getByText('Main Content')).toBeInTheDocument()
- expect(screen.getByText('Close')).toBeInTheDocument()
+ // There are two "Close" elements: the SheetClose button and the sr-only span in the X close button
+ expect(screen.getAllByText('Close').length).toBeGreaterThan(0)
})
})
diff --git a/web-app/src/components/ui/__tests__/skeleton.test.tsx b/web-app/src/components/ui/__tests__/skeleton.test.tsx
index 39d9535a7..8b9ca26c3 100644
--- a/web-app/src/components/ui/__tests__/skeleton.test.tsx
+++ b/web-app/src/components/ui/__tests__/skeleton.test.tsx
@@ -19,9 +19,9 @@ describe('Skeleton', () => {
it('renders with default styling classes', () => {
render(<Skeleton />)
-
+
const skeleton = document.querySelector('[data-slot="skeleton"]')
- expect(skeleton).toHaveClass('bg-main-view-fg/10')
+ expect(skeleton).toHaveClass('bg-accent')
})
it('renders with custom width and height', () => {
diff --git a/web-app/src/components/ui/__tests__/slider.test.tsx b/web-app/src/components/ui/__tests__/slider.test.tsx
index 2a15441b2..04bfceb66 100644
--- a/web-app/src/components/ui/__tests__/slider.test.tsx
+++ b/web-app/src/components/ui/__tests__/slider.test.tsx
@@ -103,23 +103,23 @@ describe('Slider', () => {
it('renders track with correct styling', () => {
render(<Slider />)
-
+
const track = document.querySelector('[data-slot="slider-track"]')
- expect(track).toHaveClass('bg-main-view-fg/10', 'relative', 'grow', 'overflow-hidden', 'rounded-full')
+ expect(track).toHaveClass('bg-muted', 'relative', 'grow', 'overflow-hidden', 'rounded-full')
})
it('renders range with correct styling', () => {
render(<Slider />)
-
+
const range = document.querySelector('[data-slot="slider-range"]')
- expect(range).toHaveClass('bg-accent', 'absolute')
+ expect(range).toHaveClass('bg-primary', 'absolute')
})
it('renders thumb with correct styling', () => {
render(<Slider value={[50]} />)
-
+
const thumb = document.querySelector('[data-slot="slider-thumb"]')
- expect(thumb).toHaveClass('border-accent', 'bg-main-view', 'ring-ring/50', 'block', 'size-4', 'shrink-0', 'rounded-full', 'border', 'shadow-sm')
+ expect(thumb).toHaveClass('border-primary', 'bg-white', 'ring-ring/50', 'block', 'size-4', 'shrink-0', 'rounded-full', 'border', 'shadow-sm')
})
it('handles disabled state', () => {
@@ -181,13 +181,13 @@ describe('Slider', () => {
it('handles range slider with two thumbs', () => {
render(<Slider defaultValue={[25, 75]} />)
-
+
const thumbs = document.querySelectorAll('[data-slot="slider-thumb"]')
expect(thumbs).toHaveLength(2)
-
+
// Both thumbs should have the same styling
thumbs.forEach(thumb => {
- expect(thumb).toHaveClass('border-accent', 'bg-main-view', 'rounded-full')
+ expect(thumb).toHaveClass('border-primary', 'bg-white', 'rounded-full')
})
})
})
diff --git a/web-app/src/components/ui/__tests__/switch.test.tsx b/web-app/src/components/ui/__tests__/switch.test.tsx
index 0db35d716..433d31eac 100644
--- a/web-app/src/components/ui/__tests__/switch.test.tsx
+++ b/web-app/src/components/ui/__tests__/switch.test.tsx
@@ -26,9 +26,9 @@ describe('Switch', () => {
it('renders thumb with correct styling', () => {
render(<Switch />)
-
+
const thumb = document.querySelector('[data-slot="switch-thumb"]')
- expect(thumb).toHaveClass('bg-main-view', 'pointer-events-none', 'block', 'size-4', 'rounded-full', 'ring-0', 'transition-transform')
+ expect(thumb).toHaveClass('bg-foreground', 'pointer-events-none', 'block', 'size-4', 'rounded-full', 'ring-0', 'transition-transform')
})
it('renders with custom className', () => {
@@ -72,11 +72,11 @@ describe('Switch', () => {
it('renders loading spinner with correct styling', () => {
render(<Switch loading />)
-
+
const spinner = document.querySelector('.animate-spin')
expect(spinner).toBeInTheDocument()
- expect(spinner).toHaveClass('text-main-view-fg/50')
-
+ expect(spinner).toHaveClass('text-muted-foreground')
+
const spinnerContainer = document.querySelector('.absolute.inset-0')
expect(spinnerContainer).toHaveClass('flex', 'items-center', 'justify-center', 'z-10', 'size-3.5')
})
@@ -178,15 +178,15 @@ describe('Switch', () => {
it('handles checked state styling', () => {
render(<Switch checked />)
-
+
const switchElement = document.querySelector('[data-slot="switch"]')
- expect(switchElement).toHaveClass('data-[state=checked]:bg-accent')
+ expect(switchElement).toHaveClass('data-[state=checked]:bg-primary')
})
it('handles unchecked state styling', () => {
render(<Switch checked={false} />)
-
+
const switchElement = document.querySelector('[data-slot="switch"]')
- expect(switchElement).toHaveClass('data-[state=unchecked]:bg-main-view-fg/20')
+ expect(switchElement).toHaveClass('data-[state=unchecked]:bg-background')
})
})
diff --git a/web-app/src/ui/button-group.tsx b/web-app/src/components/ui/button-group.tsx
similarity index 86%
rename from web-app/src/ui/button-group.tsx
rename to web-app/src/components/ui/button-group.tsx
index b8db7a4a9..8600af03e 100644
--- a/web-app/src/ui/button-group.tsx
+++ b/web-app/src/components/ui/button-group.tsx
@@ -1,9 +1,8 @@
-/* eslint-disable react-refresh/only-export-components */
-import { Slot } from "@radix-ui/react-slot";
-import { cva, type VariantProps } from "class-variance-authority";
+import { Slot } from "@radix-ui/react-slot"
+import { cva, type VariantProps } from "class-variance-authority"
-import { cn } from "../lib/utils";
-import { Separator } from "./separator";
+import { cn } from "@/lib/utils"
+import { Separator } from "@/components/ui/separator"
const buttonGroupVariants = cva(
"flex w-fit items-stretch [&>*]:focus-visible:z-10 [&>*]:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2",
@@ -19,8 +18,8 @@ const buttonGroupVariants = cva(
defaultVariants: {
orientation: "horizontal",
},
- },
-);
+ }
+)
function ButtonGroup({
className,
@@ -35,7 +34,7 @@ function ButtonGroup({
className={cn(buttonGroupVariants({ orientation }), className)}
{...props}
/>
- );
+ )
}
function ButtonGroupText({
@@ -43,19 +42,19 @@ function ButtonGroupText({
asChild = false,
...props
}: React.ComponentProps<"div"> & {
- asChild?: boolean;
+ asChild?: boolean
}) {
- const Comp = asChild ? Slot : "div";
+ const Comp = asChild ? Slot : "div"
return (
<Comp
className={cn(
"bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
- className,
+ className
)}
{...props}
/>
- );
+ )
}
function ButtonGroupSeparator({
@@ -69,11 +68,11 @@ function ButtonGroupSeparator({
orientation={orientation}
className={cn(
"bg-input relative !m-0 self-stretch data-[orientation=vertical]:h-auto",
- className,
+ className
)}
{...props}
/>
- );
+ )
}
export {
@@ -81,4 +80,4 @@ export {
ButtonGroupSeparator,
ButtonGroupText,
buttonGroupVariants,
-};
+}
diff --git a/web-app/src/components/ui/button.tsx b/web-app/src/components/ui/button.tsx
index 7692ac782..38806edc2 100644
--- a/web-app/src/components/ui/button.tsx
+++ b/web-app/src/components/ui/button.tsx
@@ -1,62 +1,64 @@
-import * as React from 'react'
-import { Slot } from '@radix-ui/react-slot'
-import { cva, type VariantProps } from 'class-variance-authority'
+import * as React from "react"
+import { Slot } from "@radix-ui/react-slot"
+import { cva, type VariantProps } from "class-variance-authority"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
const buttonVariants = cva(
- cn(
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none aria-invalid:ring-destructive/60 aria-invalid:border-destructive cursor-pointer",
- 'focus:border-accent focus:ring-2 focus:ring-accent/50 focus:accent-[0px]',
- 'focus-visible:border-accent focus-visible:ring-2 focus-visible:ring-accent/50 focus-visible:accent-[0px]'
- ),
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",
{
variants: {
variant: {
- default:
- 'bg-primary text-primary-fg shadow-xs hover:bg-primary/90 focus-visible:ring-primary/60 focus:ring-primary/60 focus:border-primary focus-visible:border-primary',
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
destructive:
- 'bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/60 text-destructive-fg focus:border-destructive focus:ring-destructive/60',
+ "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
- 'border border-main-view-fg/20 bg-transparent text-main-view-fg hover:bg-main-view/60 hover:text-main-view-fg focus-visible:ring-main-view-fg/40 focus:border-main-view-fg',
+ "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
+ secondary:
+ "bg-secondary text-secondary-foreground hover:bg-secondary/80",
ghost:
- 'bg-transparent text-main-view-fg hover:bg-main-view/60 focus-visible:ring-main-view-fg/40 focus:border-main-view-fg',
- link: 'underline-offset-4 hover:no-underline',
+ "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
+ link: "text-primary underline-offset-4 hover:underline",
},
size: {
- default: 'h-7 px-3 py-2 has-[>svg]:px-3 rounded-sm',
- sm: 'h-6 gap-1.5 px-2 has-[>svg]:px-2.5 rounded-sm',
- lg: 'h-9 rounded-md px-4 has-[>svg]:px-4',
- icon: 'size-8',
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
+ xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
+ sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
+ icon: "size-9",
+ "icon-xs": "size-6 rounded-md [&_svg:not([class*='size-'])]:size-4",
+ "icon-sm": "size-8",
+ "icon-lg": "size-10",
},
},
defaultVariants: {
- variant: 'default',
- size: 'default',
+ variant: "default",
+ size: "default",
},
}
)
function Button({
className,
- variant,
- size,
+ variant = "default",
+ size = "default",
asChild = false,
...props
-}: React.ComponentProps<'button'> &
+}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean
}) {
- const Comp = asChild ? Slot : 'button'
+ const Comp = asChild ? Slot : "button"
return (
<Comp
data-slot="button"
+ data-variant={variant}
+ data-size={size}
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
)
}
-// eslint-disable-next-line react-refresh/only-export-components
export { Button, buttonVariants }
diff --git a/web-app/src/ui/collapsible.tsx b/web-app/src/components/ui/collapsible.tsx
similarity index 88%
rename from web-app/src/ui/collapsible.tsx
rename to web-app/src/components/ui/collapsible.tsx
index 849e7b66f..77f86beda 100644
--- a/web-app/src/ui/collapsible.tsx
+++ b/web-app/src/components/ui/collapsible.tsx
@@ -1,9 +1,9 @@
-import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
+import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"
function Collapsible({
...props
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
+ return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
}
function CollapsibleTrigger({
@@ -14,7 +14,7 @@ function CollapsibleTrigger({
data-slot="collapsible-trigger"
{...props}
/>
- );
+ )
}
function CollapsibleContent({
@@ -25,7 +25,7 @@ function CollapsibleContent({
data-slot="collapsible-content"
{...props}
/>
- );
+ )
}
-export { Collapsible, CollapsibleTrigger, CollapsibleContent };
+export { Collapsible, CollapsibleTrigger, CollapsibleContent }
diff --git a/web-app/src/components/ui/dialog.tsx b/web-app/src/components/ui/dialog.tsx
index dec9cfab0..200ad4b17 100644
--- a/web-app/src/components/ui/dialog.tsx
+++ b/web-app/src/components/ui/dialog.tsx
@@ -1,9 +1,9 @@
-import * as React from 'react'
-import * as DialogPrimitive from '@radix-ui/react-dialog'
-import { XIcon } from 'lucide-react'
+import * as React from "react"
+import * as DialogPrimitive from "@radix-ui/react-dialog"
+import { XIcon } from "lucide-react"
-import { cn } from '@/lib/utils'
-import { useTranslation } from '@/i18n/react-i18next-compat'
+import { cn } from "@/lib/utils"
+import { Button } from "@/components/ui/button"
function Dialog({
...props
@@ -37,7 +37,7 @@ function DialogOverlay({
<DialogPrimitive.Overlay
data-slot="dialog-overlay"
className={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-[80] bg-main-view/80 backdrop-blur-sm',
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur",
className
)}
{...props}
@@ -45,38 +45,33 @@ function DialogOverlay({
)
}
-type DialogContentProps = React.ComponentProps<
- typeof DialogPrimitive.Content
-> & {
- 'showCloseButton'?: boolean
- 'aria-describedby'?: string | undefined
-}
-
function DialogContent({
- showCloseButton = true,
className,
children,
- 'aria-describedby': ariaDescribedBy,
+ showCloseButton = true,
...props
-}: DialogContentProps) {
- const { t } = useTranslation()
+}: React.ComponentProps<typeof DialogPrimitive.Content> & {
+ showCloseButton?: boolean
+}) {
return (
<DialogPortal data-slot="dialog-portal">
<DialogOverlay />
<DialogPrimitive.Content
data-slot="dialog-content"
- aria-describedby={ariaDescribedBy}
className={cn(
- 'bg-main-view max-h-[calc(100%-80px)] overflow-auto border-main-view-fg/10 text-main-view-fg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-[90] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg max-h-[85vh] overflow-y-auto",
className
)}
{...props}
>
{children}
{showCloseButton && (
- <DialogPrimitive.Close className="data-[state=open]:text-main-view-fg/50 absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-0 focus:outline-0 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 cursor-pointer">
+ <DialogPrimitive.Close
+ data-slot="dialog-close"
+ className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
+ >
<XIcon />
- <span className="sr-only">{t('close')}</span>
+ <span className="sr-only">Close</span>
</DialogPrimitive.Close>
)}
</DialogPrimitive.Content>
@@ -84,26 +79,40 @@ function DialogContent({
)
}
-function DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {
+function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="dialog-header"
- className={cn('flex flex-col gap-2 text-center sm:text-left', className)}
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
{...props}
/>
)
}
-function DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {
+function DialogFooter({
+ className,
+ showCloseButton = false,
+ children,
+ ...props
+}: React.ComponentProps<"div"> & {
+ showCloseButton?: boolean
+}) {
return (
<div
data-slot="dialog-footer"
className={cn(
- 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',
+ "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end bg-background pt-4 -mb-2",
className
)}
{...props}
- />
+ >
+ {children}
+ {showCloseButton && (
+ <DialogPrimitive.Close asChild>
+ <Button variant="outline">Close</Button>
+ </DialogPrimitive.Close>
+ )}
+ </div>
)
}
@@ -114,7 +123,7 @@ function DialogTitle({
return (
<DialogPrimitive.Title
data-slot="dialog-title"
- className={cn('text-lg leading-none font-medium', className)}
+ className={cn("text-lg leading-none font-studio font-medium", className)}
{...props}
/>
)
@@ -127,7 +136,7 @@ function DialogDescription({
return (
<DialogPrimitive.Description
data-slot="dialog-description"
- className={cn('text-main-view-fg/80 text-sm', className)}
+ className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
diff --git a/web-app/src/components/ui/drawer.tsx b/web-app/src/components/ui/drawer.tsx
index 6766e6caf..869955fc8 100644
--- a/web-app/src/components/ui/drawer.tsx
+++ b/web-app/src/components/ui/drawer.tsx
@@ -1,7 +1,7 @@
-import * as React from 'react'
-import { Drawer as DrawerPrimitive } from 'vaul'
+import * as React from "react"
+import { Drawer as DrawerPrimitive } from "vaul"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
function Drawer({
...props
@@ -35,7 +35,7 @@ function DrawerOverlay({
<DrawerPrimitive.Overlay
data-slot="drawer-overlay"
className={cn(
- 'data-[state=open]:animate-in backdrop-blur data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
className
)}
{...props}
@@ -54,28 +54,28 @@ function DrawerContent({
<DrawerPrimitive.Content
data-slot="drawer-content"
className={cn(
- 'group/drawer-content fixed z-50 flex h-auto flex-col',
- 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b',
- 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t',
- 'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm',
- 'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm',
+ "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
className
)}
{...props}
>
- <div className="bg-main-view-fg/10 mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
+ <div className="bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
)
}
-function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
+function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="drawer-header"
className={cn(
- 'flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left',
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
className
)}
{...props}
@@ -83,11 +83,11 @@ function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {
)
}
-function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {
+function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="drawer-footer"
- className={cn('mt-auto flex flex-col gap-2 p-4', className)}
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
@@ -100,7 +100,7 @@ function DrawerTitle({
return (
<DrawerPrimitive.Title
data-slot="drawer-title"
- className={cn('font-semibold', className)}
+ className={cn("text-foreground font-semibold", className)}
{...props}
/>
)
@@ -113,7 +113,7 @@ function DrawerDescription({
return (
<DrawerPrimitive.Description
data-slot="drawer-description"
- className={cn('text-sm', className)}
+ className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
diff --git a/web-app/src/components/ui/dropdown-menu.tsx b/web-app/src/components/ui/dropdown-menu.tsx
index 4f92ebe60..eaed9baff 100644
--- a/web-app/src/components/ui/dropdown-menu.tsx
+++ b/web-app/src/components/ui/dropdown-menu.tsx
@@ -1,8 +1,8 @@
-import * as React from 'react'
-import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
-import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react'
+import * as React from "react"
+import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"
+import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
function DropdownMenu({
...props
@@ -24,7 +24,6 @@ function DropdownMenuTrigger({
return (
<DropdownMenuPrimitive.Trigger
data-slot="dropdown-menu-trigger"
- className="outline-none"
{...props}
/>
)
@@ -41,7 +40,7 @@ function DropdownMenuContent({
data-slot="dropdown-menu-content"
sideOffset={sideOffset}
className={cn(
- 'bg-main-view select-none text-main-view-fg border-main-view-fg/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md z-[90]',
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
className
)}
{...props}
@@ -61,11 +60,11 @@ function DropdownMenuGroup({
function DropdownMenuItem({
className,
inset,
- variant = 'default',
+ variant = "default",
...props
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
inset?: boolean
- variant?: 'default' | 'destructive'
+ variant?: "default" | "destructive"
}) {
return (
<DropdownMenuPrimitive.Item
@@ -73,7 +72,7 @@ function DropdownMenuItem({
data-inset={inset}
data-variant={variant}
className={cn(
- "relative cursor-pointer hover:bg-main-view-fg/4 flex items-center gap-2 rounded-sm px-2 py-1 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
@@ -91,7 +90,7 @@ function DropdownMenuCheckboxItem({
<DropdownMenuPrimitive.CheckboxItem
data-slot="dropdown-menu-checkbox-item"
className={cn(
- "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
checked={checked}
@@ -127,7 +126,7 @@ function DropdownMenuRadioItem({
<DropdownMenuPrimitive.RadioItem
data-slot="dropdown-menu-radio-item"
className={cn(
- "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
@@ -154,7 +153,7 @@ function DropdownMenuLabel({
data-slot="dropdown-menu-label"
data-inset={inset}
className={cn(
- 'px-2 py-1.5 text-xs text-main-view-fg/50 data-[inset]:pl-8',
+ "px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
className
)}
{...props}
@@ -169,7 +168,7 @@ function DropdownMenuSeparator({
return (
<DropdownMenuPrimitive.Separator
data-slot="dropdown-menu-separator"
- className={cn('-mx-1 my-1 h-px bg-main-view-fg/5', className)}
+ className={cn("bg-border -mx-1 my-1 h-px", className)}
{...props}
/>
)
@@ -178,12 +177,12 @@ function DropdownMenuSeparator({
function DropdownMenuShortcut({
className,
...props
-}: React.ComponentProps<'span'>) {
+}: React.ComponentProps<"span">) {
return (
<span
data-slot="dropdown-menu-shortcut"
className={cn(
- 'text-muted-foreground ml-auto text-xs tracking-widest',
+ "text-muted-foreground ml-auto text-xs tracking-widest",
className
)}
{...props}
@@ -210,13 +209,13 @@ function DropdownMenuSubTrigger({
data-slot="dropdown-menu-sub-trigger"
data-inset={inset}
className={cn(
- 'flex cursor-pointer hover:bg-main-view-fg/4 data-[state=open]:bg-main-view-fg/4 items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8',
+ "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
>
{children}
- <ChevronRightIcon className="ml-auto size-4 text-main-view-fg/50" />
+ <ChevronRightIcon className="ml-auto size-4" />
</DropdownMenuPrimitive.SubTrigger>
)
}
@@ -229,7 +228,7 @@ function DropdownMenuSubContent({
<DropdownMenuPrimitive.SubContent
data-slot="dropdown-menu-sub-content"
className={cn(
- 'bg-main-view text-main-view-fg border-main-view-fg/5 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-[51] min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-y-auto max-h-[var(--radix-dropdown-menu-content-available-height)] rounded-md border p-1 shadow-lg',
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
className
)}
{...props}
diff --git a/web-app/src/components/ui/dropdrawer.tsx b/web-app/src/components/ui/dropdrawer.tsx
index f363527a1..890967f93 100644
--- a/web-app/src/components/ui/dropdrawer.tsx
+++ b/web-app/src/components/ui/dropdrawer.tsx
@@ -1,9 +1,6 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
-'use client'
-
-import { AnimatePresence, motion } from 'framer-motion'
-import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'
-import * as React from 'react'
+import { AnimatePresence, motion } from "framer-motion";
+import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
+import * as React from "react";
import {
Drawer,
@@ -13,8 +10,7 @@ import {
DrawerHeader,
DrawerTitle,
DrawerTrigger,
-} from '@/components/ui/drawer'
-
+} from "./drawer";
import {
DropdownMenu,
DropdownMenuContent,
@@ -25,132 +21,23 @@ import {
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-
-import { cn } from '@/lib/utils'
-import { useSmallScreen } from '@/hooks/useMediaQuery'
-
-const ANIMATION_CONFIG = {
- variants: {
- enter: (direction: 'forward' | 'backward') => ({
- x: direction === 'forward' ? '100%' : '-100%',
- opacity: 0,
- }),
- center: {
- x: 0,
- opacity: 1,
- },
- exit: (direction: 'forward' | 'backward') => ({
- x: direction === 'forward' ? '-100%' : '100%',
- opacity: 0,
- }),
- },
- transition: {
- duration: 0.3,
- ease: [0.25, 0.1, 0.25, 1.0],
- },
-} as const
-
-const getMobileItemStyles = (
- isInsideGroup: boolean,
- inset?: boolean,
- variant?: string,
- disabled?: boolean
-) => {
- return cn(
- 'flex cursor-pointer items-center justify-between px-4 py-4 w-full gap-4',
- !isInsideGroup && 'bg-main-view-fg/50 mx-2 my-1.5 rounded-md',
- isInsideGroup && 'bg-transparent py-4',
- inset && 'pl-8',
- variant === 'destructive' && 'text-destructive',
- disabled && 'pointer-events-none opacity-50'
- )
-}
+} from "./dropdown-menu";
+import { useIsMobile } from "@/hooks/use-mobile";
+import { cn } from "@/lib/utils";
const DropDrawerContext = React.createContext<{ isMobile: boolean }>({
isMobile: false,
-})
+});
const useDropDrawerContext = () => {
- const context = React.useContext(DropDrawerContext)
+ const context = React.useContext(DropDrawerContext);
if (!context) {
throw new Error(
- 'DropDrawer components cannot be rendered outside the DropDrawer Context'
- )
- }
- return context
-}
-
-const useComponentSelection = () => {
- const { isMobile } = useDropDrawerContext()
-
- const selectComponent = <T, D>(mobileComponent: T, desktopComponent: D) => {
- return isMobile ? mobileComponent : desktopComponent
+ "DropDrawer components cannot be rendered outside the DropDrawer Context",
+ );
}
-
- return { isMobile, selectComponent }
-}
-
-const useGroupDetection = () => {
- const isInGroup = React.useCallback(
- (element: HTMLElement | null): boolean => {
- if (!element) return false
-
- let parent = element.parentElement
- while (parent) {
- if (parent.hasAttribute('data-drop-drawer-group')) {
- return true
- }
- parent = parent.parentElement
- }
- return false
- },
- []
- )
-
- const useGroupState = () => {
- const { isMobile } = useComponentSelection()
- const itemRef = React.useRef<HTMLDivElement>(null)
- const [isInsideGroup, setIsInsideGroup] = React.useState(false)
-
- React.useEffect(() => {
- if (!isMobile) return
-
- const timer = setTimeout(() => {
- if (itemRef.current) {
- setIsInsideGroup(isInGroup(itemRef.current))
- }
- }, 0)
-
- return () => clearTimeout(timer)
- }, [isMobile])
-
- return { itemRef, isInsideGroup }
- }
-
- return { isInGroup, useGroupState }
-}
-
-type ConditionalComponentProps<T, D> = {
- children: React.ReactNode
- className?: string
-} & (T | D)
-
-const ConditionalComponent = <T, D>({
- mobileComponent,
- desktopComponent,
- children,
- ...props
-}: {
- mobileComponent: React.ComponentType<any>
- desktopComponent: React.ComponentType<any>
- children: React.ReactNode
-} & ConditionalComponentProps<T, D>) => {
- const { selectComponent } = useComponentSelection()
- const Component = selectComponent(mobileComponent, desktopComponent)
-
- return <Component {...props}>{children}</Component>
-}
+ return context;
+};
function DropDrawer({
children,
@@ -158,20 +45,20 @@ function DropDrawer({
}:
| React.ComponentProps<typeof Drawer>
| React.ComponentProps<typeof DropdownMenu>) {
- const isMobile = useSmallScreen()
+ const isMobile = useIsMobile();
+ const DropdownComponent = isMobile ? Drawer : DropdownMenu;
return (
<DropDrawerContext.Provider value={{ isMobile }}>
- <ConditionalComponent
- mobileComponent={Drawer}
- desktopComponent={DropdownMenu}
+ <DropdownComponent
data-slot="drop-drawer"
+ {...(isMobile && { autoFocus: true })}
{...props}
>
{children}
- </ConditionalComponent>
+ </DropdownComponent>
</DropDrawerContext.Provider>
- )
+ );
}
function DropDrawerTrigger({
@@ -181,17 +68,18 @@ function DropDrawerTrigger({
}:
| React.ComponentProps<typeof DrawerTrigger>
| React.ComponentProps<typeof DropdownMenuTrigger>) {
+ const { isMobile } = useDropDrawerContext();
+ const TriggerComponent = isMobile ? DrawerTrigger : DropdownMenuTrigger;
+
return (
- <ConditionalComponent
- mobileComponent={DrawerTrigger}
- desktopComponent={DropdownMenuTrigger}
+ <TriggerComponent
data-slot="drop-drawer-trigger"
className={className}
{...props}
>
{children}
- </ConditionalComponent>
- )
+ </TriggerComponent>
+ );
}
function DropDrawerContent({
@@ -201,118 +89,185 @@ function DropDrawerContent({
}:
| React.ComponentProps<typeof DrawerContent>
| React.ComponentProps<typeof DropdownMenuContent>) {
- const { isMobile } = useDropDrawerContext()
- const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null)
- const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null)
+ const { isMobile } = useDropDrawerContext();
+ const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null);
+ const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null);
const [submenuStack, setSubmenuStack] = React.useState<
{ id: string; title: string }[]
- >([])
+ >([]);
// Add animation direction state
const [animationDirection, setAnimationDirection] = React.useState<
- 'forward' | 'backward'
- >('forward')
+ "forward" | "backward"
+ >("forward");
- // Create a ref to store submenu content by ID
- const submenuContentRef = React.useRef<Map<string, React.ReactNode[]>>(
- new Map()
- )
+ // Store submenu content by ID using state instead of ref
+ const [submenuContentCache, setSubmenuContentCache] = React.useState<
+ Map<string, React.ReactNode[]>
+ >(new Map());
// Function to navigate to a submenu
const navigateToSubmenu = React.useCallback((id: string, title: string) => {
// Set animation direction to forward when navigating to a submenu
- setAnimationDirection('forward')
- setActiveSubmenu(id)
- setSubmenuTitle(title)
- setSubmenuStack((prev) => [...prev, { id, title }])
- }, [])
+ setAnimationDirection("forward");
+ setActiveSubmenu(id);
+ setSubmenuTitle(title);
+ setSubmenuStack((prev) => [...prev, { id, title }]);
+ }, []);
// Function to go back to previous menu
const goBack = React.useCallback(() => {
// Set animation direction to backward when going back
- setAnimationDirection('backward')
+ setAnimationDirection("backward");
if (submenuStack.length <= 1) {
// If we're at the first level, go back to main menu
- setActiveSubmenu(null)
- setSubmenuTitle(null)
- setSubmenuStack([])
+ setActiveSubmenu(null);
+ setSubmenuTitle(null);
+ setSubmenuStack([]);
} else {
// Go back to previous submenu
- const newStack = [...submenuStack]
- newStack.pop() // Remove current
- const previous = newStack[newStack.length - 1]
- setActiveSubmenu(previous.id)
- setSubmenuTitle(previous.title)
- setSubmenuStack(newStack)
+ const newStack = [...submenuStack];
+ newStack.pop(); // Remove current
+ const previous = newStack[newStack.length - 1];
+ setActiveSubmenu(previous.id);
+ setSubmenuTitle(previous.title);
+ setSubmenuStack(newStack);
}
- }, [submenuStack])
+ }, [submenuStack]);
// Function to register submenu content
const registerSubmenuContent = React.useCallback(
(id: string, content: React.ReactNode[]) => {
- submenuContentRef.current.set(id, content)
+ setSubmenuContentCache((prev) => {
+ const newCache = new Map(prev);
+ newCache.set(id, content);
+ return newCache;
+ });
},
- []
- )
+ [],
+ );
+ // Function to extract submenu content
const extractSubmenuContent = React.useCallback(
(elements: React.ReactNode, targetId: string): React.ReactNode[] => {
- const result: React.ReactNode[] = []
+ const result: React.ReactNode[] = [];
+ // Recursive function to search through all children
const findSubmenuContent = (node: React.ReactNode) => {
- if (!React.isValidElement(node)) return
+ // Skip if not a valid element
+ if (!React.isValidElement(node)) return;
- const element = node as React.ReactElement
+ const element = node as React.ReactElement;
+ // Use a more specific type to avoid 'any'
const props = element.props as {
- 'id'?: string
- 'data-submenu-id'?: string
- 'children'?: React.ReactNode
- }
+ id?: string;
+ "data-submenu-id"?: string;
+ children?: React.ReactNode;
+ };
+ // Check if this is a DropDrawerSub
if (element.type === DropDrawerSub) {
- const elementId = props.id || props['data-submenu-id']
-
- if (elementId === targetId) {
- React.Children.forEach(props.children, (child) => {
- if (
- React.isValidElement(child) &&
- child.type === DropDrawerSubContent
- ) {
- const subContentProps = child.props as {
- children?: React.ReactNode
- }
- React.Children.forEach(
- subContentProps.children,
- (contentChild) => {
- result.push(contentChild)
+ // Get all possible ID values
+ const elementId = props.id;
+ const dataSubmenuId = props["data-submenu-id"];
+
+ // If this is the submenu we're looking for
+ if (elementId === targetId || dataSubmenuId === targetId) {
+ // Find the SubContent within this Sub
+ if (props.children) {
+ React.Children.forEach(props.children, (child) => {
+ if (
+ React.isValidElement(child) &&
+ child.type === DropDrawerSubContent
+ ) {
+ // Add all children of the SubContent to the result
+ const subContentProps = child.props as {
+ children?: React.ReactNode;
+ };
+ if (subContentProps.children) {
+ React.Children.forEach(
+ subContentProps.children,
+ (contentChild) => {
+ result.push(contentChild);
+ },
+ );
}
- )
- }
- })
- return
+ }
+ });
+ }
+ return; // Found what we needed, no need to search deeper
}
}
+ // If this element has children, search through them
if (props.children) {
- React.Children.forEach(props.children, findSubmenuContent)
+ if (Array.isArray(props.children)) {
+ props.children.forEach((child: React.ReactNode) =>
+ findSubmenuContent(child),
+ );
+ } else {
+ findSubmenuContent(props.children);
+ }
}
+ };
+
+ // Start the search from the root elements
+ if (Array.isArray(elements)) {
+ elements.forEach((child) => findSubmenuContent(child));
+ } else {
+ findSubmenuContent(elements);
}
- React.Children.forEach(elements, findSubmenuContent)
- return result
+ return result;
},
- []
- )
+ [],
+ );
- // Get submenu content (always extract fresh to reflect state changes)
+ // Get submenu content (either from cache or extract it)
const getSubmenuContent = React.useCallback(
(id: string) => {
- // Always extract fresh content to ensure state changes are reflected
- const submenuContent = extractSubmenuContent(children, id)
- return submenuContent
+ // Check if we have the content in our cache
+ const cachedContent = submenuContentCache.get(id || "");
+ if (cachedContent && cachedContent.length > 0) {
+ return cachedContent;
+ }
+
+ // If not in cache, extract it
+ const submenuContent = extractSubmenuContent(children, id);
+
+ if (submenuContent.length === 0) {
+ return [];
+ }
+
+ // Store in cache for future use
+ if (id) {
+ setSubmenuContentCache((prev) => {
+ const newCache = new Map(prev);
+ newCache.set(id, submenuContent);
+ return newCache;
+ });
+ }
+
+ return submenuContent;
},
- [children, extractSubmenuContent]
- )
+ [children, extractSubmenuContent, submenuContentCache],
+ );
+
+ // Animation variants for Framer Motion
+ const variants = {
+ enter: (direction: "forward" | "backward") => ({
+ x: direction === "forward" ? "100%" : "-100%",
+ opacity: 0,
+ }),
+ center: {
+ x: 0,
+ opacity: 1,
+ },
+ exit: (direction: "forward" | "backward") => ({
+ x: direction === "forward" ? "-100%" : "100%",
+ opacity: 0,
+ }),
+ };
if (isMobile) {
return (
@@ -321,9 +276,9 @@ function DropDrawerContent({
activeSubmenu,
setActiveSubmenu: (id) => {
if (id === null) {
- setActiveSubmenu(null)
- setSubmenuTitle(null)
- setSubmenuStack([])
+ setActiveSubmenu(null);
+ setSubmenuTitle(null);
+ setSubmenuStack([]);
}
},
submenuTitle,
@@ -334,10 +289,7 @@ function DropDrawerContent({
>
<DrawerContent
data-slot="drop-drawer-content"
- className={cn(
- 'max-h-[90vh] w-full overflow-hidden max-w-none',
- className
- )}
+ className={cn("max-h-[90vh]", className)}
{...props}
>
{activeSubmenu ? (
@@ -346,16 +298,14 @@ function DropDrawerContent({
<div className="flex items-center gap-2">
<button
onClick={goBack}
- className="hover:bg-muted/50 rounded-full "
+ className="hover:bg-muted/50 rounded-full p-1"
>
- <ChevronLeftIcon className="h-5 w-5 text-main-view-fg/50" />
+ <ChevronLeftIcon className="size-5" />
</button>
- <DrawerTitle className="text-main-view-fg/80 text-sm">
- {submenuTitle || 'Submenu'}
- </DrawerTitle>
+ <DrawerTitle>{submenuTitle || "Submenu"}</DrawerTitle>
</div>
</DrawerHeader>
- <div className="flex-1 relative overflow-hidden max-h-[70vh]">
+ <div className="flex-1 relative overflow-y-auto max-h-[70vh]">
{/* Use AnimatePresence to handle exit animations */}
<AnimatePresence
initial={false}
@@ -363,14 +313,13 @@ function DropDrawerContent({
custom={animationDirection}
>
<motion.div
- key={activeSubmenu || 'main'}
+ key={activeSubmenu || "main"}
custom={animationDirection}
- variants={ANIMATION_CONFIG.variants}
+ variants={variants}
initial="enter"
animate="center"
exit="exit"
- transition={ANIMATION_CONFIG.transition as any}
- className="pb-6 space-y-1.5 w-full h-full overflow-hidden"
+ className="pb-6 space-y-1.5 w-full h-full"
>
{activeSubmenu
? getSubmenuContent(activeSubmenu)
@@ -384,7 +333,7 @@ function DropDrawerContent({
<DrawerHeader className="sr-only">
<DrawerTitle>Menu</DrawerTitle>
</DrawerHeader>
- <div className="overflow-hidden max-h-[70vh]">
+ <div className="overflow-y-auto max-h-[70vh]">
<AnimatePresence
initial={false}
mode="wait"
@@ -393,12 +342,11 @@ function DropDrawerContent({
<motion.div
key="main-menu"
custom={animationDirection}
- variants={ANIMATION_CONFIG.variants}
+ variants={variants}
initial="enter"
animate="center"
exit="exit"
- transition={ANIMATION_CONFIG.transition as any}
- className="pb-6 space-y-1.5 w-full overflow-hidden"
+ className="pb-6 space-y-1.5 w-full"
>
{children}
</motion.div>
@@ -408,7 +356,7 @@ function DropDrawerContent({
)}
</DrawerContent>
</SubmenuContext.Provider>
- )
+ );
}
return (
@@ -418,23 +366,23 @@ function DropDrawerContent({
setActiveSubmenu,
submenuTitle,
setSubmenuTitle,
- navigateToSubmenu,
registerSubmenuContent,
}}
>
<DropdownMenuContent
data-slot="drop-drawer-content"
+ align="end"
sideOffset={4}
className={cn(
- 'max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[220px] overflow-hidden',
- className
+ "max-h-(--radix-dropdown-menu-content-available-height) min-w-[220px] overflow-y-auto",
+ className,
)}
{...props}
>
{children}
</DropdownMenuContent>
</SubmenuContext.Provider>
- )
+ );
}
function DropDrawerItem({
@@ -443,41 +391,58 @@ function DropDrawerItem({
onSelect,
onClick,
icon,
- variant = 'default',
+ variant = "default",
inset,
disabled,
...props
}: React.ComponentProps<typeof DropdownMenuItem> & {
- icon?: React.ReactNode
+ icon?: React.ReactNode;
}) {
- const { isMobile } = useComponentSelection()
- const { useGroupState } = useGroupDetection()
- const { itemRef, isInsideGroup } = useGroupState()
+ const { isMobile } = useDropDrawerContext();
- if (isMobile) {
- const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
- if (disabled) return
+ // Define hooks outside of conditionals to follow React rules
+ // Check if this item is inside a group by looking at parent elements
+ const isInGroup = React.useCallback(
+ (element: HTMLElement | null): boolean => {
+ if (!element) return false;
- // If this item only has an icon (like a switch) and no other interactive content,
- // don't handle clicks on the main area - let the icon handle everything
- if (icon && !onClick && !onSelect) {
- return
+ // Check if any parent has a data-drop-drawer-group attribute
+ let parent = element.parentElement;
+ while (parent) {
+ if (parent.hasAttribute("data-drop-drawer-group")) {
+ return true;
+ }
+ parent = parent.parentElement;
}
+ return false;
+ },
+ [],
+ );
- // Check if the click came from the icon area (where the Switch is)
- const target = e.target as HTMLElement
- const iconContainer = (e.currentTarget as HTMLElement).querySelector(
- '[data-icon-container]'
- )
+ // Create a ref to check if the item is in a group
+ const itemRef = React.useRef<HTMLDivElement>(null);
+ const [isInsideGroup, setIsInsideGroup] = React.useState(false);
- if (iconContainer && iconContainer.contains(target)) {
- // Don't handle the click if it came from the icon area
- return
+ React.useEffect(() => {
+ // Only run this effect in mobile mode
+ if (!isMobile) return;
+
+ // Use a short timeout to ensure the DOM is fully rendered
+ const timer = setTimeout(() => {
+ if (itemRef.current) {
+ setIsInsideGroup(isInGroup(itemRef.current));
}
+ }, 0);
- if (onClick) onClick(e)
- if (onSelect) onSelect(e as unknown as Event)
- }
+ return () => clearTimeout(timer);
+ }, [isInGroup, isMobile]);
+
+ if (isMobile) {
+ const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
+ if (disabled) return;
+ if (onClick) onClick(e);
+ if (onSelect) onSelect(e as unknown as Event);
+ };
// Only wrap in DrawerClose if it's not a submenu item
const content = (
@@ -488,32 +453,35 @@ function DropDrawerItem({
data-inset={inset}
data-disabled={disabled}
className={cn(
- getMobileItemStyles(isInsideGroup, inset, variant, disabled),
- className
+ "flex cursor-pointer items-center justify-between px-4 py-2",
+ // Only apply margin, background and rounded corners if not in a group
+ !isInsideGroup && "mx-2 my-1.5 rounded-md",
+ // For items in a group, don't add background but add more padding
+ isInsideGroup && "bg-transparent py-4",
+ inset && "pl-8",
+ variant === "destructive" && "text-destructive dark:text-destructive",
+ disabled && "pointer-events-none opacity-50",
+ className,
)}
onClick={handleClick}
aria-disabled={disabled}
{...props}
>
- <div className="flex items-center gap-2">{children}</div>
- {icon && (
- <div className="flex-shrink-0" data-icon-container>
- {icon}
- </div>
- )}
+ <div className="flex items-center gap-2 size-full">{children}</div>
+ {icon && <div className="shrink-0">{icon}</div>}
</div>
- )
+ );
// Check if this is inside a submenu
const isInSubmenu =
- (props as Record<string, unknown>)['data-parent-submenu-id'] ||
- (props as Record<string, unknown>)['data-parent-submenu']
+ (props as Record<string, unknown>)["data-parent-submenu-id"] ||
+ (props as Record<string, unknown>)["data-parent-submenu"];
if (isInSubmenu) {
- return content
+ return content;
}
- return <DrawerClose asChild>{content}</DrawerClose>
+ return <DrawerClose asChild>{content}</DrawerClose>;
}
return (
@@ -529,31 +497,37 @@ function DropDrawerItem({
disabled={disabled}
{...props}
>
- <div className="flex w-full items-start justify-between gap-4">
- <div className="min-w-0 flex-1">{children}</div>
- {icon && <div className="flex-shrink-0">{icon}</div>}
- </div>
+ {icon ? (
+ <div className="flex w-full items-center justify-between">
+ {children}
+ <div>{icon}</div>
+ </div>
+ ) : (
+ children
+ )}
</DropdownMenuItem>
- )
+ );
}
function DropDrawerSeparator({
className,
...props
}: React.ComponentProps<typeof DropdownMenuSeparator>) {
- const { isMobile } = useComponentSelection()
+ const { isMobile } = useDropDrawerContext();
+ // For mobile, render a simple divider
if (isMobile) {
- return null
+ return null;
}
+ // For desktop, use the standard dropdown separator
return (
<DropdownMenuSeparator
data-slot="drop-drawer-separator"
className={className}
{...props}
/>
- )
+ );
}
function DropDrawerLabel({
@@ -563,7 +537,7 @@ function DropDrawerLabel({
}:
| React.ComponentProps<typeof DropdownMenuLabel>
| React.ComponentProps<typeof DrawerTitle>) {
- const { isMobile } = useComponentSelection()
+ const { isMobile } = useDropDrawerContext();
if (isMobile) {
return (
@@ -571,15 +545,15 @@ function DropDrawerLabel({
<DrawerTitle
data-slot="drop-drawer-label"
className={cn(
- 'px-4 py-2 text-sm font-medium text-main-view-fg/60',
- className
+ "text-muted-foreground px-4 py-2 text-sm font-medium",
+ className,
)}
{...props}
>
{children}
</DrawerTitle>
</DrawerHeader>
- )
+ );
}
return (
@@ -590,64 +564,64 @@ function DropDrawerLabel({
>
{children}
</DropdownMenuLabel>
- )
+ );
}
function DropDrawerFooter({
className,
children,
...props
-}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<'div'>) {
- const { isMobile } = useDropDrawerContext()
+}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<"div">) {
+ const { isMobile } = useDropDrawerContext();
if (isMobile) {
return (
<DrawerFooter
data-slot="drop-drawer-footer"
- className={cn('p-4', className)}
+ className={cn("p-4", className)}
{...props}
>
{children}
</DrawerFooter>
- )
+ );
}
// No direct equivalent in DropdownMenu, so we'll just render a div
return (
<div
data-slot="drop-drawer-footer"
- className={cn('p-2', className)}
+ className={cn("p-2", className)}
{...props}
>
{children}
</div>
- )
+ );
}
function DropDrawerGroup({
className,
children,
...props
-}: React.ComponentProps<'div'> & {
- children: React.ReactNode
+}: React.ComponentProps<"div"> & {
+ children: React.ReactNode;
}) {
- const { isMobile } = useDropDrawerContext()
+ const { isMobile } = useDropDrawerContext();
// Add separators between children on mobile
const childrenWithSeparators = React.useMemo(() => {
- if (!isMobile) return children
+ if (!isMobile) return children;
- const childArray = React.Children.toArray(children)
+ const childArray = React.Children.toArray(children);
// Filter out any existing separators
const filteredChildren = childArray.filter(
(child) =>
- React.isValidElement(child) && child.type !== DropDrawerSeparator
- )
+ React.isValidElement(child) && child.type !== DropDrawerSeparator,
+ );
// Add separators between items
return filteredChildren.flatMap((child, index) => {
- if (index === filteredChildren.length - 1) return [child]
+ if (index === filteredChildren.length - 1) return [child];
return [
child,
<div
@@ -655,9 +629,9 @@ function DropDrawerGroup({
className="bg-border h-px"
aria-hidden="true"
/>,
- ]
- })
- }, [children, isMobile])
+ ];
+ });
+ }, [children, isMobile]);
if (isMobile) {
return (
@@ -666,14 +640,14 @@ function DropDrawerGroup({
data-slot="drop-drawer-group"
role="group"
className={cn(
- 'bg-main-view-fg/2 border border-main-view-fg/4 mx-2 my-3 overflow-hidden rounded-xl',
- className
+ "bg-accent dark:bg-accent mx-2 my-3 overflow-hidden rounded-xl",
+ className,
)}
{...props}
>
{childrenWithSeparators}
</div>
- )
+ );
}
// On desktop, use a div with proper role and attributes
@@ -687,17 +661,17 @@ function DropDrawerGroup({
>
{children}
</div>
- )
+ );
}
// Context for managing submenu state on mobile
interface SubmenuContextType {
- activeSubmenu: string | null
- setActiveSubmenu: (id: string | null) => void
- submenuTitle: string | null
- setSubmenuTitle: (title: string | null) => void
- navigateToSubmenu?: (id: string, title: string) => void
- registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void
+ activeSubmenu: string | null;
+ setActiveSubmenu: (id: string | null) => void;
+ submenuTitle: string | null;
+ setSubmenuTitle: (title: string | null) => void;
+ navigateToSubmenu?: (id: string, title: string) => void;
+ registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void;
}
const SubmenuContext = React.createContext<SubmenuContextType>({
@@ -707,70 +681,67 @@ const SubmenuContext = React.createContext<SubmenuContextType>({
setSubmenuTitle: () => {},
navigateToSubmenu: undefined,
registerSubmenuContent: undefined,
-})
+});
// Submenu components
// Counter for generating simple numeric IDs
-let submenuIdCounter = 0
+let submenuIdCounter = 0;
function DropDrawerSub({
children,
id,
- title,
...props
}: React.ComponentProps<typeof DropdownMenuSub> & {
- id?: string
- title?: string
+ id?: string;
}) {
- const { isMobile } = useDropDrawerContext()
- const { registerSubmenuContent } = React.useContext(SubmenuContext)
+ const { isMobile } = useDropDrawerContext();
+ const { registerSubmenuContent } = React.useContext(SubmenuContext);
// Generate a simple numeric ID instead of using React.useId()
- const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`)
- const submenuId = id || generatedId
+ const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`);
+ const submenuId = id || generatedId;
// Extract submenu content to register with parent
React.useEffect(() => {
- if (!registerSubmenuContent) return
+ if (!registerSubmenuContent) return;
// Find the SubContent within this Sub
- const contentItems: React.ReactNode[] = []
+ const contentItems: React.ReactNode[] = [];
React.Children.forEach(children, (child) => {
if (React.isValidElement(child) && child.type === DropDrawerSubContent) {
// Add all children of the SubContent to the result
React.Children.forEach(
(child.props as { children?: React.ReactNode }).children,
(contentChild) => {
- contentItems.push(contentChild)
- }
- )
+ contentItems.push(contentChild);
+ },
+ );
}
- })
+ });
// Register the content with the parent
if (contentItems.length > 0) {
- registerSubmenuContent(submenuId, contentItems)
+ registerSubmenuContent(submenuId, contentItems);
}
- }, [children, registerSubmenuContent, submenuId])
+ }, [children, registerSubmenuContent, submenuId]);
if (isMobile) {
// For mobile, we'll use the context to manage submenu state
// Process children to pass the submenu ID to the trigger and content
const processedChildren = React.Children.map(children, (child) => {
- if (!React.isValidElement(child)) return child
+ if (!React.isValidElement(child)) return child;
if (child.type === DropDrawerSubTrigger) {
return React.cloneElement(
child as React.ReactElement,
{
...(child.props as object),
- 'data-parent-submenu-id': submenuId,
- 'data-submenu-id': submenuId,
+ "data-parent-submenu-id": submenuId,
+ "data-submenu-id": submenuId,
// Use only data attributes, not custom props
- 'data-parent-submenu': submenuId,
- 'data-submenu-title': title,
- } as React.HTMLAttributes<HTMLElement>
- )
+ "data-parent-submenu": submenuId,
+ } as React.HTMLAttributes<HTMLElement>,
+ );
}
if (child.type === DropDrawerSubContent) {
@@ -778,16 +749,16 @@ function DropDrawerSub({
child as React.ReactElement,
{
...(child.props as object),
- 'data-parent-submenu-id': submenuId,
- 'data-submenu-id': submenuId,
+ "data-parent-submenu-id": submenuId,
+ "data-submenu-id": submenuId,
// Use only data attributes, not custom props
- 'data-parent-submenu': submenuId,
- } as React.HTMLAttributes<HTMLElement>
- )
+ "data-parent-submenu": submenuId,
+ } as React.HTMLAttributes<HTMLElement>,
+ );
}
- return child
- })
+ return child;
+ });
return (
<div
@@ -797,11 +768,20 @@ function DropDrawerSub({
>
{processedChildren}
</div>
- )
+ );
}
- // For desktop, use the standard DropdownMenuSub
- return <DropdownMenuSub {...props}>{children}</DropdownMenuSub>
+ // For desktop, pass the generated ID to the DropdownMenuSub
+ return (
+ <DropdownMenuSub
+ data-slot="drop-drawer-sub"
+ data-submenu-id={submenuId}
+ // Don't pass id to DropdownMenuSub as it doesn't accept this prop
+ {...props}
+ >
+ {children}
+ </DropdownMenuSub>
+ );
}
function DropDrawerSubTrigger({
@@ -810,29 +790,64 @@ function DropDrawerSubTrigger({
children,
...props
}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
- icon?: React.ReactNode
+ icon?: React.ReactNode;
}) {
- const { isMobile } = useComponentSelection()
- const { navigateToSubmenu } = React.useContext(SubmenuContext)
- const { useGroupState } = useGroupDetection()
- const { itemRef, isInsideGroup } = useGroupState()
+ const { isMobile } = useDropDrawerContext();
+ const { navigateToSubmenu } = React.useContext(SubmenuContext);
+
+ // Define hooks outside of conditionals to follow React rules
+ // Check if this item is inside a group by looking at parent elements
+ const isInGroup = React.useCallback(
+ (element: HTMLElement | null): boolean => {
+ if (!element) return false;
+
+ // Check if any parent has a data-drop-drawer-group attribute
+ let parent = element.parentElement;
+ while (parent) {
+ if (parent.hasAttribute("data-drop-drawer-group")) {
+ return true;
+ }
+ parent = parent.parentElement;
+ }
+ return false;
+ },
+ [],
+ );
+
+ // Create a ref to check if the item is in a group
+ const itemRef = React.useRef<HTMLDivElement>(null);
+ const [isInsideGroup, setIsInsideGroup] = React.useState(false);
+
+ React.useEffect(() => {
+ // Only run this effect in mobile mode
+ if (!isMobile) return;
+
+ // Use a short timeout to ensure the DOM is fully rendered
+ const timer = setTimeout(() => {
+ if (itemRef.current) {
+ setIsInsideGroup(isInGroup(itemRef.current));
+ }
+ }, 0);
+
+ return () => clearTimeout(timer);
+ }, [isInGroup, isMobile]);
if (isMobile) {
// Find the parent submenu ID
const handleClick = (e: React.MouseEvent) => {
- e.preventDefault()
- e.stopPropagation()
+ e.preventDefault();
+ e.stopPropagation();
// Get the closest parent with data-submenu-id attribute
- const element = e.currentTarget as HTMLElement
- let submenuId: string | null = null
+ const element = e.currentTarget as HTMLElement;
+ let submenuId: string | null = null;
// First check if the element itself has the data attribute
- if (element.closest('[data-submenu-id]')) {
- const closestElement = element.closest('[data-submenu-id]')
- const id = closestElement?.getAttribute('data-submenu-id')
+ if (element.closest("[data-submenu-id]")) {
+ const closestElement = element.closest("[data-submenu-id]");
+ const id = closestElement?.getAttribute("data-submenu-id");
if (id) {
- submenuId = id
+ submenuId = id;
}
}
@@ -840,44 +855,43 @@ function DropDrawerSubTrigger({
if (!submenuId) {
submenuId =
((props as Record<string, unknown>)[
- 'data-parent-submenu-id'
+ "data-parent-submenu-id"
] as string) ||
- ((props as Record<string, unknown>)['data-parent-submenu'] as string)
+ ((props as Record<string, unknown>)["data-parent-submenu"] as string);
}
if (!submenuId) {
- return
+ return;
}
- // Get the title - first try data attribute, then children, then fallback
- const dataTitle = (props as Record<string, unknown>)[
- 'data-submenu-title'
- ] as string
+ // Get the title
+ const triggerElement = e.currentTarget as HTMLElement;
+ const mobileTitle = triggerElement.getAttribute("data-mobile-title");
const title =
- dataTitle || (typeof children === 'string' ? children : 'Submenu')
+ mobileTitle || (typeof children === "string" ? children : "Submenu");
// Navigate to the submenu
if (navigateToSubmenu) {
- navigateToSubmenu(submenuId, title)
+ navigateToSubmenu(submenuId, title);
}
- }
+ };
// Combine onClick handlers
const combinedOnClick = (e: React.MouseEvent) => {
// Call the original onClick if provided
- const typedProps = props as Record<string, unknown>
+ const typedProps = props as Record<string, unknown>;
if (typedProps.onClick) {
const originalOnClick =
- typedProps.onClick as React.MouseEventHandler<HTMLDivElement>
- originalOnClick(e as React.MouseEvent<HTMLDivElement>)
+ typedProps.onClick as React.MouseEventHandler<HTMLDivElement>;
+ originalOnClick(e as React.MouseEvent<HTMLDivElement>);
}
// Call our navigation handler
- handleClick(e)
- }
+ handleClick(e);
+ };
// Remove onClick from props to avoid duplicate handlers
- const { ...restProps } = props as Record<string, unknown>
+ const { ...restProps } = props as Record<string, unknown>;
// Don't wrap in DrawerClose for submenu triggers
return (
@@ -885,14 +899,22 @@ function DropDrawerSubTrigger({
ref={itemRef}
data-slot="drop-drawer-sub-trigger"
data-inset={inset}
- className={cn(getMobileItemStyles(isInsideGroup, inset), className)}
+ className={cn(
+ "flex cursor-pointer items-center justify-between px-4 py-4",
+ // Only apply margin, background and rounded corners if not in a group
+ !isInsideGroup && "mx-2 my-1.5 rounded-md",
+ // For items in a group, don't add background but add more padding
+ isInsideGroup && "bg-transparent py-4",
+ inset && "pl-8",
+ className,
+ )}
onClick={combinedOnClick}
{...restProps}
>
- <div className="flex items-center gap-2 w-full">{children}</div>
- <ChevronRightIcon className="h-5 w-5 text-main-view-fg/50 " />
+ <div className="flex items-center gap-2">{children}</div>
+ <ChevronRightIcon className="size-5" />
</div>
- )
+ );
}
return (
@@ -905,7 +927,7 @@ function DropDrawerSubTrigger({
>
{children}
</DropdownMenuSubTrigger>
- )
+ );
}
function DropDrawerSubContent({
@@ -914,24 +936,27 @@ function DropDrawerSubContent({
children,
...props
}: React.ComponentProps<typeof DropdownMenuSubContent>) {
- const { isMobile } = useDropDrawerContext()
+ const { isMobile } = useDropDrawerContext();
if (isMobile) {
// For mobile, we don't render the content directly
// It will be rendered by the DropDrawerContent component when active
- return null
+ return null;
}
return (
<DropdownMenuSubContent
data-slot="drop-drawer-sub-content"
sideOffset={sideOffset}
- className={className}
+ className={cn(
+ "z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-lg",
+ className,
+ )}
{...props}
>
{children}
</DropdownMenuSubContent>
- )
+ );
}
export {
@@ -946,4 +971,4 @@ export {
DropDrawerSubContent,
DropDrawerSubTrigger,
DropDrawerTrigger,
-}
+};
diff --git a/web-app/src/components/ui/hover-card.tsx b/web-app/src/components/ui/hover-card.tsx
index a06451ead..e4204e0d6 100644
--- a/web-app/src/components/ui/hover-card.tsx
+++ b/web-app/src/components/ui/hover-card.tsx
@@ -1,19 +1,12 @@
-import * as React from 'react'
-import * as HoverCardPrimitive from '@radix-ui/react-hover-card'
+import * as React from "react"
+import * as HoverCardPrimitive from "@radix-ui/react-hover-card"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
function HoverCard({
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
- return (
- <HoverCardPrimitive.Root
- openDelay={0}
- closeDelay={0}
- data-slot="hover-card"
- {...props}
- />
- )
+ return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />
}
function HoverCardTrigger({
@@ -26,7 +19,7 @@ function HoverCardTrigger({
function HoverCardContent({
className,
- align = 'center',
+ align = "center",
sideOffset = 4,
...props
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
@@ -37,7 +30,7 @@ function HoverCardContent({
align={align}
sideOffset={sideOffset}
className={cn(
- 'bg-main-view text-main-view-fg/70 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border border-main-view-fg/10 p-2 px-3 shadow-md outline-hidden',
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
className
)}
{...props}
diff --git a/web-app/src/components/ui/input.tsx b/web-app/src/components/ui/input.tsx
index 1d7dd9120..146f6ea4a 100644
--- a/web-app/src/components/ui/input.tsx
+++ b/web-app/src/components/ui/input.tsx
@@ -1,17 +1,16 @@
-import * as React from 'react'
+import * as React from "react"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
-function Input({ className, type, ...props }: React.ComponentProps<'input'>) {
+function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
<input
type={type}
data-slot="input"
className={cn(
- 'placeholder:text-main-view-fg/40 border-main-view-fg/10 flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 shadow-xs transition-[color,box-shadow] outline-none disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 text-sm',
- 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[1px] ring-main-view-fg/10',
- 'aria-invalid:ring-destructive/20 aria-invalid:border-destructive',
- '[&::-webkit-inner-spin-button]:appearance-none',
+ "file:text-foreground placeholder:text-muted-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-white px-3 py-1 text-base text-foreground caret-current shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
className
)}
{...props}
diff --git a/web-app/src/components/ui/kbd.tsx b/web-app/src/components/ui/kbd.tsx
new file mode 100644
index 000000000..a95d6e573
--- /dev/null
+++ b/web-app/src/components/ui/kbd.tsx
@@ -0,0 +1,28 @@
+import { cn } from "@/lib/utils"
+
+function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
+ return (
+ <kbd
+ data-slot="kbd"
+ className={cn(
+ "bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
+ "[&_svg:not([class*='size-'])]:size-3",
+ "in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10",
+ className
+ )}
+ {...props}
+ />
+ )
+}
+
+function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <kbd
+ data-slot="kbd-group"
+ className={cn("inline-flex items-center gap-1", className)}
+ {...props}
+ />
+ )
+}
+
+export { Kbd, KbdGroup }
diff --git a/web-app/src/components/ui/popover.tsx b/web-app/src/components/ui/popover.tsx
index 01aeb7580..584ef3270 100644
--- a/web-app/src/components/ui/popover.tsx
+++ b/web-app/src/components/ui/popover.tsx
@@ -28,7 +28,7 @@ function PopoverContent({
align={align}
sideOffset={sideOffset}
className={cn(
- 'bg-main-view text-main-view-fg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border border-main-view-fg/10 p-4 shadow-md outline-hidden',
+ 'bg-background text-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden',
className
)}
{...props}
diff --git a/web-app/src/components/ui/progress.tsx b/web-app/src/components/ui/progress.tsx
index e8b378c97..9ef4f8cfa 100644
--- a/web-app/src/components/ui/progress.tsx
+++ b/web-app/src/components/ui/progress.tsx
@@ -12,14 +12,14 @@ function Progress({
<ProgressPrimitive.Root
data-slot="progress"
className={cn(
- 'bg-accent/30 relative h-2 w-full overflow-hidden rounded-full',
+ 'bg-secondary relative h-2 w-full overflow-hidden rounded-full',
className
)}
{...props}
>
<ProgressPrimitive.Indicator
data-slot="progress-indicator"
- className="bg-accent h-full w-full flex-1 transition-all"
+ className="bg-primary h-full w-full flex-1 transition-all"
style={{ transform: `translateX(-${100 - (value || 0)}%)` }}
/>
</ProgressPrimitive.Root>
diff --git a/web-app/src/components/ui/radio-group.tsx b/web-app/src/components/ui/radio-group.tsx
index e604ac901..dc682eb90 100644
--- a/web-app/src/components/ui/radio-group.tsx
+++ b/web-app/src/components/ui/radio-group.tsx
@@ -1,42 +1,43 @@
-import * as React from 'react'
-import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
-import { CircleIcon } from 'lucide-react'
+import * as React from "react"
+import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
+import { CircleIcon } from "lucide-react"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
-const RadioGroup = React.forwardRef<
- React.ElementRef<typeof RadioGroupPrimitive.Root>,
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
->(({ className, ...props }, ref) => {
+function RadioGroup({
+ className,
+ ...props
+}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
return (
<RadioGroupPrimitive.Root
- className={cn('grid gap-2', className)}
+ data-slot="radio-group"
+ className={cn("grid gap-3", className)}
{...props}
- ref={ref}
/>
)
-})
-RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
+}
-const RadioGroupItem = React.forwardRef<
- React.ElementRef<typeof RadioGroupPrimitive.Item>,
- React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
->(({ className, ...props }, ref) => {
+function RadioGroupItem({
+ className,
+ ...props
+}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
return (
<RadioGroupPrimitive.Item
- ref={ref}
+ data-slot="radio-group-item"
className={cn(
- 'aspect-square size-4 rounded-full border border-main-view-fg/20 text-main-view-fg ring-offset-main-view focus:outline-none focus-visible:ring-2 focus-visible:ring-main-view-fg/50 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
+ "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
className
)}
{...props}
>
- <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
- <CircleIcon className="size-2.5 fill-current text-current" />
+ <RadioGroupPrimitive.Indicator
+ data-slot="radio-group-indicator"
+ className="relative flex items-center justify-center"
+ >
+ <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
</RadioGroupPrimitive.Indicator>
</RadioGroupPrimitive.Item>
)
-})
-RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName
+}
export { RadioGroup, RadioGroupItem }
diff --git a/web-app/src/components/ui/resizable.tsx b/web-app/src/components/ui/resizable.tsx
deleted file mode 100644
index 7b3787645..000000000
--- a/web-app/src/components/ui/resizable.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import * as React from 'react'
-import { GripVerticalIcon } from 'lucide-react'
-import * as ResizablePrimitive from 'react-resizable-panels'
-
-import { cn } from '@/lib/utils'
-
-function ResizablePanelGroup({
- className,
- ...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) {
- return (
- <ResizablePrimitive.PanelGroup
- data-slot="resizable-panel-group"
- className={cn(
- 'flex h-full w-full data-[panel-group-direction=vertical]:flex-col',
- className
- )}
- {...props}
- />
- )
-}
-
-function ResizablePanel({
- ...props
-}: React.ComponentProps<typeof ResizablePrimitive.Panel>) {
- return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />
-}
-
-function ResizableHandle({
- withHandle,
- className,
- ...props
-}: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
- withHandle?: boolean
-}) {
- return (
- <ResizablePrimitive.PanelResizeHandle
- data-slot="resizable-handle"
- className={cn(
- 'focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90',
- className
- )}
- {...props}
- >
- {withHandle && (
- <div className="bg-main-view z-10 flex h-4 w-3 items-center justify-center rounded-xs border border-main-view-fg/10 relative left-0.5">
- <GripVerticalIcon className="size-2.5 text-main-view-fg" />
- </div>
- )}
- </ResizablePrimitive.PanelResizeHandle>
- )
-}
-
-export { ResizablePanelGroup, ResizablePanel, ResizableHandle }
diff --git a/web-app/src/ui/separator.tsx b/web-app/src/components/ui/separator.tsx
similarity index 74%
rename from web-app/src/ui/separator.tsx
rename to web-app/src/components/ui/separator.tsx
index 4e1403417..bb3ad74cf 100644
--- a/web-app/src/ui/separator.tsx
+++ b/web-app/src/components/ui/separator.tsx
@@ -1,7 +1,7 @@
-import * as React from "react";
-import * as SeparatorPrimitive from "@radix-ui/react-separator";
+import * as React from "react"
+import * as SeparatorPrimitive from "@radix-ui/react-separator"
-import { cn } from "../lib/utils";
+import { cn } from "@/lib/utils"
function Separator({
className,
@@ -16,11 +16,11 @@ function Separator({
orientation={orientation}
className={cn(
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
- className,
+ className
)}
{...props}
/>
- );
+ )
}
-export { Separator };
+export { Separator }
diff --git a/web-app/src/components/ui/settings.tsx b/web-app/src/components/ui/settings.tsx
new file mode 100644
index 000000000..933de5b18
--- /dev/null
+++ b/web-app/src/components/ui/settings.tsx
@@ -0,0 +1,92 @@
+"use client";
+
+import { motion, useAnimation } from "motion/react";
+import type { HTMLAttributes } from "react";
+import { forwardRef, useCallback, useImperativeHandle, useRef } from "react";
+
+import { cn } from "@/lib/utils";
+
+export interface SettingsIconHandle {
+ startAnimation: () => void;
+ stopAnimation: () => void;
+}
+
+interface SettingsIconProps extends HTMLAttributes<HTMLDivElement> {
+ size?: number;
+}
+
+const SettingsIcon = forwardRef<SettingsIconHandle, SettingsIconProps>(
+ ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
+ const controls = useAnimation();
+ const isControlledRef = useRef(false);
+
+ useImperativeHandle(ref, () => {
+ isControlledRef.current = true;
+
+ return {
+ startAnimation: () => controls.start("animate"),
+ stopAnimation: () => controls.start("normal"),
+ };
+ });
+
+ const handleMouseEnter = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseEnter?.(e);
+ } else {
+ controls.start("animate");
+ }
+ },
+ [controls, onMouseEnter]
+ );
+
+ const handleMouseLeave = useCallback(
+ (e: React.MouseEvent<HTMLDivElement>) => {
+ if (isControlledRef.current) {
+ onMouseLeave?.(e);
+ } else {
+ controls.start("normal");
+ }
+ },
+ [controls, onMouseLeave]
+ );
+
+ return (
+ <div
+ className={cn(className)}
+ onMouseEnter={handleMouseEnter}
+ onMouseLeave={handleMouseLeave}
+ {...props}
+ >
+ <motion.svg
+ animate={controls}
+ fill="none"
+ height={size}
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="2"
+ transition={{ type: "spring", stiffness: 50, damping: 10 }}
+ variants={{
+ normal: {
+ rotate: 0,
+ },
+ animate: {
+ rotate: 180,
+ },
+ }}
+ viewBox="0 0 24 24"
+ width={size}
+ xmlns="http://www.w3.org/2000/svg"
+ >
+ <path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
+ <circle cx="12" cy="12" r="3" />
+ </motion.svg>
+ </div>
+ );
+ }
+);
+
+SettingsIcon.displayName = "SettingsIcon";
+
+export { SettingsIcon };
diff --git a/web-app/src/components/ui/sheet.tsx b/web-app/src/components/ui/sheet.tsx
index 10ba1db5d..72397234f 100644
--- a/web-app/src/components/ui/sheet.tsx
+++ b/web-app/src/components/ui/sheet.tsx
@@ -1,9 +1,10 @@
-import * as React from 'react'
-import * as SheetPrimitive from '@radix-ui/react-dialog'
-import { XIcon } from 'lucide-react'
+"use client"
-import { cn } from '@/lib/utils'
-import { useTranslation } from '@/i18n/react-i18next-compat'
+import * as React from "react"
+import * as SheetPrimitive from "@radix-ui/react-dialog"
+import { XIcon } from "lucide-react"
+
+import { cn } from "@/lib/utils"
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
return <SheetPrimitive.Root data-slot="sheet" {...props} />
@@ -35,7 +36,7 @@ function SheetOverlay({
<SheetPrimitive.Overlay
data-slot="sheet-overlay"
className={cn(
- 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-main-view/50 backdrop-blur-xs transition-all duration-300 ease-in-out',
+ "data-[state=open]:animate-in backdrop-blur data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
className
)}
{...props}
@@ -46,56 +47,59 @@ function SheetOverlay({
function SheetContent({
className,
children,
- side = 'right',
+ side = "right",
+ showCloseButton = true,
...props
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
- side?: 'top' | 'right' | 'bottom' | 'left'
+ side?: "top" | "right" | "bottom" | "left"
+ showCloseButton?: boolean
}) {
- const { t } = useTranslation()
return (
<SheetPortal>
<SheetOverlay />
<SheetPrimitive.Content
data-slot="sheet-content"
className={cn(
- 'bg-main-view text-sm text-main-view-fg data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-1 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
- side === 'right' &&
- 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l border-main-view-fg/4 sm:max-w-sm',
- side === 'left' &&
- 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r border-main-view-fg/4 sm:max-w-sm',
- side === 'top' &&
- 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b border-main-view-fg/4',
- side === 'bottom' &&
- 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t border-main-view-fg/4',
+ "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
+ side === "right" &&
+ "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
+ side === "left" &&
+ "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
+ side === "top" &&
+ "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
+ side === "bottom" &&
+ "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
className
)}
{...props}
>
{children}
- <SheetPrimitive.Close className="absolute top-4 text-main-view-fg right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-0 disabled:pointer-events-none">
- <XIcon className="size-4" />
- <span className="sr-only">{t('close')}</span>
- </SheetPrimitive.Close>
+ {showCloseButton && (
+ <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
+ <XIcon className="size-4" />
+ <span className="sr-only">Close</span>
+ </SheetPrimitive.Close>
+ )}
</SheetPrimitive.Content>
</SheetPortal>
)
}
-function SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {
+function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-header"
- className={cn('flex flex-col gap-1.5 p-4', className)}
+ className={cn("flex flex-col gap-1.5 p-4", className)}
{...props}
/>
)
}
-function SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {
+function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="sheet-footer"
- className={cn('mt-auto flex flex-col gap-2 p-4', className)}
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
@@ -108,7 +112,7 @@ function SheetTitle({
return (
<SheetPrimitive.Title
data-slot="sheet-title"
- className={cn('font-medium', className)}
+ className={cn("text-foreground font-semibold", className)}
{...props}
/>
)
@@ -121,7 +125,7 @@ function SheetDescription({
return (
<SheetPrimitive.Description
data-slot="sheet-description"
- className={cn('text-main-view-fg/70 text-sm', className)}
+ className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
diff --git a/web-app/src/components/ui/sidebar.tsx b/web-app/src/components/ui/sidebar.tsx
new file mode 100644
index 000000000..9f6a3b372
--- /dev/null
+++ b/web-app/src/components/ui/sidebar.tsx
@@ -0,0 +1,859 @@
+"use client";
+
+import { Slot } from "@radix-ui/react-slot";
+import { type VariantProps, cva } from "class-variance-authority";
+import { PanelLeft } from "lucide-react";
+import * as React from "react";
+
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Separator } from "@/components/ui/separator";
+import { Sheet, SheetContent } from "@/components/ui/sheet";
+import { Skeleton } from "@/components/ui/skeleton";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from "@/components/ui/tooltip";
+import { useIsMobile } from "@/hooks/use-mobile";
+import { useSidebarResize } from "@/hooks/use-sidebar-resize";
+import { mergeButtonRefs } from "@/lib/merge-button-refs";
+import { cn } from "@/lib/utils";
+
+const SIDEBAR_COOKIE_NAME = "sidebar:state";
+const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
+const SIDEBAR_WIDTH = "15rem";
+const SIDEBAR_WIDTH_MOBILE = "18rem";
+const SIDEBAR_WIDTH_ICON = "5rem";
+const SIDEBAR_KEYBOARD_SHORTCUT = "b";
+
+//* new constants for sidebar resizing
+const MIN_SIDEBAR_WIDTH = "14rem";
+const MAX_SIDEBAR_WIDTH = "40rem";
+
+type SidebarContext = {
+ state: "expanded" | "collapsed";
+ open: boolean;
+ setOpen: (open: boolean) => void;
+ openMobile: boolean;
+ setOpenMobile: (open: boolean) => void;
+ isMobile: boolean;
+ toggleSidebar: () => void;
+ //* new properties for sidebar resizing
+ width: string;
+ setWidth: (width: string) => void;
+ //* new properties for tracking is dragging rail
+ isDraggingRail: boolean;
+ setIsDraggingRail: (isDraggingRail: boolean) => void;
+};
+
+const SidebarContext = React.createContext<SidebarContext | null>(null);
+
+function useSidebar() {
+ const context = React.useContext(SidebarContext);
+ if (!context) {
+ throw new Error("useSidebar must be used within a SidebarProvider.");
+ }
+
+ return context;
+}
+
+const SidebarProvider = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ defaultOpen?: boolean;
+ open?: boolean;
+ onOpenChange?: (open: boolean) => void;
+ //* new prop for default width
+ defaultWidth?: string;
+ //* new prop for width change callback
+ onWidthChange?: (width: string) => void;
+ }
+>(
+ (
+ {
+ defaultOpen = true,
+ open: openProp,
+ onOpenChange: setOpenProp,
+ className,
+ style,
+ children,
+ defaultWidth = SIDEBAR_WIDTH,
+ onWidthChange,
+ ...props
+ },
+ ref,
+ ) => {
+ const isMobile = useIsMobile();
+ //* new state for sidebar width
+ const [width, setWidthState] = React.useState(defaultWidth);
+
+ //* wrapper to call both internal state and external callback
+ const setWidth = React.useCallback((newWidth: string) => {
+ setWidthState(newWidth);
+ onWidthChange?.(newWidth);
+ }, [onWidthChange]);
+ const [openMobile, setOpenMobile] = React.useState(false);
+ //* new state for tracking is dragging rail
+ const [isDraggingRail, setIsDraggingRail] = React.useState(false);
+
+ // This is the internal state of the sidebar.
+ // We use openProp and setOpenProp for control from outside the component.
+ const [_open, _setOpen] = React.useState(defaultOpen);
+ const open = openProp ?? _open;
+ const setOpen = React.useCallback(
+ (value: boolean | ((value: boolean) => boolean)) => {
+ const openState = typeof value === "function" ? value(open) : value;
+ if (setOpenProp) {
+ setOpenProp(openState);
+ } else {
+ _setOpen(openState);
+ }
+
+ // This sets the cookie to keep the sidebar state.
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
+ },
+ [setOpenProp, open],
+ );
+
+ // Helper to toggle the sidebar.
+ const toggleSidebar = React.useCallback(() => {
+ return isMobile
+ ? setOpenMobile((open) => !open)
+ : setOpen((open) => !open);
+ }, [
+ isMobile,
+ setOpen,
+ //* remove setOpenMobile from dependencies because setOpenMobile are state setters created by useState
+ // setOpenMobile
+ ]);
+
+ // Adds a keyboard shortcut to toggle the sidebar.
+ React.useEffect(() => {
+ const handleKeyDown = (event: KeyboardEvent) => {
+ if (
+ event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
+ (event.metaKey || event.ctrlKey)
+ ) {
+ event.preventDefault();
+ toggleSidebar();
+ }
+ };
+
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [toggleSidebar]);
+
+ // We add a state so that we can do data-state="expanded" or "collapsed".
+ // This makes it easier to style the sidebar with Tailwind classes.
+ const state = open ? "expanded" : "collapsed";
+
+ const contextValue = React.useMemo<SidebarContext>(
+ () => ({
+ state,
+ open,
+ setOpen,
+ isMobile,
+ openMobile,
+ setOpenMobile,
+ toggleSidebar,
+ //* new context for sidebar resizing
+ width,
+ setWidth,
+ //* new context for tracking is dragging rail
+ isDraggingRail,
+ setIsDraggingRail,
+ }),
+ [
+ state,
+ open,
+ setOpen,
+ isMobile,
+ openMobile,
+ //* remove setOpenMobile from dependencies because setOpenMobile are state setters created by useState
+ // setOpenMobile,
+ toggleSidebar,
+ //* add width to dependencies
+ width,
+ //* add isDraggingRail to dependencies
+ isDraggingRail,
+ ],
+ );
+
+ return (
+ <SidebarContext.Provider value={contextValue}>
+ <TooltipProvider delayDuration={0}>
+ <div
+ style={
+ {
+ // * update '--sidebar-width' to use the new width state
+ "--sidebar-width": width,
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
+ ...style,
+ } as React.CSSProperties
+ }
+ className={cn(
+ "group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
+ className,
+ )}
+ ref={ref}
+ {...props}
+ >
+ {children}
+ </div>
+ </TooltipProvider>
+ </SidebarContext.Provider>
+ );
+ },
+);
+SidebarProvider.displayName = "SidebarProvider";
+
+const Sidebar = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ side?: "left" | "right";
+ variant?: "sidebar" | "floating" | "inset";
+ collapsible?: "offcanvas" | "icon" | "none";
+ }
+>(
+ (
+ {
+ side = "left",
+ variant = "sidebar",
+ collapsible = "offcanvas",
+ className,
+ children,
+ ...props
+ },
+ ref,
+ ) => {
+ const {
+ isMobile,
+ state,
+ openMobile,
+ setOpenMobile,
+ //* new property for tracking is dragging rail
+ isDraggingRail,
+ } = useSidebar();
+
+ if (collapsible === "none") {
+ return (
+ <div
+ className={cn(
+ "flex h-full w-(--sidebar-width) flex-col bg-clip-padding bg-linear-to-b from-sidebar dark:from-sidebar/70 to-background text-sidebar-foreground",
+ className,
+ )}
+ ref={ref}
+ {...props}
+ >
+ {children}
+ </div>
+ );
+ }
+
+ if (isMobile) {
+ return (
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
+ <SheetContent
+ data-sidebar="sidebar"
+ data-mobile="true"
+ className="w-(--sidebar-width) bg-clip-padding bg-linear-to-b from-sidebar dark:from-sidebar/70 to-background p-0 text-sidebar-foreground [&>button]:hidden"
+ style={
+ {
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
+ } as React.CSSProperties
+ }
+ side={side}
+ >
+ <div className="flex h-full w-full flex-col">{children}</div>
+ </SheetContent>
+ </Sheet>
+ );
+ }
+
+ return (
+ <div
+ ref={ref}
+ className="group peer hidden md:block text-sidebar-foreground"
+ data-state={state}
+ data-collapsible={state === "collapsed" ? collapsible : ""}
+ data-variant={variant}
+ data-side={side}
+ //* add data-dragging attribute
+ data-dragging={isDraggingRail}
+ >
+ {/* This is what handles the sidebar gap on desktop */}
+ <div
+ className={cn(
+ "duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear",
+ "group-data-[collapsible=offcanvas]:w-0",
+ "group-data-[side=right]:rotate-180",
+ variant === "floating" || variant === "inset"
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
+ //* set duration to 0 for all elements when dragging
+ "group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:duration-0!",
+ )}
+ />
+ <div
+ className={cn(
+ "duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
+ side === "left"
+ ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
+ : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
+ // Adjust the padding for floating and inset variants.
+ variant === "floating" || variant === "inset"
+ ? "p-2 pr-0 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
+ //* set duration to 0 for all elements when dragging
+ "group-data-[dragging=true]:duration-0! group-data-[dragging=true]_*:duration-0!",
+ className,
+ )}
+ {...props}
+ >
+ <div
+ data-sidebar="sidebar"
+ className="flex bg-clip-padding h-full w-full flex-col bg-linear-to-b from-sidebar dark:from-sidebar/70 to-background group-data-[variant=floating]:rounded-xl group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border"
+ >
+ {children}
+ </div>
+ </div>
+ </div>
+ );
+ },
+);
+Sidebar.displayName = "Sidebar";
+
+const SidebarTrigger = React.forwardRef<
+ React.ElementRef<typeof Button>,
+ React.ComponentProps<typeof Button>
+>(({ className, onClick, ...props }, ref) => {
+ const { toggleSidebar } = useSidebar();
+
+ return (
+ <Button
+ ref={ref}
+ data-sidebar="trigger"
+ variant="ghost"
+ size="icon"
+ className={cn("size-8", className)}
+ onClick={(event) => {
+ onClick?.(event);
+ toggleSidebar();
+ }}
+ {...props}
+ >
+ <PanelLeft />
+ <span className="sr-only">Toggle Sidebar</span>
+ </Button>
+ );
+});
+SidebarTrigger.displayName = "SidebarTrigger";
+
+const SidebarRail = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & {
+ //* new prop for enabling drag
+ enableDrag?: boolean;
+ }
+>(({ className, enableDrag = true, ...props }, ref) => {
+ const { toggleSidebar, setWidth, state, width, setIsDraggingRail } =
+ useSidebar();
+
+ const { dragRef, handleMouseDown } = useSidebarResize({
+ direction: "right",
+ enableDrag,
+ onResize: setWidth,
+ onToggle: toggleSidebar,
+ currentWidth: width,
+ isCollapsed: state === "collapsed",
+ minResizeWidth: MIN_SIDEBAR_WIDTH,
+ maxResizeWidth: MAX_SIDEBAR_WIDTH,
+ setIsDraggingRail,
+ widthCookieName: "sidebar:width",
+ widthCookieMaxAge: 60 * 60 * 24 * 7, // 1 week
+ });
+
+ //* Merge external ref with our dragRef
+ const combinedRef = React.useMemo(
+ () => mergeButtonRefs([ref, dragRef]),
+ [ref, dragRef],
+ );
+
+ return (
+ <button
+ //* updated ref to use combinedRef
+ ref={combinedRef}
+ data-sidebar="rail"
+ aria-label="Toggle Sidebar"
+ tabIndex={-1}
+ // onClick={toggleSidebar}
+ //* replace onClick with onMouseDown
+ onMouseDown={handleMouseDown}
+ title="Toggle Sidebar"
+ className={cn(
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 hover:after:bg-sidebar group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
+ // Cursor styles for resize
+ "cursor-ew-resize group-data-[side=left]:cursor-ew-resize group-data-[side=right]:cursor-ew-resize",
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
+ // Adjust for floating variant - match the rounded corners and padding
+ "group-data-[variant=floating]:inset-y-2 group-data-[side=left]:group-data-[variant=floating]:-right-4 group-data-[variant=floating]:after:rounded-lg group-data-[variant=floating]:mt-4 group-data-[variant=floating]:h-[calc(100%-4rem)]",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarRail.displayName = "SidebarRail";
+
+const SidebarInset = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"main">
+>(({ className, ...props }, ref) => {
+ return (
+ <main
+ ref={ref}
+ className={cn(
+ "relative flex min-h-svh flex-1 flex-col bg-background",
+ "peer-data-[variant=inset]:min-h-[calc(100svh-(--spacing(4)))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarInset.displayName = "SidebarInset";
+
+const SidebarInput = React.forwardRef<
+ React.ElementRef<typeof Input>,
+ React.ComponentProps<typeof Input>
+>(({ className, ...props }, ref) => {
+ return (
+ <Input
+ ref={ref}
+ data-sidebar="input"
+ className={cn(
+ "h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarInput.displayName = "SidebarInput";
+
+const SidebarHeader = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="header"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarHeader.displayName = "SidebarHeader";
+
+const SidebarFooter = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="footer"
+ className={cn("flex flex-col gap-2 p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarFooter.displayName = "SidebarFooter";
+
+const SidebarSeparator = React.forwardRef<
+ React.ElementRef<typeof Separator>,
+ React.ComponentProps<typeof Separator>
+>(({ className, ...props }, ref) => {
+ return (
+ <Separator
+ ref={ref}
+ data-sidebar="separator"
+ className={cn("mx-2 w-auto bg-sidebar-border", className)}
+ {...props}
+ />
+ );
+});
+SidebarSeparator.displayName = "SidebarSeparator";
+
+const SidebarContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="content"
+ className={cn(
+ "flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarContent.displayName = "SidebarContent";
+
+const SidebarGroup = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => {
+ return (
+ <div
+ ref={ref}
+ data-sidebar="group"
+ className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
+ {...props}
+ />
+ );
+});
+SidebarGroup.displayName = "SidebarGroup";
+
+const SidebarGroupLabel = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & { asChild?: boolean }
+>(({ className, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "div";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="group-label"
+ className={cn(
+ "duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-hidden ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarGroupLabel.displayName = "SidebarGroupLabel";
+
+const SidebarGroupAction = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & { asChild?: boolean }
+>(({ className, asChild = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="group-action"
+ className={cn(
+ "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 md:after:hidden",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarGroupAction.displayName = "SidebarGroupAction";
+
+const SidebarGroupContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ data-sidebar="group-content"
+ className={cn("w-full text-sm", className)}
+ {...props}
+ />
+));
+SidebarGroupContent.displayName = "SidebarGroupContent";
+
+const SidebarMenu = React.forwardRef<
+ HTMLUListElement,
+ React.ComponentProps<"ul">
+>(({ className, ...props }, ref) => (
+ <ul
+ ref={ref}
+ data-sidebar="menu"
+ className={cn("flex w-full min-w-0 flex-col gap-1", className)}
+ {...props}
+ />
+));
+SidebarMenu.displayName = "SidebarMenu";
+
+const SidebarMenuItem = React.forwardRef<
+ HTMLLIElement,
+ React.ComponentProps<"li">
+>(({ className, ...props }, ref) => (
+ <li
+ ref={ref}
+ data-sidebar="menu-item"
+ className={cn("group/menu-item relative", className)}
+ {...props}
+ />
+));
+SidebarMenuItem.displayName = "SidebarMenuItem";
+
+const sidebarMenuButtonVariants = cva(
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
+ {
+ variants: {
+ variant: {
+ default: "hover:bg-sidebar-foreground/8 hover:text-sidebar-accent-foreground",
+ outline:
+ "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]",
+ },
+ size: {
+ default: "h-8 text-sm",
+ sm: "h-7 text-xs",
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ size: "default",
+ },
+ },
+);
+
+const SidebarMenuButton = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ isActive?: boolean;
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
+ } & VariantProps<typeof sidebarMenuButtonVariants>
+>(
+ (
+ {
+ asChild = false,
+ isActive = false,
+ variant = "default",
+ size = "default",
+ tooltip,
+ className,
+ ...props
+ },
+ ref,
+ ) => {
+ const Comp = asChild ? Slot : "button";
+ const { isMobile, state } = useSidebar();
+
+ const button = (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
+ {...props}
+ />
+ );
+
+ if (!tooltip) {
+ return button;
+ }
+
+ if (typeof tooltip === "string") {
+ tooltip = {
+ children: tooltip,
+ };
+ }
+
+ return (
+ <Tooltip>
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
+ <TooltipContent
+ side="right"
+ align="center"
+ hidden={state !== "collapsed" || isMobile}
+ {...tooltip}
+ />
+ </Tooltip>
+ );
+ },
+);
+SidebarMenuButton.displayName = "SidebarMenuButton";
+
+const SidebarMenuAction = React.forwardRef<
+ HTMLButtonElement,
+ React.ComponentProps<"button"> & {
+ asChild?: boolean;
+ showOnHover?: boolean;
+ }
+>(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
+ const Comp = asChild ? Slot : "button";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-action"
+ className={cn(
+ "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-hidden ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
+ // Increases the hit area of the button on mobile.
+ "after:absolute after:-inset-2 md:after:hidden",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ showOnHover &&
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarMenuAction.displayName = "SidebarMenuAction";
+
+const SidebarMenuBadge = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div">
+>(({ className, ...props }, ref) => (
+ <div
+ ref={ref}
+ data-sidebar="menu-badge"
+ className={cn(
+ "absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none",
+ "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
+ "peer-data-[size=sm]/menu-button:top-1",
+ "peer-data-[size=default]/menu-button:top-1.5",
+ "peer-data-[size=lg]/menu-button:top-2.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+));
+SidebarMenuBadge.displayName = "SidebarMenuBadge";
+
+const SidebarMenuSkeleton = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ showIcon?: boolean;
+ }
+>(({ className, showIcon = false, ...props }, ref) => {
+ // Random width between 50 to 90%.
+ const width = React.useMemo(() => {
+ return `${Math.floor(Math.random() * 40) + 50}%`;
+ }, []);
+
+ return (
+ <div
+ ref={ref}
+ data-sidebar="menu-skeleton"
+ className={cn("rounded-md h-8 flex gap-2 px-2 items-center", className)}
+ {...props}
+ >
+ {showIcon && (
+ <Skeleton
+ className="size-4 rounded-md"
+ data-sidebar="menu-skeleton-icon"
+ />
+ )}
+ <Skeleton
+ className="h-4 flex-1 max-w-(--skeleton-width)"
+ data-sidebar="menu-skeleton-text"
+ style={
+ {
+ "--skeleton-width": width,
+ } as React.CSSProperties
+ }
+ />
+ </div>
+ );
+});
+SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
+
+const SidebarMenuSub = React.forwardRef<
+ HTMLUListElement,
+ React.ComponentProps<"ul">
+>(({ className, ...props }, ref) => (
+ <ul
+ ref={ref}
+ data-sidebar="menu-sub"
+ className={cn(
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+));
+SidebarMenuSub.displayName = "SidebarMenuSub";
+
+const SidebarMenuSubItem = React.forwardRef<
+ HTMLLIElement,
+ React.ComponentProps<"li">
+>(({ ...props }, ref) => <li ref={ref} {...props} />);
+SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
+
+const SidebarMenuSubButton = React.forwardRef<
+ HTMLAnchorElement,
+ React.ComponentProps<"a"> & {
+ asChild?: boolean;
+ size?: "sm" | "md";
+ isActive?: boolean;
+ }
+>(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
+ const Comp = asChild ? Slot : "a";
+
+ return (
+ <Comp
+ ref={ref}
+ data-sidebar="menu-sub-button"
+ data-size={size}
+ data-active={isActive}
+ className={cn(
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-hidden ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
+ "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
+ size === "sm" && "text-xs",
+ size === "md" && "text-sm",
+ "group-data-[collapsible=icon]:hidden",
+ className,
+ )}
+ {...props}
+ />
+ );
+});
+SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
+
+export {
+ Sidebar,
+ SidebarContent,
+ SidebarFooter,
+ SidebarGroup,
+ SidebarGroupAction,
+ SidebarGroupContent,
+ SidebarGroupLabel,
+ SidebarHeader,
+ SidebarInput,
+ SidebarInset,
+ SidebarMenu,
+ SidebarMenuAction,
+ SidebarMenuBadge,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ SidebarMenuSkeleton,
+ SidebarMenuSub,
+ SidebarMenuSubButton,
+ SidebarMenuSubItem,
+ SidebarProvider,
+ SidebarRail,
+ SidebarSeparator,
+ SidebarTrigger,
+ useSidebar,
+};
\ No newline at end of file
diff --git a/web-app/src/components/ui/skeleton.tsx b/web-app/src/components/ui/skeleton.tsx
index 9efe5678e..32ea0ef7f 100644
--- a/web-app/src/components/ui/skeleton.tsx
+++ b/web-app/src/components/ui/skeleton.tsx
@@ -1,10 +1,10 @@
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
-function Skeleton({ className, ...props }: React.ComponentProps<'div'>) {
+function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="skeleton"
- className={cn('bg-main-view-fg/10', className)}
+ className={cn("bg-accent animate-pulse rounded-md", className)}
{...props}
/>
)
diff --git a/web-app/src/components/ui/slider.tsx b/web-app/src/components/ui/slider.tsx
index 74c8ebe05..5f9617f22 100644
--- a/web-app/src/components/ui/slider.tsx
+++ b/web-app/src/components/ui/slider.tsx
@@ -1,7 +1,7 @@
-import * as React from 'react'
-import * as SliderPrimitive from '@radix-ui/react-slider'
+import * as React from "react"
+import * as SliderPrimitive from "@radix-ui/react-slider"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
function Slider({
className,
@@ -29,7 +29,7 @@ function Slider({
min={min}
max={max}
className={cn(
- 'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col',
+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
className
)}
{...props}
@@ -37,13 +37,13 @@ function Slider({
<SliderPrimitive.Track
data-slot="slider-track"
className={cn(
- 'bg-main-view-fg/10 relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5'
+ "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
)}
>
<SliderPrimitive.Range
data-slot="slider-range"
className={cn(
- 'bg-accent absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full'
+ "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
)}
/>
</SliderPrimitive.Track>
@@ -51,7 +51,7 @@ function Slider({
<SliderPrimitive.Thumb
data-slot="slider-thumb"
key={index}
- className="border-accent bg-main-view ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-2 ring-accent focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
+ className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
/>
))}
</SliderPrimitive.Root>
diff --git a/web-app/src/components/ui/sonner.tsx b/web-app/src/components/ui/sonner.tsx
index ea7312970..eb0bec70f 100644
--- a/web-app/src/components/ui/sonner.tsx
+++ b/web-app/src/components/ui/sonner.tsx
@@ -3,15 +3,7 @@ import { Toaster as Sonner, ToasterProps } from 'sonner'
const Toaster = ({ ...props }: ToasterProps) => {
return (
<Sonner
- // theme={theme as ToasterProps['theme']}
className="toaster group"
- // style={
- // {
- // '--normal-bg': 'var(--app-main-view)',
- // '--normal-text': 'var(--popover-foreground)',
- // '--normal-border': 'var(--border)',
- // } as React.CSSProperties
- // }
{...props}
/>
)
diff --git a/web-app/src/components/ui/switch.tsx b/web-app/src/components/ui/switch.tsx
index 3022a2f71..97abd3da1 100644
--- a/web-app/src/components/ui/switch.tsx
+++ b/web-app/src/components/ui/switch.tsx
@@ -12,7 +12,7 @@ function Switch({ loading, className, ...props }: SwitchProps) {
<SwitchPrimitive.Root
data-slot="switch"
className={cn(
- 'relative peer cursor-pointer data-[state=checked]:bg-accent data-[state=unchecked]:bg-main-view-fg/20 focus-visible:border-none inline-flex h-[18px] w-8.5 shrink-0 items-center rounded-full border border-transparent shadow-xs outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 transition-all',
+ 'relative peer cursor-pointer data-[state=checked]:bg-primary data-[state=unchecked]:bg-background focus-visible:border-none inline-flex h-[18px] w-8.5 shrink-0 items-center rounded-full border shadow-xs outline-none focus-visible:ring-0 disabled:cursor-not-allowed disabled:opacity-50 transition-all',
loading && 'w-4.5 pointer-events-none',
className
)}
@@ -20,13 +20,13 @@ function Switch({ loading, className, ...props }: SwitchProps) {
>
{loading && (
<div className="absolute inset-0 flex items-center justify-center z-10 size-3.5 top-1/2 -translate-y-1/2 left-1/2 -translate-x-1/2">
- <IconLoader2 className="animate-spin text-main-view-fg/50" />
+ <IconLoader2 className="animate-spin text-muted-foreground" />
</div>
)}
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
- 'bg-main-view pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%)] data-[state=unchecked]:-translate-x-0'
+ 'bg-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%)] data-[state=unchecked]:translate-x-0'
)}
/>
</SwitchPrimitive.Root>
diff --git a/web-app/src/components/ui/textarea.tsx b/web-app/src/components/ui/textarea.tsx
index 9a29541ab..7f21b5e78 100644
--- a/web-app/src/components/ui/textarea.tsx
+++ b/web-app/src/components/ui/textarea.tsx
@@ -1,14 +1,13 @@
-import * as React from 'react'
+import * as React from "react"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
-function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {
+function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
return (
<textarea
data-slot="textarea"
className={cn(
- 'placeholder:text-main-view-fg/40 border-main-view-fg/10 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 text-sm',
- 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[1px] ring-main-view-fg/10',
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className
)}
{...props}
diff --git a/web-app/src/components/ui/tooltip.tsx b/web-app/src/components/ui/tooltip.tsx
index 78e71a538..1f022c1da 100644
--- a/web-app/src/components/ui/tooltip.tsx
+++ b/web-app/src/components/ui/tooltip.tsx
@@ -1,7 +1,7 @@
-import * as React from 'react'
-import * as TooltipPrimitive from '@radix-ui/react-tooltip'
+import * as React from "react"
+import * as TooltipPrimitive from "@radix-ui/react-tooltip"
-import { cn } from '@/lib/utils'
+import { cn } from "@/lib/utils"
function TooltipProvider({
delayDuration = 0,
@@ -35,27 +35,23 @@ function TooltipTrigger({
function TooltipContent({
className,
sideOffset = 0,
- showArrow = true,
children,
+ showArrow = true,
...props
-}: React.ComponentProps<typeof TooltipPrimitive.Content> & {
- showArrow?: boolean
-}) {
+}: React.ComponentProps<typeof TooltipPrimitive.Content> & { showArrow?: boolean }) {
return (
<TooltipPrimitive.Portal>
<TooltipPrimitive.Content
data-slot="tooltip-content"
sideOffset={sideOffset}
className={cn(
- 'bg-main-view-fg text-main-view animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance capitalize',
+ "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
className
)}
{...props}
>
{children}
- {showArrow && (
- <TooltipPrimitive.Arrow className="bg-main-view-fg fill-main-view-fg z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" />
- )}
+ {showArrow && <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]" />}
</TooltipPrimitive.Content>
</TooltipPrimitive.Portal>
)
diff --git a/web-app/src/containers/AccentColorPicker.tsx b/web-app/src/containers/AccentColorPicker.tsx
new file mode 100644
index 000000000..5fd632f0e
--- /dev/null
+++ b/web-app/src/containers/AccentColorPicker.tsx
@@ -0,0 +1,32 @@
+import { cn } from '@/lib/utils'
+import {
+ useInterfaceSettings,
+ ACCENT_COLORS,
+} from '@/hooks/useInterfaceSettings'
+
+export function AccentColorPicker() {
+ const { accentColor, setAccentColor } = useInterfaceSettings()
+
+ return (
+ <div className="flex items-center gap-1.5 flex-wrap">
+ {ACCENT_COLORS.map((color) => {
+ const isSelected = color.value === accentColor
+ return (
+ <button
+ key={color.value}
+ title={color.name}
+ onClick={() => setAccentColor(color.value)}
+ className={cn(
+ 'size-5 rounded-full border border-secondary transition-all duration-200 cursor-pointer hover:scale-110',
+ isSelected &&
+ 'ring-2 ring-offset-2 ring-primary border-none'
+ )}
+ style={{
+ backgroundColor: color.thumb,
+ }}
+ />
+ )
+ })}
+ </div>
+ )
+}
diff --git a/web-app/src/containers/ApiKeyInput.tsx b/web-app/src/containers/ApiKeyInput.tsx
index b3dc51b3f..cfcf8ac63 100644
--- a/web-app/src/containers/ApiKeyInput.tsx
+++ b/web-app/src/containers/ApiKeyInput.tsx
@@ -73,7 +73,7 @@ export function ApiKeyInput({
className={cn(
'w-full text-sm pr-10',
hasError &&
- 'border-1 border-destructive focus:border-destructive focus:ring-destructive',
+ 'border border-destructive focus:border-destructive focus:ring-destructive',
isServerRunning && 'opacity-50 pointer-events-none'
)}
placeholder={t('common:enterApiKey')}
@@ -81,7 +81,7 @@ export function ApiKeyInput({
<div className="absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1">
<button
onClick={() => setShowPassword(!showPassword)}
- className="p-1 rounded hover:bg-main-view-fg/5 text-main-view-fg/70"
+ className="p-1 rounded hover:bg-secondary/50 text-muted-foreground"
type="button"
>
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
diff --git a/web-app/src/containers/Capabilities.tsx b/web-app/src/containers/Capabilities.tsx
index 21593a899..32deebe97 100644
--- a/web-app/src/containers/Capabilities.tsx
+++ b/web-app/src/containers/Capabilities.tsx
@@ -26,7 +26,7 @@ const Capabilities = ({ capabilities }: CapabilitiesProps) => {
})
return (
- <div className="flex gap-1">
+ <div className="flex gap-0.5">
{filteredCapabilities.map((capability: string, capIndex: number) => {
let icon = null
@@ -58,7 +58,10 @@ const Capabilities = ({ capabilities }: CapabilitiesProps) => {
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
- <span className={badgeClass} title={capability}>
+ <span
+ className="flex items-center gap-1 size-5 hover:bg-secondary rounded text-muted-foreground justify-center last:mr-1 transition-all"
+ title={capability}
+ >
{icon}
{isEmbedding && <span>Embedding</span>}
</span>
diff --git a/web-app/src/containers/Card.tsx b/web-app/src/containers/Card.tsx
index 7d68550db..4c98673e7 100644
--- a/web-app/src/containers/Card.tsx
+++ b/web-app/src/containers/Card.tsx
@@ -32,7 +32,7 @@ export function CardItem({
<>
<div
className={cn(
- 'flex justify-between mt-2 first:mt-0 border-b border-main-view-fg/5 pb-3 last:border-none last:pb-0 gap-8',
+ 'flex justify-between mt-2 first:mt-0 border-b border-border/40 pb-3 last:border-none last:pb-0 gap-8',
descriptionOutside && 'border-0',
align === 'start' && 'items-start',
align === 'center' && 'items-center',
@@ -42,9 +42,9 @@ export function CardItem({
)}
>
<div className="space-y-1.5">
- <h1 className="font-medium">{title}</h1>
+ <h1 className="font-medium text-foreground">{title}</h1>
{description && (
- <span className="text-main-view-fg/70 leading-normal">
+ <span className="text-muted-foreground leading-normal">
{description}
</span>
)}
@@ -62,7 +62,7 @@ export function CardItem({
)}
</div>
{descriptionOutside && (
- <span className="text-main-view-fg/70 leading-normal">
+ <span className="text-muted-foreground leading-normal">
{descriptionOutside}
</span>
)}
@@ -72,9 +72,9 @@ export function CardItem({
export function Card({ title, children, header }: CardProps) {
return (
- <div className="bg-main-view-fg/3 p-4 rounded-lg text-main-view-fg/90 w-full">
+ <div className="bg-secondary dark:bg-secondary/30 p-4 rounded-lg text-muted-foreground w-full">
{title && (
- <h1 className="text-main-view-fg font-medium text-base mb-4">
+ <h1 className="text-foreground font-studio font-medium text-base mb-4">
{title}
</h1>
)}
diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx
index c9dda28e7..a68de6a02 100644
--- a/web-app/src/containers/ChatInput.tsx
+++ b/web-app/src/containers/ChatInput.tsx
@@ -1,5 +1,3 @@
-'use client'
-
import TextareaAutosize from 'react-textarea-autosize'
import { cn } from '@/lib/utils'
import { usePrompt } from '@/hooks/usePrompt'
@@ -9,7 +7,6 @@ import { Button } from '@/components/ui/button'
import {
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip'
import {
@@ -28,8 +25,8 @@ import {
IconX,
IconPaperclip,
IconLoader2,
- IconCheck,
IconWorld,
+ IconBrandChrome,
} from '@tabler/icons-react'
import { useTranslation } from '@/i18n/react-i18next-compat'
import { useGeneralSetting } from '@/hooks/useGeneralSetting'
@@ -49,8 +46,6 @@ import {
import { localStorageKey } from '@/constants/localStorage'
import { defaultModel } from '@/lib/models'
import { useAssistant } from '@/hooks/useAssistant'
-import DropdownModelProvider from '@/containers/DropdownModelProvider'
-import { ModelLoader } from '@/containers/loaders/ModelLoader'
import DropdownToolsAvailable from '@/containers/DropdownToolsAvailable'
import { useServiceHub } from '@/hooks/useServiceHub'
import { useTools } from '@/hooks/useTools'
@@ -102,7 +97,6 @@ type ChatInputProps = {
}
const ChatInput = ({
- model,
className,
initialMessage,
projectId,
@@ -115,7 +109,6 @@ const ChatInput = ({
const [rows, setRows] = useState(1)
const serviceHub = useServiceHub()
const abortControllers = useAppState((state) => state.abortControllers)
- const loadingModel = useAppState((state) => state.loadingModel)
const updateLoadingModel = useAppState((state) => state.updateLoadingModel)
const tools = useAppState((state) => state.tools)
const cancelToolCall = useAppState((state) => state.cancelToolCall)
@@ -1106,10 +1099,7 @@ const ChatInput = ({
await openImagePicker()
return
}
-
- if (selectedProvider === 'llamacpp') {
- setShowVisionModelPrompt(true)
- }
+ setShowVisionModelPrompt(true)
}
const handleVisionModelDownloadComplete = useCallback(
@@ -1326,7 +1316,7 @@ const ChatInput = ({
<div className="relative">
<div
className={cn(
- 'relative overflow-hidden p-[2px] rounded-3xl',
+ 'relative overflow-hidden p-0.5 rounded-3xl',
isStreaming && 'opacity-70'
)}
>
@@ -1344,9 +1334,9 @@ const ChatInput = ({
<div
className={cn(
- 'relative z-20 px-0 pb-10 border border-border rounded-3xl text-main-view-fg bg-main-view',
- isFocused && 'ring-1 ring-main-view-fg/10',
- isDragOver && 'ring-2 ring-accent border-accent'
+ 'relative z-20 px-0 pb-10 border rounded-3xl border-input dark:bg-input/30',
+ isFocused && 'ring-1 ring-ring/50',
+ isDragOver && 'ring-2 ring-ring/50 border-primary'
)}
data-drop-zone={hasMmproj ? 'true' : undefined}
onDragEnter={hasMmproj ? handleDragEnter : undefined}
@@ -1367,78 +1357,55 @@ const ChatInput = ({
key={`${att.type}-${idx}-${att.name}`}
className="relative"
>
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div
+ className={cn(
+ 'relative border rounded-xl size-14 overflow-hidden',
+ 'flex items-center justify-center'
+ )}
+ >
+ {/* Inner content by state */}
+ {isImage && att.dataUrl ? (
+ <img
+ className="object-cover w-full h-full"
+ src={att.dataUrl}
+ alt={`${att.name}`}
+ />
+ ) : (
+ <div className="flex flex-col items-center justify-center text-muted-foreground">
+ <IconPaperclip size={18} />
+ {ext && (
+ <span className="text-[10px] leading-none mt-0.5 uppercase opacity-70">
+ .{ext}
+ </span>
+ )}
+ </div>
+ )}
+
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <div className="text-xs">
<div
- className={cn(
- 'relative border border-main-view-fg/5 rounded-xl size-14 overflow-hidden bg-main-view/40',
- 'flex items-center justify-center'
- )}
+ className="font-medium truncate max-w-52"
+ title={att.name}
>
- {/* Inner content by state */}
- {isImage && att.dataUrl ? (
- <img
- className="object-cover w-full h-full"
- src={att.dataUrl}
- alt={`${att.name}`}
- />
- ) : (
- <div className="flex flex-col items-center justify-center text-main-view-fg/70">
- <IconPaperclip size={18} />
- {ext && (
- <span className="text-[10px] leading-none mt-0.5 uppercase opacity-70">
- .{ext}
- </span>
- )}
- </div>
- )}
-
- {/* Overlay spinner when processing */}
- {att.processing && (
- <div className="absolute inset-0 flex items-center justify-center bg-black/10">
- <IconLoader2
- size={18}
- className="text-main-view-fg/80 animate-spin"
- />
- </div>
- )}
-
- {/* Overlay success check when processed */}
- {att.processed && !att.processing && (
- <div className="absolute inset-0 flex items-center justify-center bg-black/5">
- <div className="bg-green-600/90 rounded-full p-1">
- <IconCheck
- size={14}
- className="text-white"
- />
- </div>
- </div>
- )}
+ {att.name}
</div>
- </TooltipTrigger>
- <TooltipContent>
- <div className="text-xs">
- <div
- className="font-medium truncate max-w-52"
- title={att.name}
- >
- {att.name}
- </div>
- <div className="opacity-70">
- {isImage
- ? att.mimeType || 'image'
- : ext
- ? `.${ext}`
- : 'document'}
- {att.size
- ? ` · ${formatBytes(att.size)}`
- : ''}
- </div>
+ <div className="opacity-70">
+ {isImage
+ ? att.mimeType || 'image'
+ : ext
+ ? `.${ext}`
+ : 'document'}
+ {att.size
+ ? ` · ${formatBytes(att.size)}`
+ : ''}
</div>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ </div>
+ </TooltipContent>
+ </Tooltip>
{/* Remove button disabled while processing - outside overflow-hidden container */}
{!att.processing && (
@@ -1495,7 +1462,7 @@ const ChatInput = ({
data-gramm_editor={spellCheckChatInput}
data-gramm_grammarly={spellCheckChatInput}
className={cn(
- 'bg-transparent pt-4 w-full flex-shrink-0 border-none resize-none outline-0 px-4',
+ 'bg-transparent pt-4 w-full shrink-0 border-none resize-none outline-0 px-4',
rows < maxRows && 'scrollbar-hide',
className
)}
@@ -1515,16 +1482,14 @@ const ChatInput = ({
{/* Dropdown for attachments */}
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <div className="size-7 flex items-center justify-center rounded-full bg-main-view-fg/4 hover:bg-main-view-fg/4 transition-all duration-200 ease-in-out gap-1 mr-2 cursor-pointer">
- <PlusIcon size={18} className="text-main-view-fg/50" />
- </div>
+ <Button variant="secondary" size="icon-sm" className='rounded-full mr-2 mb-1'>
+ <PlusIcon size={18} className="text-muted-foreground" />
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="start">
- <DropdownMenuItem
- onClick={handleImagePickerClick}
- disabled={selectedProvider !== 'llamacpp' && !hasMmproj}
- >
- <IconPhoto size={18} className="text-main-view-fg/50" />
+ {/* Vision image attachment - always enabled, prompts to download vision model if needed */}
+ <DropdownMenuItem onClick={handleImagePickerClick}>
+ <IconPhoto size={18} className="text-muted-foreground" />
<span>Add Images</span>
<input
type="file"
@@ -1542,12 +1507,12 @@ const ChatInput = ({
{ingestingDocs ? (
<IconLoader2
size={18}
- className="text-main-view-fg/50 animate-spin"
+ className="text-muted-foreground animate-spin"
/>
) : (
<IconPaperclip
size={18}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
/>
)}
<span>
@@ -1558,80 +1523,75 @@ const ChatInput = ({
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
- {model?.provider === 'llamacpp' && loadingModel ? (
+ {/* {model?.provider === 'llamacpp' && loadingModel ? (
<ModelLoader />
) : (
<DropdownModelProvider
model={model}
useLastUsedModel={initialMessage}
/>
- )}
- {/* Microphone - always available - Temp Hide */}
- {/* <div className="h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1">
- <IconMicrophone size={18} className="text-main-view-fg/50" />
- </div> */}
- {selectedModel?.capabilities?.includes('embeddings') && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1">
- <IconCodeCircle2
+ )} */}
+ {hasJanBrowserMCPConfig && modelSupportsBrowser && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ disabled={isJanBrowserMCPLoading}
+ className={cn(janBrowserMCPActive && "text-primary")}
+ onClick={
+ isJanBrowserMCPLoading
+ ? undefined
+ : handleBrowseClick
+ }
+ >
+ {isJanBrowserMCPLoading ? (
+ <IconLoader2
size={18}
- className="text-main-view-fg/50"
+ className="text-primary animate-spin"
/>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('embeddings')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ ) : (
+ <IconBrandChrome
+ size={18}
+ className={cn(
+ 'text-muted-foreground',
+ janBrowserMCPActive && 'text-primary'
+ )}
+ />
+ )}
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>
+ {isJanBrowserMCPLoading
+ ? 'Starting...'
+ : janBrowserMCPActive
+ ? 'Browse (Active)'
+ : 'Browse'}
+ </p>
+ </TooltipContent>
+ </Tooltip>
)}
- {hasJanBrowserMCPConfig && modelSupportsBrowser && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div
- className={cn(
- 'h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1 cursor-pointer',
- janBrowserMCPActive && 'bg-primary/10',
- isJanBrowserMCPLoading &&
- 'opacity-70 cursor-not-allowed'
- )}
- onClick={
- isJanBrowserMCPLoading
- ? undefined
- : handleBrowseClick
- }
+
+ {selectedModel?.capabilities?.includes('embeddings') && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
>
- {isJanBrowserMCPLoading ? (
- <IconLoader2
- size={18}
- className="text-primary animate-spin"
- />
- ) : (
- <IconWorld
- size={18}
- className={cn(
- 'text-main-view-fg/50',
- janBrowserMCPActive && 'text-primary'
- )}
- />
- )}
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>
- {isJanBrowserMCPLoading
- ? 'Starting...'
- : janBrowserMCPActive
- ? 'Browse (Active)'
- : 'Browse'}
- </p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <IconCodeCircle2
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('embeddings')}</p>
+ </TooltipContent>
+ </Tooltip>
)}
+
{selectedModel?.capabilities?.includes('tools') &&
hasActiveMCPServers &&
(MCPToolComponent ? (
@@ -1647,91 +1607,86 @@ const ChatInput = ({
/>
) : (
// Use default tools dropdown
- <TooltipProvider>
- <Tooltip
- open={tooltipToolsAvailable}
- onOpenChange={setTooltipToolsAvailable}
+ <Tooltip
+ open={tooltipToolsAvailable}
+ onOpenChange={setTooltipToolsAvailable}
+ >
+ <TooltipTrigger
+ asChild
+ disabled={dropdownToolsAvailable}
>
- <TooltipTrigger
- asChild
- disabled={dropdownToolsAvailable}
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ onClick={(e) => {
+ setDropdownToolsAvailable(false)
+ e.stopPropagation()
+ }}
>
- <div
- onClick={(e) => {
- setDropdownToolsAvailable(false)
- e.stopPropagation()
+ <DropdownToolsAvailable
+ initialMessage={initialMessage}
+ onOpenChange={(isOpen) => {
+ setDropdownToolsAvailable(isOpen)
+ if (isOpen) {
+ setTooltipToolsAvailable(false)
+ }
}}
>
- <DropdownToolsAvailable
- initialMessage={initialMessage}
- onOpenChange={(isOpen) => {
- setDropdownToolsAvailable(isOpen)
- if (isOpen) {
- setTooltipToolsAvailable(false)
- }
- }}
- >
- {(isOpen, toolsCount) => {
- return (
- <div
+ {() => {
+ return (
+ <div
+ className={cn(
+ 'p-1 flex items-center justify-center rounded-sm transition-all duration-200 ease-in-out gap-1 cursor-pointer',
+ )}
+ >
+ <IconTool
+ size={18}
className={cn(
- 'h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1 cursor-pointer',
- isOpen && 'bg-main-view-fg/10',
- toolsCount > 0 && 'bg-primary/10'
+ 'text-muted-foreground',
)}
- >
- <IconTool
- size={18}
- className={cn(
- 'text-main-view-fg/50',
- toolsCount > 0 && 'text-primary'
- )}
- />
- </div>
- )
- }}
- </DropdownToolsAvailable>
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('tools')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
- ))}
- {selectedModel?.capabilities?.includes('web_search') && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1">
- <IconWorld
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
+ />
+ </div>
+ )
+ }}
+ </DropdownToolsAvailable>
+ </Button>
</TooltipTrigger>
<TooltipContent>
- <p>Web Search</p>
+ <p>{t('tools')}</p>
</TooltipContent>
</Tooltip>
- </TooltipProvider>
+ ))}
+
+ {selectedModel?.capabilities?.includes('web_search') && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <IconWorld
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>Web Search</p>
+ </TooltipContent>
+ </Tooltip>
)}
+
{selectedModel?.capabilities?.includes('reasoning') && (
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div className="h-7 p-1 flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out gap-1">
- <IconAtom
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('reasoning')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <IconAtom
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('reasoning')}</p>
+ </TooltipContent>
+ </Tooltip>
)}
</div>
</div>
@@ -1761,8 +1716,8 @@ const ChatInput = ({
{isStreaming ? (
<Button
variant="destructive"
- size="icon"
- className="rounded-full mr-0.5"
+ size="icon-sm"
+ className="rounded-full mr-1 mb-1"
onClick={() => {
if (currentThreadId) stopStreaming(currentThreadId)
}}
@@ -1771,12 +1726,12 @@ const ChatInput = ({
</Button>
) : (
<Button
- variant={!prompt.trim() ? null : 'default'}
- size="icon"
+ variant="default"
+ size="icon-sm"
disabled={!prompt.trim() || ingestingAny}
data-test-id="send-message-button"
onClick={() => handleSendMessage(prompt)}
- className="rounded-full mr-0.5 text-black"
+ className="rounded-full mr-1 mb-1"
>
<ArrowRight className="text-primary-fg" />
</Button>
@@ -1787,11 +1742,11 @@ const ChatInput = ({
</div>
{message && (
- <div className="bg-main-view-fg/2 -mt-0.5 mx-2 pb-2 px-3 pt-1.5 rounded-b-lg text-xs text-destructive transition-all duration-200 ease-in-out">
+ <div className="-mt-0.5 mx-2 pb-2 px-3 pt-1.5 rounded-b-lg text-xs text-destructive transition-all duration-200 ease-in-out">
<div className="flex items-center gap-1 justify-between">
{message}
<IconX
- className="size-3 text-main-view-fg/30 cursor-pointer"
+ className="size-3 text-muted-foreground cursor-pointer"
onClick={() => {
setMessage('')
// Reset file input to allow re-uploading the same file
@@ -1811,7 +1766,6 @@ const ChatInput = ({
<div className="flex-1 w-full flex justify-start px-2">
<TokenCounter
messages={threadMessages || []}
- compact={false}
uploadedFiles={attachments
.filter((a) => a.type === 'image' && a.dataUrl)
.map((a) => ({
diff --git a/web-app/src/containers/ChatWidthSwitcher.tsx b/web-app/src/containers/ChatWidthSwitcher.tsx
deleted file mode 100644
index c35062271..000000000
--- a/web-app/src/containers/ChatWidthSwitcher.tsx
+++ /dev/null
@@ -1,71 +0,0 @@
-import { Skeleton } from '@/components/ui/skeleton'
-import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { IconCircleCheckFilled } from '@tabler/icons-react'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-
-export function ChatWidthSwitcher() {
- const { chatWidth, setChatWidth } = useInterfaceSettings()
- const { t } = useTranslation()
-
- return (
- <div className="flex flex-col sm:flex-row sm:gap-4">
- <button
- className={cn(
- 'w-full overflow-hidden border border-main-view-fg/10 rounded-md my-2 pb-2 cursor-pointer',
- chatWidth === 'compact' && 'border-accent'
- )}
- onClick={() => setChatWidth('compact')}
- >
- <div className="flex items-center justify-between px-4 pt-3 pb-2 bg-main-view-fg/10 -mt-1">
- <span className="font-medium text-xs font-sans">
- {t('common:compactWidth')}
- </span>
- {chatWidth === 'compact' && (
- <IconCircleCheckFilled className="size-4 text-accent" />
- )}
- </div>
- <div className="overflow-auto p-2">
- <div className="flex flex-col px-6 gap-2 mt-2">
- <Skeleton className="h-2 w-full rounded-full" />
- <Skeleton className="h-2 w-full rounded-full" />
- <Skeleton className="h-2 w-full rounded-full" />
- <div className="bg-main-view-fg/10 h-8 px-4 w-full flex-shrink-0 border-none resize-none outline-0 rounded-sm flex items-center truncate">
- <span className="text-main-view-fg/50 line-clamp-1">
- {t('common:placeholder.chatInput')}
- </span>
- </div>
- </div>
- </div>
- </button>
- <button
- className={cn(
- 'w-full overflow-hidden border border-main-view-fg/10 rounded-md my-2 pb-2 cursor-pointer',
- chatWidth === 'full' && 'border-accent'
- )}
- onClick={() => setChatWidth('full')}
- >
- <div className="flex items-center justify-between px-4 py-2 bg-main-view-fg/10">
- <span className="font-medium text-xs font-sans">
- {t('common:fullWidth')}
- </span>
- {chatWidth === 'full' && (
- <IconCircleCheckFilled className="size-4 text-accent" />
- )}
- </div>
- <div className="overflow-auto p-2">
- <div className="flex flex-col gap-2 mt-2">
- <Skeleton className="h-2 w-full rounded-full" />
- <Skeleton className="h-2 w-full rounded-full" />
- <Skeleton className="h-2 w-full rounded-full" />
- <div className="bg-main-view-fg/10 h-8 px-4 w-full flex-shrink-0 border-none resize-none outline-0 rounded-sm flex items-center">
- <span className="text-main-view-fg/50">
- {t('common:placeholder.chatInput')}
- </span>
- </div>
- </div>
- </div>
- </button>
- </div>
- )
-}
diff --git a/web-app/src/containers/ColorPickerAppAccentColor.tsx b/web-app/src/containers/ColorPickerAppAccentColor.tsx
deleted file mode 100644
index 1b38fc2f5..000000000
--- a/web-app/src/containers/ColorPickerAppAccentColor.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { useInterfaceSettings, isDefaultColorAccent } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { RgbaColor, RgbaColorPicker } from 'react-colorful'
-import { IconColorPicker } from '@tabler/icons-react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-
-export function ColorPickerAppAccentColor() {
- const { appAccentBgColor, setAppAccentBgColor } = useInterfaceSettings()
-
- const predefineAppAccentBgColor: RgbaColor[] = [
- {
- r: 45,
- g: 120,
- b: 220,
- a: 1,
- },
- {
- r: 220,
- g: 45,
- b: 120,
- a: 1,
- },
-
- {
- r: 180,
- g: 120,
- b: 45,
- a: 1,
- },
- ]
-
- return (
- <div className="flex items-center gap-1.5">
- {predefineAppAccentBgColor.map((item, i) => {
- const isSelected =
- (item.r === appAccentBgColor.r &&
- item.g === appAccentBgColor.g &&
- item.b === appAccentBgColor.b &&
- item.a === appAccentBgColor.a) ||
- (isDefaultColorAccent(appAccentBgColor) && isDefaultColorAccent(item))
- return (
- <div
- key={i}
- className={cn(
- 'size-4 rounded-full border border-main-view-fg/20',
- isSelected && 'ring-2 ring-accent border-none'
- )}
- onClick={() => {
- setAppAccentBgColor(item)
- }}
- style={{
- backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`,
- }}
- />
- )
- })}
-
- <div className="">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- title="Pick Color App Accent"
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10"
- >
- <IconColorPicker size={18} className="text-main-view-fg/50" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="border-none w-full h-full overflow-visible"
- side="right"
- align="start"
- style={{ zIndex: 9999 }}
- >
- <div>
- <RgbaColorPicker
- color={appAccentBgColor}
- onChange={(color) => {
- setAppAccentBgColor(color)
- }}
- />
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )
-}
diff --git a/web-app/src/containers/ColorPickerAppBgColor.tsx b/web-app/src/containers/ColorPickerAppBgColor.tsx
deleted file mode 100644
index a2001f05b..000000000
--- a/web-app/src/containers/ColorPickerAppBgColor.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { useInterfaceSettings, useBlurSupport } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { RgbaColor, RgbaColorPicker } from 'react-colorful'
-import { IconColorPicker } from '@tabler/icons-react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useTheme } from '@/hooks/useTheme'
-
-export function ColorPickerAppBgColor() {
- const { appBgColor, setAppBgColor } = useInterfaceSettings()
- const { isDark } = useTheme()
- const { t } = useTranslation()
- const showAlphaSlider = useBlurSupport()
-
- // Helper to get alpha value based on blur support
- const getAlpha = (defaultAlpha: number) => {
- return showAlphaSlider ? defaultAlpha : 1
- }
-
- const predefineAppBgColor: RgbaColor[] = [
- isDark
- ? {
- r: 25,
- g: 25,
- b: 25,
- a: getAlpha(0.4),
- }
- : {
- r: 255,
- g: 255,
- b: 255,
- a: getAlpha(0.4),
- },
- {
- r: 70,
- g: 79,
- b: 229,
- a: getAlpha(0.5),
- },
- {
- r: 238,
- g: 130,
- b: 238,
- a: getAlpha(0.5),
- },
-
- {
- r: 255,
- g: 99,
- b: 71,
- a: getAlpha(0.5),
- },
- {
- r: 255,
- g: 165,
- b: 0,
- a: getAlpha(0.5),
- },
- ]
-
- // Check if a color is the default color (considering both dark and light themes)
- const isColorDefault = (color: RgbaColor): boolean => {
- const isDarkDefault = color.r === 25 && color.g === 25 && color.b === 25
- const isLightDefault = color.r === 255 && color.g === 255 && color.b === 255
- // Accept both 0.4 and 1 as valid default alpha values (handles blur detection timing)
- const hasDefaultAlpha = Math.abs(color.a - 0.4) < 0.01 || Math.abs(color.a - 1) < 0.01
- return (isDarkDefault || isLightDefault) && hasDefaultAlpha
- }
-
- return (
- <div className="flex items-center gap-1.5">
- {predefineAppBgColor.map((item, i) => {
- const isSelected =
- (item.r === appBgColor.r &&
- item.g === appBgColor.g &&
- item.b === appBgColor.b &&
- Math.abs(item.a - appBgColor.a) < 0.01) ||
- (isColorDefault(appBgColor) && isColorDefault(item))
- return (
- <div
- key={i}
- className={cn(
- 'size-4 rounded-full border border-main-view-fg/20 cursor-pointer',
- isSelected && 'ring-2 ring-accent border-none'
- )}
- onClick={() => {
- setAppBgColor(item)
- }}
- style={{
- backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`,
- }}
- />
- )
- })}
-
- <div className="">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- title={t('common:pickColorWindowBackground')}
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10"
- >
- <IconColorPicker size={18} className="text-main-view-fg/50" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="border-none w-full h-full overflow-visible"
- side="right"
- align="start"
- >
- <RgbaColorPicker
- color={appBgColor}
- onChange={(color) => setAppBgColor(color)}
- />
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )
-}
diff --git a/web-app/src/containers/ColorPickerAppDestructiveColor.tsx b/web-app/src/containers/ColorPickerAppDestructiveColor.tsx
deleted file mode 100644
index 7b2fc0fd0..000000000
--- a/web-app/src/containers/ColorPickerAppDestructiveColor.tsx
+++ /dev/null
@@ -1,100 +0,0 @@
-import { useInterfaceSettings, isDefaultColorDestructive } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { RgbaColor, RgbaColorPicker } from 'react-colorful'
-import { IconColorPicker } from '@tabler/icons-react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import { useTheme } from '@/hooks/useTheme'
-
-export function ColorPickerAppDestructiveColor() {
- const { appDestructiveBgColor, setAppDestructiveBgColor } = useInterfaceSettings()
- const { isDark } = useTheme()
-
- const predefineAppDestructiveBgColor: RgbaColor[] = [
- isDark
- ? { r: 144, g: 60, b: 60, a: 1 }
- : {
- r: 217,
- g: 95,
- b: 95,
- a: 1,
- },
- {
- r: 220,
- g: 100,
- b: 45,
- a: 1,
- },
- {
- r: 180,
- g: 45,
- b: 120,
- a: 1,
- },
- {
- r: 150,
- g: 45,
- b: 180,
- a: 1,
- },
- ]
-
- return (
- <div className="flex items-center gap-1.5">
- {predefineAppDestructiveBgColor.map((item, i) => {
- const isSelected =
- (item.r === appDestructiveBgColor.r &&
- item.g === appDestructiveBgColor.g &&
- item.b === appDestructiveBgColor.b &&
- item.a === appDestructiveBgColor.a) ||
- (isDefaultColorDestructive(appDestructiveBgColor) && isDefaultColorDestructive(item))
- return (
- <div
- key={i}
- className={cn(
- 'size-4 rounded-full border border-main-view-fg/20',
- isSelected && 'ring-2 ring-accent border-none'
- )}
- onClick={() => {
- setAppDestructiveBgColor(item)
- }}
- style={{
- backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`,
- }}
- />
- )
- })}
-
- <div className="">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- title="Pick Color App Destructive"
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10"
- >
- <IconColorPicker size={18} className="text-main-view-fg/50" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="border-none w-full h-full overflow-visible"
- side="right"
- align="start"
- style={{ zIndex: 9999 }}
- >
- <div>
- <RgbaColorPicker
- color={appDestructiveBgColor}
- onChange={(color) => {
- setAppDestructiveBgColor(color)
- }}
- />
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )
-}
diff --git a/web-app/src/containers/ColorPickerAppMainView.tsx b/web-app/src/containers/ColorPickerAppMainView.tsx
deleted file mode 100644
index f90e7f114..000000000
--- a/web-app/src/containers/ColorPickerAppMainView.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { useInterfaceSettings, isDefaultColorMainView } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { RgbaColor, RgbaColorPicker } from 'react-colorful'
-import { IconColorPicker } from '@tabler/icons-react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import { useTheme } from '@/hooks/useTheme'
-
-export function ColorPickerAppMainView() {
- const { appMainViewBgColor, setAppMainViewBgColor } = useInterfaceSettings()
- const { isDark } = useTheme()
-
- const predefineAppMainViewBgColor: RgbaColor[] = [
- isDark
- ? {
- r: 25,
- g: 25,
- b: 25,
- a: 1,
- }
- : {
- r: 255,
- g: 255,
- b: 255,
- a: 1,
- },
- ]
-
- return (
- <div className="flex items-center gap-1.5">
- {predefineAppMainViewBgColor.map((item, i) => {
- const isSelected =
- (item.r === appMainViewBgColor.r &&
- item.g === appMainViewBgColor.g &&
- item.b === appMainViewBgColor.b &&
- item.a === appMainViewBgColor.a) ||
- (isDefaultColorMainView(appMainViewBgColor) && isDefaultColorMainView(item))
- return (
- <div
- key={i}
- className={cn(
- 'size-4 rounded-full border border-main-view-fg/20',
- isSelected && 'ring-2 ring-accent border-none'
- )}
- onClick={() => {
- setAppMainViewBgColor(item)
- }}
- style={{
- backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`,
- }}
- />
- )
- })}
-
- <div className="">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- title="Pick Color App Main View"
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10"
- >
- <IconColorPicker size={18} className="text-main-view-fg/50" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="border-none w-full h-full overflow-visible"
- side="right"
- align="start"
- >
- <RgbaColorPicker
- color={appMainViewBgColor}
- onChange={(color) => setAppMainViewBgColor(color)}
- />
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )
-}
diff --git a/web-app/src/containers/ColorPickerAppPrimaryColor.tsx b/web-app/src/containers/ColorPickerAppPrimaryColor.tsx
deleted file mode 100644
index db96c71cf..000000000
--- a/web-app/src/containers/ColorPickerAppPrimaryColor.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-import { useInterfaceSettings, isDefaultColorPrimary } from '@/hooks/useInterfaceSettings'
-import { cn } from '@/lib/utils'
-import { RgbaColor, RgbaColorPicker } from 'react-colorful'
-import { IconColorPicker } from '@tabler/icons-react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-
-export function ColorPickerAppPrimaryColor() {
- const { appPrimaryBgColor, setAppPrimaryBgColor } = useInterfaceSettings()
-
- const predefineappPrimaryBgColor: RgbaColor[] = [
- {
- r: 219,
- g: 88,
- b: 44,
- a: 1,
- },
- {
- r: 120,
- g: 44,
- b: 220,
- a: 1,
- },
- {
- r: 219,
- g: 167,
- b: 44,
- a: 1,
- },
- {
- r: 46,
- g: 158,
- b: 57,
- a: 1,
- },
- ]
-
- return (
- <div className="flex items-center gap-1.5">
- {predefineappPrimaryBgColor.map((item, i) => {
- const isSelected =
- (item.r === appPrimaryBgColor.r &&
- item.g === appPrimaryBgColor.g &&
- item.b === appPrimaryBgColor.b &&
- item.a === appPrimaryBgColor.a) ||
- (isDefaultColorPrimary(appPrimaryBgColor) && isDefaultColorPrimary(item))
- return (
- <div
- key={i}
- className={cn(
- 'size-4 rounded-full border border-main-view-fg/20',
- isSelected && 'ring-2 ring-accent border-none'
- )}
- onClick={() => {
- setAppPrimaryBgColor(item)
- }}
- style={{
- backgroundColor: `rgba(${item.r}, ${item.g}, ${item.b}, ${item.a})`,
- }}
- />
- )
- })}
-
- <div className="">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- title="Pick Color App Primary"
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10"
- >
- <IconColorPicker size={18} className="text-main-view-fg/50" />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- className="border-none w-full h-full overflow-visible"
- side="right"
- align="start"
- style={{ zIndex: 9999 }}
- >
- <div>
- <RgbaColorPicker
- color={appPrimaryBgColor}
- onChange={(color) => {
- setAppPrimaryBgColor(color)
- }}
- />
- </div>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )
-}
diff --git a/web-app/src/containers/DownloadButton.tsx b/web-app/src/containers/DownloadButton.tsx
index 01ca21a5c..9d5567737 100644
--- a/web-app/src/containers/DownloadButton.tsx
+++ b/web-app/src/containers/DownloadButton.tsx
@@ -129,26 +129,24 @@ export function DownloadButtonPlaceholder({
{isDownloading && !isDownloaded && (
<div className={cn('flex items-center gap-2 w-20')}>
<Progress value={downloadProgress * 100} />
- <span className="text-xs text-center text-main-view-fg/70">
+ <span className="text-xs text-center text-muted-foreground">
{Math.round(downloadProgress * 100)}%
</span>
</div>
)}
{isDownloaded ? (
<Button
- variant="link"
+ variant="default"
size="sm"
- className="p-0"
onClick={() => handleUseModel(modelId)}
data-test-id={`hub-model-${modelId}`}
>
- <div className="rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1">
- {t('hub:newChat')}
- </div>
+ {t('hub:newChat')}
</Button>
) : (
<Button
data-test-id={`hub-model-${modelId}`}
+ variant="outline"
size="sm"
onClick={handleDownload}
className={cn(isDownloading && 'hidden')}
diff --git a/web-app/src/containers/DownloadManegement.tsx b/web-app/src/containers/DownloadManegement.tsx
index 4b79ebd90..d261f9c33 100644
--- a/web-app/src/containers/DownloadManegement.tsx
+++ b/web-app/src/containers/DownloadManegement.tsx
@@ -364,14 +364,12 @@ export function DownloadManagement() {
<Popover open={isPopoverOpen} onOpenChange={setIsPopoverOpen}>
<PopoverTrigger asChild>
{isLeftPanelOpen ? (
- <div className="bg-left-panel-fg/10 hover:bg-left-panel-fg/12 p-2 rounded-md my-1 relative border border-left-panel-fg/10 cursor-pointer text-left">
- <div className="text-left-panel-fg/80 font-medium flex gap-2">
- <span>{t('downloads')}</span>
- <span>
- <div className="bg-primary font-bold size-5 rounded-full flex items-center justify-center text-primary-fg">
- {downloadCount}
- </div>
- </span>
+ <div className="p-2 rounded-md my-1 relative border cursor-pointer text-left">
+ <div className="font-studio font-medium flex gap-2 items-center justify-between">
+ <span className='text-sm'>{t('downloads')}</span>
+ <div className="bg-primary/50 font-bold size-4 rounded-full flex items-center justify-center text-xs">
+ <span>{downloadCount}</span>
+ </div>
</div>
<div className="mt-2 flex items-center justify-between space-x-2">
<Progress value={overallProgress * 100} />
@@ -381,14 +379,14 @@ export function DownloadManagement() {
</div>
</div>
) : (
- <div className="fixed bottom-4 left-4 z-50 size-10 bg-main-view border-2 border-main-view-fg/10 rounded-full shadow-md cursor-pointer flex items-center justify-center">
+ <div className="fixed bottom-4 left-4 z-50 size-10 border-2 rounded-full shadow-md cursor-pointer flex items-center justify-center">
<div className="relative">
<IconDownload
- className="text-main-view-fg/50 -mt-1"
+ className="text-muted-foreground -mt-1"
size={20}
/>
- <div className="bg-primary font-bold size-5 rounded-full absolute -top-4 -right-4 flex items-center justify-center text-primary-fg">
- {downloadCount}
+ <div className="bg-primary font-bold size-5 rounded-full absolute -top-4 -right-4 flex items-center justify-center text-xs">
+ <span>{downloadCount}</span>
</div>
</div>
</div>
@@ -403,16 +401,16 @@ export function DownloadManagement() {
onFocusOutside={(e) => e.preventDefault}
>
<div className="flex flex-col">
- <div className="p-2 py-1.5 bg-main-view-fg/5 border-b border-main-view-fg/6">
- <p className="text-xs text-main-view-fg/70">
+ <div className="px-3 py-2 border-b">
+ <p>
{t('downloading')}
</p>
</div>
<div className="p-2 max-h-[300px] overflow-y-auto space-y-2">
{appUpdateState.isDownloading && (
- <div className="bg-main-view-fg/4 rounded-md p-2">
+ <div className="rounded-md p-2">
<div className="flex items-center justify-between">
- <p className="truncate text-main-view-fg/80">
+ <p className="truncate">
App Update
</p>
</div>
@@ -420,7 +418,7 @@ export function DownloadManagement() {
value={appUpdateState.downloadProgress * 100}
className="my-2"
/>
- <p className="text-main-view-fg/60 text-xs">
+ <p className="text-muted-foreground text-xs">
{`${renderGB(appUpdateState.downloadedBytes)} / ${renderGB(appUpdateState.totalBytes)}`}{' '}
GB ({Math.round(appUpdateState.downloadProgress * 100)}
%)
@@ -430,16 +428,16 @@ export function DownloadManagement() {
{downloadProcesses.map((download) => (
<div
key={download.id}
- className="bg-main-view-fg/4 rounded-md p-2"
+ className="rounded-md p-2"
>
<div className="flex items-center justify-between">
- <p className="truncate text-main-view-fg/80">
+ <p className="truncate">
{download.name}
</p>
<div className="shrink-0 flex items-center space-x-0.5">
<IconX
size={16}
- className="text-main-view-fg/70 cursor-pointer"
+ className="text-muted-foreground cursor-pointer"
title="Cancel download"
onClick={() => {
// TODO: Consolidate cancellation logic
@@ -477,7 +475,7 @@ export function DownloadManagement() {
value={download.progress * 100}
className="my-2"
/>
- <p className="text-main-view-fg/60 text-xs">
+ <p className="text-muted-foreground text-xs">
{download.total > 0
? `${renderGB(download.current)} / ${renderGB(download.total)} GB (${Math.round(download.progress * 100)}%)`
: 'Initializing download...'}
diff --git a/web-app/src/containers/DropdownAssistant.tsx b/web-app/src/containers/DropdownAssistant.tsx
deleted file mode 100644
index 41fdb3531..000000000
--- a/web-app/src/containers/DropdownAssistant.tsx
+++ /dev/null
@@ -1,158 +0,0 @@
-import { useState } from 'react'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-import { useAssistant } from '@/hooks/useAssistant'
-import AddEditAssistant from './dialogs/AddEditAssistant'
-import { IconCirclePlus, IconSettings } from '@tabler/icons-react'
-import { useThreads } from '@/hooks/useThreads'
-import { AvatarEmoji } from '@/containers/AvatarEmoji'
-
-const DropdownAssistant = () => {
- const {
- assistants,
- currentAssistant,
- addAssistant,
- updateAssistant,
- setCurrentAssistant,
- } = useAssistant()
- const updateCurrentThreadAssistant = useThreads(
- (state) => state.updateCurrentThreadAssistant
- )
- const [dropdownOpen, setDropdownOpen] = useState(false)
- const [dialogOpen, setDialogOpen] = useState(false)
- const [editingAssistantId, setEditingAssistantId] = useState<string | null>(
- null
- )
-
- const selectedAssistant =
- assistants.find((a) => a.id === currentAssistant?.id) || assistants[0]
-
- return (
- <>
- <DropdownMenu open={dropdownOpen} onOpenChange={setDropdownOpen}>
- <div className="inline-flex items-center justify-between gap-2 bg-main-view-fg/5 py-1 hover:bg-main-view-fg/8 px-2 rounded-sm">
- <DropdownMenuTrigger asChild>
- <button className="font-medium cursor-pointer flex items-center gap-1.5 relative z-20 max-w-40">
- <div className="text-main-view-fg/80 flex items-center gap-1">
- {selectedAssistant?.avatar && (
- <span className="shrink-0 w-4 h-4 relative flex items-center justify-center">
- <AvatarEmoji
- avatar={selectedAssistant.avatar}
- imageClassName="object-cover"
- textClassName="text-sm"
- />
- </span>
- )}
- <div className="truncate max-w-30">
- <span>{selectedAssistant?.name || 'Jan'}</span>
- </div>
- </div>
- </button>
- </DropdownMenuTrigger>
- <div
- className="size-5 cursor-pointer relative z-10 flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out "
- onClick={() => {
- if (selectedAssistant) {
- setEditingAssistantId(selectedAssistant.id)
- setDialogOpen(true)
- }
- }}
- >
- <IconSettings
- size={16}
- className="text-main-view-fg/50"
- title="Edit Assistant"
- />
- </div>
- </div>
- <DropdownMenuContent
- className="w-44 max-h-[320px]"
- side="bottom"
- sideOffset={10}
- align="start"
- >
- {assistants.map((assistant) => (
- <div
- className="relative pr-6 hover:bg-main-view-fg/4 rounded-sm"
- key={assistant.id}
- >
- <DropdownMenuItem
- className="hover:bg-transparent"
- onClick={() => {
- setCurrentAssistant(assistant)
- updateCurrentThreadAssistant(assistant)
- }}
- >
- <div className="text-main-view-fg/70 cursor-pointer flex gap-2 w-full">
- {assistant?.avatar && (
- <div className="shrink-0 relative w-4 h-4">
- <AvatarEmoji
- avatar={assistant?.avatar}
- imageClassName="object-cover"
- textClassName=""
- />
- </div>
- )}
-
- <div className="text-left">
- <span className="line-clamp-1">{assistant.name}</span>
- </div>
- </div>
- </DropdownMenuItem>
- <div className="absolute top-1/2 -translate-y-1/2 right-1">
- <div className="size-5 text-main-view-fg/50 cursor-pointer relative z-10 flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconSettings
- size={16}
- onClick={() => {
- setEditingAssistantId(assistant.id)
- setDialogOpen(true)
- }}
- />
- </div>
- </div>
- </div>
- ))}
-
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={() => {
- setEditingAssistantId(null)
- setDialogOpen(true)
- }}
- >
- <IconCirclePlus />
- <span className="truncate text-main-view-fg/70">
- Create Assistant
- </span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- <AddEditAssistant
- open={dialogOpen}
- onOpenChange={setDialogOpen}
- editingKey={editingAssistantId}
- initialData={
- editingAssistantId
- ? assistants.find((a) => a.id === editingAssistantId)
- : undefined
- }
- onSave={(assistant) => {
- if (editingAssistantId) {
- updateAssistant(assistant)
- } else {
- addAssistant(assistant)
- }
- setEditingAssistantId(null)
- setDialogOpen(false)
- }}
- />
- </>
- )
-}
-
-export default DropdownAssistant
diff --git a/web-app/src/containers/DropdownModelProvider.tsx b/web-app/src/containers/DropdownModelProvider.tsx
index 33116ee7a..207e9f248 100644
--- a/web-app/src/containers/DropdownModelProvider.tsx
+++ b/web-app/src/containers/DropdownModelProvider.tsx
@@ -23,6 +23,7 @@ import { useFavoriteModel } from '@/hooks/useFavoriteModel'
import { predefinedProviders } from '@/constants/providers'
import { useServiceHub } from '@/hooks/useServiceHub'
import { getLastUsedModel } from '@/utils/getModelToStart'
+import { ChevronsUpDown } from 'lucide-react'
type DropdownModelProviderProps = {
model?: ThreadModel
@@ -432,7 +433,7 @@ const DropdownModelProvider = ({
return (
<Popover open={open} onOpenChange={onOpenChange}>
- <div className="bg-main-view-fg/5 hover:bg-main-view-fg/8 px-2 py-1 flex items-center gap-1.5 rounded-sm">
+ <div className="border px-4 py-1.5 flex items-center gap-1.5 rounded-full">
<PopoverTrigger asChild>
<button
type="button"
@@ -445,12 +446,13 @@ const DropdownModelProvider = ({
)}
<span
className={cn(
- 'text-main-view-fg/80 truncate leading-normal',
- !selectedModel?.id && 'text-main-view-fg/50'
+ 'text-foreground truncate leading-normal',
+ !selectedModel?.id && 'text-muted-foreground'
)}
>
{displayModel}
</span>
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground" />
</button>
</PopoverTrigger>
{currentModel?.settings &&
@@ -459,31 +461,30 @@ const DropdownModelProvider = ({
<ModelSetting
model={currentModel as Model}
provider={provider}
- smallIcon
/>
)}
<ModelSupportStatus
modelId={selectedModel?.id}
provider={selectedProvider}
contextSize={getContextSize()}
- className="ml-0.5 flex-shrink-0"
+ className="ml-0.5 shrink-0"
/>
</div>
<PopoverContent
className={cn(
- 'w-60 p-0 backdrop-blur-2xl',
- searchValue.length === 0 && 'h-[320px]'
+ 'w-70 p-0 backdrop-blur-2xl bg-background/95 border',
+ searchValue.length === 0 && 'h-80'
)}
align="start"
- sideOffset={10}
- alignOffset={-8}
- side={searchValue.length === 0 ? undefined : 'top'}
+ sideOffset={16}
+ alignOffset={-10}
+ side="bottom"
avoidCollisions={searchValue.length === 0 ? true : false}
>
- <div className="flex flex-col w-full h-full">
+ <div className="flex flex-col size-full">
{/* Search input */}
- <div className="relative px-2 py-1.5 border-b border-main-view-fg/10 backdrop-blur-4xl">
+ <div className="relative p-2 border-b">
<input
ref={searchInputRef}
value={searchValue}
@@ -495,7 +496,7 @@ const DropdownModelProvider = ({
<div className="absolute right-2 top-0 bottom-0 flex items-center justify-center">
<IconX
size={16}
- className="text-main-view-fg/50 hover:text-main-view-fg cursor-pointer"
+ className="text-muted-foreground cursor-pointer"
onClick={onClearSearch}
/>
</div>
@@ -503,19 +504,19 @@ const DropdownModelProvider = ({
</div>
{/* Model list */}
- <div className="max-h-[320px] overflow-y-auto">
+ <div className="max-h-80 overflow-y-auto">
{Object.keys(groupedItems).length === 0 && searchValue ? (
- <div className="py-3 px-4 text-sm text-main-view-fg/60">
+ <div className="py-3 px-4 text-sm ">
{t('common:noModelsFoundFor', { searchValue })}
</div>
) : (
<div className="py-1">
{/* Favorites section - only show when not searching */}
{!searchValue && favoriteItems.length > 0 && (
- <div className="bg-main-view-fg/2 backdrop-blur-2xl rounded-sm my-1.5 mx-1.5">
+ <div className="bg-secondary/30 rounded-sm m-2 py-1">
{/* Favorites header */}
<div className="flex items-center gap-1.5 px-2 py-1">
- <span className="text-sm font-medium text-main-view-fg/80">
+ <span className="text-sm font-medium text-muted-foreground">
{t('common:favorites')}
</span>
</div>
@@ -535,9 +536,9 @@ const DropdownModelProvider = ({
onClick={() => handleSelect(searchableModel)}
className={cn(
'mx-1 mb-1 px-2 py-1.5 rounded-sm cursor-pointer flex items-center gap-2 transition-all duration-200',
- 'hover:bg-main-view-fg/4',
+ 'hover:bg-secondary/40',
isSelected &&
- 'bg-main-view-fg/8 hover:bg-main-view-fg/8'
+ 'bg-secondary/50'
)}
>
<div className="flex items-center gap-1 flex-1 min-w-0">
@@ -546,12 +547,12 @@ const DropdownModelProvider = ({
provider={searchableModel.provider}
/>
</div>
- <span className="text-main-view-fg/80 text-sm">
+ <span className="text-sm">
{getModelDisplayName(searchableModel.model)}
</span>
<div className="flex-1"></div>
{capabilities.length > 0 && (
- <div className="flex-shrink-0 -mr-1.5">
+ <div className="shrink-0 -mr-1.5">
<Capabilities capabilities={capabilities} />
</div>
)}
@@ -564,7 +565,7 @@ const DropdownModelProvider = ({
{/* Divider between favorites and regular providers */}
{favoriteItems.length > 0 && (
- <div className="border-b border-1 border-main-view-fg/8 mx-2"></div>
+ <div className="border-b mx-2"></div>
)}
{/* Regular provider sections */}
@@ -578,19 +579,19 @@ const DropdownModelProvider = ({
return (
<div
key={providerKey}
- className="bg-main-view-fg/2 backdrop-blur-2xl first:mt-0 rounded-sm my-1.5 mx-1.5 first:mb-0"
+ className="bg-secondary/30 first:mt-0 rounded-sm my-1.5 mx-1.5 first:mb-0 py-1"
>
{/* Provider header */}
<div className="flex items-center justify-between px-2 py-1">
<div className="flex items-center gap-1.5">
<ProvidersAvatar provider={providerInfo} />
- <span className="capitalize text-sm font-medium text-main-view-fg/80">
+ <span className="capitalize text-sm font-medium text-muted-foreground">
{getProviderTitle(providerInfo.provider)}
</span>
</div>
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded-sm bg-secondary-foreground/8 transition-all duration-200 ease-in-out"
onClick={(e) => {
e.stopPropagation()
navigate({
@@ -602,7 +603,7 @@ const DropdownModelProvider = ({
>
<IconSettings
size={16}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
/>
</div>
</div>
@@ -627,21 +628,21 @@ const DropdownModelProvider = ({
onClick={() => handleSelect(searchableModel)}
className={cn(
'mx-1 mb-1 px-2 py-1.5 rounded-sm cursor-pointer flex items-center gap-2 transition-all duration-200',
- 'hover:bg-main-view-fg/4',
+ 'hover:bg-secondary/40',
isSelected &&
- 'bg-main-view-fg/8 hover:bg-main-view-fg/8'
+ 'bg-secondary/60 hover:bg-secondary/60'
)}
>
<div className="flex items-center gap-2 flex-1 min-w-0">
<span
- className="text-main-view-fg/80 text-sm"
+ className="text-sm truncate"
title={searchableModel.model.id}
>
{getModelDisplayName(searchableModel.model)}
</span>
<div className="flex-1"></div>
{capabilities.length > 0 && (
- <div className="flex-shrink-0 -mr-1.5">
+ <div className="shrink-0 -mr-1.5">
<Capabilities capabilities={capabilities} />
</div>
)}
diff --git a/web-app/src/containers/DropdownToolsAvailable.tsx b/web-app/src/containers/DropdownToolsAvailable.tsx
index fc38bd667..0bee79dca 100644
--- a/web-app/src/containers/DropdownToolsAvailable.tsx
+++ b/web-app/src/containers/DropdownToolsAvailable.tsx
@@ -160,7 +160,7 @@ export default function DropdownToolsAvailable({
<DropDrawerContent
side="top"
align="start"
- className="bg-main-view !overflow-hidden"
+ className="overflow-hidden!"
onClick={(e) => e.stopPropagation()}
>
<DropDrawerLabel className="flex items-center gap-2 sticky -top-1 z-10 px-4 pl-2 py-1">
@@ -173,14 +173,13 @@ export default function DropdownToolsAvailable({
<DropDrawerSub
id={`server-${serverName}`}
key={serverName}
- title={serverName}
>
- <DropDrawerSubTrigger className="py-2 hover:bg-main-view-fg/5 hover:backdrop-blur-2xl rounded-sm px-2 mx-auto w-full">
+ <DropDrawerSubTrigger className="py-2 hover:backdrop-blur-2xl rounded-sm px-2 mx-auto w-full">
<div className="flex items-center justify-between w-full">
- <span className="text-sm text-main-view-fg/80">
+ <span className="text-sm">
{serverName}
</span>
- <span className="text-xs text-main-view-fg/50 inline-flex items-center mr-1 border border-main-view-fg/20 px-1 rounded-sm">
+ <span className="text-xs text-muted-foreground inline-flex items-center mr-1 border px-1 rounded-sm">
{
serverTools.filter((tool) => isToolChecked(tool.server, tool.name))
.length
@@ -191,8 +190,8 @@ export default function DropdownToolsAvailable({
<DropDrawerSubContent className="max-w-64 max-h-70 w-full overflow-hidden">
<DropDrawerGroup>
{serverTools.length > 1 && (
- <div className="sticky top-0 z-10 bg-main-view border-b border-main-view-fg/10 px-4 md:px-2 pr-2 py-1.5 flex items-center justify-between">
- <span className="text-xs font-medium text-main-view-fg/70">
+ <div className="sticky top-0 z-10 border-b px-4 md:px-2 pr-2 py-1.5 flex items-center justify-between">
+ <span className="text-xs font-medium">
All Tools
</span>
<div
@@ -212,7 +211,7 @@ export default function DropdownToolsAvailable({
</div>
</div>
)}
- <div className="max-h-56 overflow-y-auto">
+ <div className="max-h-56 overflow-y-auto p-1">
{serverTools.map((tool) => {
const isChecked = isToolChecked(tool.server, tool.name)
return (
@@ -242,7 +241,7 @@ export default function DropdownToolsAvailable({
>
<div className="overflow-hidden flex flex-col items-start w-full">
<span
- className="text-sm font-medium text-main-view-fg truncate block w-full"
+ className="text-sm font-medium truncate block w-full"
title={tool.name}
>
{tool.name}
@@ -250,7 +249,7 @@ export default function DropdownToolsAvailable({
{tool.description && (
<p
- className="text-xs text-main-view-fg/70 mt-1 line-clamp-1"
+ className="text-xs text-muted-foreground mt-1 line-clamp-1"
title={tool.description}
>
{tool.description}
diff --git a/web-app/src/containers/FavoriteModelAction.tsx b/web-app/src/containers/FavoriteModelAction.tsx
index 7daa5267f..e8eb47f10 100644
--- a/web-app/src/containers/FavoriteModelAction.tsx
+++ b/web-app/src/containers/FavoriteModelAction.tsx
@@ -1,5 +1,6 @@
import { IconStar, IconStarFilled } from '@tabler/icons-react'
import { useFavoriteModel } from '@/hooks/useFavoriteModel'
+import { Button } from '@/components/ui/button'
interface FavoriteModelActionProps {
model: Model
@@ -10,16 +11,17 @@ export function FavoriteModelAction({ model }: FavoriteModelActionProps) {
const isModelFavorite = isFavorite(model.id)
return (
- <div
- aria-label="Toggle favorite"
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ <Button
+ aria-label="Toggle favorite"
+ variant="ghost"
+ size="icon-xs"
onClick={() => toggleFavorite(model)}
>
{isModelFavorite ? (
- <IconStarFilled size={18} className="text-main-view-fg" />
+ <IconStarFilled size={18} className="text-muted-foreground" />
) : (
- <IconStar size={18} className="text-main-view-fg/50" />
+ <IconStar size={18} className="text-muted-foreground" />
)}
- </div>
+ </Button>
)
}
diff --git a/web-app/src/containers/FontSizeSwitcher.tsx b/web-app/src/containers/FontSizeSwitcher.tsx
index d347d0235..986e3e2c3 100644
--- a/web-app/src/containers/FontSizeSwitcher.tsx
+++ b/web-app/src/containers/FontSizeSwitcher.tsx
@@ -7,6 +7,8 @@
import { fontSizeOptions, useInterfaceSettings } from '@/hooks/useInterfaceSettings'
import { cn } from '@/lib/utils'
import { useTranslation } from '@/i18n/react-i18next-compat'
+import { Button } from '@/components/ui/button'
+import { ChevronsUpDown } from 'lucide-react'
export function FontSizeSwitcher() {
const { fontSize, setFontSize } = useInterfaceSettings()
@@ -15,22 +17,20 @@ export function FontSizeSwitcher() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <span
- title={t('common:adjustFontSize')}
- className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm bg-main-view-fg/15 text-sm outline-none text-main-view-fg font-medium"
- >
+ <Button variant="outline" size="sm" className="w-full justify-between" title={t('common:adjustFontSize')}>
{fontSizeOptions.find(
(item: { value: string; label: string }) => item.value === fontSize
)?.label || t('common:medium')}
- </span>
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground ml-2" />
+ </Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-24">
+ <DropdownMenuContent align="end">
{fontSizeOptions.map((item: { value: string; label: string }) => (
<DropdownMenuItem
key={item.value}
className={cn(
'cursor-pointer my-0.5',
- fontSize === item.value && 'bg-main-view-fg/5'
+ fontSize === item.value && 'bg-secondary-foreground/8'
)}
onClick={() => setFontSize(item.value as FontSize)}
>
diff --git a/web-app/src/containers/GlobalError.tsx b/web-app/src/containers/GlobalError.tsx
index 3d2228826..5e651c5d6 100644
--- a/web-app/src/containers/GlobalError.tsx
+++ b/web-app/src/containers/GlobalError.tsx
@@ -49,7 +49,7 @@ export default function GlobalError({ error }: GlobalErrorProps) {
or <br /> feel free to{' '}
<a
rel="noopener noreferrer"
- className="!text-accent hover:underline"
+ className="text-accent! hover:underline"
href="https://discord.gg/FTk2MvZwJH"
target="_blank"
>
@@ -58,7 +58,7 @@ export default function GlobalError({ error }: GlobalErrorProps) {
if the problem persists.
</p>
<div
- className="mt-5 w-full md:w-4/5 mx-auto rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700 "
+ className="mt-5 w-full md:w-4/5 xl:w-4/6 mx-auto rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700 "
role="alert"
>
<strong className="font-bold">Error: </strong>
diff --git a/web-app/src/containers/HeaderPage.tsx b/web-app/src/containers/HeaderPage.tsx
index 2c48a84dd..30ee6f3ff 100644
--- a/web-app/src/containers/HeaderPage.tsx
+++ b/web-app/src/containers/HeaderPage.tsx
@@ -1,57 +1,46 @@
import { useLeftPanel } from '@/hooks/useLeftPanel'
import { cn } from '@/lib/utils'
-import { useMobileScreen, useSmallScreen } from '@/hooks/useMediaQuery'
import {
IconLayoutSidebar,
} from '@tabler/icons-react'
import { ReactNode } from 'react'
+import { Button } from "@/components/ui/button"
type HeaderPageProps = {
children?: ReactNode
}
const HeaderPage = ({ children }: HeaderPageProps) => {
const { open, setLeftPanel } = useLeftPanel()
- const isMobile = useMobileScreen()
- const isSmallScreen = useSmallScreen()
return (
<div
className={cn(
- 'h-10 text-main-view-fg flex items-center shrink-0 border-b border-main-view-fg/5',
- // Mobile-first responsive padding
- isMobile ? 'px-3' : 'px-4',
- // macOS-specific padding when panel is closed
- (IS_MACOS && isSmallScreen) || (IS_MACOS && !open) ? 'pl-20' : '',
+ 'h-15 flex items-center shrink-0',
+ (IS_MACOS && !open) ? 'pl-22' : ' pl-4',
children === undefined && 'border-none'
)}
>
<div
className={cn(
- 'flex items-center w-full',
- // Adjust gap based on screen size
- isMobile ? 'gap-2' : 'gap-3'
+ 'flex items-center w-full gap-2',
)}
>
{!open && (
- <button
- className={cn(
- 'cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10',
- // Larger touch target on mobile
- isMobile ? 'size-8 min-w-8' : 'size-5'
- )}
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ className='rounded-full'
onClick={() => setLeftPanel(!open)}
aria-label="Toggle sidebar"
>
<IconLayoutSidebar
- size={18}
- className="text-main-view-fg relative z-20"
+ className="text-muted-foreground relative size-4.5"
/>
- </button>
+ </Button>
)}
<div
className={cn(
- 'flex-1 min-w-0', // Allow content to shrink on small screens
- isMobile && 'overflow-hidden'
+ 'flex-1 min-w-0'
)}
>
{children}
diff --git a/web-app/src/containers/LanguageSwitcher.tsx b/web-app/src/containers/LanguageSwitcher.tsx
index 05c8d539d..5c244ac8a 100644
--- a/web-app/src/containers/LanguageSwitcher.tsx
+++ b/web-app/src/containers/LanguageSwitcher.tsx
@@ -7,6 +7,8 @@ import {
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu'
import { cn } from '@/lib/utils'
+import { Button } from '@/components/ui/button'
+import { ChevronsUpDown } from 'lucide-react'
const LANGUAGES = [
{ value: 'en', label: 'English' },
@@ -35,23 +37,21 @@ export default function LanguageSwitcher() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <span
- title={t('common:changeLanguage')}
- className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm bg-main-view-fg/15 text-sm outline-none text-main-view-fg font-medium"
- >
+ <Button variant="outline" size="sm" className="w-full justify-between">
{LANGUAGES.find(
(lang: { value: string; label: string }) =>
lang.value === currentLanguage
)?.label || t('common:english')}
- </span>
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground ml-2" />
+ </Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-24">
+ <DropdownMenuContent align="end" className="w-40">
{LANGUAGES.map((lang) => (
<DropdownMenuItem
key={lang.value}
className={cn(
'cursor-pointer my-0.5',
- currentLanguage === lang.value && 'bg-main-view-fg/5'
+ currentLanguage === lang.value && 'bg-secondary-foreground/8'
)}
onClick={() => changeLanguage(lang.value)}
>
diff --git a/web-app/src/containers/LeftPanel.tsx b/web-app/src/containers/LeftPanel.tsx
deleted file mode 100644
index aec8998ec..000000000
--- a/web-app/src/containers/LeftPanel.tsx
+++ /dev/null
@@ -1,582 +0,0 @@
-import { Link, useRouterState, useNavigate } from '@tanstack/react-router'
-import { useLeftPanel } from '@/hooks/useLeftPanel'
-import { cn } from '@/lib/utils'
-import {
- IconLayoutSidebar,
- IconDots,
- IconCirclePlus,
- IconSettings,
- IconStar,
- IconFolderPlus,
- IconApps,
- IconSearch,
- IconFolder,
- IconPencil,
- IconTrash,
-} from '@tabler/icons-react'
-import { route } from '@/constants/routes'
-import ThreadList from './ThreadList'
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu'
-
-import { useThreads } from '@/hooks/useThreads'
-import { useThreadManagement } from '@/hooks/useThreadManagement'
-
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useMemo, useState, useEffect, useRef } from 'react'
-import { toast } from 'sonner'
-import { DownloadManagement } from '@/containers/DownloadManegement'
-import { useSmallScreen } from '@/hooks/useMediaQuery'
-import { useClickOutside } from '@/hooks/useClickOutside'
-
-import { DeleteAllThreadsDialog, SearchDialog } from '@/containers/dialogs'
-import AddProjectDialog from '@/containers/dialogs/AddProjectDialog'
-import { DeleteProjectDialog } from '@/containers/dialogs/DeleteProjectDialog'
-
-const mainMenus = [
- {
- title: 'common:newChat',
- icon: IconCirclePlus,
- route: route.home,
- isEnabled: true,
- },
- {
- title: 'common:projects.title',
- icon: IconFolderPlus,
- route: route.project,
- isEnabled: true,
- },
-]
-
-const secondaryMenus = [
- {
- title: 'common:hub',
- icon: IconApps,
- route: route.hub.index,
- isEnabled: true,
- },
- {
- title: 'common:settings',
- icon: IconSettings,
- route: route.settings.general,
- isEnabled: true,
- },
-]
-
-const LeftPanel = () => {
- const open = useLeftPanel((state) => state.open)
- const setLeftPanel = useLeftPanel((state) => state.setLeftPanel)
- const { t } = useTranslation()
- const navigate = useNavigate()
- const [searchDialogOpen, setSearchDialogOpen] = useState(false)
-
- const isSmallScreen = useSmallScreen()
- const prevScreenSizeRef = useRef<boolean | null>(null)
- const isInitialMountRef = useRef(true)
- const panelRef = useRef<HTMLElement>(null)
-
- // Determine if we're in a resizable context (large screen with panel open)
- const isResizableContext = !isSmallScreen && open
-
- // Use click outside hook for panel with debugging
- useClickOutside(
- () => {
- if (isSmallScreen && open) {
- setLeftPanel(false)
- }
- },
- null,
- [panelRef.current]
- )
-
- // Auto-collapse panel only when window is resized
- useEffect(() => {
- const handleResize = () => {
- const currentIsSmallScreen = window.innerWidth <= 768
-
- // Skip on initial mount
- if (isInitialMountRef.current) {
- isInitialMountRef.current = false
- prevScreenSizeRef.current = currentIsSmallScreen
- return
- }
-
- // Only trigger if the screen size actually changed
- if (
- prevScreenSizeRef.current !== null &&
- prevScreenSizeRef.current !== currentIsSmallScreen
- ) {
- if (currentIsSmallScreen && open) {
- setLeftPanel(false)
- } else if (!open) {
- setLeftPanel(true)
- }
- prevScreenSizeRef.current = currentIsSmallScreen
- }
- }
-
- // Add resize listener
- window.addEventListener('resize', handleResize)
-
- // Initialize the previous screen size on mount
- if (isInitialMountRef.current) {
- prevScreenSizeRef.current = window.innerWidth <= 768
- isInitialMountRef.current = false
- }
-
- return () => {
- window.removeEventListener('resize', handleResize)
- }
- }, [setLeftPanel, open])
-
- const currentPath = useRouterState({
- select: (state) => state.location.pathname,
- })
-
- const deleteAllThreads = useThreads((state) => state.deleteAllThreads)
- const unstarAllThreads = useThreads((state) => state.unstarAllThreads)
- const getFilteredThreads = useThreads((state) => state.getFilteredThreads)
- const threads = useThreads((state) => state.threads)
-
- const { folders, addFolder, updateFolder, getFolderById } =
- useThreadManagement()
-
- // Project dialog states
- const [projectDialogOpen, setProjectDialogOpen] = useState(false)
- const [editingProjectKey, setEditingProjectKey] = useState<string | null>(
- null
- )
- const [deleteProjectConfirmOpen, setDeleteProjectConfirmOpen] =
- useState(false)
- const [deletingProjectId, setDeletingProjectId] = useState<string | null>(
- null
- )
-
- const allThreads = useMemo(() => {
- return getFilteredThreads('')
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [getFilteredThreads, threads])
-
- // Memoize categorized threads based on allThreads
- const favoritedThreads = useMemo(() => {
- return allThreads.filter((t: Thread) => t.isFavorite)
- }, [allThreads])
-
- const unFavoritedThreads = useMemo(() => {
- return allThreads.filter(
- (t: Thread) => !t.isFavorite && !t.metadata?.project
- )
- }, [allThreads])
-
- // Project handlers
- const handleProjectDelete = (id: string) => {
- setDeletingProjectId(id)
- setDeleteProjectConfirmOpen(true)
- }
-
- const handleProjectDeleteClose = () => {
- setDeleteProjectConfirmOpen(false)
- setDeletingProjectId(null)
- }
-
- const handleProjectSave = async (name: string) => {
- if (editingProjectKey) {
- await updateFolder(editingProjectKey, name)
- } else {
- const newProject = await addFolder(name)
- // Navigate to the newly created project
- navigate({
- to: '/project/$projectId',
- params: { projectId: newProject.id },
- })
- }
- setProjectDialogOpen(false)
- setEditingProjectKey(null)
- }
-
- // Disable body scroll when panel is open on small screens
- useEffect(() => {
- if (isSmallScreen && open) {
- document.body.style.overflow = 'hidden'
- } else {
- document.body.style.overflow = ''
- }
-
- return () => {
- document.body.style.overflow = ''
- }
- }, [isSmallScreen, open])
-
- return (
- <>
- {/* Backdrop overlay for small screens */}
- {isSmallScreen && open && !IS_IOS && !IS_ANDROID && (
- <div
- className="fixed inset-0 bg-black/50 backdrop-blur z-30"
- onClick={() => setLeftPanel(false)}
- />
- )}
- <aside
- ref={panelRef}
- className={cn(
- 'text-left-panel-fg overflow-hidden relative',
- // Resizable context: full height and width, no margins
- isResizableContext && 'h-full w-full',
- // Small screen context: fixed positioning and styling
- isSmallScreen &&
- 'fixed h-full pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))] bg-main-view z-50 md:border border-left-panel-fg/10 px-1 w-full md:w-48',
- // Default context: original styling
- !isResizableContext &&
- !isSmallScreen &&
- 'w-48 shrink-0 rounded-lg m-1.5 mr-0',
- // Visibility controls
- open
- ? 'opacity-100 visibility-visible'
- : 'w-0 absolute -top-100 -left-100 visibility-hidden'
- )}
- >
- {IS_MACOS ?
- <div className="relative h-10">
- <button
- className={cn(
- 'absolute top-1/2 -translate-y-1/2 z-20 right-0',
- (isSmallScreen) || (!open)
- ? 'pl-20 right-auto'
- : ''
- )}
- onClick={() => setLeftPanel(!open)}
- >
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-left-panel-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-left-panel-fg/10">
- <IconLayoutSidebar size={18} className="text-left-panel-fg" />
- </div>
- </button>
- </div>
- :
- <div className="absolute right-0 z-40 top-1.5">
- <button
- onClick={() => setLeftPanel(!open)}
- >
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-left-panel-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-left-panel-fg/10">
- <IconLayoutSidebar size={18} className="text-left-panel-fg" />
- </div>
- </button>
- </div>
- }
-
- <div className={cn("flex flex-col gap-y-1 overflow-hidden mt-0", IS_MACOS ? "h-[calc(100%-42px)]!" : "h-full")}>
- <div className="space-y-1 py-1">
- {/* Search button */}
- <button
- onClick={() => setSearchDialogOpen(true)}
- className="flex items-center gap-1.5 cursor-pointer hover:bg-left-panel-fg/10 py-1 px-1 rounded w-full"
- >
- <IconSearch size={18} className="text-left-panel-fg/70" />
- <span className="font-medium text-left-panel-fg/90">
- {t('common:search')}
- </span>
- </button>
-
- {mainMenus.map((menu) => {
- if (!menu.isEnabled) {
- return null
- }
-
- // Regular menu items must have route and icon
- if (!menu.route || !menu.icon) return null
-
- const isActive = (() => {
- // Settings routes
- if (menu.route.includes(route.settings.index)) {
- return currentPath.includes(route.settings.index)
- }
-
- // Default exact match for other routes
- return currentPath === menu.route
- })()
- return (
- <Link
- key={menu.title}
- to={menu.route}
- onClick={() => isSmallScreen && setLeftPanel(false)}
- data-test-id={`menu-${menu.title}`}
- activeOptions={{ exact: true }}
- className={cn(
- 'flex items-center gap-1.5 cursor-pointer hover:bg-left-panel-fg/10 py-1 px-1 rounded',
- isActive && 'bg-left-panel-fg/10'
- )}
- >
- <menu.icon size={18} className="text-left-panel-fg/70" />
- <span className="font-medium text-left-panel-fg/90">
- {t(menu.title)}
- </span>
- </Link>
- )
- })}
- </div>
-
- {folders.length > 0 && !(IS_IOS || IS_ANDROID) && (
- <div className="space-y-1 py-1 flex flex-col">
- <div className="flex items-center justify-between mb-2">
- <span className="block text-xs text-left-panel-fg/50 px-1 font-semibold">
- {t('common:projects.title')}
- </span>
- </div>
- <div className="flex flex-col max-h-[140px] overflow-y-auto">
- {folders
- .slice()
- .sort((a, b) => b.updated_at - a.updated_at)
- .map((folder) => {
- const ProjectItem = () => {
- const [openDropdown, setOpenDropdown] = useState(false)
- const isProjectActive =
- currentPath === `/project/${folder.id}`
-
- return (
- <div key={folder.id} className="mb-1">
- <div
- className={cn(
- 'rounded hover:bg-left-panel-fg/10 flex items-center justify-between gap-2 px-1.5 group/project-list transition-all cursor-pointer',
- isProjectActive && 'bg-left-panel-fg/10'
- )}
- onContextMenu={(e) => {
- e.preventDefault()
- }}
- >
- <Link
- to="/project/$projectId"
- params={{ projectId: folder.id }}
- onClick={() =>
- isSmallScreen && setLeftPanel(false)
- }
- className="py-1 pr-2 truncate flex items-center gap-2 flex-1"
- >
- <IconFolder
- size={16}
- className="text-left-panel-fg/70 shrink-0"
- />
- <span className="text-sm text-left-panel-fg/90 truncate">
- {folder.name}
- </span>
- </Link>
- <div className="flex items-center">
- <DropdownMenu
- open={openDropdown}
- onOpenChange={(open) => setOpenDropdown(open)}
- >
- <DropdownMenuTrigger asChild>
- <IconDots
- size={14}
- className="text-left-panel-fg/60 shrink-0 cursor-pointer px-0.5 -mr-1 data-[state=open]:bg-left-panel-fg/10 rounded group-hover/project-list:data-[state=closed]:size-5 size-5 data-[state=closed]:size-0"
- onClick={(e) => {
- e.preventDefault()
- e.stopPropagation()
- }}
- />
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="end">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- setEditingProjectKey(folder.id)
- setProjectDialogOpen(true)
- }}
- >
- <IconPencil size={16} />
- <span>Edit</span>
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- handleProjectDelete(folder.id)
- }}
- >
- <IconTrash size={16} />
- <span>Delete</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- </div>
- )
- }
-
- return <ProjectItem key={folder.id} />
- })}
- </div>
- </div>
- )}
-
- <div className="flex flex-col h-full overflow-y-scroll w-[calc(100%+6px)]">
- <div className="flex flex-col w-full h-full overflow-y-auto overflow-x-hidden mb-3">
- <div className="h-full w-full overflow-y-auto">
- {favoritedThreads.length > 0 && (
- <>
- <div className="flex items-center justify-between mb-2">
- <span className="block text-xs text-left-panel-fg/50 px-1 font-semibold sticky top-0">
- {t('common:favorites')}
- </span>
- <div className="relative">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button className="size-6 flex cursor-pointer items-center justify-center rounded hover:bg-left-panel-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-left-panel-fg/10">
- <IconDots
- size={18}
- className="text-left-panel-fg/60"
- />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="end">
- <DropdownMenuItem
- onClick={() => {
- unstarAllThreads()
- toast.success(
- t('common:toast.allThreadsUnfavorited.title'),
- {
- id: 'unfav-all-threads',
- description: t(
- 'common:toast.allThreadsUnfavorited.description'
- ),
- }
- )
- }}
- >
- <IconStar size={16} />
- <span>{t('common:unstarAll')}</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- <div className="flex flex-col mb-4">
- <ThreadList
- threads={favoritedThreads}
- isFavoriteSection={true}
- />
- {favoritedThreads.length === 0 && (
- <p className="text-xs text-left-panel-fg/50 px-1 font-semibold">
- {t('chat.status.empty', { ns: 'chat' })}
- </p>
- )}
- </div>
- </>
- )}
-
- {unFavoritedThreads.length > 0 && (
- <div className="flex items-center justify-between mb-2">
- <span className="block text-xs text-left-panel-fg/50 px-1 font-semibold">
- {t('common:recents')}
- </span>
- <div className="relative">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- className="size-6 flex cursor-pointer items-center justify-center rounded hover:bg-left-panel-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-left-panel-fg/10"
- onClick={(e) => {
- e.preventDefault()
- e.stopPropagation()
- }}
- >
- <IconDots
- size={18}
- className="text-left-panel-fg/60"
- />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="end">
- <DeleteAllThreadsDialog
- onDeleteAll={deleteAllThreads}
- />
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
- </div>
- )}
-
- <div className="flex flex-col">
- <ThreadList threads={unFavoritedThreads} />
- </div>
- </div>
- </div>
-
- {secondaryMenus.map((menu) => {
- if (!menu.isEnabled) {
- return null
- }
-
- // Regular menu items must have route and icon
- if (!menu.route || !menu.icon) return null
-
- const isActive = (() => {
- // Settings routes
- if (menu.route.includes(route.settings.index)) {
- return currentPath.includes(route.settings.index)
- }
-
- // Default exact match for other routes
- return currentPath === menu.route
- })()
- return (
- <Link
- key={menu.title}
- to={menu.route}
- onClick={() => isSmallScreen && setLeftPanel(false)}
- data-test-id={`menu-${menu.title}`}
- activeOptions={{ exact: true }}
- className={cn(
- 'flex items-center gap-1.5 cursor-pointer hover:bg-left-panel-fg/10 py-1 my-0.5 px-1 rounded',
- isActive && 'bg-left-panel-fg/10'
- )}
- >
- <menu.icon size={18} className="text-left-panel-fg/70" />
- <span className="font-medium text-left-panel-fg/90">
- {t(menu.title)}
- </span>
- </Link>
- )
- })}
-
- <DownloadManagement />
- </div>
- </div>
- </aside>
-
- {/* Project Dialogs */}
- {
- <>
- <AddProjectDialog
- open={projectDialogOpen}
- onOpenChange={setProjectDialogOpen}
- editingKey={editingProjectKey}
- initialData={
- editingProjectKey ? getFolderById(editingProjectKey) : undefined
- }
- onSave={handleProjectSave}
- />
- <DeleteProjectDialog
- open={deleteProjectConfirmOpen}
- onOpenChange={handleProjectDeleteClose}
- projectId={deletingProjectId ?? undefined}
- projectName={
- deletingProjectId
- ? getFolderById(deletingProjectId)?.name
- : undefined
- }
- />
- </>
- }
-
- {/* Search Dialog */}
- <SearchDialog
- open={searchDialogOpen}
- onOpenChange={setSearchDialogOpen}
- />
- </>
- )
-}
-
-export default LeftPanel
diff --git a/web-app/src/containers/MessageItem.tsx b/web-app/src/containers/MessageItem.tsx
index 60edd5671..c5482b9f9 100644
--- a/web-app/src/containers/MessageItem.tsx
+++ b/web-app/src/containers/MessageItem.tsx
@@ -8,16 +8,15 @@ import {
Reasoning,
ReasoningContent,
ReasoningTrigger,
-} from '@/ai-elements/reasoning'
+} from '@/components/ai-elements/reasoning'
import {
Tool,
ToolContent,
ToolHeader,
ToolInput,
ToolOutput,
-} from '@/ai-elements/tool'
+} from '@/components/ai-elements/tool'
import { CopyButton } from './CopyButton'
-import { AvatarEmoji } from '@/containers/AvatarEmoji'
import { useModelProvider } from '@/hooks/useModelProvider'
import { IconRefresh, IconPaperclip } from '@tabler/icons-react'
import { EditMessageDialog } from '@/containers/dialogs/EditMessageDialog'
@@ -59,8 +58,6 @@ export const MessageItem = memo(
onRegenerate,
onEdit,
onDelete,
- assistant,
- showAssistant,
}: MessageItemProps) => {
const selectedModel = useModelProvider((state) => state.selectedModel)
const [previewImage, setPreviewImage] = useState<{
@@ -149,23 +146,23 @@ export const MessageItem = memo(
return (
<div key={`${message.id}-${partIndex}`} className="w-full">
{message.role === 'user' ? (
- <div className="flex justify-end w-full h-full text-start break-words whitespace-normal">
- <div className="bg-main-view-fg/4 relative text-main-view-fg p-2 rounded-md inline-block max-w-[80%]">
+ <div className="flex justify-end w-full h-full text-start wrap-break-word whitespace-normal">
+ <div className="bg-secondary relative text-foreground p-2 rounded-md inline-block max-w-[80%]">
{/* Show attached files if any */}
{attachedFiles.length > 0 && (
- <div className="flex flex-wrap gap-2 mb-2">
+ <div className="flex flex-wrap gap-2 mb-3">
{attachedFiles.map((file: FileMetadata, idx: number) => (
<div
key={`file-${idx}-${file.id}`}
- className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-main-view-fg/10 text-xs"
+ className="flex items-center gap-1.5 px-2 py-1 rounded-sm bg-secondary border text-xs"
>
<IconPaperclip
size={14}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
/>
<span className="font-medium">{file.name}</span>
{file.injectionMode && (
- <span className="text-main-view-fg/50">
+ <span className="text-muted-foreground">
({file.injectionMode})
</span>
)}
@@ -208,14 +205,14 @@ export const MessageItem = memo(
return (
<div
key={`${message.id}-${partIndex}`}
- className="flex justify-end w-full mb-2"
+ className="flex justify-end w-full my-2"
>
<div className="flex flex-wrap gap-2 max-w-[80%] justify-end">
<div className="relative">
<img
src={part.url}
alt={part.filename || 'Uploaded attachment'}
- className="size-40 rounded-md object-cover border border-main-view-fg/10 cursor-pointer"
+ className="size-20 rounded-lg object-cover border cursor-pointer"
onClick={() =>
setPreviewImage({ url: part.url!, filename: part.filename })
}
@@ -327,25 +324,6 @@ export const MessageItem = memo(
return (
<div className="w-full mb-4">
- {/* Show assistant header for assistant messages */}
- {message.role === 'assistant' && showAssistant && (
- <div className="flex items-center gap-2 mb-3 text-main-view-fg/60">
- {assistant?.avatar && (
- <div className="flex items-center gap-2 size-8 rounded-md justify-center border border-main-view-fg/10 bg-main-view-fg/5 p-1">
- <AvatarEmoji
- avatar={assistant.avatar}
- imageClassName="w-6 h-6 object-contain"
- textClassName="text-base"
- />
- </div>
- )}
- <div className="flex flex-col">
- <span className="text-main-view-fg font-medium">
- {assistant?.name || 'Jan'}
- </span>
- </div>
- </div>
- )}
{/* Render message parts */}
{message.parts.map((part, i) => {
@@ -366,7 +344,7 @@ export const MessageItem = memo(
{/* Message actions for user messages */}
{message.role === 'user' && (
- <div className="flex items-center justify-end gap-2 text-main-view-fg/60 text-xs mt-2">
+ <div className="flex items-center justify-end gap-2 text-muted-foreground text-xs mt-4">
<CopyButton text={getFullTextContent()} />
{onEdit && status !== CHAT_STATUS.STREAMING && (
@@ -386,7 +364,7 @@ export const MessageItem = memo(
{/* Message actions for assistant messages (non-tool) */}
{message.role === 'assistant' &&
message.parts.some((p) => p.type === 'text' && p.text.length > 0) && (
- <div className="flex items-center gap-2 text-main-view-fg/60 text-xs">
+ <div className="flex items-center gap-2 text-muted-foreground text-xs mt-1">
<div
className={cn(
'flex items-center gap-2',
@@ -429,7 +407,7 @@ export const MessageItem = memo(
{/* Image Preview Dialog */}
{previewImage && (
<div
- className="fixed inset-0 z-[100] bg-black/90 backdrop-blur-md flex items-center justify-center cursor-pointer"
+ className="fixed inset-0 z-100 bg-black/50 backdrop-blur-md flex items-center justify-center cursor-pointer"
onClick={() => setPreviewImage(null)}
>
<img
diff --git a/web-app/src/containers/ModelCombobox.tsx b/web-app/src/containers/ModelCombobox.tsx
index 7f4a3f857..43b879c30 100644
--- a/web-app/src/containers/ModelCombobox.tsx
+++ b/web-app/src/containers/ModelCombobox.tsx
@@ -71,14 +71,14 @@ const ErrorSection = ({
{t('common:failedToLoadModels')}
</span>
</div>
- <div className="text-xs text-main-view-fg/50 mt-0">{error}</div>
+ <div className="text-xs text-muted-foreground mt-0">{error}</div>
</div>
)
const LoadingSection = ({ t }: { t: (key: string) => string }) => (
- <div className="flex items-center justify-center px-3 py-3 text-sm text-main-view-fg/50">
- <IconLoader2 className="h-4 w-4 animate-spin mr-2 text-main-view-fg/50" />
- <span className="text-sm text-main-view-fg/50">{t('common:loading')}</span>
+ <div className="flex items-center justify-center px-3 py-3 text-sm text-muted-foreground">
+ <IconLoader2 className="h-4 w-4 animate-spin mr-2 text-muted-foreground" />
+ <span className="text-sm text-muted-foreground">{t('common:loading')}</span>
</div>
)
@@ -89,15 +89,15 @@ const EmptySection = ({
inputValue: string
t: (key: string, options?: Record<string, string>) => string
}) => (
- <div className="px-3 py-3 text-sm text-main-view-fg/50 text-center">
+ <div className="px-3 py-3 text-sm text-muted-foreground text-center">
<div className="flex items-center justify-between">
<div className="flex-1">
{inputValue.trim() ? (
- <span className="text-main-view-fg/50">
+ <span className="text-muted-foreground">
{t('common:noModelsFoundFor', { searchValue: inputValue })}
</span>
) : (
- <span className="text-main-view-fg/50">{t('common:noModels')}</span>
+ <span className="text-muted-foreground">{t('common:noModels')}</span>
)}
</div>
</div>
@@ -128,12 +128,12 @@ const ModelsList = ({
}}
onMouseEnter={() => onHighlight(index)}
className={cn(
- 'cursor-pointer px-3 py-2 hover:bg-main-view-fg/15 hover:shadow-sm transition-all duration-200 text-main-view-fg',
- value === model && 'bg-main-view-fg/12 shadow-sm',
- highlightedIndex === index && 'bg-main-view-fg/20 shadow-md'
+ 'cursor-pointer mx-3 px-2 rounded-md py-2 bg-background z-20 transition-all duration-200',
+ value === model && 'bg-secondary shadow-sm',
+ highlightedIndex === index && ' bg-secondary'
)}
>
- <span className="text-sm truncate text-main-view-fg">{model}</span>
+ <span className="text-sm truncate text-foreground">{model}</span>
</div>
))}
</>
@@ -416,33 +416,31 @@ export function ModelCombobox({
<div className="absolute right-1 top-1/2 -translate-y-1/2 flex gap-1">
{onRefresh && (
<Button
- variant="link"
- size="sm"
+ variant="ghost"
+ size="icon-xs"
disabled={disabled || loading}
onMouseDown={(e) => e.preventDefault()}
onClick={(e) => {
e.stopPropagation()
onRefresh()
}}
- className="h-6 w-6 p-0 no-underline hover:bg-main-view-fg/10"
aria-label="Refresh models"
>
{loading ? (
- <IconLoader2 className="h-3 w-3 animate-spin" />
+ <IconLoader2 className="size-4 animate-spin" />
) : (
- <IconRefresh className="h-3 w-3 opacity-70" />
+ <IconRefresh className="size-4 opacity-70" />
)}
</Button>
)}
<Button
- variant="link"
- size="sm"
+ variant="ghost"
+ size="icon-xs"
disabled={disabled}
onMouseDown={(e) => e.preventDefault()}
onClick={handleDropdownToggle}
- className="h-6 w-6 p-0 no-underline hover:bg-main-view-fg/10"
>
- <IconChevronDown className="h-3 w-3 opacity-50" />
+ <IconChevronDown className="size-4 opacity-50" />
</Button>
</div>
@@ -452,7 +450,7 @@ export function ModelCombobox({
createPortal(
<div
ref={dropdownRef}
- className="fixed z-[9999] bg-main-view border border-main-view-fg/10 rounded-md shadow-lg max-h-[300px] overflow-y-auto text-main-view-fg animate-in fade-in-0 zoom-in-95 duration-200"
+ className="fixed z-9999 py-2 bg-background border rounded-md shadow-lg max-h-[300px] overflow-y-auto animate-in fade-in-0 zoom-in-95 duration-200 "
style={{
top: dropdownPosition.top,
left: dropdownPosition.left,
diff --git a/web-app/src/containers/ModelDownloadAction.tsx b/web-app/src/containers/ModelDownloadAction.tsx
index e975621dd..a6fae7c9c 100644
--- a/web-app/src/containers/ModelDownloadAction.tsx
+++ b/web-app/src/containers/ModelDownloadAction.tsx
@@ -94,7 +94,7 @@ export const ModelDownloadAction = ({
<>
<div className="flex items-center gap-2 w-20">
<Progress value={downloadProgress * 100} />
- <span className="text-xs text-center text-main-view-fg/70">
+ <span className="text-xs text-center text-muted-foreground">
{Math.round(downloadProgress * 100)}%
</span>
</div>
@@ -105,26 +105,23 @@ export const ModelDownloadAction = ({
if (isDownloaded) {
return (
<Button
- variant="link"
+ variant="default"
size="sm"
- className="p-0"
onClick={() => handleUseModel(variant.model_id)}
title={t('hub:useModel')}
>
- <div className="rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1">
- {t('hub:newChat')}
- </div>
+ {t('hub:newChat')}
</Button>
)
}
return (
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded transition-all duration-200 ease-in-out"
title={t('hub:downloadModel')}
onClick={handleDownloadModel}
>
- <IconDownload size={16} className="text-main-view-fg/80" />
+ <IconDownload size={16} className="text-muted-foreground" />
</div>
)
}
diff --git a/web-app/src/containers/ModelInfoHoverCard.tsx b/web-app/src/containers/ModelInfoHoverCard.tsx
index 25edff914..5143ec5f0 100644
--- a/web-app/src/containers/ModelInfoHoverCard.tsx
+++ b/web-app/src/containers/ModelInfoHoverCard.tsx
@@ -48,8 +48,8 @@ export const ModelInfoHoverCard = ({
if (status === 'LOADING') {
return (
<div className="flex items-start gap-2">
- <div className="size-2 shrink-0 border border-main-view-fg/50 border-t-transparent rounded-full animate-spin mt-1"></div>
- <span className="text-main-view-fg/50">Checking...</span>
+ <div className="size-2 shrink-0 border border-t-transparent rounded-full animate-spin mt-1"></div>
+ <span className="text-muted-foreground">Checking...</span>
</div>
)
} else if (status === 'GREEN') {
@@ -105,19 +105,19 @@ export const ModelInfoHoverCard = ({
<div className="cursor-pointer">
<IconInfoCircle
size={isDefaultVariant ? 20 : 14}
- className="mt-0.5 text-main-view-fg/80 hover:text-main-view-fg/80 transition-colors"
+ className="mt-0.5 text-muted-foreground transition-colors"
/>
</div>
)}
</HoverCardTrigger>
- <HoverCardContent className="w-96 p-4" side="left">
+ <HoverCardContent className="w-80 p-4" side="left">
<div className="space-y-4">
{/* Header */}
- <div className="border-b border-main-view-fg/10 pb-3">
- <h4 className="text-sm font-semibold text-main-view-fg">
+ <div className="border-b pb-3">
+ <h4 className="text-sm font-semibold">
{!isDefaultVariant ? variant?.model_id : model?.model_name}
</h4>
- <p className="text-xs text-main-view-fg/60 mt-1">
+ <p className="text-xs text-muted-foreground mt-1">
{!isDefaultVariant
? 'Model Variant Information'
: 'Model Information'}
@@ -125,14 +125,14 @@ export const ModelInfoHoverCard = ({
</div>
{/* Main Info Grid */}
- <div className="grid grid-cols-2 gap-3 text-xs">
+ <div className="grid grid-cols-1 gap-4 text-xs">
<div className="space-y-2">
<>
<div>
- <span className="text-main-view-fg/50 block">
+ <span className="text-muted-foreground block">
{isDefaultVariant ? 'Default Quantization' : 'Quantization'}
</span>
- <span className="text-main-view-fg font-medium mt-1 inline-block">
+ <span className="font-medium mt-1 inline-block">
{variant?.model_id.split('-').pop()?.toUpperCase() || 'N/A'}
</span>
</div>
@@ -141,7 +141,7 @@ export const ModelInfoHoverCard = ({
<div className="space-y-2">
<div>
- <span className="text-main-view-fg/50 block">
+ <span className="text-muted-foreground block">
Compatibility
</span>
<div className="flex items-center gap-1.5 mt-1">
@@ -153,28 +153,28 @@ export const ModelInfoHoverCard = ({
{/* Features Section */}
{(model.num_mmproj > 0 || model.tools || (model.num_mmproj > 0 && model.tools)) && (
- <div className="border-t border-main-view-fg/10 pt-3">
- <h5 className="text-xs font-medium text-main-view-fg/70 mb-2">
+ <div className="border-t pt-3">
+ <h5 className="text-xs font-medium text-muted-foreground mb-2">
Features
</h5>
<div className="flex flex-wrap gap-2">
{model.tools && (
- <div className="flex items-center gap-1.5 px-2 py-1 bg-main-view-fg/10 rounded-md">
- <span className="text-xs text-main-view-fg font-medium">
+ <div className="flex items-center gap-1.5 px-2 py-1 bg-secondary rounded-sm">
+ <span className="text-xs font-medium">
Tools
</span>
</div>
)}
{model.num_mmproj > 0 && (
- <div className="flex items-center gap-1.5 px-2 py-1 bg-main-view-fg/10 rounded-md">
- <span className="text-xs text-main-view-fg font-medium">
+ <div className="flex items-center gap-1.5 px-2 py-1 bg-secondary rounded-sm">
+ <span className="text-xs font-medium">
Vision
</span>
</div>
)}
{model.num_mmproj > 0 && model.tools && (
- <div className="flex items-center gap-1.5 px-2 py-1 bg-main-view-fg/10 rounded-md">
- <span className="text-xs text-main-view-fg font-medium">
+ <div className="flex items-center gap-1.5 px-2 py-1 bg-secondary rounded-sm">
+ <span className="text-xs font-medium">
Proactive
</span>
</div>
diff --git a/web-app/src/containers/ModelSetting.tsx b/web-app/src/containers/ModelSetting.tsx
index 1409981be..7a02ebecd 100644
--- a/web-app/src/containers/ModelSetting.tsx
+++ b/web-app/src/containers/ModelSetting.tsx
@@ -21,13 +21,11 @@ import { useAppState } from '@/hooks/useAppState'
type ModelSettingProps = {
provider: ProviderObject
model: Model
- smallIcon?: boolean
}
export function ModelSetting({
model,
provider,
- smallIcon,
}: ModelSettingProps) {
const { updateProvider } = useModelProvider()
const { t } = useTranslation()
@@ -264,38 +262,33 @@ export function ModelSetting({
return (
<Sheet>
<SheetTrigger asChild>
- <div
- className={cn(
- 'size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out',
- smallIcon && 'size-5'
- )}
- >
- <IconSettings size={18} className="text-main-view-fg/50" />
- </div>
+ <Button variant="ghost" size="icon-xs">
+ <IconSettings size={18} className="text-muted-foreground" />
+ </Button>
</SheetTrigger>
- <SheetContent className="h-[calc(100%-8px)] top-1 right-1 rounded-e-md overflow-y-auto">
+ <SheetContent className="overflow-y-auto">
<SheetHeader>
<SheetTitle>
{t('common:modelSettings.title', {
modelId: getModelDisplayName(model),
})}
</SheetTitle>
- <SheetDescription>
+ <SheetDescription className='text-xs leading-normal'>
{t('common:modelSettings.description')}
</SheetDescription>
{/* Model Load Planning Section - Only show for llamacpp provider */}
{provider.provider === 'llamacpp' && (
- <div className="pb-4 border-b border-main-view-fg/10 my-4">
+ <div className="pb-4 border-b mt-4">
<div>
<div>
<div className="flex items-center gap-2 mb-1">
<h3 className="font-medium">Optimize Settings</h3>
- <div className="text-xs bg-main-view-fg/10 border border-main-view-fg/20 text-main-view-fg/70 rounded-full py-0.5 px-2">
+ <div className="text-xs bg-secondary border text-muted-foreground rounded-full py-0.5 px-2">
<span>{t('mcp-servers:experimental')}</span>
</div>
</div>
- <p className="text-main-view-fg/70 text-xs mb-3">
+ <p className="text-muted-foreground leading-normal text-xs mb-3">
Analyze your system and model, then apply optimal loading
settings automatically
</p>
@@ -320,25 +313,21 @@ export function ModelSetting({
)}
</SheetHeader>
- <div className="px-4 space-y-6">
+ <div className="px-4 space-y-8 pb-4">
{Object.entries(model.settings || {}).map(([key, value]) => {
const config = value as ProviderSetting
-
return (
<div key={key} className="space-y-2">
<div
className={cn(
- 'flex items-start justify-between gap-8 last:mb-2',
+ 'flex items-start justify-between gap-8',
(key === 'chat_template' ||
key === 'override_tensor_buffer_t') &&
'flex-col gap-1 w-full'
)}
>
- <div className="space-y-1 mb-2">
- <h3 className="font-medium">{config.title}</h3>
- <p className="text-main-view-fg/70 text-xs">
- {config.description}
- </p>
+ <div className="mb-1 truncate">
+ <span title={config.title} className="font-medium">{config.title}</span>
</div>
<DynamicControllerSetting
key={config.key}
@@ -352,6 +341,9 @@ export function ModelSetting({
onChange={(newValue) => handleSettingChange(key, newValue)}
/>
</div>
+ <p className="text-muted-foreground leading-normal text-xs">
+ {config.description}
+ </p>
</div>
)
})}
diff --git a/web-app/src/containers/ModelSupportStatus.tsx b/web-app/src/containers/ModelSupportStatus.tsx
index 560880a11..fe57a2c4b 100644
--- a/web-app/src/containers/ModelSupportStatus.tsx
+++ b/web-app/src/containers/ModelSupportStatus.tsx
@@ -101,9 +101,9 @@ export const ModelSupportStatus = ({
case 'RED':
return 'bg-red-500'
case 'LOADING':
- return 'bg-main-view-fg/50'
+ return 'bg-secondary'
default:
- return 'bg-main-view-fg/50'
+ return 'bg-secondary'
}
}
@@ -161,7 +161,7 @@ export const ModelSupportStatus = ({
className={cn(
'size-2 flex items-center justify-center rounded-full',
modelSupportStatus === 'LOADING'
- ? 'size-2.5 border border-main-view-fg/50 border-t-transparent animate-spin'
+ ? 'size-2.5 border border-t-transparent animate-spin'
: getStatusColor(),
className
)}
diff --git a/web-app/src/containers/PromptJanModel.tsx b/web-app/src/containers/PromptJanModel.tsx
index c18cef3f4..65560aa9d 100644
--- a/web-app/src/containers/PromptJanModel.tsx
+++ b/web-app/src/containers/PromptJanModel.tsx
@@ -94,26 +94,27 @@ export function PromptJanModel() {
if (isLoading) return null
return (
- <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-main-view w-4/5 md:w-100 border border-main-view-fg/8 rounded-lg">
+ <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-background w-4/5 md:w-100 border rounded-lg">
<div className="flex items-center gap-2">
<img src="/images/jan-logo.png" alt="Jan" className="size-5" />
- <h2 className="font-medium text-main-view-fg/80">
+ <h2 className="font-medium">
Jan v3 Model
{defaultVariant && (
- <span className="text-main-view-fg/50">
+ <span className="text-muted-foreground">
{' '}
({defaultVariant.file_size})
</span>
)}
</h2>
</div>
- <p className="mt-2 text-sm text-main-view-fg/70">
+ <p className="mt-2 text-sm text-muted-foreground">
Get started with Jan v3, our recommended local AI model optimized for your device.
</p>
<div className="mt-4 flex justify-end space-x-2">
<Button
- variant="link"
- className="text-main-view-fg/70"
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground"
onClick={handleDismiss}
>
Later
@@ -121,6 +122,7 @@ export function PromptJanModel() {
<Button
onClick={handleDownload}
disabled={!defaultVariant || isDownloading}
+ size="sm"
>
{isDownloading ? 'Downloading' : 'Download'}
</Button>
diff --git a/web-app/src/containers/PromptVisionModel.tsx b/web-app/src/containers/PromptVisionModel.tsx
index 27403d516..467ce0a66 100644
--- a/web-app/src/containers/PromptVisionModel.tsx
+++ b/web-app/src/containers/PromptVisionModel.tsx
@@ -191,27 +191,28 @@ export function PromptVisionModel({
if (isLoading) return null
return (
- <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-main-view w-4/5 md:w-100 border border-main-view-fg/8 rounded-lg">
+ <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-background w-4/5 md:w-100 border rounded-lg">
<div className="flex items-center gap-2">
<img src="/images/jan-logo.png" alt="Jan" className="size-5" />
- <h2 className="font-medium text-main-view-fg/80">
+ <h2 className="font-medium">
Jan V2 VL Model
- <span className="text-main-view-fg/50"> (~5GB)</span>
+ <span className="text-muted-foreground"> (~5GB)</span>
</h2>
</div>
- <p className="mt-2 text-sm text-main-view-fg/70">
+ <p className="mt-2 text-sm text-muted-foreground">
Add vision capabilities to chat with images. Download Jan V2 VL, our
recommended vision model.
</p>
<div className="mt-4 flex justify-end space-x-2">
<Button
- variant="link"
- className="text-main-view-fg/70"
+ variant="ghost"
+ size="sm"
onClick={onClose}
>
{isDownloading ? 'Close' : 'Cancel'}
</Button>
<Button
+ size="sm"
onClick={handleDownload}
disabled={!defaultVariant || isDownloading}
>
diff --git a/web-app/src/containers/ProvidersAvatar.tsx b/web-app/src/containers/ProvidersAvatar.tsx
index dbe149338..992da51e8 100644
--- a/web-app/src/containers/ProvidersAvatar.tsx
+++ b/web-app/src/containers/ProvidersAvatar.tsx
@@ -4,7 +4,7 @@ const ProvidersAvatar = ({ provider }: { provider: ProviderObject }) => {
return (
<>
{getProviderLogo(provider.provider) === undefined ? (
- <div className="flex w-4.5 h-4.5 rounded-full border border-main-view-fg/20 items-center justify-center bg-main-view-fg/10">
+ <div className="flex size-4.5 rounded-full border items-center justify-center">
<p className="text-xs leading-0 capitalize">
{getProviderTitle(provider.provider).charAt(0)}
</p>
diff --git a/web-app/src/containers/ServerHostSwitcher.tsx b/web-app/src/containers/ServerHostSwitcher.tsx
index ee05908ab..ed18b14fb 100644
--- a/web-app/src/containers/ServerHostSwitcher.tsx
+++ b/web-app/src/containers/ServerHostSwitcher.tsx
@@ -1,3 +1,4 @@
+import { Button } from '@/components/ui/button'
import {
DropdownMenu,
DropdownMenuContent,
@@ -7,6 +8,7 @@ import {
import { useLocalApiServer } from '@/hooks/useLocalApiServer'
import { cn } from '@/lib/utils'
+import { ChevronsUpDown } from 'lucide-react'
const hostOptions = [
{ value: '127.0.0.1', label: '127.0.0.1' },
@@ -26,12 +28,10 @@ export function ServerHostSwitcher({
asChild
className={cn(isServerRunning && 'opacity-50 pointer-events-none')}
>
- <span
- title="Edit Server Host"
- className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm bg-main-view-fg/15 text-sm outline-none text-main-view-fg font-medium"
- >
+ <Button variant="outline" size="sm" className="w-full justify-between" title="Edit Server Host">
{serverHost}
- </span>
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground ml-2" />
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-24">
{hostOptions.map((item) => (
@@ -39,7 +39,7 @@ export function ServerHostSwitcher({
key={item.value}
className={cn(
'cursor-pointer my-0.5',
- serverHost === item.value && 'bg-main-view-fg/5'
+ serverHost === item.value && 'bg-seconday'
)}
onClick={() => setServerHost(item.value as '127.0.0.1' | '0.0.0.0')}
>
diff --git a/web-app/src/containers/SettingsMenu.tsx b/web-app/src/containers/SettingsMenu.tsx
index 2c6b10c75..ddc03d0f8 100644
--- a/web-app/src/containers/SettingsMenu.tsx
+++ b/web-app/src/containers/SettingsMenu.tsx
@@ -5,8 +5,6 @@ import { useState, useEffect } from 'react'
import {
IconChevronDown,
IconChevronRight,
- IconMenu2,
- IconX,
} from '@tabler/icons-react'
import { useMatches, useNavigate } from '@tanstack/react-router'
import { cn } from '@/lib/utils'
@@ -17,8 +15,7 @@ import ProvidersAvatar from '@/containers/ProvidersAvatar'
const SettingsMenu = () => {
const { t } = useTranslation()
- const [expandedProviders, setExpandedProviders] = useState(false)
- const [isMenuOpen, setIsMenuOpen] = useState(false)
+ const [expandedProviders, setExpandedProviders] = useState(true)
const matches = useMatches()
const navigate = useNavigate()
@@ -123,45 +120,25 @@ const SettingsMenu = () => {
hasSubMenu: false,
isEnabled: true,
},
- {
- title: 'common:extensions',
- route: route.settings.extensions,
- hasSubMenu: false,
- isEnabled: true,
- },
+ // Hide Extension settings for now
+ // {
+ // title: 'common:extensions',
+ // route: route.settings.extensions,
+ // hasSubMenu: false,
+ // isEnabled: true,
+ // },
]
const toggleProvidersExpansion = () => {
setExpandedProviders(!expandedProviders)
}
- const toggleMenu = () => {
- setIsMenuOpen(!isMenuOpen)
- }
-
return (
<>
- <button
- className="fixed top-[calc(10px+env(safe-area-inset-top))] right-4 sm:hidden size-5 cursor-pointer items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out data-[state=open]:bg-main-view-fg/10 z-20"
- onClick={toggleMenu}
- aria-label="Toggle settings menu"
- >
- {isMenuOpen ? (
- <IconX size={18} className="text-main-view-fg relative z-20" />
- ) : (
- <IconMenu2 size={18} className="text-main-view-fg relative z-20" />
- )}
- </button>
<div
- className={cn(
- 'h-full w-44 shrink-0 px-1.5 pt-3 border-r border-main-view-fg/5 bg-main-view',
- 'sm:flex',
- isMenuOpen
- ? 'flex fixed sm:hidden top-[calc(10px+env(safe-area-inset-top))] z-10 m-1 h-[calc(100%-8px)] border-r-0 border-l bg-main-view right-0 py-8 rounded-tr-lg rounded-br-lg'
- : 'hidden'
- )}
+ className='h-full w-54 shrink-0 px-1.5 flex'
>
- <div className="flex flex-col gap-1 w-full text-main-view-fg/90 font-medium">
+ <div className="flex flex-col gap-1 w-full font-medium">
{menuSettings.map((menu) => {
if (!menu.isEnabled) {
return null
@@ -170,10 +147,10 @@ const SettingsMenu = () => {
<div key={menu.title}>
<Link
to={menu.route}
- className="block px-2 gap-1.5 cursor-pointer hover:bg-main-view-fg/5 py-1 w-full rounded [&.active]:bg-main-view-fg/5"
+ className="block px-2 gap-1.5 cursor-pointer hover:bg-secondary/60 py-1 w-full rounded-sm [&.active]:bg-secondary/80"
>
<div className="flex items-center justify-between">
- <span className="text-main-view-fg/80">
+ <span>
{t(menu.title)}
</span>
{menu.hasSubMenu && (
@@ -183,7 +160,7 @@ const SettingsMenu = () => {
e.stopPropagation()
toggleProvidersExpansion()
}}
- className="text-main-view-fg/60 hover:text-main-view-fg/80"
+ className="text-muted-foreground/60 hover:text-muted-foreground/80"
>
{expandedProviders ? (
<IconChevronDown size={16} />
@@ -211,8 +188,8 @@ const SettingsMenu = () => {
<div key={provider.provider}>
<div
className={cn(
- 'flex px-2 items-center gap-1.5 cursor-pointer hover:bg-main-view-fg/5 py-1 w-full rounded [&.active]:bg-main-view-fg/5 text-main-view-fg/80',
- isActive && 'bg-main-view-fg/5',
+ 'flex px-2 items-center gap-1.5 cursor-pointer hover:bg-secondary/60 py-1 w-full rounded-sm [&.active]:bg-secondary/80 text-foreground',
+ isActive && 'bg-secondary',
// hidden for llama.cpp provider for setup remote provider
provider.provider === 'llama.cpp' &&
stepSetupRemoteProvider &&
diff --git a/web-app/src/containers/SetupScreen.tsx b/web-app/src/containers/SetupScreen.tsx
index 13d9bf87b..20e39406c 100644
--- a/web-app/src/containers/SetupScreen.tsx
+++ b/web-app/src/containers/SetupScreen.tsx
@@ -1,7 +1,6 @@
import { useModelProvider } from '@/hooks/useModelProvider'
import { useNavigate } from '@tanstack/react-router'
import { route } from '@/constants/routes'
-import HeaderPage from './HeaderPage'
import { useTranslation } from '@/i18n/react-i18next-compat'
import { localStorageKey, CACHE_EXPIRY_MS } from '@/constants/localStorage'
import { useDownloadStore } from '@/hooks/useDownloadStore'
@@ -394,37 +393,35 @@ function SetupScreen() {
return (
<div className="flex h-full flex-col justify-center">
- <HeaderPage></HeaderPage>
<div className="h-full px-8 overflow-y-auto flex flex-col gap-2 justify-center ">
<div className="w-full mx-auto">
<div className="mb-4 text-center">
- <h1 className="font-studio font-medium text-main-view-fg text-2xl">
+ <h1 className="font-studio font-medium text-2xl mb-1">
{isDownloading ? 'Sit tight, Jan is getting ready...' : 'Welcome to Jan!'}
</h1>
- <p className='text-main-view-fg/70 w-full md:w-3/4 mx-auto mt-1'>{isDownloading ? 'Jan is getting ready to work on your device. This may take a few minutes.' : 'To get started, Jan needs to download a model to your device. This only takes a few minutes.'}</p>
+ <p className='text-muted-foreground w-full md:w-1/2 mx-auto mt-1'>{isDownloading ? 'Jan is getting ready to work on your device. This may take a few minutes.' : 'To get started, Jan needs to download a model to your device. This only takes a few minutes.'}</p>
</div>
<div className="flex gap-4 flex-col mt-6">
{/* Quick Start Button - Highlighted */}
- <button
+ <div
onClick={handleQuickStart}
- disabled={quickStartInitiated || isDownloading || isDownloaded}
className="w-full text-left lg:w-2/3 mx-auto"
>
- <div className={cn("bg-main-view-fg/2 p-3 rounded-lg border border-main-view-fg/10 transition-all hover:shadow-lg disabled:opacity-60 flex justify-between items-start")}>
+ <div className={cn("bg-background p-3 rounded-lg border transition-all hover:shadow-lg disabled:opacity-60 flex justify-between items-start")}>
<div className="flex items-start gap-4">
- <div className="shrink-0 size-12 bg-main-view-fg/10 rounded-lg flex items-center justify-center">
+ <div className="shrink-0 size-12 bg-secondary/40 rounded-xl flex items-center justify-center">
<img src="/images/jan-logo.png" alt="Jan Logo" className='size-6' />
</div>
<div className="flex-1">
- <h1 className="text-main-view-fg font-semibold text-sm mb-1">
- <span>Jan v3</span> <span className='text-xs text-main-view-fg/50'>· {defaultVariant?.file_size}</span>
+ <h1 className="font-semibold text-sm mb-1">
+ <span>Jan v3</span>&nbsp;<span className='text-xs text-muted-foreground'>· {defaultVariant?.file_size}</span>
</h1>
- <div className="text-main-view-fg/70 text-sm mt-1.5">
- <span className="inline-flex items-center gap-1 px-2 py-0.5 bg-main-view-fg/20 text-xs rounded-full mr-1">
+ <div className="text-muted-foreground text-sm mt-1.5">
+ <span className="inline-flex items-center gap-1 px-2 py-0.5 bg-secondary text-xs rounded-full mr-1">
<IconSquareCheck size={12} />
General
</span>
- {(janNewModel?.mmproj_models?.length ?? 0) > 0 && <span className="inline-flex items-center gap-1 px-2 py-0.5 bg-main-view-fg/20 text-xs rounded-full">
+ {(janNewModel?.mmproj_models?.length ?? 0) > 0 && <span className="inline-flex items-center gap-1 px-2 py-0.5 bg-secondary text-xs rounded-full">
<IconEye size={12} />
Vision
</span>}
@@ -432,11 +429,11 @@ function SetupScreen() {
</div>
</div>
<div className="flex flex-col items-end gap-2">
- <Button disabled={quickStartInitiated || isDownloading}>
+ <Button size="sm" disabled={quickStartInitiated || isDownloading}>
{quickStartInitiated || isDownloading ? 'Downloading' : 'Download'}
</Button>
{(quickStartInitiated || isDownloading) && (
- <div className="flex items-center gap-1.5 text-xs text-main-view-fg/50">
+ <div className="flex items-center gap-1.5 text-xs text-muted-foreground">
<svg
className="size-3 animate-spin"
viewBox="0 0 24 24"
@@ -461,7 +458,7 @@ function SetupScreen() {
)}
</div>
</div>
- </button>
+ </div>
</div>
</div>
</div>
diff --git a/web-app/src/containers/ThemeSwitcher.tsx b/web-app/src/containers/ThemeSwitcher.tsx
index fce342a82..02f31988c 100644
--- a/web-app/src/containers/ThemeSwitcher.tsx
+++ b/web-app/src/containers/ThemeSwitcher.tsx
@@ -7,6 +7,8 @@ import {
import { useTheme } from '@/hooks/useTheme'
import { cn } from '@/lib/utils'
import { useTranslation } from '@/i18n/react-i18next-compat'
+import { ChevronsUpDown } from 'lucide-react'
+import { Button } from '@/components/ui/button'
export function ThemeSwitcher() {
const { t } = useTranslation()
@@ -22,21 +24,20 @@ export function ThemeSwitcher() {
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <span
- title={t('common:editTheme')}
- className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm bg-main-view-fg/15 text-sm outline-none text-main-view-fg font-medium"
- >
- {themeOptions.find((item) => item.value === activeTheme)?.label ||
- t('common:auto')}
- </span>
+ <Button variant="outline" size="sm" className="w-full justify-between" title={t('common:editTheme')}>
+ {themeOptions.find(
+ (item: { value: string; label: string }) => item.value === activeTheme
+ )?.label || t('common:auto')}
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground ml-2" />
+ </Button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="w-24">
+ <DropdownMenuContent align="end">
{themeOptions.map((item) => (
<DropdownMenuItem
key={item.value}
className={cn(
'cursor-pointer my-0.5',
- activeTheme === item.value && 'bg-main-view-fg/5'
+ activeTheme === item.value && 'bg-secondary-foreground/8'
)}
onClick={() => setTheme(item.value as 'auto' | 'light' | 'dark')}
>
diff --git a/web-app/src/containers/ThreadList.tsx b/web-app/src/containers/ThreadList.tsx
index 75cbce053..69cf0a47a 100644
--- a/web-app/src/containers/ThreadList.tsx
+++ b/web-app/src/containers/ThreadList.tsx
@@ -1,31 +1,6 @@
-import {
- DndContext,
- closestCenter,
- useSensor,
- useSensors,
- PointerSensor,
- KeyboardSensor,
-} from '@dnd-kit/core'
-import {
- SortableContext,
- verticalListSortingStrategy,
- useSortable,
-} from '@dnd-kit/sortable'
-import { CSS } from '@dnd-kit/utilities'
-import {
- IconDots,
- IconStarFilled,
- IconStar,
- IconFolder,
- IconX,
- IconTrash,
-} from '@tabler/icons-react'
+import { Folder, MoreHorizontal, Pencil, Trash2, X } from 'lucide-react'
import { useThreads } from '@/hooks/useThreads'
import { useThreadManagement } from '@/hooks/useThreadManagement'
-import { useLeftPanel } from '@/hooks/useLeftPanel'
-import { useMessages } from '@/hooks/useMessages'
-import { cn, extractThinkingContent } from '@/lib/utils'
-import { useSmallScreen } from '@/hooks/useMediaQuery'
import {
DropdownMenu,
@@ -37,86 +12,46 @@ import {
DropdownMenuSubContent,
DropdownMenuSubTrigger,
} from '@/components/ui/dropdown-menu'
+import {
+ SidebarMenuAction,
+ SidebarMenuButton,
+ SidebarMenuItem,
+ useSidebar,
+} from '@/components/ui/sidebar'
import { useTranslation } from '@/i18n/react-i18next-compat'
-import { memo, MouseEvent, useMemo, useState } from 'react'
-import { useNavigate, useMatches } from '@tanstack/react-router'
+import { memo, useMemo, useState } from 'react'
+import { Link } from '@tanstack/react-router'
import { RenameThreadDialog, DeleteThreadDialog } from '@/containers/dialogs'
-import { route } from '@/constants/routes'
import { toast } from 'sonner'
+import { cn } from '@/lib/utils'
-const SortableItem = memo(
+const ThreadItem = memo(
({
thread,
- variant,
+ isMobile,
currentProjectId,
}: {
thread: Thread
- variant?: 'default' | 'project'
+ isMobile: boolean
currentProjectId?: string
}) => {
- const {
- attributes,
- listeners,
- setNodeRef,
- transform,
- transition,
- isDragging,
- } = useSortable({ id: thread.id, disabled: true })
-
- const isSmallScreen = useSmallScreen()
- const setLeftPanel = useLeftPanel((state) => state.setLeftPanel)
-
- const style = {
- transform: CSS.Transform.toString(transform),
- transition,
- opacity: isDragging ? 0.5 : 1,
- }
- const toggleFavorite = useThreads((state) => state.toggleFavorite)
const deleteThread = useThreads((state) => state.deleteThread)
const renameThread = useThreads((state) => state.renameThread)
const updateThread = useThreads((state) => state.updateThread)
const getFolderById = useThreadManagement().getFolderById
const { folders } = useThreadManagement()
- const getMessages = useMessages((state) => state.getMessages)
const { t } = useTranslation()
- const [openDropdown, setOpenDropdown] = useState(false)
+ const [renameOpen, setRenameOpen] = useState(false)
const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false)
- const navigate = useNavigate()
- // Check if current route matches this thread's detail page
- const matches = useMatches()
- const isActive = matches.some(
- (match) =>
- match.routeId === '/threads/$threadId' &&
- 'threadId' in match.params &&
- match.params.threadId === thread.id
- )
- const handleClick = (e: MouseEvent<HTMLDivElement>) => {
- if (openDropdown) {
- e.stopPropagation()
- e.preventDefault()
- return
- }
- if (!isDragging) {
- // Only close panel and navigate if the thread is not already active
- if (!isActive) {
- if (isSmallScreen) setLeftPanel(false)
- navigate({ to: route.threadsDetail, params: { threadId: thread.id } })
- }
- }
- }
const plainTitleForRename = useMemo(() => {
- // Basic HTML stripping for simple span tags.
- // If thread.title is undefined or null, treat as empty string before replace.
return (thread.title || '').replace(/<span[^>]*>|<\/span>/g, '')
}, [thread.title])
const availableProjects = useMemo(() => {
return folders
.filter((f) => {
- // Exclude the current project page we're on
if (f.id === currentProjectId) return false
- // Exclude the project this thread is already assigned to
if (f.id === thread.metadata?.project?.id) return false
return true
})
@@ -143,226 +78,144 @@ const SortableItem = memo(
}
}
- const getLastMessageInfo = useMemo(() => {
- const messages = getMessages(thread.id)
- if (messages.length === 0) return null
-
- const lastMessage = messages[messages.length - 1]
- return {
- date: new Date(lastMessage.created_at || 0),
- content: lastMessage.content?.[0]?.text?.value || '',
- }
- }, [getMessages, thread.id])
-
return (
- <div
- ref={setNodeRef}
- style={style}
- {...attributes}
- {...listeners}
- className={cn(
- 'rounded hover:bg-left-panel-fg/10 flex items-center justify-between gap-2 px-1.5 group/thread-list transition-all',
- variant === 'project'
- ? 'mb-2 rounded-lg px-4 border border-main-view-fg/10 bg-main-view-fg/5'
- : 'mb-1',
- isDragging ? 'cursor-move' : 'cursor-pointer',
- isActive && 'bg-left-panel-fg/10'
- )}
- onClick={(e) => handleClick(e)}
- onContextMenu={(e) => {
- e.preventDefault()
- e.stopPropagation()
- setOpenDropdown(true)
- }}
- >
- <div
- className={cn(
- 'pr-2 truncate flex-1',
- variant === 'project' ? 'py-2 cursor-pointer' : 'py-1'
- )}
- >
- <span>{thread.title || t('common:newThread')}</span>
- {variant === 'project' && getLastMessageInfo?.content && (
- <span className="block text-sm text-main-view-fg/60 mt-0.5 truncate">
- {extractThinkingContent(getLastMessageInfo.content)}
- </span>
- )}
- </div>
- <div className="flex items-center">
- <DropdownMenu
- open={openDropdown}
- onOpenChange={(open) => setOpenDropdown(open)}
+ <SidebarMenuItem>
+ <SidebarMenuButton asChild>
+ <Link to="/threads/$threadId" params={{ threadId: thread.id }} className={cn(currentProjectId && "bg-secondary/20 px-4 py-6 hover:bg-secondary/30 rounded-md")}>
+ <span>{thread.title || t('common:newThread')}</span>
+ </Link>
+ </SidebarMenuButton>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <SidebarMenuAction
+ showOnHover
+ className={cn("hover:bg-sidebar-foreground/8", currentProjectId && 'mt-2 mr-2')}
+ >
+ <MoreHorizontal />
+ <span className="sr-only">More</span>
+ </SidebarMenuAction>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ className="w-48"
+ side={isMobile ? 'bottom' : 'right'}
+ align={isMobile ? 'end' : 'start'}
>
- <DropdownMenuTrigger asChild>
- <IconDots
- size={14}
- className={cn(
- 'text-left-panel-fg/60 shrink-0 cursor-pointer px-0.5 -mr-1 data-[state=open]:bg-left-panel-fg/10 rounded group-hover/thread-list:data-[state=closed]:size-5 size-5 data-[state=closed]:size-0',
- variant === 'project' && 'text-main-view-fg/60'
+ <DropdownMenuItem onSelect={() => setRenameOpen(true)}>
+ <Pencil className="size-4" />
+ <span>{t('common:rename')}</span>
+ </DropdownMenuItem>
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger className="gap-2">
+ <Folder className="size-4" />
+ <span>{t('common:projects.addToProject')}</span>
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent className="max-h-60 min-w-44 overflow-y-auto">
+ {availableProjects.length === 0 ? (
+ <DropdownMenuItem disabled>
+ <span className="text-muted-foreground">
+ {t('common:projects.noProjectsAvailable')}
+ </span>
+ </DropdownMenuItem>
+ ) : (
+ availableProjects.map((folder) => (
+ <DropdownMenuItem
+ key={folder.id}
+ onClick={(e) => {
+ e.stopPropagation()
+ assignThreadToProject(thread.id, folder.id)
+ }}
+ >
+ <Folder className="size-4" />
+ <span className="truncate max-w-[200px]">
+ {folder.name}
+ </span>
+ </DropdownMenuItem>
+ ))
)}
- onClick={(e) => {
- e.preventDefault()
- e.stopPropagation()
- }}
- />
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="end" className="min-w-44">
- {thread.isFavorite ? (
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- toggleFavorite(thread.id)
- }}
- >
- <IconStarFilled />
- <span>{t('common:unstar')}</span>
- </DropdownMenuItem>
- ) : (
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ {thread.metadata?.project && (
+ <>
+ <DropdownMenuSeparator />
<DropdownMenuItem
onClick={(e) => {
e.stopPropagation()
- toggleFavorite(thread.id)
+ const projectName = thread.metadata?.project?.name
+ updateThread(thread.id, {
+ metadata: {
+ ...thread.metadata,
+ project: undefined,
+ },
+ })
+ toast.success(
+ `Thread removed from "${projectName}" successfully`
+ )
}}
>
- <IconStar />
- <span>{t('common:star')}</span>
+ <X className="size-4" />
+ <span>Remove from project</span>
</DropdownMenuItem>
- )}
- <RenameThreadDialog
- thread={thread}
- plainTitleForRename={plainTitleForRename}
- onRename={renameThread}
- onDropdownClose={() => setOpenDropdown(false)}
- />
-
- <DropdownMenuSub>
- <DropdownMenuSubTrigger className="gap-2">
- <IconFolder size={16} />
- <span>{t('common:projects.addToProject')}</span>
- </DropdownMenuSubTrigger>
- <DropdownMenuSubContent className="max-h-60 min-w-44 overflow-y-auto">
- {availableProjects.length === 0 ? (
- <DropdownMenuItem disabled>
- <span className="text-left-panel-fg/50">
- {t('common:projects.noProjectsAvailable')}
- </span>
- </DropdownMenuItem>
- ) : (
- availableProjects.map((folder) => (
- <DropdownMenuItem
- key={folder.id}
- onClick={(e) => {
- e.stopPropagation()
- assignThreadToProject(thread.id, folder.id)
- }}
- >
- <IconFolder size={16} />
- <span className="truncate max-w-[200px]">
- {folder.name}
- </span>
- </DropdownMenuItem>
- ))
- )}
- </DropdownMenuSubContent>
- </DropdownMenuSub>
- {thread.metadata?.project && (
- <>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- // Remove project from metadata
- const projectName = thread.metadata?.project?.name
- updateThread(thread.id, {
- metadata: {
- ...thread.metadata,
- project: undefined,
- },
- })
- toast.success(
- `Thread removed from "${projectName}" successfully`
- )
- }}
- >
- <IconX size={16} />
- <span>Remove from project</span>
- </DropdownMenuItem>
- </>
- )}
- <DropdownMenuSeparator />
- <DropdownMenuItem
- onSelect={(e) => {
- e.preventDefault()
- e.stopPropagation()
- setDeleteConfirmOpen(true)
- setOpenDropdown(false)
- }}
- >
- <IconTrash />
- <span>{t('common:delete')}</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- <DeleteThreadDialog
- thread={thread}
- onDelete={deleteThread}
- onDropdownClose={() => setOpenDropdown(false)}
- variant={variant}
- open={deleteConfirmOpen}
- onOpenChange={setDeleteConfirmOpen}
- withoutTrigger
- />
- </div>
- </div>
+ </>
+ )}
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ onSelect={() => {
+ setDeleteConfirmOpen(true)
+ }}
+ >
+ <Trash2 className="size-4" />
+ <span>{t('common:delete')}</span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+
+ <RenameThreadDialog
+ thread={thread}
+ plainTitleForRename={plainTitleForRename}
+ onRename={renameThread}
+ open={renameOpen}
+ onOpenChange={setRenameOpen}
+ withoutTrigger
+ />
+
+ <DeleteThreadDialog
+ thread={thread}
+ onDelete={deleteThread}
+ open={deleteConfirmOpen}
+ onOpenChange={setDeleteConfirmOpen}
+ withoutTrigger
+ />
+ </SidebarMenuItem>
)
}
)
type ThreadListProps = {
threads: Thread[]
- isFavoriteSection?: boolean
- variant?: 'default' | 'project'
- showDate?: boolean
currentProjectId?: string
}
-function ThreadList({
- threads,
- variant = 'default',
- currentProjectId,
-}: ThreadListProps) {
+function ThreadList({ threads, currentProjectId }: ThreadListProps) {
+ const { isMobile } = useSidebar()
+
const sortedThreads = useMemo(() => {
- return threads.sort((a, b) => {
+ return [...threads].sort((a, b) => {
return (b.updated || 0) - (a.updated || 0)
})
}, [threads])
- const sensors = useSensors(
- useSensor(PointerSensor, {
- activationConstraint: {
- delay: 200,
- tolerance: 5,
- },
- }),
- useSensor(KeyboardSensor)
- )
-
return (
- <DndContext sensors={sensors} collisionDetection={closestCenter}>
- <SortableContext
- items={sortedThreads.map((t) => t.id)}
- strategy={verticalListSortingStrategy}
- >
- {sortedThreads.map((thread, index) => (
- <SortableItem
- key={index}
- thread={thread}
- variant={variant}
- currentProjectId={currentProjectId}
- />
- ))}
- </SortableContext>
- </DndContext>
+ <>
+ {sortedThreads.map((thread) => (
+ <ThreadItem
+ key={thread.id}
+ thread={thread}
+ isMobile={isMobile}
+ currentProjectId={currentProjectId}
+ />
+ ))}
+ </>
)
}
diff --git a/web-app/src/containers/ThreadScrollBehaviorSwitcher.tsx b/web-app/src/containers/ThreadScrollBehaviorSwitcher.tsx
deleted file mode 100644
index c6c1fb817..000000000
--- a/web-app/src/containers/ThreadScrollBehaviorSwitcher.tsx
+++ /dev/null
@@ -1,577 +0,0 @@
-import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
-import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
-import { THREAD_SCROLL_BEHAVIOR } from '@/constants/threadScroll'
-import { cn } from '@/lib/utils'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { IconCircleCheckFilled } from '@tabler/icons-react'
-
-export function ThreadScrollBehaviorSwitcher() {
- const { threadScrollBehavior, setThreadScrollBehavior } = useInterfaceSettings()
- const { t } = useTranslation()
-
- const isFlowSelected = threadScrollBehavior === THREAD_SCROLL_BEHAVIOR.FLOW
- const isStickySelected = threadScrollBehavior === THREAD_SCROLL_BEHAVIOR.STICKY
- const placeholder = t('common:placeholder.chatInput')
-
- return (
- <div className="flex flex-col sm:flex-row sm:gap-4">
- <ScrollOption
- title={t('settings:interface.threadScrollFlowTitle')}
- hint={t('settings:interface.threadScrollFlowHint')}
- placeholder={placeholder}
- isSelected={isFlowSelected}
- onSelect={() => setThreadScrollBehavior(THREAD_SCROLL_BEHAVIOR.FLOW)}
- preview={<FlowScrollPreview placeholder={placeholder} />}
- />
- <ScrollOption
- title={t('settings:interface.threadScrollStickyTitle')}
- hint={t('settings:interface.threadScrollStickyHint')}
- placeholder={placeholder}
- isSelected={isStickySelected}
- onSelect={() => setThreadScrollBehavior(THREAD_SCROLL_BEHAVIOR.STICKY)}
- preview={<StickyScrollPreview placeholder={placeholder} />}
- />
- </div>
- )
-}
-
-type ScrollOptionProps = {
- title: string
- hint: string
- placeholder: string
- isSelected: boolean
- onSelect: () => void
- preview?: ReactNode
-}
-
-function ScrollOption({
- title,
- hint,
- placeholder,
- isSelected,
- onSelect,
- preview,
-}: ScrollOptionProps) {
- return (
- <button
- className={cn(
- 'w-full overflow-hidden border border-main-view-fg/10 rounded-md my-2 pb-2 cursor-pointer text-left transition-colors duration-200',
- isSelected && 'border-accent'
- )}
- onClick={onSelect}
- type="button"
- >
- <div className="flex items-center justify-between px-4 pt-3 pb-2 bg-main-view-fg/10 -mt-1">
- <span className="font-medium text-xs font-sans">{title}</span>
- {isSelected && (
- <IconCircleCheckFilled className="size-4 text-accent" />
- )}
- </div>
- <div className="px-6 py-5 space-y-2">
- {preview ?? (
- <>
- <div className="flex flex-col gap-2">
- <PlaceholderLine />
- <PlaceholderLine width="92%" />
- <PlaceholderLine width="76%" />
- </div>
- <div className="bg-main-view-fg/10 border border-main-view-fg/15 h-9 px-4 rounded-md flex items-center text-xs text-main-view-fg/55">
- <span className="line-clamp-1">{placeholder}</span>
- </div>
- </>
- )}
- <div className="text-[11px] text-main-view-fg/55 leading-snug border border-dashed border-main-view-fg/15 rounded-md px-3 py-2 bg-main-view-fg/7">
- {hint}
- </div>
- </div>
- </button>
- )
-}
-
-function PlaceholderLine({ width = '100%' }: { width?: string }) {
- return (
- <div className="h-2 rounded-full bg-main-view-fg/15" style={{ width }} />
- )
-}
-
-const FLOW_HISTORY_FRAMES = [
- { id: 'history-1', widths: ['82%', '68%', '46%'] },
- { id: 'history-2', widths: ['78%', '60%', '38%'] },
- { id: 'history-3', widths: ['70%', '52%'] },
-] as const
-
-const createFlowHistoryFrames = () =>
- Array.from(FLOW_HISTORY_FRAMES, (frame) => ({ ...frame }))
-
-const FLOW_TYPING_TEXT = 'Jan, help me summarize this'
-// Mirror Flow's history reveal timing so the typing cadence stays aligned.
-const STICKY_USER_MESSAGE_DELAY =
- FLOW_HISTORY_FRAMES.length * 160 + 380
-// Extend sticky preview loop so it resets in sync with Flow preview.
-const STICKY_LOOP_ALIGNMENT_DELAY = 900
-
-function FlowScrollPreview({ placeholder }: { placeholder: string }) {
- const [step, setStep] = useState(0)
- const [typedText, setTypedText] = useState('')
- const [sentMessage, setSentMessage] = useState('')
- const [streamProgress, setStreamProgress] = useState(0)
- const [historyMessages, setHistoryMessages] = useState<
- Array<{ id: string; widths: readonly string[] }>
- >(createFlowHistoryFrames)
- const [exitingHistoryIds, setExitingHistoryIds] = useState<string[]>([])
- const [userMessageVisible, setUserMessageVisible] = useState(false)
- const [streamStage, setStreamStage] = useState<'idle' | 'streaming' | 'complete'>('idle')
-
- const timersRef = useRef<number[]>([])
- const historyRef = useRef(historyMessages)
-
- useEffect(() => {
- historyRef.current = historyMessages
- }, [historyMessages])
-
- useEffect(() => {
- return () => {
- timersRef.current.forEach((timer) => clearTimeout(timer))
- timersRef.current = []
- }
- }, [])
-
- useEffect(() => {
- timersRef.current.forEach((timer) => clearTimeout(timer))
- timersRef.current = []
-
- if (step === 0) {
- setHistoryMessages(createFlowHistoryFrames())
- setExitingHistoryIds([])
- setTypedText('')
- setSentMessage('')
- setUserMessageVisible(false)
- setStreamStage('idle')
- setStreamProgress(0)
-
- const timer = window.setTimeout(() => setStep(1), 1200)
- timersRef.current.push(timer)
- return
- }
-
- if (step === 1) {
- setTypedText('')
- let index = 0
- const type = () => {
- index += 1
- setTypedText(FLOW_TYPING_TEXT.slice(0, index))
- if (index < FLOW_TYPING_TEXT.length) {
- const timer = window.setTimeout(type, 60)
- timersRef.current.push(timer)
- } else {
- const timer = window.setTimeout(() => setStep(2), 300)
- timersRef.current.push(timer)
- }
- }
- const start = window.setTimeout(type, 160)
- timersRef.current.push(start)
- return
- }
-
- if (step === 2) {
- const ids = historyRef.current.map((msg) => msg.id)
- if (ids.length === 0) {
- const timer = window.setTimeout(() => {
- setSentMessage(FLOW_TYPING_TEXT)
- setUserMessageVisible(true)
- setStep(3)
- }, 120)
- timersRef.current.push(timer)
- return
- }
-
- ids.forEach((id, index) => {
- const exitTimer = window.setTimeout(() => {
- setExitingHistoryIds((prev) =>
- prev.includes(id) ? prev : [...prev, id]
- )
- }, index * 160)
- timersRef.current.push(exitTimer)
-
- const removeTimer = window.setTimeout(() => {
- setHistoryMessages((prev) => prev.filter((msg) => msg.id !== id))
- }, index * 160 + 320)
- timersRef.current.push(removeTimer)
- })
-
- const revealDelay = ids.length * 160 + 380
- const revealTimer = window.setTimeout(() => {
- setSentMessage(FLOW_TYPING_TEXT)
- setUserMessageVisible(true)
- setExitingHistoryIds([])
- setStep(3)
- }, revealDelay)
- timersRef.current.push(revealTimer)
- return
- }
-
- if (step === 3) {
- setStreamStage('streaming')
- setStreamProgress(0)
-
- const tick = (value: number) => {
- setStreamProgress(value)
- if (value >= 100) {
- const timer = window.setTimeout(() => setStep(4), 400)
- timersRef.current.push(timer)
- } else {
- const timer = window.setTimeout(() => tick(value + 20), 140)
- timersRef.current.push(timer)
- }
- }
-
- const start = window.setTimeout(() => tick(20), 180)
- timersRef.current.push(start)
- return
- }
-
- if (step === 4) {
- setStreamStage('complete')
- const timer = window.setTimeout(() => setStep(0), 2200)
- timersRef.current.push(timer)
- }
- }, [step])
-
- const messageStack = useMemo(() => {
- const stack: ReactNode[] = []
-
- if (streamStage !== 'idle') {
- stack.unshift(
- <AssistantStreamBubble
- key="stream"
- progress={streamProgress}
- state={streamStage}
- />
- )
- }
-
- stack.unshift(
- <UserBubble
- key="user"
- text={sentMessage}
- visible={userMessageVisible}
- />
- )
-
- if (historyMessages.length > 0) {
- stack.push(
- <HistoryContainer key="history">
- {historyMessages.map((msg) => (
- <HistoryBubble
- key={msg.id}
- widths={msg.widths}
- exiting={exitingHistoryIds.includes(msg.id)}
- />
- ))}
- </HistoryContainer>
- )
- }
-
- return stack
- }, [
- exitingHistoryIds,
- historyMessages,
- sentMessage,
- streamProgress,
- streamStage,
- userMessageVisible,
- ])
-
- return (
- <div className="space-y-3 select-none">
- <div className="rounded-md border border-main-view-fg/10 bg-main-view-fg/5 p-3 h-[152px] overflow-hidden">
- <div className="flex h-full flex-col justify-start gap-2">
- {messageStack}
- </div>
- </div>
- <div className="bg-main-view-fg/10 border border-main-view-fg/15 h-9 px-4 rounded-md flex items-center text-xs text-main-view-fg/60 transition-all duration-500">
- {step === 1 ? (
- <div className="flex items-center gap-1 text-main-view-fg/80 font-medium truncate">
- <span className="truncate">{typedText}</span>
- <span className="inline-block w-[2px] h-4 bg-main-view-fg/60 animate-pulse" />
- </div>
- ) : (
- <span className="line-clamp-1">{placeholder}</span>
- )}
- </div>
- </div>
- )
-}
-
-function StickyScrollPreview({ placeholder }: { placeholder: string }) {
- const [step, setStep] = useState(0)
- const [typedText, setTypedText] = useState('')
- const [messages, setMessages] = useState<
- Array<{ id: string; type: 'assistant' | 'user'; widths: readonly string[] }>
- >(
- () =>
- createFlowHistoryFrames().map((frame) => ({
- ...frame,
- type: 'assistant' as const,
- }))
- )
- const [exitingIds, setExitingIds] = useState<string[]>([])
- const exitingIdsRef = useRef(exitingIds)
- const timersRef = useRef<number[]>([])
- const MAX_ASSISTANTS = FLOW_HISTORY_FRAMES.length
-
- useEffect(() => {
- exitingIdsRef.current = exitingIds
- }, [exitingIds])
-
- useEffect(() => {
- timersRef.current.forEach((timer) => clearTimeout(timer))
- timersRef.current = []
-
- if (step === 0) {
- setMessages(
- createFlowHistoryFrames().map((frame) => ({
- ...frame,
- type: 'assistant' as const,
- }))
- )
- setTypedText('')
- setExitingIds([])
- const timer = window.setTimeout(() => setStep(1), 1200)
- timersRef.current.push(timer)
- return
- }
-
- if (step === 1) {
- setTypedText('')
- let index = 0
- const type = () => {
- index += 1
- setTypedText(FLOW_TYPING_TEXT.slice(0, index))
- if (index < FLOW_TYPING_TEXT.length) {
- const t = window.setTimeout(type, 60)
- timersRef.current.push(t)
- } else {
- const t = window.setTimeout(() => setStep(2), 300)
- timersRef.current.push(t)
- }
- }
- const start = window.setTimeout(type, 160)
- timersRef.current.push(start)
- return
- }
-
- if (step === 2) {
- setMessages((prev) => {
- const alreadyHasUser = prev.some((msg) => msg.type === 'user')
- if (alreadyHasUser) return prev
- return [
- ...prev,
- {
- id: 'user-message',
- type: 'user',
- widths: [FLOW_TYPING_TEXT],
- },
- ]
- })
-
- const timer = window.setTimeout(() => setStep(3), STICKY_USER_MESSAGE_DELAY)
- timersRef.current.push(timer)
- return
- }
-
- if (step === 3) {
- const newAssistantMessages: Array<{ id: string; type: 'assistant'; widths: readonly string[] }> = [
- { id: 'assistant-stream-1', type: 'assistant', widths: ['64%', '52%', '36%'] },
- { id: 'assistant-stream-2', type: 'assistant', widths: ['58%', '40%'] },
- { id: 'assistant-stream-3', type: 'assistant', widths: ['62%', '53%', '42%', '24%'] },
- ]
-
- newAssistantMessages.forEach((message, index) => {
- const timer = window.setTimeout(() => {
- setMessages((prev) => {
- const updated = [...prev, message]
-
- const assistantCount = updated.filter(
- (item) => item.type === 'assistant'
- ).length
-
- if (assistantCount > MAX_ASSISTANTS) {
- const target = updated.find(
- (item) =>
- item.type === 'assistant' &&
- item.id !== message.id &&
- !exitingIdsRef.current.includes(item.id)
- )
-
- if (target) {
- setExitingIds((current) =>
- current.includes(target.id)
- ? current
- : [...current, target.id]
- )
-
- const removalTimer = window.setTimeout(() => {
- setMessages((current) =>
- current.filter((item) => item.id !== target.id)
- )
- setExitingIds((current) =>
- current.filter((id) => id !== target.id)
- )
- }, 260)
-
- timersRef.current.push(removalTimer)
- }
- }
-
- return updated
- })
-
- if (index === newAssistantMessages.length - 1) {
- const loopTimer = window.setTimeout(
- () => setStep(0),
- 2000 + STICKY_LOOP_ALIGNMENT_DELAY
- )
- timersRef.current.push(loopTimer)
- }
- }, index * 220)
- timersRef.current.push(timer)
- })
- }
- }, [step, MAX_ASSISTANTS])
-
- useEffect(() => {
- return () => {
- timersRef.current.forEach((timer) => clearTimeout(timer))
- timersRef.current = []
- }
- }, [])
-
- return (
- <div className="space-y-3 select-none">
- <div className="rounded-md border border-main-view-fg/10 bg-main-view-fg/5 p-3 h-[152px] overflow-hidden">
- <div className="flex h-full flex-col justify-end gap-2">
- {messages.map((message) => {
- if (message.type === 'user') {
- return (
- <div
- key={message.id}
- className={cn(
- 'rounded-md border border-main-view-fg/20 bg-main-view px-3 py-2 text-xs font-medium text-main-view-fg shadow-sm transition-all duration-500',
- typeof message.widths[0] === 'string' && message.widths[0] === FLOW_TYPING_TEXT
- ? 'opacity-100 translate-y-0'
- : 'opacity-80 translate-y-0'
- )}
- >
- {message.widths[0]}
- </div>
- )
- }
-
- return (
- <HistoryBubble
- key={message.id}
- widths={message.widths}
- exiting={exitingIds.includes(message.id)}
- collapse={false}
- />
- )
- })}
- </div>
- </div>
- <div className="bg-main-view-fg/10 border border-main-view-fg/15 h-9 px-4 rounded-md flex items-center text-xs text-main-view-fg/60 transition-all duration-500">
- {step === 1 ? (
- <div className="flex items-center gap-1 text-main-view-fg/80 font-medium truncate">
- <span className="truncate">{typedText}</span>
- <span className="inline-block w-[2px] h-4 bg-main-view-fg/60 animate-pulse" />
- </div>
- ) : (
- <span className="line-clamp-1">{placeholder}</span>
- )}
- </div>
- </div>
- )
-}
-
-function HistoryContainer({ children }: { children: ReactNode }) {
- return <>{children}</>
-}
-
-function HistoryBubble({
- widths,
- exiting,
- collapse = true,
-}: {
- widths: readonly string[]
- exiting: boolean
- collapse?: boolean
-}) {
- return (
- <div
- className={cn(
- 'overflow-hidden rounded-md border border-main-view-fg/10 bg-main-view-fg/10 p-3 space-y-2 transition-all duration-500 ease-in-out',
- exiting &&
- (collapse
- ? 'max-h-0 opacity-0 -translate-y-3 p-0 border-transparent'
- : 'opacity-0')
- )}
- >
- {widths.map((width, idx) => (
- <div
- key={idx}
- className="h-2 rounded-full bg-main-view-fg/15"
- style={{ width }}
- />
- ))}
- </div>
- )
-}
-
-function UserBubble({ text, visible }: { text: string; visible: boolean }) {
- return (
- <div
- className={cn(
- 'overflow-hidden rounded-md border border-main-view-fg/20 bg-main-view px-3 text-xs font-medium text-main-view-fg shadow-sm transition-all duration-500 ease-out',
- visible
- ? 'opacity-100 translate-y-0 max-h-[64px] py-2'
- : 'pointer-events-none opacity-0 -translate-y-3 max-h-0 py-0 border-transparent'
- )}
- >
- {text}
- </div>
- )
-}
-
-function AssistantStreamBubble({
- progress,
- state,
-}: {
- progress: number
- state: 'idle' | 'streaming' | 'complete'
-}) {
- const isVisible = state !== 'idle'
- const isComplete = state === 'complete'
-
- return (
- <div
- className={cn(
- 'overflow-hidden rounded-md border border-main-view-fg/10 bg-main-view-fg/10 p-3 space-y-2 transition-all duration-500 ease-out',
- isVisible
- ? 'opacity-100 translate-y-0 max-h-[120px]'
- : 'pointer-events-none opacity-0 -translate-y-3 max-h-0 p-0 border-transparent'
- )}
- >
- <div className="h-2 rounded-full bg-main-view-fg/25 overflow-hidden">
- <div
- className="h-full rounded-full bg-main-view-fg/60 transition-all duration-200 ease-out"
- style={{ width: `${isComplete ? 100 : Math.min(progress, 100)}%` }}
- />
- </div>
- <div className="flex gap-2">
- <div className="h-2 w-20 rounded-full bg-main-view-fg/20" />
- <div className="h-2 w-16 rounded-full bg-main-view-fg/15" />
- </div>
- <div className="h-2 w-32 rounded-full bg-main-view-fg/15" />
- </div>
- )
-}
diff --git a/web-app/src/containers/TokenSpeedIndicator.tsx b/web-app/src/containers/TokenSpeedIndicator.tsx
index e33252a7b..f1a9c4ad4 100644
--- a/web-app/src/containers/TokenSpeedIndicator.tsx
+++ b/web-app/src/containers/TokenSpeedIndicator.tsx
@@ -65,13 +65,13 @@ export const TokenSpeedIndicator = memo(
if (!shouldShow) return
return (
- <div className="flex items-center gap-2 text-main-view-fg/60 text-xs">
+ <div className="flex items-center gap-2 text-muted-foreground text-xs">
<div className="flex items-center gap-1">
<Gauge size={16} />
<span>{displaySpeed} tokens/sec</span>
</div>
{displayTokenCount > 0 && (
- <span className="text-main-view-fg/40">
+ <span className="text-muted-foreground">
({displayTokenCount} tokens)
</span>
)}
diff --git a/web-app/src/containers/__tests__/LeftPanel.test.tsx b/web-app/src/containers/__tests__/LeftPanel.test.tsx
deleted file mode 100644
index 09d9c5fba..000000000
--- a/web-app/src/containers/__tests__/LeftPanel.test.tsx
+++ /dev/null
@@ -1,292 +0,0 @@
-import { describe, it, expect, vi, beforeEach } from 'vitest'
-import { render, screen } from '@testing-library/react'
-import LeftPanel from '../LeftPanel'
-import { useLeftPanel } from '@/hooks/useLeftPanel'
-
-// Mock global constants
-Object.defineProperty(global, 'IS_WINDOWS', { value: false, writable: true })
-Object.defineProperty(global, 'IS_LINUX', { value: false, writable: true })
-Object.defineProperty(global, 'IS_WEB_APP', { value: false, writable: true })
-Object.defineProperty(global, 'IS_MACOS', { value: false, writable: true })
-
-// Mock all dependencies
-vi.mock('@tanstack/react-router', () => ({
- Link: ({ to, children, className }: any) => (
- <a href={to} className={className} data-testid={`link-${to}`}>
- {children}
- </a>
- ),
- useNavigate: () => vi.fn(),
- useRouterState: vi.fn((options) => {
- if (options && options.select) {
- return options.select({ location: { pathname: '/' } })
- }
- return { location: { pathname: '/' } }
- }),
-}))
-
-vi.mock('@/hooks/useLeftPanel', () => ({
- useLeftPanel: vi.fn(() => ({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })),
-}))
-
-vi.mock('@/hooks/useThreads', () => ({
- useThreads: (selector: any) => {
- const state = {
- threads: [],
- searchTerm: '',
- setSearchTerm: vi.fn(),
- deleteThread: vi.fn(),
- deleteAllThreads: vi.fn(),
- unstarAllThreads: vi.fn(),
- clearThreads: vi.fn(),
- getFilteredThreads: vi.fn(() => []),
- filteredThreads: [],
- currentThreadId: null,
- }
- return selector ? selector(state) : state
- },
-}))
-
-vi.mock('@/hooks/useThreadManagement', () => {
- const mockStore = {
- folders: [],
- addFolder: vi.fn(async (name: string) => ({
- id: 'project-id',
- name,
- updated_at: Date.now(),
- created_at: Date.now(),
- })),
- updateFolder: vi.fn(),
- deleteFolder: vi.fn(),
- deleteFolderWithThreads: vi.fn(),
- setFolders: vi.fn(),
- getFolderById: vi.fn(),
- getProjectById: vi.fn(),
- }
-
- return {
- useThreadManagement: () => mockStore,
- }
-})
-
-vi.mock('@/hooks/useMediaQuery', () => ({
- useSmallScreen: vi.fn(() => false),
-}))
-
-vi.mock('@/hooks/useClickOutside', () => ({
- useClickOutside: () => null,
-}))
-
-vi.mock('./ThreadList', () => ({
- default: () => <div data-testid="thread-list">ThreadList</div>,
-}))
-
-vi.mock('@/containers/DownloadManegement', () => ({
- DownloadManagement: () => <div data-testid="download-management">DownloadManagement</div>,
-}))
-
-vi.mock('@/i18n/react-i18next-compat', () => ({
- useTranslation: () => ({
- t: (key: string) => key,
- }),
-}))
-
-
-vi.mock('@/hooks/useEvent', () => ({
- useEvent: () => ({
- on: vi.fn(),
- off: vi.fn(),
- }),
-}))
-
-vi.mock('@/hooks/useAuth', () => ({
- useAuth: () => ({
- isAuthenticated: false,
- }),
-}))
-
-vi.mock('@/hooks/useDownloadStore', () => ({
- useDownloadStore: () => ({
- downloads: {},
- localDownloadingModels: new Set(),
- }),
-}))
-
-// Mock the auth components
-vi.mock('@/containers/auth/AuthLoginButton', () => ({
- AuthLoginButton: () => <div data-testid="auth-login-button">Login</div>,
-}))
-
-vi.mock('@/containers/auth/UserProfileMenu', () => ({
- UserProfileMenu: () => <div data-testid="user-profile-menu">Profile</div>,
-}))
-
-// Mock the dialogs
-vi.mock('@/containers/dialogs', () => ({
- DeleteAllThreadsDialog: () => <div data-testid="delete-all-threads-dialog">Dialog</div>,
- SearchDialog: ({ open }: { open: boolean }) => open ? <div data-testid="search-dialog">SearchDialog</div> : null,
-}))
-
-// Mock the store
-vi.mock('@/store/useAppState', () => ({
- useAppState: () => ({
- setLeftPanel: vi.fn(),
- }),
-}))
-
-// Mock platform features
-vi.mock('@/lib/platform/const', () => ({
- PlatformFeatures: {
- ASSISTANTS: true,
- MODEL_HUB: true,
- AUTHENTICATION: false,
- projects: true,
- },
-}))
-
-// Mock route constants
-vi.mock('@/constants/routes', () => ({
- route: {
- home: '/',
- assistant: '/assistant',
- hub: {
- index: '/hub',
- },
- settings: {
- general: '/settings',
- index: '/settings',
- },
- },
-}))
-
-describe('LeftPanel', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- })
-
- it('should render when panel is open', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- // Check that the panel is rendered (it should contain some basic elements)
- expect(screen.getByText('common:search')).toBeDefined()
- })
-
- it('should hide panel when closed', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: false,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- // When panel is closed, it should still render but may have different styling
- // The important thing is that the test doesn't fail - the visual hiding is handled by CSS
- const panel = document.querySelector('aside')
- expect(panel).not.toBeNull()
- expect(panel?.tagName).toBe('ASIDE')
- })
-
- it('should render main menu items', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- expect(screen.getByText('common:newChat')).toBeDefined()
- expect(screen.getByText('common:settings')).toBeDefined()
- // Note: assistants and hub may be filtered by platform features
- })
-
- it('should render search button', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- const searchButton = screen.getByText('common:search')
- expect(searchButton).toBeDefined()
- })
-
- it('should render download management component', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- expect(screen.getByTestId('download-management')).toBeDefined()
- })
-
- it('should have proper structure when open', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- // Check that basic structure exists
- const searchButton = screen.getByText('common:search')
- expect(searchButton).toBeDefined()
-
- const downloadComponent = screen.getByTestId('download-management')
- expect(downloadComponent).toBeDefined()
- })
-
- it('should render menu navigation links', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- // Check for navigation elements that are actually rendered
- expect(screen.getByText('common:newChat')).toBeDefined()
- expect(screen.getByText('common:settings')).toBeDefined()
- })
-
- it('should have sidebar toggle functionality', () => {
- vi.mocked(useLeftPanel).mockReturnValue({
- open: true,
- setLeftPanel: vi.fn(),
- toggle: vi.fn(),
- close: vi.fn(),
- })
-
- render(<LeftPanel />)
-
- // Check that the sidebar toggle icon is present by looking for the IconLayoutSidebar
- const toggleButton = document.querySelector('svg.tabler-icon-layout-sidebar')
- expect(toggleButton).not.toBeNull()
- })
-})
diff --git a/web-app/src/containers/__tests__/ModelCombobox.test.tsx b/web-app/src/containers/__tests__/ModelCombobox.test.tsx
index 1c0815549..3b4799839 100644
--- a/web-app/src/containers/__tests__/ModelCombobox.test.tsx
+++ b/web-app/src/containers/__tests__/ModelCombobox.test.tsx
@@ -493,7 +493,7 @@ describe('ModelCombobox', () => {
await waitFor(() => {
const secondModel = screen.getByText('gpt-4')
const modelElement = secondModel.closest('[data-model]')
- expect(modelElement).toHaveClass('bg-main-view-fg/20')
+ expect(modelElement).toHaveClass('bg-secondary')
})
})
diff --git a/web-app/src/containers/__tests__/SettingsMenu.test.tsx b/web-app/src/containers/__tests__/SettingsMenu.test.tsx
index 31ee86c9d..416c8e3d3 100644
--- a/web-app/src/containers/__tests__/SettingsMenu.test.tsx
+++ b/web-app/src/containers/__tests__/SettingsMenu.test.tsx
@@ -1,9 +1,8 @@
-import { render, screen, fireEvent, waitFor } from '@testing-library/react'
+import { render, screen } from '@testing-library/react'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import userEvent from '@testing-library/user-event'
import SettingsMenu from '../SettingsMenu'
import { useNavigate, useMatches } from '@tanstack/react-router'
-import { useGeneralSetting } from '@/hooks/useGeneralSetting'
import { useModelProvider } from '@/hooks/useModelProvider'
// Mock global platform constants - simulate desktop (Tauri) environment
@@ -11,33 +10,6 @@ Object.defineProperty(global, 'IS_IOS', { value: false, writable: true })
Object.defineProperty(global, 'IS_ANDROID', { value: false, writable: true })
Object.defineProperty(global, 'IS_WEB_APP', { value: false, writable: true })
-// Mock platform features
-vi.mock('@/lib/platform/const', () => ({
- PlatformFeatures: {
- hardwareMonitoring: true,
- shortcut: true, // Desktop has shortcuts enabled
- localInference: true,
- localApiServer: true,
- modelHub: true,
- systemIntegrations: true,
- httpsProxy: true,
- defaultProviders: true,
- analytics: true,
- webAutoModelSelection: false,
- modelProviderSettings: true,
- mcpAutoApproveTools: false,
- mcpServersSettings: true,
- extensionsSettings: true,
- assistants: true,
- authentication: false,
- googleAnalytics: false,
- alternateShortcutBindings: false,
- firstMessagePersistedThread: false,
- temporaryChat: false,
- projects: true,
- },
-}))
-
// Mock dependencies
vi.mock('@tanstack/react-router', () => ({
Link: ({ children, to, className }: any) => (
@@ -113,43 +85,47 @@ describe('SettingsMenu', () => {
expect(screen.getByText('common:interface')).toBeInTheDocument()
expect(screen.getByText('common:privacy')).toBeInTheDocument()
expect(screen.getByText('common:modelProviders')).toBeInTheDocument()
- // Platform-specific features tested separately
})
- it('renders keyboard shortcuts on desktop platforms', () => {
- // This test assumes desktop platform (mocked in setup with shortcut: true)
+ it('renders keyboard shortcuts and other settings', () => {
render(<SettingsMenu />)
expect(screen.getByText('common:keyboardShortcuts')).toBeInTheDocument()
expect(screen.getByText('common:hardware')).toBeInTheDocument()
expect(screen.getByText('common:local_api_server')).toBeInTheDocument()
expect(screen.getByText('common:https_proxy')).toBeInTheDocument()
- expect(screen.getByText('common:extensions')).toBeInTheDocument()
expect(screen.getByText('common:mcp-servers')).toBeInTheDocument()
})
it('shows provider expansion chevron when providers are active', () => {
render(<SettingsMenu />)
+ // There should be at least one button (the chevron)
const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- expect(chevron).toBeInTheDocument()
+ expect(chevronButtons.length).toBeGreaterThan(0)
})
- it('expands providers submenu when chevron is clicked', async () => {
+ it('shows expanded providers by default', () => {
+ render(<SettingsMenu />)
+
+ // Providers should be expanded by default (expandedProviders starts as true)
+ expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
+ expect(screen.getByTestId('provider-avatar-llama.cpp')).toBeInTheDocument()
+ })
+
+ it('collapses providers submenu when chevron is clicked', async () => {
const user = userEvent.setup()
render(<SettingsMenu />)
+ // Providers should be visible initially
+ expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
+
+ // Click the chevron to collapse
const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- if (!chevron) throw new Error('Chevron button not found')
+ const chevron = chevronButtons[0]
await user.click(chevron)
- expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
- expect(screen.getByTestId('provider-avatar-llama.cpp')).toBeInTheDocument()
+ // After clicking, providers should be hidden
+ expect(screen.queryByTestId('provider-avatar-openai')).not.toBeInTheDocument()
})
it('auto-expands providers when on provider route', () => {
@@ -163,12 +139,9 @@ describe('SettingsMenu', () => {
render(<SettingsMenu />)
expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
- // llama.cpp provider may be filtered out based on certain conditions
})
- it('highlights active provider in submenu', async () => {
- const user = userEvent.setup()
-
+ it('highlights active provider in submenu', () => {
vi.mocked(useMatches).mockReturnValue([
{
routeId: '/settings/providers/$providerName',
@@ -178,13 +151,6 @@ describe('SettingsMenu', () => {
render(<SettingsMenu />)
- // First expand the providers submenu
- const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- if (chevron) await user.click(chevron)
-
const openaiProvider = screen
.getByTestId('provider-avatar-openai')
.closest('div')
@@ -195,69 +161,16 @@ describe('SettingsMenu', () => {
const user = userEvent.setup()
render(<SettingsMenu />)
- // First expand the providers
- const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- if (!chevron) throw new Error('Chevron button not found')
- await user.click(chevron)
-
- // Then click on a provider
+ // Providers are expanded by default, so click on a provider directly
const openaiProvider = screen
.getByTestId('provider-avatar-openai')
- .closest('div')
+ .closest('div[class*="cursor-pointer"]')
await user.click(openaiProvider!)
- expect(mockNavigate).toHaveBeenCalledWith({
- to: '/settings/providers/$providerName',
- params: { providerName: 'openai' },
- })
- })
-
- it('shows mobile menu toggle button', () => {
- render(<SettingsMenu />)
-
- const menuToggle = screen.getByRole('button', {
- name: 'Toggle settings menu',
- })
- expect(menuToggle).toBeInTheDocument()
+ expect(mockNavigate).toHaveBeenCalled()
})
- it('opens mobile menu when toggle is clicked', async () => {
- const user = userEvent.setup()
- render(<SettingsMenu />)
-
- const menuToggle = screen.getByRole('button', {
- name: 'Toggle settings menu',
- })
- await user.click(menuToggle)
-
- // Menu should now be visible
- const menu = screen.getByText('common:general').closest('div')
- expect(menu).toHaveClass('flex')
- })
-
- it('closes mobile menu when X is clicked', async () => {
- const user = userEvent.setup()
- render(<SettingsMenu />)
-
- // Open menu first
- const menuToggle = screen.getByRole('button', {
- name: 'Toggle settings menu',
- })
- await user.click(menuToggle)
-
- // Then close it
- await user.click(menuToggle)
-
- // Just verify the toggle button is still there after clicking twice
- expect(menuToggle).toBeInTheDocument()
- })
-
- it('shows only openai provider during setup remote provider step', async () => {
- const user = userEvent.setup()
-
+ it('hides llama.cpp during setup remote provider step', () => {
vi.mocked(useMatches).mockReturnValue([
{
routeId: '/settings/providers/',
@@ -268,25 +181,15 @@ describe('SettingsMenu', () => {
render(<SettingsMenu />)
- // First expand the providers submenu
- const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- if (chevron) await user.click(chevron)
-
// openai should be visible during remote provider setup
expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
-
- // During the setup_remote_provider step, llama.cpp should be hidden since it's a local provider
- // However, the current test setup suggests it should be visible, indicating the hidden logic
- // might not be working as expected. Let's verify llama.cpp is present.
- expect(screen.getByTestId('provider-avatar-llama.cpp')).toBeInTheDocument()
- })
- it('filters out inactive providers from submenu', async () => {
- const user = userEvent.setup()
+ // llama.cpp should have 'hidden' class during setup_remote_provider step
+ const llamaCpp = screen.getByTestId('provider-avatar-llama.cpp').closest('div[class*="cursor-pointer"]')
+ expect(llamaCpp?.className).toContain('hidden')
+ })
+ it('filters out inactive providers from submenu', () => {
vi.mocked(useModelProvider).mockReturnValue({
providers: [
{
@@ -304,13 +207,6 @@ describe('SettingsMenu', () => {
render(<SettingsMenu />)
- // Expand providers
- const chevronButtons = screen.getAllByRole('button')
- const chevron = chevronButtons.find((button) =>
- button.querySelector('svg.tabler-icon-chevron-right')
- )
- if (chevron) await user.click(chevron)
-
expect(screen.getByTestId('provider-avatar-openai')).toBeInTheDocument()
expect(
screen.queryByTestId('provider-avatar-anthropic')
diff --git a/web-app/src/containers/analytics/PromptAnalytic.tsx b/web-app/src/containers/analytics/PromptAnalytic.tsx
index 425492a31..a5bdac6b3 100644
--- a/web-app/src/containers/analytics/PromptAnalytic.tsx
+++ b/web-app/src/containers/analytics/PromptAnalytic.tsx
@@ -21,31 +21,34 @@ export function PromptAnalytic() {
}
return (
- <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-main-view w-4/5 md:w-100 border border-main-view-fg/8 rounded-lg">
+ <div className="fixed bottom-4 right-4 z-50 p-4 shadow-lg bg-background w-4/5 md:w-100 border rounded-lg">
<div className="flex items-center gap-2">
- <IconFileTextShield className="text-accent" />
- <h2 className="font-medium text-main-view-fg/80">
+ <IconFileTextShield className="text-muted-foreground" />
+ <h2 className="font-medium">
{t('helpUsImproveJan')}
</h2>
</div>
- <p className="mt-2 text-sm text-main-view-fg/70">
+ <p className="mt-2 text-xs text-muted-foreground leading-normal">
We collect anonymous data to understand feature usage. Your chats and
personal information are never tracked. You can change this anytime
in&nbsp;
- <span className="font-medium text-main-view-fg">{`Settings > Privacy.`}</span>
+ <span className="font-medium text-muted-foreground">{`Settings > Privacy.`}</span>
</p>
- <p className="mt-2 text-sm text-main-view-fg/80">
+ <p className="mt-2 text-sm">
Would you like to help us to improve Jan?
</p>
<div className="mt-4 flex justify-end space-x-2">
<Button
- variant="link"
- className="text-main-view-fg/70"
+ variant="ghost"
+ size="sm"
onClick={() => handleProductAnalytics(false)}
>
{t('deny')}
</Button>
- <Button onClick={() => handleProductAnalytics(true)}>
+ <Button
+ size="sm"
+ onClick={() => handleProductAnalytics(true)}
+ >
{t('allow')}
</Button>
</div>
diff --git a/web-app/src/containers/dialogs/AddEditAssistant.tsx b/web-app/src/containers/dialogs/AddEditAssistant.tsx
index 37570a199..8ab73acb6 100644
--- a/web-app/src/containers/dialogs/AddEditAssistant.tsx
+++ b/web-app/src/containers/dialogs/AddEditAssistant.tsx
@@ -258,25 +258,25 @@ export default function AddEditAssistant({
{t('assistants:emoji')}
</label>
<div
- className="border rounded-sm p-1 w-9 h-9 flex items-center justify-center border-main-view-fg/10 cursor-pointer"
+ className="border rounded-sm p-1 size-9 flex items-center justify-center cursor-pointer"
onClick={() => setShowEmojiPicker(!showEmojiPicker)}
ref={emojiPickerTriggerRef}
>
{avatar ? (
<AvatarEmoji
avatar={avatar}
- imageClassName="w-5 h-5 object-contain"
+ imageClassName="size-5 object-contain"
textClassName=""
/>
) : (
- <IconMoodSmile size={18} className="text-main-view-fg/50" />
+ <IconMoodSmile size={18} className="text-muted-foreground" />
)}
</div>
<div className="relative" ref={emojiPickerRef}>
<EmojiPicker
open={showEmojiPicker}
theme={isDark ? ('dark' as Theme) : ('light' as Theme)}
- className="!absolute !z-40 !overflow-y-auto top-2"
+ className="absolute!s z-40! overflow-y-auto! top-2"
height={350}
customEmojis={isDev() ? teamEmoji : []}
lazyLoadEmojis
@@ -339,7 +339,7 @@ export default function AddEditAssistant({
className="resize-none"
rows={4}
/>
- <div className="text-xs text-main-view-fg/60">
+ <div className="text-xs text-muted-foreground">
{t('assistants:instructionsDateHint')}
</div>
</div>
@@ -415,7 +415,7 @@ export default function AddEditAssistant({
}
}}
className={cn(
- 'text-xs bg-main-view-fg/10 py-1 px-2 rounded-sm cursor-pointer',
+ 'text-xs bg-secondary-foreground/5 py-1 px-2 rounded-sm cursor-pointer',
paramsKeys.includes(setting.key) && 'opacity-50'
)}
>
@@ -428,12 +428,13 @@ export default function AddEditAssistant({
<div className="space-y-2">
<div className="flex items-center justify-between">
<label className="text-sm">{t('assistants:parameters')}</label>
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ <Button
+ variant="ghost"
+ size="icon-xs"
onClick={handleAddParameter}
>
- <IconPlus size={18} className="text-main-view-fg/60" />
- </div>
+ <IconPlus size={18} className="text-muted-foreground" />
+ </Button>
</div>
{paramsKeys.map((key, index) => (
@@ -463,7 +464,7 @@ export default function AddEditAssistant({
/>
<IconChevronDown
size={14}
- className="text-main-view-fg/50 absolute right-2 top-1/2 -translate-y-1/2"
+ className="text-muted-foreground absolute right-2 top-1/2 -translate-y-1/2"
/>
</div>
</DropdownMenuTrigger>
@@ -513,7 +514,7 @@ export default function AddEditAssistant({
/>
<IconChevronDown
size={14}
- className="text-main-view-fg/50 absolute right-2 top-1/2 -translate-y-1/2"
+ className="text-muted-foreground absolute right-2 top-1/2 -translate-y-1/2"
/>
</div>
</DropdownMenuTrigger>
@@ -545,7 +546,7 @@ export default function AddEditAssistant({
handleParameterChange(index, e.target.value, 'value')
}
placeholder={t('assistants:jsonValuePlaceholder')}
- className="sm:flex-1 h-[36px] w-full"
+ className="sm:flex-1 h-9 w-full"
/>
) : (
<Input
@@ -556,16 +557,17 @@ export default function AddEditAssistant({
type={paramsTypes[index] === 'number' ? 'number' : 'text'}
step={paramsTypes[index] === 'number' ? 'any' : undefined}
placeholder={t('assistants:value')}
- className="sm:flex-1 h-[36px] w-full"
+ className="sm:flex-1 h-9 w-full"
/>
)}
</div>
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ <Button
+ variant="ghost"
+ size="icon-sm"
onClick={() => handleRemoveParameter(index)}
>
<IconTrash size={18} className="text-destructive" />
- </div>
+ </Button>
</div>
))}
</div>
diff --git a/web-app/src/containers/dialogs/AddEditMCPServer.tsx b/web-app/src/containers/dialogs/AddEditMCPServer.tsx
index c5279edfb..c8c9a77b7 100644
--- a/web-app/src/containers/dialogs/AddEditMCPServer.tsx
+++ b/web-app/src/containers/dialogs/AddEditMCPServer.tsx
@@ -79,9 +79,9 @@ function SortableArgItem({
<div
{...attributes}
{...listeners}
- className="size-6 cursor-move flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-move flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
>
- <IconGripVertical size={18} className="text-main-view-fg/60" />
+ <IconGripVertical size={16} className="text-muted-foreground" />
</div>
<Input
value={value}
@@ -91,10 +91,10 @@ function SortableArgItem({
/>
{canRemove && (
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={onRemove}
>
- <IconTrash size={18} className="text-destructive" />
+ <IconTrash size={16} className="text-destructive" />
</div>
)}
</div>
@@ -387,8 +387,8 @@ export default function AddEditMCPServer({
</span>
<div
className={cn(
- 'size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out',
- isToggled && 'bg-main-view-fg/10 text-accent'
+ 'size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out',
+ isToggled && 'bg-secondary text-primary'
)}
title="Add server by JSON"
onClick={() => setIsToggled(!isToggled)}
@@ -403,7 +403,7 @@ export default function AddEditMCPServer({
<label className="text-sm mb-2 inline-block">
{t('mcp-servers:editJson.placeholder')}
</label>
- <div className="border border-main-view-fg/10 rounded-md overflow-hidden">
+ <div className="border rounded-md overflow-hidden">
<CodeEditor
value={jsonContent}
language="json"
@@ -427,7 +427,7 @@ export default function AddEditMCPServer({
overflowWrap: 'anywhere',
whiteSpace: 'pre-wrap',
}}
- className="w-full !text-sm min-h-[300px] !font-mono"
+ className="w-full text-sm! min-h-[300px] font-mono!"
/>
</div>
{error && <div className="text-destructive text-sm">{error}</div>}
@@ -517,10 +517,10 @@ export default function AddEditMCPServer({
{t('mcp-servers:arguments')}
</label>
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={handleAddArg}
>
- <IconPlus size={18} className="text-main-view-fg/60" />
+ <IconPlus size={16} className="text-muted-foreground" />
</div>
</div>
@@ -563,10 +563,10 @@ export default function AddEditMCPServer({
<div className="flex items-center justify-between">
<label className="text-sm">{t('mcp-servers:envVars')}</label>
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={handleAddEnv}
>
- <IconPlus size={18} className="text-main-view-fg/60" />
+ <IconPlus size={16} className="text-muted-foreground" />
</div>
</div>
@@ -590,10 +590,10 @@ export default function AddEditMCPServer({
/>
{envKeys.length > 1 && (
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={() => handleRemoveEnv(index)}
>
- <IconTrash size={18} className="text-destructive" />
+ <IconTrash size={16} className="text-destructive" />
</div>
)}
</div>
@@ -607,10 +607,10 @@ export default function AddEditMCPServer({
<div className="flex items-center justify-between">
<label className="text-sm">Headers</label>
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={handleAddHeader}
>
- <IconPlus size={18} className="text-main-view-fg/60" />
+ <IconPlus size={16} className="text-muted-foreground" />
</div>
</div>
@@ -637,10 +637,10 @@ export default function AddEditMCPServer({
/>
{headerKeys.length > 1 && (
<div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
+ className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-secondary transition-all duration-200 ease-in-out"
onClick={() => handleRemoveHeader(index)}
>
- <IconTrash size={18} className="text-destructive" />
+ <IconTrash size={16} className="text-destructive" />
</div>
)}
</div>
@@ -664,11 +664,12 @@ export default function AddEditMCPServer({
)}
<DialogFooter>
- <Button variant="link" onClick={() => onOpenChange(false)}>
+ <Button variant="ghost" size="sm" onClick={() => onOpenChange(false)}>
{t('common:cancel')}
</Button>
<Button
onClick={handleSave}
+ size="sm"
disabled={!isToggled && serverName.trim() === ''}
>
{t('mcp-servers:save')}
diff --git a/web-app/src/containers/dialogs/AddModel.tsx b/web-app/src/containers/dialogs/AddModel.tsx
index c44d3a0a5..c1af11c21 100644
--- a/web-app/src/containers/dialogs/AddModel.tsx
+++ b/web-app/src/containers/dialogs/AddModel.tsx
@@ -71,8 +71,8 @@ export const DialogAddModel = ({ provider, trigger }: DialogAddModelProps) => {
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
{trigger || (
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconPlus size={18} className="text-main-view-fg/50" />
+ <div className="size-6 cursor-pointer flex items-center justify-center rounded transition-all duration-200 ease-in-out">
+ <IconPlus size={18} className="text-muted-foreground" />
</div>
)}
</DialogTrigger>
@@ -116,12 +116,12 @@ export const DialogAddModel = ({ provider, trigger }: DialogAddModelProps) => {
{/* Explore models link */}
{provider.explore_models_url && (
- <div className="text-sm text-main-view-fg/70">
+ <div className="text-sm text-muted-foreground">
<a
href={provider.explore_models_url}
target="_blank"
rel="noopener noreferrer"
- className="flex items-center gap-1 hover:underline text-primary"
+ className="flex items-center gap-1 hover:underline"
>
<span>
{t('providers:addModel.exploreModels', {
diff --git a/web-app/src/containers/dialogs/AddProjectDialog.tsx b/web-app/src/containers/dialogs/AddProjectDialog.tsx
index f0fda648c..7cc71bd48 100644
--- a/web-app/src/containers/dialogs/AddProjectDialog.tsx
+++ b/web-app/src/containers/dialogs/AddProjectDialog.tsx
@@ -71,7 +71,6 @@ export default function AddProjectDialog({
} else {
toast.success(t('projects.addProjectDialog.createSuccess', { projectName: trimmedName }))
}
-
setName('')
}
@@ -86,7 +85,7 @@ export default function AddProjectDialog({
return (
<Dialog open={open} onOpenChange={onOpenChange}>
- <DialogContent className="sm:max-w-md">
+ <DialogContent>
<DialogHeader>
<DialogTitle>
{editingKey ? t('projects.addProjectDialog.editTitle') : t('projects.addProjectDialog.createTitle')}
@@ -94,9 +93,6 @@ export default function AddProjectDialog({
</DialogHeader>
<div className="space-y-4">
<div>
- <label className="text-sm font-medium text-main-view-fg/80">
- {t('projects.addProjectDialog.nameLabel')}
- </label>
<Input
value={name}
onChange={(e) => setName(e.target.value)}
@@ -112,7 +108,7 @@ export default function AddProjectDialog({
</div>
</div>
<DialogFooter>
- <Button variant="link" onClick={handleCancel}>
+ <Button variant="ghost" onClick={handleCancel}>
{t('cancel')}
</Button>
<Button onClick={handleSave} disabled={Boolean(isButtonDisabled)}>
diff --git a/web-app/src/containers/dialogs/AppUpdater.tsx b/web-app/src/containers/dialogs/AppUpdater.tsx
index f076cae4a..8fd8ad915 100644
--- a/web-app/src/containers/dialogs/AppUpdater.tsx
+++ b/web-app/src/containers/dialogs/AppUpdater.tsx
@@ -48,15 +48,15 @@ const DialogAppUpdater = () => {
{appUpdateState.isUpdateAvailable && (
<div
className={cn(
- 'fixed z-50 w-[400px] bottom-3 right-3 bg-main-view text-main-view-fg flex items-center justify-center border border-main-view-fg/10 rounded-lg shadow-md'
+ 'fixed z-50 bottom-3 right-3 bg-background flex items-center justify-center border rounded-lg shadow-md'
)}
>
- <div className="px-0 py-4">
+ <div className="px-2 py-4">
<div className="px-4">
<div className="flex items-start gap-2">
<IconDownload
size={20}
- className="shrink-0 text-main-view-fg/60 mt-1"
+ className="shrink-0 text-muted-foreground mt-1"
/>
<div>
<div className="text-base font-medium">
@@ -64,7 +64,7 @@ const DialogAppUpdater = () => {
version: updateState.updateInfo?.version,
})}
</div>
- <div className="mt-1 text-main-view-fg/70 font-normal mb-2">
+ <div className="mt-1 text-muted-foreground font-normal mb-2">
{t('updater:updateAvailable')}
</div>
</div>
@@ -88,7 +88,7 @@ const DialogAppUpdater = () => {
/>
),
h2: ({ ...props }) => (
- <h2 {...props} className="!text-xl !mt-0" />
+ <h2 {...props} className="text-xl! mt-0!" />
),
}}
content={release?.body}
@@ -98,20 +98,20 @@ const DialogAppUpdater = () => {
)}
<div className="pt-3 px-4">
- <div className="flex gap-x-4 w-full items-center justify-between">
+ <div className="flex gap-x-0 w-full items-center justify-between">
<Button
- variant="link"
- className="px-0 text-main-view-fg/70"
+ variant="ghost"
+ size="sm"
onClick={() => setShowReleaseNotes(!showReleaseNotes)}
>
{showReleaseNotes
? t('updater:hideReleaseNotes')
: t('updater:showReleaseNotes')}
</Button>
- <div className="flex gap-x-5">
+ <div className="flex gap-x-2">
<Button
- variant="link"
- className="px-0 text-main-view-fg/70 remind-me-later"
+ variant="ghost"
+ size="sm"
onClick={() => setRemindMeLater(true)}
>
{t('updater:remindMeLater')}
@@ -119,6 +119,7 @@ const DialogAppUpdater = () => {
<Button
onClick={handleUpdate}
disabled={updateState.isDownloading}
+ size="sm"
>
{updateState.isDownloading
? t('updater:downloading')
diff --git a/web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx b/web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx
index 7b5a0f845..7d9066de8 100644
--- a/web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx
+++ b/web-app/src/containers/dialogs/AttachmentIngestionDialog.tsx
@@ -31,7 +31,7 @@ export default function AttachmentIngestionDialog() {
<DialogTitle>
{t('common:attachmentsIngestion.title')}
{totalCount > 1 && (
- <span className="text-sm font-normal text-main-view-fg/70 ml-2">
+ <span className="text-sm font-normal text-muted-foreground ml-2">
({currentIndex + 1} of {totalCount})
</span>
)}
@@ -41,12 +41,12 @@ export default function AttachmentIngestionDialog() {
</DialogDescription>
</DialogHeader>
- <div className="border border-main-view-fg/10 rounded-md p-3 bg-main-view/40">
+ <div className="border rounded-md p-3 bg-secondary">
<div className="flex items-center justify-between gap-2">
<span className="truncate font-medium" title={currentAttachment.name}>
{currentAttachment.name}
</span>
- <span className="text-xs text-main-view-fg/70 flex-shrink-0">
+ <span className="text-xs text-muted-foreground shrink-0">
{formatBytes(currentAttachment.size)}
</span>
</div>
@@ -58,7 +58,6 @@ export default function AttachmentIngestionDialog() {
</Button>
<Button
variant="outline"
- className="border-main-view-fg/20"
onClick={() => choose('embeddings')}
>
{t('common:attachmentsIngestion.embeddings')}
diff --git a/web-app/src/containers/dialogs/BackendUpdater.tsx b/web-app/src/containers/dialogs/BackendUpdater.tsx
index d59cfd7c9..73b1e4817 100644
--- a/web-app/src/containers/dialogs/BackendUpdater.tsx
+++ b/web-app/src/containers/dialogs/BackendUpdater.tsx
@@ -54,15 +54,15 @@ const BackendUpdater = () => {
{backendUpdateState.isUpdateAvailable && (
<div
className={cn(
- 'fixed z-50 min-w-[300px] bottom-3 right-3 bg-main-view text-main-view-fg flex items-center justify-center border border-main-view-fg/10 rounded-lg shadow-md'
+ 'fixed z-50 bottom-3 right-3 bg-background flex items-center border rounded-lg shadow-md'
)}
>
- <div className="px-0 py-4">
+ <div className="px-2 py-4">
<div className="px-4">
<div className="flex items-start gap-2">
<IconDownload
size={20}
- className="shrink-0 text-main-view-fg/60 mt-1"
+ className="shrink-0 text-muted-foreground mt-1"
/>
<div>
<div className="text-base font-medium">
@@ -70,7 +70,7 @@ const BackendUpdater = () => {
version: updateState.updateInfo?.newVersion,
})}
</div>
- <div className="mt-1 text-main-view-fg/70 font-normal mb-2">
+ <div className="mt-1 text-muted-foreground font-normal mb-2">
{t('settings:backendUpdater.backendUpdateAvailable')}
</div>
</div>
@@ -79,15 +79,16 @@ const BackendUpdater = () => {
<div className="pt-3 px-4">
<div className="flex gap-x-4 w-full items-center justify-end">
- <div className="flex gap-x-5">
+ <div className="flex gap-x-2">
<Button
- variant="link"
- className="px-0 text-main-view-fg/70 remind-me-later"
+ variant="ghost"
+ size="sm"
onClick={() => setRemindMeLater(true)}
>
{t('settings:backendUpdater.remindMeLater')}
</Button>
<Button
+ size="sm"
onClick={handleUpdate}
disabled={updateState.isUpdating}
>
diff --git a/web-app/src/containers/dialogs/ChangeDataFolderLocation.tsx b/web-app/src/containers/dialogs/ChangeDataFolderLocation.tsx
index 9232c6e9c..bb2c4c8ee 100644
--- a/web-app/src/containers/dialogs/ChangeDataFolderLocation.tsx
+++ b/web-app/src/containers/dialogs/ChangeDataFolderLocation.tsx
@@ -46,34 +46,34 @@ export default function ChangeDataFolderLocation({
<div className="space-y-4">
<div>
- <h4 className="text-sm font-medium text-main-view-fg/80 mb-2">
+ <h4 className="text-sm font-medium mb-2">
{t('settings:dialogs.changeDataFolder.currentLocation')}
</h4>
- <div className="bg-main-view-fg/5 border border-main-view-fg/10 rounded">
- <code className="text-xs text-main-view-fg/70 break-all">
+ <div className="bg-secondary border p-2 rounded-lg">
+ <code className="text-xs text-muted-foreground break-all">
{currentPath}
</code>
</div>
</div>
<div>
- <h4 className="text-sm font-medium text-main-view-fg/80 mb-2">
+ <h4 className="text-sm font-medium mb-2">
{t('settings:dialogs.changeDataFolder.newLocation')}
</h4>
- <div className="bg-accent/10 border border-accent/20 rounded">
- <code className="text-xs text-accent break-all">{newPath}</code>
+ <div className="bg-secondary border p-2 rounded-lg">
+ <code className="text-xs break-all">{newPath}</code>
</div>
</div>
</div>
<DialogFooter className="flex items-center gap-2">
<DialogClose asChild>
- <Button variant="link" size="sm">
+ <Button variant="ghost" size="sm">
{t('settings:dialogs.changeDataFolder.cancel')}
</Button>
</DialogClose>
<DialogClose asChild>
- <Button onClick={onConfirm}>
+ <Button size="sm" onClick={onConfirm}>
{t('settings:dialogs.changeDataFolder.changeLocation')}
</Button>
</DialogClose>
diff --git a/web-app/src/containers/dialogs/DeleteAssistantDialog.tsx b/web-app/src/containers/dialogs/DeleteAssistantDialog.tsx
index 2af8117af..9fa143bd2 100644
--- a/web-app/src/containers/dialogs/DeleteAssistantDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteAssistantDialog.tsx
@@ -55,7 +55,8 @@ export function DeleteAssistantDialog({
</DialogHeader>
<DialogFooter className="flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<Button
- variant="link"
+ variant="ghost"
+ size="sm"
onClick={handleCancel}
className="w-full sm:w-auto"
>
@@ -65,6 +66,7 @@ export function DeleteAssistantDialog({
ref={deleteButtonRef}
variant="destructive"
onClick={handleConfirm}
+ size="sm"
onKeyDown={handleKeyDown}
className="w-full sm:w-auto"
aria-label={t('assistants:delete')}
diff --git a/web-app/src/containers/dialogs/DeleteModel.tsx b/web-app/src/containers/dialogs/DeleteModel.tsx
index 69e65e584..46c9b0c9c 100644
--- a/web-app/src/containers/dialogs/DeleteModel.tsx
+++ b/web-app/src/containers/dialogs/DeleteModel.tsx
@@ -90,8 +90,8 @@ export const DialogDeleteModel = ({
return (
<Dialog>
<DialogTrigger asChild>
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconTrash size={18} className="text-main-view-fg/50" />
+ <div className="size-6 cursor-pointer flex items-center justify-center rounded transition-all duration-200 ease-in-out">
+ <IconTrash size={18} className="text-muted-foreground" />
</div>
</DialogTrigger>
<DialogContent>
@@ -106,7 +106,7 @@ export const DialogDeleteModel = ({
<DialogFooter className="mt-2">
<DialogClose asChild>
- <Button variant="link" size="sm" className="hover:no-underline">
+ <Button variant="ghost" size="sm">
{t('providers:deleteModel.cancel')}
</Button>
</DialogClose>
diff --git a/web-app/src/containers/dialogs/DeleteProjectDialog.tsx b/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
index 50379570d..26e76453b 100644
--- a/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteProjectDialog.tsx
@@ -31,21 +31,12 @@ export function DeleteProjectDialog({
const threads = useThreads((state) => state.threads)
const { deleteFolderWithThreads } = useThreadManagement()
- // Calculate thread stats for this project
- const { threadCount, starredThreadCount } = useMemo(() => {
- if (!projectId) return { threadCount: 0, starredThreadCount: 0 }
+ const threadCount = useMemo(() => {
+ if (!projectId) return 0
- const projectThreads = Object.values(threads).filter(
+ return Object.values(threads).filter(
(thread) => thread.metadata?.project?.id === projectId
- )
- const starredCount = projectThreads.filter(
- (thread) => thread.isFavorite
).length
-
- return {
- threadCount: projectThreads.length,
- starredThreadCount: starredCount,
- }
}, [projectId, threads])
const handleConfirm = async () => {
@@ -71,13 +62,11 @@ export function DeleteProjectDialog({
}
}
- const hasStarredThreads = starredThreadCount > 0
const hasThreads = threadCount > 0
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
- className="sm:max-w-md"
onOpenAutoFocus={(e) => {
e.preventDefault()
deleteButtonRef.current?.focus()
@@ -85,34 +74,16 @@ export function DeleteProjectDialog({
>
<DialogHeader>
<DialogTitle>{t('projects.deleteProjectDialog.title')}</DialogTitle>
- <DialogDescription className="space-y-2">
- {hasStarredThreads ? (
- <>
- <p className="text-red-600 dark:text-red-400 font-semibold">
- {t('projects.deleteProjectDialog.starredWarning')}
- </p>
- <p className="font-medium">
- {t('projects.deleteProjectDialog.permanentDeleteWarning')}
- </p>
- </>
- ) : hasThreads ? (
- <p>
- {t('projects.deleteProjectDialog.permanentDelete')}
- </p>
+ <DialogDescription>
+ {hasThreads ? (
+ <p>{t('projects.deleteProjectDialog.permanentDelete')}</p>
) : (
- <p>
- {t('projects.deleteProjectDialog.deleteEmptyProject', { projectName })}
- </p>
- )}
- {hasThreads && (
- <p className="text-sm text-muted-foreground mt-3">
- {t('projects.deleteProjectDialog.saveThreadsAdvice')}
- </p>
+ <p>{t('projects.deleteProjectDialog.deleteEmptyProject', { projectName })}</p>
)}
</DialogDescription>
</DialogHeader>
<DialogFooter>
- <Button variant="link" onClick={() => onOpenChange(false)}>
+ <Button variant="ghost" onClick={() => onOpenChange(false)}>
{t('cancel')}
</Button>
<Button
diff --git a/web-app/src/containers/dialogs/DeleteThreadDialog.tsx b/web-app/src/containers/dialogs/DeleteThreadDialog.tsx
index eaeb43260..649c4a408 100644
--- a/web-app/src/containers/dialogs/DeleteThreadDialog.tsx
+++ b/web-app/src/containers/dialogs/DeleteThreadDialog.tsx
@@ -102,7 +102,7 @@ export function DeleteThreadDialog({
</DialogDescription>
<DialogFooter className="mt-4 flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<DialogClose asChild>
- <Button variant="link" size="sm" className="w-full sm:w-auto">
+ <Button variant="ghost" size="sm" className="w-full sm:w-auto">
{t('common:cancel')}
</Button>
</DialogClose>
diff --git a/web-app/src/containers/dialogs/EditJsonMCPserver.tsx b/web-app/src/containers/dialogs/EditJsonMCPserver.tsx
index 3c4a4d56b..f68ddf1bb 100644
--- a/web-app/src/containers/dialogs/EditJsonMCPserver.tsx
+++ b/web-app/src/containers/dialogs/EditJsonMCPserver.tsx
@@ -82,7 +82,7 @@ export default function EditJsonMCPserver({
</DialogTitle>
</DialogHeader>
<div className="space-y-2">
- <div className="border border-main-view-fg/10 rounded-md !overflow-hidden">
+ <div className="border rounded-md !overflow-hidden">
<style>{`
.w-tc-editor textarea {
word-break: break-all !important;
diff --git a/web-app/src/containers/dialogs/EditMessageDialog.tsx b/web-app/src/containers/dialogs/EditMessageDialog.tsx
index ad18eb822..41917ef0f 100644
--- a/web-app/src/containers/dialogs/EditMessageDialog.tsx
+++ b/web-app/src/containers/dialogs/EditMessageDialog.tsx
@@ -90,7 +90,7 @@ export function EditMessageDialog({
{keptImages.map((imageUrl, index) => (
<div
key={index}
- className="relative border border-main-view-fg/5 rounded-lg size-14"
+ className="relative border rounded-lg size-14"
>
<img
className="object-cover w-full h-full rounded-lg"
@@ -123,7 +123,7 @@ export function EditMessageDialog({
/>
<DialogFooter className="mt-4 flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<DialogClose asChild>
- <Button variant="link" size="sm" className="w-full sm:w-auto">
+ <Button variant="ghost" size="sm" className="w-full sm:w-auto">
{t('common:cancel')}
</Button>
</DialogClose>
diff --git a/web-app/src/containers/dialogs/EditModel.tsx b/web-app/src/containers/dialogs/EditModel.tsx
index f7dec06eb..1d8af8145 100644
--- a/web-app/src/containers/dialogs/EditModel.tsx
+++ b/web-app/src/containers/dialogs/EditModel.tsx
@@ -180,8 +180,8 @@ export const DialogEditModel = ({
return (
<Dialog open={isOpen} onOpenChange={handleDialogChange}>
<DialogTrigger asChild>
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconPencil size={18} className="text-main-view-fg/50" />
+ <div className="size-6 cursor-pointer flex items-center justify-center rounded transition-all duration-200 ease-in-out">
+ <IconPencil size={18} className="text-muted-foreground" />
</div>
</DialogTrigger>
<DialogContent onKeyDown={handleKeyDown}>
@@ -210,20 +210,20 @@ export const DialogEditModel = ({
className="w-full"
disabled={isLoading}
/>
- <p className="text-xs text-main-view-fg/60 mt-1">
+ <p className="text-xs text-muted-foreground mt-1">
This is the name that will be shown in the interface. The original model file remains unchanged.
</p>
</div>
{/* Warning Banner */}
- <div className="bg-main-view-fg/5 border border-main-view-fg/10 rounded-md p-3">
+ <div className="bg-secondary border rounded-md p-3">
<div className="flex items-start space-x-3">
- <IconAlertTriangle className="size-5 text-yellow-600 mt-0.5 flex-shrink-0" />
- <div className="text-sm text-main-view-fg/80">
- <p className="font-medium mb-1 text-base">
+ <IconAlertTriangle className="size-5 text-yellow-600 mt-0.5 shrink-0" />
+ <div className="text-sm">
+ <p className="font-medium mb-1">
{t('providers:editModel.warning.title')}
</p>
- <p className="text-main-view-fg/70">
+ <p className="text-muted-foreground">
{t('providers:editModel.warning.description')}
</p>
</div>
@@ -237,7 +237,7 @@ export const DialogEditModel = ({
<div className="space-y-4">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
- <IconTool className="size-4 text-main-view-fg/70" />
+ <IconTool className="size-4 text-muted-foreground" />
<span className="text-sm">
{t('providers:editModel.tools')}
</span>
@@ -254,7 +254,7 @@ export const DialogEditModel = ({
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
- <IconEye className="size-4 text-main-view-fg/70" />
+ <IconEye className="size-4 text-muted-foreground" />
<span className="text-sm">
{t('providers:editModel.vision')}
</span>
diff --git a/web-app/src/containers/dialogs/ErrorDialog.tsx b/web-app/src/containers/dialogs/ErrorDialog.tsx
deleted file mode 100644
index 3521761f0..000000000
--- a/web-app/src/containers/dialogs/ErrorDialog.tsx
+++ /dev/null
@@ -1,132 +0,0 @@
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from '@/components/ui/dialog'
-import { Button } from '@/components/ui/button'
-import { AlertTriangle, ChevronDown, ChevronRight } from 'lucide-react'
-import { IconCopy, IconCopyCheck } from '@tabler/icons-react'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { toast } from 'sonner'
-import { useState } from 'react'
-import { useAppState } from '@/hooks/useAppState'
-
-export default function ErrorDialog() {
- const { t } = useTranslation()
- const errorMessage = useAppState((state) => state.errorMessage)
- const setErrorMessage = useAppState((state) => state.setErrorMessage)
- const [isCopying, setIsCopying] = useState(false)
- const [isDetailExpanded, setIsDetailExpanded] = useState(true)
-
- const handleCopy = async () => {
- setIsCopying(true)
- try {
- await navigator.clipboard.writeText(errorMessage?.message ?? '')
- toast.success('Copy successful', {
- id: 'copy-model',
- description: 'Model load error information copied to clipboard',
- })
- } catch {
- toast.error('Failed to copy', {
- id: 'copy-model-error',
- description: 'Failed to copy error information to clipboard',
- })
- } finally {
- setTimeout(() => setIsCopying(false), 2000)
- }
- }
-
- const handleDialogOpen = (open: boolean) => {
- setErrorMessage(open ? errorMessage : undefined)
- }
-
- return (
- <Dialog open={!!errorMessage} onOpenChange={handleDialogOpen}>
- <DialogContent showCloseButton={false}>
- <DialogHeader>
- <div className="flex items-start gap-3">
- <div className="shrink-0">
- <AlertTriangle className="size-4 text-destructive" />
- </div>
- <div>
- <DialogTitle>{t('common:error')}</DialogTitle>
- <DialogDescription className="mt-1 text-main-view-fg/70">
- {errorMessage?.title ?? 'Something went wrong'}
- </DialogDescription>
- </div>
- </div>
- </DialogHeader>
-
- <div className="bg-main-view-fg/2 p-2 border border-main-view-fg/5 rounded-lg space-y-2">
- <div>
- <div
- onClick={() => setIsDetailExpanded(!isDetailExpanded)}
- className="flex items-center gap-1 text-sm text-main-view-fg/60 hover:text-main-view-fg/80 transition-colors cursor-pointer"
- role="button"
- tabIndex={0}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault()
- setIsDetailExpanded(!isDetailExpanded)
- }
- }}
- >
- {isDetailExpanded ? (
- <ChevronDown className="size-3" />
- ) : (
- <ChevronRight className="size-3" />
- )}
- Details
- </div>
-
- {isDetailExpanded && (
- <div
- className="mt-2 text-sm text-main-view-fg/70 leading-relaxed max-h-[150px] overflow-y-auto break-all bg-main-view-fg/10 p-2 rounded border border-main-view-fg/5"
- ref={(el) => {
- if (el) {
- el.scrollTop = el.scrollHeight
- }
- }}
- >
- {errorMessage?.message}
- </div>
- )}
- </div>
- <span className="text-sm text-main-view-fg/60">{errorMessage?.subtitle}</span>
- </div>
-
- <DialogFooter className="flex flex-col gap-2 sm:flex-row sm:justify-right">
- <Button
- variant="link"
- onClick={() => handleDialogOpen(false)}
- className="flex-1 text-right sm:flex-none"
- >
- {t('common:cancel')}
- </Button>
- <Button
- variant="link"
- onClick={() => handleCopy()}
- disabled={isCopying}
- autoFocus
- className="flex-1 text-right sm:flex-none border border-main-view-fg/20 !px-2"
- >
- {isCopying ? (
- <>
- <IconCopyCheck className="text-accent" />
- {t('common:copied')}
- </>
- ) : (
- <>
- <IconCopy />
- {t('common:copy')}
- </>
- )}
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- )
-}
diff --git a/web-app/src/containers/dialogs/FactoryResetDialog.tsx b/web-app/src/containers/dialogs/FactoryResetDialog.tsx
index 644460b2f..dcb3f965d 100644
--- a/web-app/src/containers/dialogs/FactoryResetDialog.tsx
+++ b/web-app/src/containers/dialogs/FactoryResetDialog.tsx
@@ -52,7 +52,7 @@ export function FactoryResetDialog({
<DialogFooter className="mt-4 flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<DialogClose asChild>
<Button
- variant="link"
+ variant="ghost"
size="sm"
className="hover:no-underline w-full sm:w-auto"
>
diff --git a/web-app/src/containers/dialogs/ImportVisionModelDialog.tsx b/web-app/src/containers/dialogs/ImportVisionModelDialog.tsx
index 9a74e0461..32e5d5e35 100644
--- a/web-app/src/containers/dialogs/ImportVisionModelDialog.tsx
+++ b/web-app/src/containers/dialogs/ImportVisionModelDialog.tsx
@@ -5,7 +5,6 @@ import {
DialogHeader,
DialogTitle,
DialogTrigger,
- DialogFooter,
} from '@/components/ui/dialog'
import { Button } from '@/components/ui/button'
import { Switch } from '@/components/ui/switch'
@@ -299,16 +298,16 @@ export const ImportVisionModelDialog = ({
<div className="space-y-6">
{/* Vision Model Toggle Card */}
- <div className="border border-main-view-fg/10 rounded-lg p-4 space-y-3 bg-main-view-fg/5">
+ <div className="border rounded-lg p-4 space-y-3">
<div className="flex items-start space-x-3">
- <div className="flex-shrink-0 mt-0.5">
- <IconEye size={20} className="text-accent" />
+ <div className="shrink-0 mt-0.5">
+ <IconEye size={20} className="text-muted-foreground" />
</div>
<div className="flex-1">
- <h3 className="font-medium text-main-view-fg">
+ <h3 className="font-medium">
Vision Model Support
</h3>
- <p className="text-sm text-main-view-fg/70">
+ <p className="text-sm text-muted-foreground leading-normal">
Enable if your model supports image understanding (requires
MMPROJ file)
</p>
@@ -330,14 +329,14 @@ export const ImportVisionModelDialog = ({
</div>
{/* Model Name Preview */}
- {modelName && (
- <div className="bg-main-view-fg/5 rounded-lg p-3">
+ {modelName && !validationError && (
+ <div className=" rounded-lg p-3">
<div className="flex items-center gap-2">
- <span className="text-sm font-medium text-main-view-fg/80">
+ <span className="text-sm font-medium text-muted-foreground">
Model will be saved as:
</span>
</div>
- <p className="text-base font-mono mt-1 text-main-view-fg">
+ <p className="text-sm font-mono mt-1">
{modelName}
</p>
</div>
@@ -346,19 +345,19 @@ export const ImportVisionModelDialog = ({
{/* File Selection Area */}
<div className="space-y-4">
{/* Model File Selection */}
- <div className="border border-main-view-fg/10 rounded-lg p-4 space-y-3 bg-main-view-fg/5">
+ <div className="border rounded-lg p-4 space-y-3">
<div className="flex items-center gap-2">
- <h3 className="font-medium text-main-view-fg">
+ <h3 className="font-medium">
Model File (GGUF)
</h3>
- <span className="text-xs bg-main-view-fg/10 text-main-view-fg/70 px-2 py-1 rounded">
+ <span className="text-xs bg-secondary px-2 py-1 rounded-sm">
Required
</span>
</div>
{modelFile ? (
<div className="space-y-2">
- <div className="bg-accent/10 border border-accent/20 rounded-lg p-3">
+ <div className="bg-accent/10 border rounded-lg p-3">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
{isValidating ? (
@@ -374,16 +373,15 @@ export const ImportVisionModelDialog = ({
) : (
<IconCheck size={16} className="text-accent" />
)}
- <span className="text-sm font-medium text-main-view-fg">
+ <span className="text-sm font-medium">
{modelFile.split(/[\\/]/).pop()}
</span>
</div>
<Button
- variant="link"
+ variant="secondary"
size="sm"
onClick={() => handleFileSelect('model')}
disabled={importing || isValidating}
- className="text-accent hover:text-accent/80"
>
Change
</Button>
@@ -396,7 +394,7 @@ export const ImportVisionModelDialog = ({
<div className="flex items-start gap-2">
<IconAlertTriangle
size={16}
- className="text-destructive mt-0.5 flex-shrink-0"
+ className="text-destructive mt-0.5 shrink-0"
/>
<div>
<p className="text-sm font-medium text-destructive">
@@ -431,7 +429,7 @@ export const ImportVisionModelDialog = ({
variant="link"
onClick={() => handleFileSelect('model')}
disabled={importing}
- className="w-full h-12 border border-dashed border-main-view-fg/10 bg-main-view text-main-view-fg/50 hover:text-main-view-fg"
+ className="w-full h-12 border border-dashed text-muted-foreground"
>
Select GGUF File
</Button>
@@ -440,17 +438,17 @@ export const ImportVisionModelDialog = ({
{/* MMPROJ File Selection - only show if vision model is enabled */}
{isVisionModel && (
- <div className="border border-main-view-fg/10 rounded-lg p-4 space-y-3 bg-main-view-fg/5">
+ <div className="border rounded-lg p-4 space-y-3">
<div className="flex items-center gap-2">
- <h3 className="font-medium text-main-view-fg">MMPROJ File</h3>
- <span className="text-xs bg-accent/10 text-accent px-2 py-1 rounded">
+ <h3 className="font-medium">MMPROJ File</h3>
+ <span className="text-xs bg-secondary px-2 py-1 rounded-sm">
Required for Vision
</span>
</div>
{mmProjFile ? (
<div className="space-y-2">
- <div className="bg-accent/10 border border-accent/20 rounded-lg p-3">
+ <div className="bg-accent/10 border rounded-lg p-3">
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
{isValidatingMmproj ? (
@@ -466,16 +464,15 @@ export const ImportVisionModelDialog = ({
) : (
<IconCheck size={16} className="text-accent" />
)}
- <span className="text-sm font-medium text-main-view-fg">
+ <span className="text-sm font-medium">
{mmProjFile.split(/[\\/]/).pop()}
</span>
</div>
<Button
- variant="link"
+ variant="secondary"
size="sm"
onClick={() => handleFileSelect('mmproj')}
disabled={importing || isValidatingMmproj}
- className="text-accent hover:text-accent/80"
>
Change
</Button>
@@ -488,7 +485,7 @@ export const ImportVisionModelDialog = ({
<div className="flex items-start gap-2">
<IconAlertTriangle
size={16}
- className="text-destructive mt-0.5 flex-shrink-0"
+ className="text-destructive mt-0.5 shrink-0"
/>
<div>
<p className="text-sm font-medium text-destructive">
@@ -523,7 +520,7 @@ export const ImportVisionModelDialog = ({
variant="link"
onClick={() => handleFileSelect('mmproj')}
disabled={importing}
- className="w-full h-12 border border-dashed border-main-view-fg/10 bg-main-view text-main-view-fg/50 hover:text-main-view-fg"
+ className="w-full h-12 border border-dashed text-muted-foreground"
>
Select MMPROJ File
</Button>
@@ -533,12 +530,11 @@ export const ImportVisionModelDialog = ({
</div>
</div>
- <DialogFooter className="flex gap-2 pt-4">
+ <div className="flex gap-2 pt-4 justify-end">
<Button
- variant="link"
+ variant="ghost"
onClick={() => handleOpenChange(false)}
disabled={importing}
- className="flex-1"
>
Cancel
</Button>
@@ -554,16 +550,15 @@ export const ImportVisionModelDialog = ({
mmprojValidationError !== null ||
isValidatingMmproj
}
- className="flex-1"
>
- {importing && <IconLoader2 className="mr-2 h-4 w-4 animate-spin" />}
+ {importing && <IconLoader2 className="mr-2 size-4 animate-spin" />}
{importing ? (
'Importing...'
) : (
<>Import {isVisionModel ? 'Vision ' : ''}Model</>
)}
</Button>
- </DialogFooter>
+ </div>
</DialogContent>
</Dialog>
)
diff --git a/web-app/src/containers/dialogs/JanBrowserExtensionDialog.tsx b/web-app/src/containers/dialogs/JanBrowserExtensionDialog.tsx
index ffef9f406..9ba056d87 100644
--- a/web-app/src/containers/dialogs/JanBrowserExtensionDialog.tsx
+++ b/web-app/src/containers/dialogs/JanBrowserExtensionDialog.tsx
@@ -69,7 +69,7 @@ export default function JanBrowserExtensionDialog({
<div className="flex items-center justify-center py-8">
<div className="flex flex-col items-center justify-center gap-3">
<IconLoader2 className="size-8 text-accent animate-spin origin-center" />
- <p className="text-sm text-main-view-fg/60">{t('mcp-servers:browserExtension.connecting.checking')}</p>
+ <p className="text-sm text-muted-foreground">{t('mcp-servers:browserExtension.connecting.checking')}</p>
</div>
</div>
</>
@@ -80,7 +80,7 @@ export default function JanBrowserExtensionDialog({
<>
<DialogHeader>
<DialogTitle>{t('mcp-servers:browserExtension.notInstalled.title')}</DialogTitle>
- <DialogDescription className="mt-1 text-main-view-fg/70">
+ <DialogDescription className="mt-1 text-muted-foreground">
{t('mcp-servers:browserExtension.notInstalled.description')}
</DialogDescription>
</DialogHeader>
diff --git a/web-app/src/containers/dialogs/LoadModelErrorDialog.tsx b/web-app/src/containers/dialogs/LoadModelErrorDialog.tsx
deleted file mode 100644
index b8227ef6f..000000000
--- a/web-app/src/containers/dialogs/LoadModelErrorDialog.tsx
+++ /dev/null
@@ -1,201 +0,0 @@
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
-} from '@/components/ui/dialog'
-import { Button } from '@/components/ui/button'
-import { AlertTriangle, ChevronDown, ChevronRight } from 'lucide-react'
-import { IconCopy, IconCopyCheck } from '@tabler/icons-react'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-import { useModelLoad } from '@/hooks/useModelLoad'
-import { toast } from 'sonner'
-import { useState } from 'react'
-
-export default function LoadModelErrorDialog() {
- const { t } = useTranslation()
- const { modelLoadError, setModelLoadError } = useModelLoad()
- const [isCopying, setIsCopying] = useState(false)
- const [isDetailExpanded, setIsDetailExpanded] = useState(true)
-
- const getErrorDetail = (error: string | object | undefined) => {
- if (!error || typeof error !== 'object') return null
- if ('details' in error) {
- return (error as { details?: string }).details
- }
- return null
- }
-
- const hasErrorDetail = (error: string | object | undefined) => {
- return Boolean(getErrorDetail(error))
- }
-
- const formatErrorForCopy = (error: string | object | undefined) => {
- if (!error) return ''
-
- if (typeof error === 'string') return error
-
- if (typeof error === 'object' && 'code' in error && 'message' in error) {
- const errorObj = error as {
- code?: string
- message: string
- details?: string
- }
- let copyText = errorObj.code
- ? `${errorObj.code}: ${errorObj.message}`
- : errorObj.message
- if (errorObj.details) {
- copyText += `\n\nDetails:\n${errorObj.details}`
- }
- return copyText
- }
-
- if (typeof error === 'object') {
- const errorObj = error as {
- code?: string
- message: string
- details?: string
- }
-
- return errorObj.message
- }
-
- return JSON.stringify(error)
- }
-
- const handleCopy = async () => {
- setIsCopying(true)
- try {
- await navigator.clipboard.writeText(formatErrorForCopy(modelLoadError))
- toast.success('Copy successful', {
- id: 'copy-model',
- description: 'Model load error information copied to clipboard',
- })
- } catch {
- toast.error('Failed to copy', {
- id: 'copy-model-error',
- description: 'Failed to copy error information to clipboard',
- })
- } finally {
- setTimeout(() => setIsCopying(false), 2000)
- }
- }
-
- const handleDialogOpen = (open: boolean) => {
- setModelLoadError(open ? modelLoadError : undefined)
- }
-
- return (
- <Dialog open={!!modelLoadError} onOpenChange={handleDialogOpen}>
- <DialogContent showCloseButton={false}>
- <DialogHeader>
- <div className="flex items-start gap-3">
- <div className="shrink-0">
- <AlertTriangle className="size-4 text-destructive" />
- </div>
- <div>
- <DialogTitle>{t('common:error')}</DialogTitle>
- <DialogDescription className="mt-1 text-main-view-fg/70">
- Something went wrong
- </DialogDescription>
- </div>
- </div>
- </DialogHeader>
-
- <div className="bg-main-view-fg/2 p-2 border border-main-view-fg/5 rounded-lg space-y-2">
- {typeof modelLoadError === 'object' &&
- modelLoadError &&
- 'code' in modelLoadError &&
- 'message' in modelLoadError ? (
- <div>
- {(modelLoadError as { code?: string }).code && (
- <div>
- <p className="text-sm text-main-view-fg/80 leading-relaxed break-all">
- {(modelLoadError as { code: string }).code}
- </p>
- </div>
- )}
- <div>
- <p className="text-sm text-main-view-fg/60 leading-relaxed break-all">
- {(modelLoadError as { message: string }).message}
- </p>
- </div>
- </div>
- ) : (
- <p className="text-sm text-main-view-fg/70 leading-relaxed break-all">
- {String(modelLoadError)}
- </p>
- )}
-
- {hasErrorDetail(modelLoadError) && (
- <div>
- <div
- onClick={() => setIsDetailExpanded(!isDetailExpanded)}
- className="flex items-center gap-1 text-sm text-main-view-fg/60 hover:text-main-view-fg/80 transition-colors cursor-pointer"
- role="button"
- tabIndex={0}
- onKeyDown={(e) => {
- if (e.key === 'Enter' || e.key === ' ') {
- e.preventDefault()
- setIsDetailExpanded(!isDetailExpanded)
- }
- }}
- >
- {isDetailExpanded ? (
- <ChevronDown className="size-3" />
- ) : (
- <ChevronRight className="size-3" />
- )}
- Details
- </div>
-
- {isDetailExpanded && (
- <div
- className="mt-2 text-sm text-main-view-fg/70 leading-relaxed max-h-[150px] overflow-y-auto break-all bg-main-view-fg/10 p-2 rounded border border-main-view-fg/5"
- ref={(el) => {
- if (el) {
- el.scrollTop = el.scrollHeight
- }
- }}
- >
- {getErrorDetail(modelLoadError)}
- </div>
- )}
- </div>
- )}
- </div>
-
- <DialogFooter className="flex flex-col gap-2 sm:flex-row sm:justify-right">
- <Button
- variant="link"
- onClick={() => handleDialogOpen(false)}
- className="flex-1 text-right sm:flex-none"
- >
- {t('common:cancel')}
- </Button>
- <Button
- variant="link"
- onClick={() => handleCopy()}
- disabled={isCopying}
- autoFocus
- className="flex-1 text-right sm:flex-none border border-main-view-fg/20 !px-2"
- >
- {isCopying ? (
- <>
- <IconCopyCheck className="text-accent" />
- {t('common:copied')}
- </>
- ) : (
- <>
- <IconCopy />
- {t('common:copy')}
- </>
- )}
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- )
-}
diff --git a/web-app/src/containers/dialogs/MessageMetadataDialog.tsx b/web-app/src/containers/dialogs/MessageMetadataDialog.tsx
index 05ce29246..0afa47295 100644
--- a/web-app/src/containers/dialogs/MessageMetadataDialog.tsx
+++ b/web-app/src/containers/dialogs/MessageMetadataDialog.tsx
@@ -59,7 +59,7 @@ export function MessageMetadataDialog({
<DialogHeader>
<DialogTitle>{t('common:dialogs.messageMetadata.title')}</DialogTitle>
<div className="space-y-2 mt-4">
- <div className="border border-main-view-fg/10 rounded-md">
+ <div className="border rounded-md">
<CodeEditor
value={JSON.stringify(metadata || {}, null, 2)}
language="json"
diff --git a/web-app/src/containers/dialogs/OutOfContextDialog.tsx b/web-app/src/containers/dialogs/OutOfContextDialog.tsx
index dad3f84e5..5e2624c7f 100644
--- a/web-app/src/containers/dialogs/OutOfContextDialog.tsx
+++ b/web-app/src/containers/dialogs/OutOfContextDialog.tsx
@@ -51,8 +51,9 @@ export default function OutOfContextPromiseModal() {
</DialogDescription>
<DialogFooter className="flex gap-2">
<Button
- variant="link"
- className="bg-transparent border border-main-view-fg/20 hover:bg-main-view-fg/4"
+ variant="ghost"
+ size="sm"
+ className="bg-transparent border"
onClick={() => {
handleContextShift()
}}
@@ -61,11 +62,12 @@ export default function OutOfContextPromiseModal() {
</Button>
<Button
autoFocus
+ size="sm"
onClick={() => {
handleContextLength()
}}
>
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('model-errors:increaseContextSize')}
</span>
</Button>
diff --git a/web-app/src/containers/dialogs/RenameThreadDialog.tsx b/web-app/src/containers/dialogs/RenameThreadDialog.tsx
index 70f579bf5..16ba98914 100644
--- a/web-app/src/containers/dialogs/RenameThreadDialog.tsx
+++ b/web-app/src/containers/dialogs/RenameThreadDialog.tsx
@@ -19,7 +19,10 @@ interface RenameThreadDialogProps {
thread: Thread
plainTitleForRename: string
onRename: (threadId: string, title: string) => void
- onDropdownClose: () => void
+ onDropdownClose?: () => void
+ open?: boolean
+ onOpenChange?: (open: boolean) => void
+ withoutTrigger?: boolean
}
export function RenameThreadDialog({
@@ -27,12 +30,25 @@ export function RenameThreadDialog({
plainTitleForRename,
onRename,
onDropdownClose,
+ open,
+ onOpenChange,
+ withoutTrigger,
}: RenameThreadDialogProps) {
const { t } = useTranslation()
const [title, setTitle] = useState('')
- const [isOpen, setIsOpen] = useState(false)
+ const [internalOpen, setInternalOpen] = useState(false)
const inputRef = useRef<HTMLInputElement>(null)
+ const isControlled = open !== undefined
+ const isOpen = isControlled ? !!open : internalOpen
+ const setOpenSafe = (next: boolean) => {
+ if (isControlled) {
+ onOpenChange?.(next)
+ } else {
+ setInternalOpen(next)
+ }
+ }
+
useEffect(() => {
if (isOpen && inputRef.current) {
setTimeout(() => {
@@ -43,19 +59,19 @@ export function RenameThreadDialog({
}, [isOpen])
const handleOpenChange = (open: boolean) => {
- setIsOpen(open)
+ setOpenSafe(open)
if (open) {
setTitle(plainTitleForRename || t('common:newThread'))
} else {
- onDropdownClose()
+ onDropdownClose?.()
}
}
const handleRename = () => {
if (title.trim()) {
onRename(thread.id, title.trim())
- setIsOpen(false)
- onDropdownClose()
+ setOpenSafe(false)
+ onDropdownClose?.()
toast.success(t('common:toast.renameThread.title'), {
id: 'rename-thread',
description: t('common:toast.renameThread.description', { title }),
@@ -72,12 +88,14 @@ export function RenameThreadDialog({
return (
<Dialog open={isOpen} onOpenChange={handleOpenChange}>
- <DialogTrigger asChild>
- <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
- <IconEdit />
- <span>{t('common:rename')}</span>
- </DropdownMenuItem>
- </DialogTrigger>
+ {!withoutTrigger && (
+ <DialogTrigger asChild>
+ <DropdownMenuItem onSelect={(e) => e.preventDefault()}>
+ <IconEdit />
+ <span>{t('common:rename')}</span>
+ </DropdownMenuItem>
+ </DialogTrigger>
+ )}
<DialogContent>
<DialogHeader>
<DialogTitle>{t('common:threadTitle')}</DialogTitle>
@@ -92,7 +110,7 @@ export function RenameThreadDialog({
/>
<DialogFooter className="mt-4 flex flex-col-reverse sm:flex-row sm:justify-end gap-2">
<DialogClose asChild>
- <Button variant="link" size="sm" className="w-full sm:w-auto">
+ <Button variant="ghost" size="sm" className="w-full sm:w-auto">
{t('common:cancel')}
</Button>
</DialogClose>
diff --git a/web-app/src/containers/dialogs/SearchDialog.tsx b/web-app/src/containers/dialogs/SearchDialog.tsx
index 74d601a8c..c2a01e34f 100644
--- a/web-app/src/containers/dialogs/SearchDialog.tsx
+++ b/web-app/src/containers/dialogs/SearchDialog.tsx
@@ -33,6 +33,7 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
const [selectedIndex, setSelectedIndex] = useState(0)
const [recentVersion, setRecentVersion] = useState(0)
const inputRef = useRef<HTMLInputElement>(null)
+ const listRef = useRef<HTMLDivElement>(null)
const threads = useThreads((state) => state.threads)
const getFilteredThreads = useThreads((state) => state.getFilteredThreads)
@@ -161,6 +162,16 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
setSelectedIndex(0)
}, [allItems.length])
+ // Scroll selected item into view
+ useEffect(() => {
+ if (listRef.current) {
+ const selectedElement = listRef.current.querySelector(
+ `[data-index="${selectedIndex}"]`
+ )
+ selectedElement?.scrollIntoView({ block: 'nearest' })
+ }
+ }, [selectedIndex])
+
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'ArrowDown') {
e.preventDefault()
@@ -203,13 +214,13 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
</VisuallyHidden>
{/* Search Input */}
- <div className="flex items-center border-b border-main-view-fg/10 px-3">
- <IconSearch className="size-4 text-main-view-fg/50 shrink-0" />
+ <div className="flex items-center border-b px-3">
+ <IconSearch className="size-4 text-muted-foreground shrink-0" />
<input
ref={inputRef}
type="text"
placeholder={t('common:searchThreads')}
- className="flex-1 h-12 px-3 bg-transparent text-main-view-fg placeholder:text-main-view-fg/50 focus:outline-none"
+ className="flex-1 h-12 px-3 bg-transparent placeholder:text-muted-foreground focus:outline-none"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
onKeyDown={handleKeyDown}
@@ -217,15 +228,15 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
</div>
{/* Results */}
- <div className="max-h-80 overflow-y-auto px-1 py-2">
+ <div ref={listRef} className="max-h-80 overflow-y-auto px-1 py-2">
{/* Empty state when searching */}
{searchQuery && !hasResults && (
<div className="flex flex-col items-center justify-center py-12 px-4 text-center">
- <IconSearch className="size-6 text-main-view-fg/50 mb-2" />
+ <IconSearch className="size-6 text-muted-foreground mb-2" />
<h3 className="text-base font-medium mb-1">
{t('common:noResultsFound')}
</h3>
- <p className="text-xs leading-relaxed text-main-view-fg/60 w-1/2 mx-auto">
+ <p className="text-xs leading-relaxed text-muted-foreground w-1/2 mx-auto">
{t('common:noResultsFoundDesc')}
</p>
</div>
@@ -235,13 +246,14 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
{showStartNewChat && (
<div className="p-1">
<button
+ data-index={0}
onClick={handleStartNewChat}
className={cn(
- 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-main-view-fg/5 transition-colors cursor-pointer',
- selectedIndex === 0 && 'bg-main-view-fg/5'
+ 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-secondary/60 transition-colors cursor-pointer',
+ selectedIndex === 0 && 'bg-secondary/50'
)}
>
- <IconCirclePlus className="size-4 text-main-view-fg/70" />
+ <IconCirclePlus className="size-4 text-muted-foreground" />
<span className="text-sm">{t('common:newChat')}</span>
</button>
</div>
@@ -250,13 +262,13 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
{/* Recent searches - shown when search is empty */}
{!searchQuery && recentSearches.length > 0 && (
<div className="p-1">
- <div className="px-3 pt-1.5 flex items-center justify-between">
- <span className="text-xs font-medium text-main-view-fg/50">
+ <div className="px-3 pt-1.5 flex items-center justify-between mb-2">
+ <span className="text-xs font-medium text-muted-foreground">
{t('common:recents')}
</span>
<button
onClick={handleClearRecent}
- className="text-xs text-main-view-fg/50 hover:text-main-view-fg transition-colors cursor-pointer"
+ className="text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer"
>
{t('common:clearRecent')}
</button>
@@ -266,13 +278,14 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
return (
<button
key={thread.id}
+ data-index={itemIndex}
onClick={() => handleSelectThread(thread.id)}
className={cn(
- 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-main-view-fg/5 transition-colors cursor-pointer',
- selectedIndex === itemIndex && 'bg-main-view-fg/5'
+ 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-secondary/60 transition-colors cursor-pointer',
+ selectedIndex === itemIndex && 'bg-secondary/50'
)}
>
- <IconHistory className="size-4 text-main-view-fg/70 shrink-0" />
+ <IconHistory className="size-4 text-muted-foreground shrink-0" />
<span className="text-sm truncate">{thread.title}</span>
</button>
)
@@ -288,15 +301,16 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
return (
<button
key={thread.id}
+ data-index={itemIndex}
onClick={() => handleSelectThread(thread.id)}
className={cn(
- 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-main-view-fg/5 transition-colors cursor-pointer',
- selectedIndex === itemIndex && 'bg-main-view-fg/5'
+ 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-secondary/60 transition-colors cursor-pointer',
+ selectedIndex === itemIndex && 'bg-secondary/50'
)}
>
- <IconMessage className="size-4 text-main-view-fg/70 shrink-0" />
+ <IconMessage className="size-4 text-muted-foreground shrink-0" />
<div className="flex items-center min-w-0">
- <span className="text-xs text-main-view-fg/50 flex items-center gap-1">
+ <span className="text-xs text-muted-foreground flex items-center gap-1">
<IconFolder className="size-3" />
{projectName} -&nbsp;
</span>
@@ -317,13 +331,14 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
return (
<button
key={thread.id}
+ data-index={itemIndex}
onClick={() => handleSelectThread(thread.id)}
className={cn(
- 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-main-view-fg/5 transition-colors cursor-pointer',
- selectedIndex === itemIndex && 'bg-main-view-fg/5'
+ 'w-full flex items-center gap-2 px-3 py-2 rounded-md text-left hover:bg-secondary/60 transition-colors cursor-pointer',
+ selectedIndex === itemIndex && 'bg-secondary/50'
)}
>
- <IconMessage className="size-4 text-main-view-fg/70 shrink-0" />
+ <IconMessage className="size-4 text-muted-foreground shrink-0" />
<span className="text-sm truncate">{thread.title}</span>
</button>
)
@@ -333,23 +348,23 @@ export function SearchDialog({ open, onOpenChange }: SearchDialogProps) {
</div>
{/* Footer with keyboard hints */}
- <div className="flex items-center justify-between border-t border-main-view-fg/10 px-3 py-2 text-xs text-main-view-fg/50">
+ <div className="flex items-center justify-between border-t px-3 py-2 text-xs text-muted-foreground">
<div className="flex items-center gap-3">
<span className="flex items-center gap-1">
- <kbd className="px-1.5 py-0.5 bg-main-view-fg/10 rounded text-[10px]">
+ <kbd className="px-1.5 py-0.5 bg-secondary/10 rounded text-[10px]">
↑↓
</kbd>
{t('common:toNavigate')}
</span>
<span className="flex items-center gap-1">
- <kbd className="px-1.5 py-0.5 bg-main-view-fg/10 rounded text-[10px]">
+ <kbd className="px-1.5 py-0.5 bg-secondary/10 rounded text-[10px]">
↵
</kbd>
{t('common:toSelect')}
</span>
</div>
<span className="flex items-center gap-1">
- <kbd className="px-1.5 py-0.5 bg-main-view-fg/10 rounded text-[10px]">
+ <kbd className="px-1.5 py-0.5 bg-secondary/10 rounded text-[10px]">
esc
</kbd>
{t('common:toClose')}
diff --git a/web-app/src/containers/dialogs/ToolApproval.tsx b/web-app/src/containers/dialogs/ToolApproval.tsx
index 7dbd4bd96..527bfc7bc 100644
--- a/web-app/src/containers/dialogs/ToolApproval.tsx
+++ b/web-app/src/containers/dialogs/ToolApproval.tsx
@@ -45,12 +45,12 @@ export default function ToolApproval() {
<DialogContent showCloseButton={false}>
<DialogHeader>
<div className="flex items-start gap-3">
- <div className="shrink-0">
+ <div className="shrink-0 text-muted-foreground">
<AlertTriangle className="size-4" />
</div>
<div>
<DialogTitle>{t('tools:toolApproval.title')}</DialogTitle>
- <DialogDescription className="mt-1 text-main-view-fg/70">
+ <DialogDescription className="mt-1 text-muted-foreground">
{t('tools:toolApproval.description')}{' '}
<span className="font-semibold">{toolName}</span>.&nbsp;
<span className="text-sm">
@@ -62,27 +62,28 @@ export default function ToolApproval() {
</DialogHeader>
{toolParameters && Object.keys(toolParameters).length > 0 && (
- <div className="bg-main-view-fg/4 p-2 border border-main-view-fg/5 rounded-lg overflow-x-scroll">
- <h4 className="text-sm font-medium text-main-view-fg mb-2">
+ <div className="bg-background p-2 border rounded-lg overflow-x-scroll">
+ <h4 className="text-sm font-medium mb-2">
{t('tools:toolApproval.parameters')}
</h4>
- <div className="relative bg-main-view-fg/6 rounded-md p-2 text-sm font-mono border border-main-view-fg/5 overflow-x-auto">
- <pre className="text-main-view-fg/80 whitespace-pre-wrap">
+ <div className="relative bg-secondary rounded-md p-2 text-sm font-mono border overflow-x-auto">
+ <pre className="whitespace-pre-wrap">
{JSON.stringify(toolParameters, null, 2)}
</pre>
</div>
</div>
)}
- <div className="bg-main-view-fg/1 p-2 border border-main-view-fg/5 rounded-lg">
- <p className="text-sm text-main-view-fg/70 leading-relaxed">
+ <div className="p-2 border bg-secondary rounded-lg">
+ <p className="text-xs text-muted-foreground leading-relaxed">
{t('tools:toolApproval.securityNotice')}
</p>
</div>
<DialogFooter className="flex flex-col gap-2 sm:flex-row sm:justify-between">
<Button
- variant="link"
+ variant="ghost"
+ size="sm"
onClick={handleDeny}
className="flex-1 text-right sm:flex-none"
>
@@ -90,14 +91,15 @@ export default function ToolApproval() {
</Button>
<div className="flex flex-col sm:flex-row gap-2 items-center">
<Button
- variant="link"
+ variant="ghost"
+ size="sm"
onClick={handleAllowOnce}
- className="border border-main-view-fg/20"
>
{t('tools:toolApproval.allowOnce')}
</Button>
<Button
variant="default"
+ size="sm"
onClick={handleAllow}
autoFocus
className="capitalize"
diff --git a/web-app/src/containers/dynamicControllerSetting/DropdownControl.tsx b/web-app/src/containers/dynamicControllerSetting/DropdownControl.tsx
index 65d44f076..115f2bfbc 100644
--- a/web-app/src/containers/dynamicControllerSetting/DropdownControl.tsx
+++ b/web-app/src/containers/dynamicControllerSetting/DropdownControl.tsx
@@ -6,6 +6,8 @@ import {
} from '@/components/ui/dropdown-menu'
import { cn } from '@/lib/utils'
+import { Button } from '@/components/ui/button'
+import { ChevronsUpDown } from 'lucide-react'
// Dropdown component
type DropdownControlProps = {
@@ -25,8 +27,11 @@ export function DropdownControl({
return (
<DropdownMenu>
- <DropdownMenuTrigger className="bg-main-view-fg/5 hover:bg-main-view-fg/8 px-3 py-1 rounded-sm font-medium cursor-pointer">
- {isSelected}
+ <DropdownMenuTrigger >
+ <Button variant="outline" size="sm" className="w-full justify-between">
+ {isSelected}
+ <ChevronsUpDown className="size-4 shrink-0 text-muted-foreground ml-2" />
+ </Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="max-h-70">
{options.map((option, optionIndex) => (
@@ -36,7 +41,7 @@ export function DropdownControl({
className={cn(
'flex items-center justify-between my-1',
isSelected === option.name
- ? 'bg-main-view-fg/6 hover:bg-main-view-fg/6'
+ ? 'bg-secondary/60 hover:bg-secondary/40'
: ''
)}
>
diff --git a/web-app/src/containers/dynamicControllerSetting/InputControl.tsx b/web-app/src/containers/dynamicControllerSetting/InputControl.tsx
index 2ba99aa5d..77152ff02 100644
--- a/web-app/src/containers/dynamicControllerSetting/InputControl.tsx
+++ b/web-app/src/containers/dynamicControllerSetting/InputControl.tsx
@@ -1,15 +1,21 @@
import { useState } from 'react'
import { Input } from '@/components/ui/input'
+import { Button } from '@/components/ui/button'
+import { ButtonGroup } from '@/components/ui/button-group'
import { Copy, Eye, EyeOff, CopyCheck } from 'lucide-react'
+import { IconMinus, IconPlus } from '@tabler/icons-react'
import { cn } from '@/lib/utils'
type InputControl = {
type?: string
placeholder?: string
- value: string
+ value: string | number
onChange: (value: string) => void
inputActions?: string[]
className?: string
+ min?: number
+ max?: number
+ step?: number
}
export function InputControl({
@@ -19,6 +25,9 @@ export function InputControl({
onChange,
className,
inputActions = [],
+ min,
+ max,
+ step = 1,
}: InputControl) {
const [showPassword, setShowPassword] = useState(false)
const [isCopied, setIsCopied] = useState(false)
@@ -26,7 +35,7 @@ export function InputControl({
const copyToClipboard = () => {
if (value) {
- navigator.clipboard.writeText(value)
+ navigator.clipboard.writeText(String(value))
setIsCopied(true)
setTimeout(() => {
setIsCopied(false)
@@ -35,22 +44,69 @@ export function InputControl({
}
const inputType = type === 'password' && showPassword ? 'text' : type
+ const hasValue = value !== undefined && value !== null && value !== ''
+ const stringValue = hasValue ? String(value) : ''
+ const numericValue = hasValue
+ ? (typeof value === 'number' ? value : Number(value) || 0)
+ : (min ?? 0)
+
+ const handleNumberAdjustment = (delta: number) => {
+ let newValue = numericValue + delta
+ // Round to avoid floating point issues
+ const decimals = (step.toString().split('.')[1] || '').length
+ newValue = Number(newValue.toFixed(decimals))
+ if (min !== undefined && newValue < min) newValue = min
+ if (max !== undefined && newValue > max) newValue = max
+ onChange(newValue.toString())
+ }
+
+ if (type === 'number') {
+ return (
+ <ButtonGroup className={className}>
+ <Input
+ value={stringValue || undefined}
+ placeholder={placeholder}
+ onChange={(e) => onChange(e.target.value)}
+ className="h-8 w-16 font-mono text-center text-xs!"
+ />
+ <Button
+ variant="outline"
+ size="icon-sm"
+ type="button"
+ aria-label="Decrement"
+ onClick={() => handleNumberAdjustment(-step)}
+ disabled={min !== undefined && numericValue <= min}
+ >
+ <IconMinus className='size-3! text-muted-foreground' />
+ </Button>
+ <Button
+ variant="outline"
+ size="icon-sm"
+ type="button"
+ aria-label="Increment"
+ onClick={() => handleNumberAdjustment(step)}
+ disabled={max !== undefined && numericValue >= max}
+ >
+ <IconPlus className='size-3! text-muted-foreground' />
+ </Button>
+ </ButtonGroup>
+ )
+ }
return (
<div
className={cn(
- 'relative',
- type === 'number' ? 'w-16' : 'w-full',
+ 'relative w-full',
className
)}
>
<Input
type={inputType}
placeholder={placeholder}
- value={value}
+ value={stringValue}
onChange={(e) => onChange(e.target.value)}
className={cn(
- type === 'number' ? 'w-16' : 'w-full',
+ 'w-full',
hasInputActions && 'pr-16'
)}
/>
@@ -60,7 +116,7 @@ export function InputControl({
type === 'password' && (
<button
onClick={() => setShowPassword(!showPassword)}
- className="p-1 rounded hover:bg-main-view-fg/5 text-main-view-fg/70"
+ className="p-1 rounded text-muted-foreground"
>
{showPassword ? <EyeOff size={16} /> : <Eye size={16} />}
</button>
@@ -68,7 +124,7 @@ export function InputControl({
{hasInputActions && inputActions.includes('copy') && (
<button
onClick={copyToClipboard}
- className="p-1 rounded hover:bg-main-view-fg/5 text-main-view-fg/70"
+ className="p-1 rounded text-muted-foreground"
>
{isCopied ? (
<CopyCheck className="text-accent" size={16} />
diff --git a/web-app/src/containers/dynamicControllerSetting/SliderControl.tsx b/web-app/src/containers/dynamicControllerSetting/SliderControl.tsx
index 8bb5f27df..deb5d1d75 100644
--- a/web-app/src/containers/dynamicControllerSetting/SliderControl.tsx
+++ b/web-app/src/containers/dynamicControllerSetting/SliderControl.tsx
@@ -24,15 +24,23 @@ export function SliderControl({
step = 1,
onChange,
}: SliderControlProps) {
- const [currentValue, setCurrentValue] = React.useState<number[]>(
- Array.isArray(value) ? value : [min]
- )
+ const initialValue = Array.isArray(value) && value[0] !== undefined ? value : [min]
+ const [currentValue, setCurrentValue] = React.useState<number[]>(initialValue)
const [inputValue, setInputValue] = React.useState<string>(
- currentValue[0].toString()
+ initialValue[0].toString()
)
- const [inputNumber, setInputNumber] = React.useState<number>(currentValue[0])
+ const [inputNumber, setInputNumber] = React.useState<number>(initialValue[0])
const isExceedingMax = inputNumber > max
+ // Sync with external value changes
+ React.useEffect(() => {
+ if (Array.isArray(value) && value[0] !== undefined) {
+ setCurrentValue(value)
+ setInputValue(value[0].toString())
+ setInputNumber(value[0])
+ }
+ }, [value])
+
const handleValueChange = (newValue: SliderProps['defaultValue']) => {
if (newValue) {
setCurrentValue(newValue)
@@ -67,19 +75,19 @@ export function SliderControl({
step={step}
value={currentValue}
onValueChange={handleValueChange}
- className="[&_[role=slider]]:h-4 [&_[role=slider]]:w-4"
+ className="**:[[role=slider]]:h-4 **:[[role=slider]]:w-4"
aria-label={title}
/>
<div className="flex justify-between px-1">
- <span className="text-xs text-main-view-fg/50">{min}</span>
- <span className="text-xs text-main-view-fg/50">{max}</span>
+ <span className="text-xs text-muted-foreground">{min}</span>
+ <span className="text-xs text-muted-foreground">{max}</span>
</div>
</div>
<Input
className={`w-16 h-8 -mt-6 rounded-md border px-2 text-right text-xs ${
isExceedingMax
? 'border-destructive text-destructive'
- : 'text-main-view-fg/20 border-main-view-fg/10'
+ : 'text-muted-foreground'
} transition-all duration-200 ease-in-out`}
value={inputValue}
onChange={handleInputChange}
diff --git a/web-app/src/containers/dynamicControllerSetting/index.tsx b/web-app/src/containers/dynamicControllerSetting/index.tsx
index 91f0e8516..598c7d02c 100644
--- a/web-app/src/containers/dynamicControllerSetting/index.tsx
+++ b/web-app/src/containers/dynamicControllerSetting/index.tsx
@@ -46,11 +46,14 @@ export function DynamicControllerSetting({
placeholder={controllerProps.placeholder}
value={
typeof controllerProps.value === 'number'
- ? controllerProps.value.toString()
+ ? controllerProps.value
: (controllerProps.value as string) || ''
}
inputActions={controllerProps.input_actions}
className={className}
+ min={controllerProps.min}
+ max={controllerProps.max}
+ step={controllerProps.step}
onChange={(newValue) => onChange(newValue)}
/>
)
diff --git a/web-app/src/containers/loaders/ModelLoader.tsx b/web-app/src/containers/loaders/ModelLoader.tsx
index 146037a0a..3b449fe4f 100644
--- a/web-app/src/containers/loaders/ModelLoader.tsx
+++ b/web-app/src/containers/loaders/ModelLoader.tsx
@@ -1,6 +1,6 @@
export function ModelLoader() {
return (
- <div className="flex items-center justify-center gap-2 py-1 px-2 bg-main-view-fg/5 rounded">
+ <div className="flex items-center justify-center gap-2 py-1 px-2 bg-background rounded">
<span className="animate-spin h-3 w-3 border-2 border-current border-t-transparent rounded-full" />
<h1 className="font-medium text-xs">Loading model...</h1>
</div>
diff --git a/web-app/src/hooks/__tests__/useInterfaceSettings.test.ts b/web-app/src/hooks/__tests__/useInterfaceSettings.test.ts
index 1a6be0506..8901201b0 100644
--- a/web-app/src/hooks/__tests__/useInterfaceSettings.test.ts
+++ b/web-app/src/hooks/__tests__/useInterfaceSettings.test.ts
@@ -1,7 +1,6 @@
-import { describe, it, expect, vi, beforeEach } from 'vitest'
+import { describe, it, expect, vi, beforeEach } from 'vitest'
import { renderHook, act } from '@testing-library/react'
import { useInterfaceSettings } from '../useInterfaceSettings'
-import { THREAD_SCROLL_BEHAVIOR } from '@/constants/threadScroll'
// Mock constants
vi.mock('@/constants/localStorage', () => ({
@@ -45,15 +44,10 @@ describe('useInterfaceSettings', () => {
const { result } = renderHook(() => useInterfaceSettings())
expect(result.current.fontSize).toBe('16px')
- expect(result.current.chatWidth).toBe('compact')
- expect(result.current.appBgColor).toEqual({
- r: 25,
- g: 25,
- b: 25,
- a: 1,
- })
- expect(result.current.threadScrollBehavior).toBe(THREAD_SCROLL_BEHAVIOR.FLOW)
- expect(typeof result.current.setThreadScrollBehavior).toBe('function')
+ expect(result.current.accentColor).toBe('gray')
+ expect(typeof result.current.setFontSize).toBe('function')
+ expect(typeof result.current.setAccentColor).toBe('function')
+ expect(typeof result.current.resetInterface).toBe('function')
})
it('should update font size', () => {
@@ -66,95 +60,34 @@ describe('useInterfaceSettings', () => {
expect(result.current.fontSize).toBe('18px')
})
- it('should update chat width', () => {
- const { result } = renderHook(() => useInterfaceSettings())
-
- act(() => {
- result.current.setChatWidth('full')
- })
-
- expect(result.current.chatWidth).toBe('full')
- })
-
- describe('thread scroll behavior', () => {
- it('should update to sticky mode', () => {
+ describe('accent color', () => {
+ it('should update accent color', () => {
const { result } = renderHook(() => useInterfaceSettings())
act(() => {
- result.current.setThreadScrollBehavior(THREAD_SCROLL_BEHAVIOR.STICKY)
+ result.current.setAccentColor('blue')
})
- expect(result.current.threadScrollBehavior).toBe(
- THREAD_SCROLL_BEHAVIOR.STICKY
- )
+ expect(result.current.accentColor).toBe('blue')
})
- it('should fall back to default for invalid values', () => {
+ it('should not update for invalid accent color', () => {
const { result } = renderHook(() => useInterfaceSettings())
+ // First reset to default state
act(() => {
- result.current.setThreadScrollBehavior('invalid' as any)
+ result.current.resetInterface()
})
- expect(result.current.threadScrollBehavior).toBe(
- THREAD_SCROLL_BEHAVIOR.FLOW
- )
- })
- })
-
- it('should update app background color', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const newColor = { r: 100, g: 100, b: 100, a: 1 }
-
- act(() => {
- result.current.setAppBgColor(newColor)
- })
-
- expect(result.current.appBgColor).toEqual(newColor)
- })
-
- it('should update main view background color', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const newColor = { r: 200, g: 200, b: 200, a: 1 }
-
- act(() => {
- result.current.setAppMainViewBgColor(newColor)
- })
-
- expect(result.current.appMainViewBgColor).toEqual(newColor)
- })
-
- it('should update primary background color', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const newColor = { r: 50, g: 100, b: 150, a: 1 }
-
- act(() => {
- result.current.setAppPrimaryBgColor(newColor)
- })
-
- expect(result.current.appPrimaryBgColor).toEqual(newColor)
- })
+ const currentColor = result.current.accentColor
- it('should update accent background color', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const newColor = { r: 255, g: 100, b: 50, a: 1 }
+ act(() => {
+ result.current.setAccentColor('invalid' as any)
+ })
- act(() => {
- result.current.setAppAccentBgColor(newColor)
+ // Should remain unchanged
+ expect(result.current.accentColor).toBe(currentColor)
})
-
- expect(result.current.appAccentBgColor).toEqual(newColor)
- })
-
- it('should update destructive background color', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const newColor = { r: 255, g: 0, b: 0, a: 1 }
-
- act(() => {
- result.current.setAppDestructiveBgColor(newColor)
- })
-
- expect(result.current.appDestructiveBgColor).toEqual(newColor)
})
it('should reset interface settings to defaults', () => {
@@ -163,8 +96,7 @@ describe('useInterfaceSettings', () => {
// Change some values first
act(() => {
result.current.setFontSize('18px')
- result.current.setChatWidth('full')
- result.current.setAppBgColor({ r: 100, g: 100, b: 100, a: 1 })
+ result.current.setAccentColor('blue')
})
// Reset
@@ -173,29 +105,9 @@ describe('useInterfaceSettings', () => {
})
expect(result.current.fontSize).toBe('16px')
- // Note: resetInterface doesn't reset chatWidth, only visual properties
- expect(result.current.chatWidth).toBe('full')
- expect(result.current.appBgColor).toEqual({
- r: 255,
- g: 255,
- b: 255,
- a: 1,
- })
- })
-
-
- describe('Platform-specific behavior', () => {
- it('should use alpha 1 for web environments', () => {
- Object.defineProperty(global, 'IS_WEB_APP', { value: false })
- Object.defineProperty(global, 'IS_WINDOWS', { value: true })
-
- const { result } = renderHook(() => useInterfaceSettings())
-
- expect(result.current.appBgColor.a).toBe(1)
- })
+ expect(result.current.accentColor).toBe('gray')
})
-
describe('Reset interface functionality', () => {
beforeEach(() => {
// Mock document.documentElement.style.setProperty
@@ -209,142 +121,37 @@ describe('useInterfaceSettings', () => {
it('should reset CSS variables when resetInterface is called', () => {
const { result } = renderHook(() => useInterfaceSettings())
-
+
act(() => {
result.current.resetInterface()
})
-
+
expect(document.documentElement.style.setProperty).toHaveBeenCalledWith(
'--font-size-base',
'16px'
)
- expect(document.documentElement.style.setProperty).toHaveBeenCalledWith(
- '--app-bg',
- expect.any(String)
- )
- expect(document.documentElement.style.setProperty).toHaveBeenCalledWith(
- '--app-main-view',
- expect.any(String)
- )
- })
- })
-
-
- describe('Color manipulation', () => {
- it('should handle color updates with CSS variable setting', () => {
- // Mock document.documentElement.style.setProperty
- const setPropertySpy = vi.fn()
- Object.defineProperty(document.documentElement, 'style', {
- value: {
- setProperty: setPropertySpy,
- },
- writable: true,
- })
-
- const { result } = renderHook(() => useInterfaceSettings())
- const testColor = { r: 128, g: 64, b: 192, a: 0.8 }
-
- act(() => {
- result.current.setAppBgColor(testColor)
- })
-
- // In web environment (IS_TAURI=false), alpha is forced to 1
- expect(result.current.appBgColor).toEqual({ ...testColor, a: 1 })
- })
-
- it('should handle transparent colors', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const transparentColor = { r: 100, g: 100, b: 100, a: 0 }
-
- act(() => {
- result.current.setAppAccentBgColor(transparentColor)
- })
-
- expect(result.current.appAccentBgColor).toEqual(transparentColor)
- })
-
- it('should preserve alpha when blur is supported (macOS)', () => {
- // Mock macOS environment
- Object.defineProperty(global, 'IS_MACOS', { value: true, writable: true })
- Object.defineProperty(global, 'IS_TAURI', { value: true, writable: true })
- Object.defineProperty(global, 'IS_WINDOWS', { value: false, writable: true })
- Object.defineProperty(global, 'IS_LINUX', { value: false, writable: true })
-
- const setPropertySpy = vi.fn()
- Object.defineProperty(document.documentElement, 'style', {
- value: {
- setProperty: setPropertySpy,
- },
- writable: true,
- })
-
- const { result } = renderHook(() => useInterfaceSettings())
- const testColor = { r: 128, g: 64, b: 192, a: 0.5 }
-
- act(() => {
- result.current.setAppBgColor(testColor)
- })
-
- // On macOS with Tauri, alpha should be preserved
- expect(result.current.appBgColor).toEqual(testColor)
-
- // Reset for other tests
- Object.defineProperty(global, 'IS_MACOS', { value: false, writable: true })
- Object.defineProperty(global, 'IS_TAURI', { value: false, writable: true })
- })
- })
-
- describe('Edge cases', () => {
- it('should handle invalid color values gracefully', () => {
- const { result } = renderHook(() => useInterfaceSettings())
- const invalidColor = { r: -10, g: 300, b: 128, a: 2 }
-
- act(() => {
- result.current.setAppPrimaryBgColor(invalidColor)
- })
-
- expect(result.current.appPrimaryBgColor).toEqual(invalidColor)
})
})
describe('Type checking', () => {
it('should only accept valid font sizes', () => {
const { result } = renderHook(() => useInterfaceSettings())
-
+
// These should work
act(() => {
result.current.setFontSize('14px')
})
expect(result.current.fontSize).toBe('14px')
-
- act(() => {
- result.current.setFontSize('15px')
- })
- expect(result.current.fontSize).toBe('15px')
-
+
act(() => {
result.current.setFontSize('16px')
})
expect(result.current.fontSize).toBe('16px')
-
+
act(() => {
result.current.setFontSize('18px')
})
expect(result.current.fontSize).toBe('18px')
})
-
- it('should only accept valid chat widths', () => {
- const { result } = renderHook(() => useInterfaceSettings())
-
- act(() => {
- result.current.setChatWidth('full')
- })
- expect(result.current.chatWidth).toBe('full')
-
- act(() => {
- result.current.setChatWidth('compact')
- })
- expect(result.current.chatWidth).toBe('compact')
- })
})
})
diff --git a/web-app/src/hooks/use-mobile.ts b/web-app/src/hooks/use-mobile.ts
new file mode 100644
index 000000000..2b0fe1dfe
--- /dev/null
+++ b/web-app/src/hooks/use-mobile.ts
@@ -0,0 +1,19 @@
+import * as React from "react"
+
+const MOBILE_BREAKPOINT = 768
+
+export function useIsMobile() {
+ const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
+
+ React.useEffect(() => {
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
+ const onChange = () => {
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
+ }
+ mql.addEventListener("change", onChange)
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
+ return () => mql.removeEventListener("change", onChange)
+ }, [])
+
+ return !!isMobile
+}
diff --git a/web-app/src/hooks/use-sidebar-resize.ts b/web-app/src/hooks/use-sidebar-resize.ts
new file mode 100644
index 000000000..059c02eb6
--- /dev/null
+++ b/web-app/src/hooks/use-sidebar-resize.ts
@@ -0,0 +1,485 @@
+import React from "react";
+
+export interface UseSidebarResizeProps {
+ /**
+ * Direction of the resize handle
+ * - 'left': Handle is on left side (for right-positioned panels)
+ * - 'right': Handle is on right side (for left-positioned panels)
+ */
+ direction?: "left" | "right";
+
+ /**
+ * Current width of the panel
+ */
+ currentWidth: string;
+
+ /**
+ * Callback to update width when resizing
+ */
+ onResize: (width: string) => void;
+
+ /**
+ * Callback to toggle panel visibility
+ */
+ onToggle?: () => void;
+
+ /**
+ * Whether the panel is currently collapsed
+ */
+ isCollapsed?: boolean;
+
+ /**
+ * Minimum resize width
+ */
+ minResizeWidth?: string;
+
+ /**
+ * Maximum resize width
+ */
+ maxResizeWidth?: string;
+
+ /**
+ * Whether to enable auto-collapse when dragged below threshold
+ */
+ enableAutoCollapse?: boolean;
+
+ /**
+ * Auto-collapse threshold as percentage of minResizeWidth
+ * A value of 1.0 means the panel will collapse when dragged to minResizeWidth
+ * A value of 0.5 means the panel will collapse when dragged to 50% of minResizeWidth
+ * A value of 1.5 means the panel will collapse when dragged to 50% beyond minResizeWidth
+ * Can be any positive number, not limited to the range 0.0-1.0
+ */
+ autoCollapseThreshold?: number;
+
+ /**
+ * Threshold to expand when dragging in opposite direction (0.0-1.0)
+ * Percentage of distance needed to drag back to expand
+ */
+ expandThreshold?: number;
+
+ /**
+ * Whether to enable drag functionality
+ */
+ enableDrag?: boolean;
+
+ /**
+ * Callback to update dragging rail state
+ */
+ setIsDraggingRail?: (isDragging: boolean) => void;
+
+ /**
+ * Cookie name for persisting width
+ */
+ widthCookieName?: string;
+
+ /**
+ * Cookie max age in seconds
+ */
+ widthCookieMaxAge?: number;
+
+ /**
+ * Whether this is a nested sidebar (not at the edge of the screen)
+ */
+ isNested?: boolean;
+
+ /**
+ * Whether to enable toggle functionality
+ */
+ enableToggle?: boolean;
+}
+
+interface WidthUnit {
+ value: number;
+ unit: "rem" | "px";
+}
+
+/**
+ * Parse width string into value and unit
+ */
+function parseWidth(width: string): WidthUnit {
+ const unit = width.endsWith("rem") ? "rem" : "px";
+ const value = Number.parseFloat(width);
+ return { value, unit };
+}
+
+/**
+ * Convert any width to pixels for calculations
+ */
+function toPx(width: string): number {
+ const { value, unit } = parseWidth(width);
+ return unit === "rem" ? value * 16 : value;
+}
+
+/**
+ * Format width value with unit
+ */
+function formatWidth(value: number, unit: "rem" | "px"): string {
+ return `${unit === "rem" ? value.toFixed(1) : Math.round(value)}${unit}`;
+}
+
+/**
+ * A versatile hook for handling resizable sidebar (or inset) panels
+ * Works for both sidebar (left side) and artifacts (right side) panels
+ * Supports VS Code-like continuous drag to collapse/expand
+ */
+export function useSidebarResize({
+ direction = "right",
+ currentWidth,
+ onResize,
+ onToggle,
+ isCollapsed = false,
+ minResizeWidth = "14rem",
+ maxResizeWidth = "24rem",
+ enableToggle = true,
+ enableAutoCollapse = true,
+ autoCollapseThreshold = 1.5, // Default to collapsing at minWidth + 50%
+ expandThreshold = 0.2,
+ enableDrag = true,
+ setIsDraggingRail = () => {},
+ widthCookieName,
+ widthCookieMaxAge = 60 * 60 * 24 * 7, // 1 week default
+ isNested = false,
+}: UseSidebarResizeProps) {
+ // Refs for tracking drag state
+ const dragRef = React.useRef<HTMLButtonElement>(null);
+ const startWidth = React.useRef(0);
+ const startX = React.useRef(0);
+ const isDragging = React.useRef(false);
+ const isInteractingWithRail = React.useRef(false);
+ const lastWidth = React.useRef(0);
+ const lastLoggedWidth = React.useRef(0);
+ const dragStartPoint = React.useRef(0);
+ const lastDragDirection = React.useRef<"expand" | "collapse" | null>(null);
+ const lastTogglePoint = React.useRef(0);
+ const lastToggleWidth = React.useRef(0);
+ const toggleCooldown = React.useRef(false);
+ const lastToggleTime = React.useRef(0);
+ const dragDistanceFromToggle = React.useRef(0);
+ const dragOffset = React.useRef(0);
+ const railRect = React.useRef<DOMRect | null>(null);
+
+ // Refs for auto-collapse threshold
+ const autoCollapseThresholdPx = React.useRef(0);
+
+ // Memoize min/max width calculations for performance
+ const minWidthPx = React.useMemo(
+ () => toPx(minResizeWidth),
+ [minResizeWidth],
+ );
+ const maxWidthPx = React.useMemo(
+ () => toPx(maxResizeWidth),
+ [maxResizeWidth],
+ );
+
+ // Helper function to determine if width is increasing based on direction and mouse movement
+ const isIncreasingWidth = React.useCallback(
+ (currentX: number, referenceX: number): boolean => {
+ return direction === "left"
+ ? currentX < referenceX // For left-positioned handle, moving left increases width
+ : currentX > referenceX; // For right-positioned handle, moving right increases width
+ },
+ [direction],
+ );
+
+ // Helper function to calculate width based on mouse position and direction
+ const calculateWidth = React.useCallback(
+ (
+ e: MouseEvent,
+ initialX: number,
+ initialWidth: number,
+ currentRailRect: DOMRect | null,
+ ): number => {
+ if (isNested && currentRailRect) {
+ // For nested sidebars, use the delta from start position for precise tracking
+ const deltaX = e.clientX - initialX;
+
+ if (direction === "left") {
+ // For left-positioned handle (right panel)
+ // Width increases as mouse moves left (negative deltaX)
+ return initialWidth - deltaX;
+ }
+ // For right-positioned handle (left panel)
+ // Width increases as mouse moves right (positive deltaX)
+ return initialWidth + deltaX;
+ }
+ // For standard sidebars at window edges
+ if (direction === "left") {
+ // For left-positioned handle (right panel)
+ return window.innerWidth - e.clientX;
+ }
+ // For right-positioned handle (left panel)
+ return e.clientX;
+ },
+ [direction, isNested],
+ );
+
+ // Update auto-collapse threshold when dependencies change
+ React.useEffect(() => {
+ autoCollapseThresholdPx.current = enableAutoCollapse
+ ? minWidthPx * autoCollapseThreshold
+ : 0;
+ }, [minWidthPx, enableAutoCollapse, autoCollapseThreshold]);
+
+ // Persist width to cookie if cookie name is provided
+ const persistWidth = React.useCallback(
+ (width: string) => {
+ if (widthCookieName) {
+ document.cookie = `${widthCookieName}=${width}; path=/; max-age=${widthCookieMaxAge}`;
+ }
+ },
+ [widthCookieName, widthCookieMaxAge],
+ );
+
+ // Handle mouse down on resize handle
+ const handleMouseDown = React.useCallback(
+ (e: React.MouseEvent) => {
+ isInteractingWithRail.current = true;
+
+ if (!enableDrag) {
+ return;
+ }
+
+ // Store initial state
+ const currentWidthPx = isCollapsed ? 0 : toPx(currentWidth);
+ startWidth.current = currentWidthPx;
+ startX.current = e.clientX;
+ dragStartPoint.current = e.clientX;
+ lastWidth.current = currentWidthPx;
+ lastLoggedWidth.current = currentWidthPx;
+ lastTogglePoint.current = e.clientX;
+ lastToggleWidth.current = currentWidthPx;
+ lastDragDirection.current = null;
+ toggleCooldown.current = false;
+ lastToggleTime.current = 0;
+ dragDistanceFromToggle.current = 0;
+
+ // Reset drag offset
+ dragOffset.current = 0;
+
+ // Store the rail element's position for nested sidebars
+ if (isNested && dragRef.current) {
+ railRect.current = dragRef.current.getBoundingClientRect();
+ } else {
+ railRect.current = null;
+ }
+
+ e.preventDefault();
+ },
+ [enableDrag, isCollapsed, currentWidth, isNested],
+ );
+
+ // Handle mouse movement and resizing
+ React.useEffect(() => {
+ const handleMouseMove = (e: MouseEvent) => {
+ if (!isInteractingWithRail.current) return;
+
+ const deltaX = Math.abs(e.clientX - startX.current);
+ if (!isDragging.current && deltaX > 5) {
+ isDragging.current = true;
+ setIsDraggingRail(true);
+ }
+
+ if (isDragging.current) {
+ // Get unit for width calculations
+ const { unit } = parseWidth(currentWidth);
+
+ // Get current rail position for ultra-precise tracking
+ let currentRailRect = railRect.current;
+ if (isNested && dragRef.current) {
+ currentRailRect = dragRef.current.getBoundingClientRect();
+ }
+
+ // Determine current drag direction
+ const currentDragDirection = isIncreasingWidth(
+ e.clientX,
+ lastTogglePoint.current,
+ )
+ ? "expand"
+ : "collapse";
+
+ // Update direction tracking
+ if (lastDragDirection.current !== currentDragDirection) {
+ lastDragDirection.current = currentDragDirection;
+ }
+
+ // Calculate distance from last toggle point
+ dragDistanceFromToggle.current = Math.abs(
+ e.clientX - lastTogglePoint.current,
+ );
+
+ // Check for toggle cooldown (prevent rapid toggling)
+ const now = Date.now();
+ if (toggleCooldown.current && now - lastToggleTime.current > 200) {
+ toggleCooldown.current = false;
+ }
+
+ // Handle toggling between collapsed and expanded states
+ if (!toggleCooldown.current) {
+ // Handle collapsing when expanded
+ if (enableAutoCollapse && onToggle && !isCollapsed) {
+ // Calculate precise width based on mouse position
+ const currentDragWidth = calculateWidth(
+ e,
+ startX.current,
+ startWidth.current,
+ currentRailRect,
+ );
+
+ // Determine if we should collapse based on threshold
+ let shouldCollapse = false;
+
+ if (autoCollapseThreshold <= 1.0) {
+ // For thresholds <= 1.0, collapse when width is below minWidth * threshold
+ shouldCollapse =
+ currentDragWidth <= minWidthPx * autoCollapseThreshold;
+ } else {
+ // For thresholds > 1.0, we need to drag beyond minWidth by a certain amount
+ if (currentDragWidth <= minWidthPx) {
+ // Calculate how much beyond minWidth we need to drag
+ const extraDragNeeded =
+ minWidthPx * (autoCollapseThreshold - 1.0);
+
+ // Only collapse if we've dragged far enough beyond minWidth
+ const distanceBeyondMin = minWidthPx - currentDragWidth;
+
+ shouldCollapse = distanceBeyondMin >= extraDragNeeded;
+ }
+ }
+
+ if (currentDragDirection === "collapse" && shouldCollapse) {
+ onToggle(); // Collapse
+ lastTogglePoint.current = e.clientX;
+ lastToggleWidth.current = 0; // Width is 0 when collapsed
+ toggleCooldown.current = true;
+ lastToggleTime.current = now;
+ return;
+ }
+ }
+
+ // Handle expanding when collapsed
+ if (
+ onToggle &&
+ isCollapsed &&
+ currentDragDirection === "expand" &&
+ dragDistanceFromToggle.current > minWidthPx * expandThreshold
+ ) {
+ onToggle(); // Expand
+
+ // Calculate initial width based on exact mouse position
+ const initialWidth = calculateWidth(
+ e,
+ startX.current,
+ startWidth.current,
+ currentRailRect,
+ );
+
+ // Clamp to min/max
+ const clampedWidth = Math.max(
+ minWidthPx,
+ Math.min(maxWidthPx, initialWidth),
+ );
+
+ // Set initial width when expanding
+ const formattedWidth = formatWidth(
+ unit === "rem" ? clampedWidth / 16 : clampedWidth,
+ unit,
+ );
+ onResize(formattedWidth);
+ persistWidth(formattedWidth);
+
+ lastTogglePoint.current = e.clientX;
+ lastToggleWidth.current = clampedWidth;
+ toggleCooldown.current = true;
+ lastToggleTime.current = now;
+ return;
+ }
+ }
+
+ // Skip width calculations if panel is collapsed
+ if (isCollapsed) {
+ return;
+ }
+
+ // Calculate new width based on mouse position and drag direction
+ const newWidthPx = calculateWidth(
+ e,
+ startX.current,
+ startWidth.current,
+ currentRailRect,
+ );
+
+ // Clamp width between min and max
+ const clampedWidthPx = Math.max(
+ minWidthPx,
+ Math.min(maxWidthPx, newWidthPx),
+ );
+
+ // Convert to the target unit
+ const newWidth = unit === "rem" ? clampedWidthPx / 16 : clampedWidthPx;
+
+ // Format and update width
+ const formattedWidth = formatWidth(newWidth, unit);
+ onResize(formattedWidth);
+ persistWidth(formattedWidth);
+
+ // Update last width
+ lastWidth.current = clampedWidthPx;
+ }
+ };
+
+ const handleMouseUp = () => {
+ if (!isInteractingWithRail.current) return;
+
+ // Handle click (not drag) behavior
+ if (!isDragging.current && onToggle && enableToggle) {
+ onToggle();
+ }
+
+ // Reset all state
+ isDragging.current = false;
+ isInteractingWithRail.current = false;
+ lastWidth.current = 0;
+ lastLoggedWidth.current = 0;
+ lastDragDirection.current = null;
+ lastTogglePoint.current = 0;
+ lastToggleWidth.current = 0;
+ toggleCooldown.current = false;
+ lastToggleTime.current = 0;
+ dragDistanceFromToggle.current = 0;
+ dragOffset.current = 0;
+ railRect.current = null;
+ setIsDraggingRail(false);
+ };
+
+ document.addEventListener("mousemove", handleMouseMove);
+ document.addEventListener("mouseup", handleMouseUp);
+
+ return () => {
+ document.removeEventListener("mousemove", handleMouseMove);
+ document.removeEventListener("mouseup", handleMouseUp);
+ };
+ }, [
+ onResize,
+ onToggle,
+ isCollapsed,
+ currentWidth,
+ persistWidth,
+ setIsDraggingRail,
+ minWidthPx,
+ maxWidthPx,
+ isIncreasingWidth,
+ calculateWidth,
+ isNested,
+ enableAutoCollapse,
+ autoCollapseThreshold,
+ expandThreshold,
+ enableToggle,
+ ]);
+
+ return {
+ dragRef,
+ isDragging,
+ handleMouseDown,
+ };
+}
\ No newline at end of file
diff --git a/web-app/src/hooks/useInterfaceSettings.ts b/web-app/src/hooks/useInterfaceSettings.ts
index e8aa914ff..5927f406e 100644
--- a/web-app/src/hooks/useInterfaceSettings.ts
+++ b/web-app/src/hooks/useInterfaceSettings.ts
@@ -1,62 +1,117 @@
import { create } from 'zustand'
import { persist, createJSONStorage } from 'zustand/middleware'
import { localStorageKey } from '@/constants/localStorage'
-import { RgbaColor } from 'react-colorful'
-import { rgb, oklch, formatCss } from 'culori'
import { useTheme } from './useTheme'
-import { useEffect, useState } from 'react'
-import { getServiceHub } from '@/hooks/useServiceHub'
-import { supportsBlurEffects } from '@/utils/blurSupport'
-import {
- DEFAULT_THREAD_SCROLL_BEHAVIOR,
- ThreadScrollBehavior,
- isThreadScrollBehavior,
-} from '@/constants/threadScroll'
export type FontSize = '14px' | '15px' | '16px' | '18px' | '20px'
-export type ChatWidth = 'full' | 'compact'
+
+export const ACCENT_COLORS = [
+ {
+ name: 'Gray',
+ value: 'gray',
+ thumb: '#3F3F46',
+ primary: '#f17455',
+ sidebar: { light: '#fafafa', dark: '#171717' },
+ },
+ {
+ name: 'Red',
+ value: 'red',
+ thumb: '#F0614B',
+ primary: '#F0614B',
+ sidebar: { light: '#F3CBC4', dark: '#5E1308' },
+ },
+ {
+ name: 'Orange',
+ value: 'orange',
+ thumb: '#E9A23F',
+ primary: '#E9A23F',
+ sidebar: { light: '#F3DFC4', dark: '#5C3A0A' },
+ },
+ {
+ name: 'Green',
+ value: 'green',
+ thumb: '#88BA42',
+ primary: '#88BA42',
+ sidebar: { light: '#DFF3C4', dark: '#374B1B' },
+ },
+ {
+ name: 'Emerald',
+ value: 'emerald',
+ thumb: '#38AB51',
+ primary: '#38AB51',
+ sidebar: { light: '#C4F3CE', dark: '#194D24' },
+ },
+ {
+ name: 'Teal',
+ value: 'teal',
+ thumb: '#38AB8D',
+ primary: '#38AB8D',
+ sidebar: { light: '#C4F3E6', dark: '#194D3F' },
+ },
+ {
+ name: 'Cyan',
+ value: 'cyan',
+ thumb: '#45BBDE',
+ primary: '#45BBDE',
+ sidebar: { light: '#C4E8F3', dark: '#0F4657' },
+ },
+ {
+ name: 'Blue',
+ value: 'blue',
+ thumb: '#456BDE',
+ primary: '#456BDE',
+ sidebar: { light: '#C4D0F3', dark: '#0F2157' },
+ },
+ {
+ name: 'Purple',
+ value: 'purple',
+ thumb: '#865EEA',
+ primary: '#865EEA',
+ sidebar: { light: '#D2C4F3', dark: '#220C5A' },
+ },
+ {
+ name: 'Pink',
+ value: 'pink',
+ thumb: '#D55EF3',
+ primary: '#D55EF3',
+ sidebar: { light: '#E9C4F3', dark: '#4D075F' },
+ },
+ {
+ name: 'Rose',
+ value: 'rose',
+ thumb: '#F655B8',
+ primary: '#F655B8',
+ sidebar: { light: '#F3C4E1', dark: '#61053E' },
+ },
+] as const
+
+export type AccentColorValue = (typeof ACCENT_COLORS)[number]['value']
+const DEFAULT_ACCENT_COLOR: AccentColorValue = 'gray'
+
+const applyAccentColorToDOM = (colorValue: string, isDark: boolean) => {
+ const color = ACCENT_COLORS.find((c) => c.value === colorValue)
+ if (!color) return
+
+ const root = document.documentElement
+ const sidebarColor = isDark ? color.sidebar.dark : color.sidebar.light
+
+ root.style.setProperty('--sidebar', sidebarColor)
+ root.style.setProperty('--primary', color.primary)
+}
interface InterfaceSettingsState {
- chatWidth: ChatWidth
fontSize: FontSize
- appBgColor: RgbaColor
- appMainViewBgColor: RgbaColor
- appPrimaryBgColor: RgbaColor
- appAccentBgColor: RgbaColor
- appDestructiveBgColor: RgbaColor
- appMainViewTextColor: string
- appPrimaryTextColor: string
- appAccentTextColor: string
- appDestructiveTextColor: string
- appLeftPanelTextColor: string
- threadScrollBehavior: ThreadScrollBehavior
- setChatWidth: (size: ChatWidth) => void
+ accentColor: AccentColorValue
setFontSize: (size: FontSize) => void
- setAppBgColor: (color: RgbaColor) => void
- setAppMainViewBgColor: (color: RgbaColor) => void
- setAppPrimaryBgColor: (color: RgbaColor) => void
- setAppAccentBgColor: (color: RgbaColor) => void
- setAppDestructiveBgColor: (color: RgbaColor) => void
- setThreadScrollBehavior: (value: ThreadScrollBehavior) => void
+ setAccentColor: (color: AccentColorValue) => void
resetInterface: () => void
}
type InterfaceSettingsPersistedSlice = Omit<
InterfaceSettingsState,
- | 'resetInterface'
- | 'setChatWidth'
- | 'setFontSize'
- | 'setAppBgColor'
- | 'setAppMainViewBgColor'
- | 'setAppPrimaryBgColor'
- | 'setAppAccentBgColor'
- | 'setAppDestructiveBgColor'
- | 'setThreadScrollBehavior'
+ 'resetInterface' | 'setFontSize' | 'setAccentColor'
>
-const getBrightness = ({ r, g, b }: RgbaColor) =>
- (r * 299 + g * 587 + b * 114) / 1000
-
export const fontSizeOptions = [
{ label: 'Small', value: '14px' as FontSize },
{ label: 'Medium', value: '16px' as FontSize },
@@ -64,149 +119,13 @@ export const fontSizeOptions = [
{ label: 'Extra Large', value: '20px' as FontSize },
]
-// Helper to determine if blur effects are supported
-// This will be dynamically checked on Windows and Linux
-let blurEffectsSupported = true
-if ((IS_WINDOWS || IS_LINUX) && IS_TAURI) {
- // Default to false for Windows/Linux, will be checked async
- blurEffectsSupported = false
-}
-
-// Helper to get the appropriate alpha value
-const getAlphaValue = () => {
- // Web always uses alpha = 1
- if (!IS_TAURI) return 1
- // Windows/Linux use 1 if blur not supported, 0.4 if supported
- if ((IS_WINDOWS || IS_LINUX) && !blurEffectsSupported) return 1
- // macOS and Windows/Linux with blur support use 0.4
- return 0.4
-}
-
// Default interface settings
const defaultFontSize: FontSize = '16px'
-const defaultAppBgColor: RgbaColor = {
- r: 25,
- g: 25,
- b: 25,
- a: getAlphaValue(),
-}
-const defaultLightAppBgColor: RgbaColor = {
- r: 255,
- g: 255,
- b: 255,
- a: getAlphaValue(),
-}
-const defaultAppMainViewBgColor: RgbaColor = { r: 25, g: 25, b: 25, a: 1 }
-const defaultLightAppMainViewBgColor: RgbaColor = {
- r: 255,
- g: 255,
- b: 255,
- a: 1,
-}
-
-const defaultAppPrimaryBgColor: RgbaColor = { r: 219, g: 88, b: 44, a: 1 }
-const defaultLightAppPrimaryBgColor: RgbaColor = { r: 219, g: 88, b: 44, a: 1 }
-const defaultAppAccentBgColor: RgbaColor = { r: 45, g: 120, b: 220, a: 1 }
-const defaultLightAppAccentBgColor: RgbaColor = { r: 45, g: 120, b: 220, a: 1 }
-const defaultAppDestructiveBgColor: RgbaColor = { r: 144, g: 60, b: 60, a: 1 }
-const defaultLightAppDestructiveBgColor: RgbaColor = {
- r: 217,
- g: 95,
- b: 95,
- a: 1,
-}
-const defaultDarkLeftPanelTextColor: string = '#FFF'
-const defaultLightLeftPanelTextColor: string = '#000'
-
-// Helper function to check if two RGBA colors are equal
-const isColorEqual = (color1: RgbaColor, color2: RgbaColor): boolean => {
- return (
- color1.r === color2.r &&
- color1.g === color2.g &&
- color1.b === color2.b &&
- color1.a === color2.a
- )
-}
-
-// Helper function to check if color is default (not customized)
-export const isDefaultColor = (color: RgbaColor): boolean => {
- // Check if RGB matches default (ignore alpha since it changes based on blur support)
- const isDarkDefault = color.r === 25 && color.g === 25 && color.b === 25
- const isLightDefault = color.r === 255 && color.g === 255 && color.b === 255
-
- // Consider it default if RGB matches and alpha is either 0.4 or 1 (common values)
- const hasDefaultAlpha =
- Math.abs(color.a - 0.4) < 0.01 || Math.abs(color.a - 1) < 0.01
-
- return (isDarkDefault || isLightDefault) && hasDefaultAlpha
-}
-
-export const isDefaultColorMainView = (color: RgbaColor): boolean => {
- return (
- isColorEqual(color, defaultAppMainViewBgColor) ||
- isColorEqual(color, defaultLightAppMainViewBgColor)
- )
-}
-
-export const isDefaultColorPrimary = (color: RgbaColor): boolean => {
- return (
- isColorEqual(color, defaultAppPrimaryBgColor) ||
- isColorEqual(color, defaultLightAppPrimaryBgColor)
- )
-}
-
-export const isDefaultColorAccent = (color: RgbaColor): boolean => {
- return (
- isColorEqual(color, defaultAppAccentBgColor) ||
- isColorEqual(color, defaultLightAppAccentBgColor)
- )
-}
-
-export const isDefaultColorDestructive = (color: RgbaColor): boolean => {
- return (
- isColorEqual(color, defaultAppDestructiveBgColor) ||
- isColorEqual(color, defaultLightAppDestructiveBgColor)
- )
-}
-
-// Helper function to get default text color based on theme
-export const getDefaultTextColor = (isDark: boolean): string => {
- return isDark ? defaultDarkLeftPanelTextColor : defaultLightLeftPanelTextColor
-}
-
-const getIsDarkTheme = (): boolean => {
- try {
- return !!useTheme.getState().isDark
- } catch {
- return false
- }
-}
-
-const copyColor = (color: RgbaColor): RgbaColor => ({
- r: color.r,
- g: color.g,
- b: color.b,
- a: color.a,
-})
const createDefaultInterfaceValues = (): InterfaceSettingsPersistedSlice => {
- const isDark = getIsDarkTheme()
- const defaultTextColor = getDefaultTextColor(isDark)
-
return {
- chatWidth: 'compact',
fontSize: defaultFontSize,
- appBgColor: copyColor(defaultAppBgColor),
- appMainViewBgColor: copyColor(defaultAppMainViewBgColor),
- appPrimaryBgColor: copyColor(defaultAppPrimaryBgColor),
- appAccentBgColor: copyColor(defaultAppAccentBgColor),
- appDestructiveBgColor: copyColor(defaultAppDestructiveBgColor),
- appLeftPanelTextColor: defaultTextColor,
- appMainViewTextColor: defaultTextColor,
- appPrimaryTextColor: defaultTextColor,
- appAccentTextColor: defaultTextColor,
- appDestructiveTextColor: '#FFF',
- threadScrollBehavior: DEFAULT_THREAD_SCROLL_BEHAVIOR,
+ accentColor: DEFAULT_ACCENT_COLOR,
}
}
@@ -214,59 +133,6 @@ const interfaceStorage = createJSONStorage<InterfaceSettingsState>(() =>
localStorage
)
-// Hook to check if alpha slider should be shown
-export const useBlurSupport = () => {
- const [supportsBlur, setSupportsBlur] = useState(
- IS_MACOS && IS_TAURI // Default to true only for macOS
- )
-
- useEffect(() => {
- const checkBlurSupport = async () => {
- if ((IS_WINDOWS || IS_LINUX) && IS_TAURI) {
- try {
- // Get hardware info to check OS version
- const hardwareInfo = await getServiceHub()
- .hardware()
- .getHardwareInfo()
- const supported = supportsBlurEffects(hardwareInfo)
-
- blurEffectsSupported = supported
- setSupportsBlur(supported)
-
- const platform = IS_WINDOWS ? 'Windows' : 'Linux'
- if (supported) {
- console.log(
- `✅ ${platform} blur effects: SUPPORTED - Alpha slider will be shown`
- )
- } else {
- console.log(
- `❌ ${platform} blur effects: NOT SUPPORTED - Alpha slider will be hidden, alpha set to 1`
- )
- }
- } catch (error) {
- console.error(
- `❌ Failed to check ${IS_WINDOWS ? 'Windows' : 'Linux'} blur support:`,
- error
- )
- setSupportsBlur(false)
- }
- } else if (IS_MACOS && IS_TAURI) {
- console.log(
- '🍎 macOS platform: Blur effects supported, alpha slider shown'
- )
- } else if (!IS_TAURI) {
- console.log('🌐 Web platform: Alpha slider hidden, alpha set to 1')
- }
- }
-
- checkBlurSupport()
- }, [])
-
- // Return true if alpha slider should be shown
- // Show on macOS (always), and conditionally on Windows/Linux based on detection
- return IS_TAURI && (IS_MACOS || supportsBlur)
-}
-
export const useInterfaceSettings = create<InterfaceSettingsState>()(
persist(
(set) => {
@@ -282,139 +148,23 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(
defaultFontSize
)
- // Reset app background color with correct alpha based on blur support
- const currentAlpha = blurEffectsSupported && IS_TAURI ? 0.4 : 1
- const defaultBg = isDark
- ? { r: 25, g: 25, b: 25, a: currentAlpha }
- : { r: 255, g: 255, b: 255, a: currentAlpha }
- const culoriRgbBg = rgb({
- mode: 'rgb',
- r: defaultBg.r / 255,
- g: defaultBg.g / 255,
- b: defaultBg.b / 255,
- alpha: defaultBg.a,
- })
- const oklchBgColor = oklch(culoriRgbBg)
- document.documentElement.style.setProperty(
- '--app-bg',
- formatCss(oklchBgColor)
- )
-
- // Reset main view background color
- const defaultMainView = isDark
- ? defaultAppMainViewBgColor
- : defaultLightAppMainViewBgColor
- const culoriRgbMainView = rgb({
- mode: 'rgb',
- r: defaultMainView.r / 255,
- g: defaultMainView.g / 255,
- b: defaultMainView.b / 255,
- alpha: defaultMainView.a,
- })
- const oklchMainViewColor = oklch(culoriRgbMainView)
- document.documentElement.style.setProperty(
- '--app-main-view',
- formatCss(oklchMainViewColor)
- )
-
- // Reset primary color
- const defaultPrimary = isDark
- ? defaultAppPrimaryBgColor
- : defaultLightAppPrimaryBgColor
- const culoriRgbPrimary = rgb({
- mode: 'rgb',
- r: defaultPrimary.r / 255,
- g: defaultPrimary.g / 255,
- b: defaultPrimary.b / 255,
- alpha: defaultPrimary.a,
- })
- const oklchPrimaryColor = oklch(culoriRgbPrimary)
- document.documentElement.style.setProperty(
- '--app-primary',
- formatCss(oklchPrimaryColor)
- )
-
- // Reset accent color
- const defaultAccent = isDark
- ? defaultAppAccentBgColor
- : defaultLightAppAccentBgColor
- const culoriRgbAccent = rgb({
- mode: 'rgb',
- r: defaultAccent.r / 255,
- g: defaultAccent.g / 255,
- b: defaultAccent.b / 255,
- alpha: defaultAccent.a,
- })
- const oklchAccentColor = oklch(culoriRgbAccent)
- document.documentElement.style.setProperty(
- '--app-accent',
- formatCss(oklchAccentColor)
- )
-
- // Reset destructive color
- const defaultDestructive = isDark
- ? defaultAppDestructiveBgColor
- : defaultLightAppDestructiveBgColor
- const culoriRgbDestructive = rgb({
- mode: 'rgb',
- r: defaultDestructive.r / 255,
- g: defaultDestructive.g / 255,
- b: defaultDestructive.b / 255,
- alpha: defaultDestructive.a,
- })
- const oklchDestructiveColor = oklch(culoriRgbDestructive)
- document.documentElement.style.setProperty(
- '--app-destructive',
- formatCss(oklchDestructiveColor)
- )
-
- // Reset text colors
- const defaultTextColor = getDefaultTextColor(isDark)
- document.documentElement.style.setProperty(
- '--text-color',
- defaultTextColor
- )
- document.documentElement.style.setProperty(
- '--app-left-panel-fg',
- defaultTextColor
- )
- document.documentElement.style.setProperty(
- '--app-main-view-fg',
- defaultTextColor
- )
- document.documentElement.style.setProperty('--app-primary-fg', '#FFF')
- document.documentElement.style.setProperty('--app-accent-fg', '#FFF')
- document.documentElement.style.setProperty(
- '--app-destructive-fg',
- '#FFF'
- )
+ // Reset accent color preset
+ applyAccentColorToDOM(DEFAULT_ACCENT_COLOR, isDark)
// Update state
- set({
- fontSize: defaultFontSize,
- appBgColor: defaultBg,
- appMainViewBgColor: defaultMainView,
- appPrimaryBgColor: defaultPrimary,
- appAccentBgColor: defaultAccent,
- appLeftPanelTextColor: defaultTextColor,
- appMainViewTextColor: defaultTextColor,
- appPrimaryTextColor: '#FFF',
- appAccentTextColor: '#FFF',
- appDestructiveBgColor: defaultDestructive,
- appDestructiveTextColor: '#FFF',
- threadScrollBehavior: DEFAULT_THREAD_SCROLL_BEHAVIOR,
- })
- },
-
- setThreadScrollBehavior: (value: ThreadScrollBehavior) =>
set({
- threadScrollBehavior: isThreadScrollBehavior(value)
- ? value
- : DEFAULT_THREAD_SCROLL_BEHAVIOR,
- }),
+ fontSize: defaultFontSize,
+ accentColor: DEFAULT_ACCENT_COLOR,
+ })
+ },
- setChatWidth: (value: ChatWidth) => {
- set({ chatWidth: value })
+ setAccentColor: (color: AccentColorValue) => {
+ const colorExists = ACCENT_COLORS.find((c) => c.value === color)
+ if (!colorExists) return
+
+ const { isDark } = useTheme.getState()
+ applyAccentColorToDOM(color, isDark)
+ set({ accentColor: color })
},
setFontSize: (size: FontSize) => {
@@ -423,275 +173,6 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(
// Update state
set({ fontSize: size })
},
-
- setAppBgColor: (color: RgbaColor) => {
- // Get the current theme state
- const { isDark } = useTheme.getState()
-
- // If color is being set to default, use theme-appropriate default
- let finalColor = color
- if (isDefaultColor(color)) {
- finalColor = isDark ? defaultAppBgColor : defaultLightAppBgColor
- }
-
- // Force alpha to 1 if blur effects are not supported
- if (!blurEffectsSupported && (IS_WINDOWS || IS_LINUX || !IS_TAURI)) {
- finalColor = { ...finalColor, a: 1 }
- }
-
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColor.r / 255,
- g: finalColor.g / 255,
- b: finalColor.b / 255,
- alpha: finalColor.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
-
- // Update CSS variable with OKLCH
- document.documentElement.style.setProperty(
- '--app-bg',
- formatCss(oklchColor)
- )
-
- // Calculate text color based on background brightness or use default based on theme
- let textColor: string
-
- if (isDefaultColor(color)) {
- // If using default background, use default text color based on theme
- textColor = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColor = getBrightness(finalColor) > 128 ? '#000' : '#FFF'
- }
-
- // Update CSS variable for text color
- document.documentElement.style.setProperty('--text-color', textColor)
-
- // Store the original RGBA and calculated text color in state
- set({ appBgColor: finalColor, appLeftPanelTextColor: textColor })
- },
-
- setAppMainViewBgColor: (color: RgbaColor) => {
- // Get the current theme state
- const { isDark } = useTheme.getState()
-
- // If color is being set to default, use theme-appropriate default
- let finalColorMainView = color
- if (isDefaultColorMainView(color)) {
- finalColorMainView = isDark
- ? defaultAppMainViewBgColor
- : defaultLightAppMainViewBgColor
- }
-
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColorMainView.r / 255,
- g: finalColorMainView.g / 255,
- b: finalColorMainView.b / 255,
- alpha: finalColorMainView.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
-
- // Update CSS variable with OKLCH
- document.documentElement.style.setProperty(
- '--app-main-view',
- formatCss(oklchColor)
- )
-
- // Calculate text color based on background brightness or use default based on theme
- let textColor: string
-
- if (isDefaultColor(color)) {
- // If using default background, use default text color based on theme
- textColor = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColor =
- getBrightness(finalColorMainView) > 128 ? '#000' : '#FFF'
- }
-
- // Update CSS variable for text color
- document.documentElement.style.setProperty(
- '--app-main-view-fg',
- textColor
- )
-
- // Store the original RGBA and calculated text color in state
- set({
- appMainViewBgColor: finalColorMainView,
- appMainViewTextColor: textColor,
- })
- },
-
- setAppPrimaryBgColor: (color: RgbaColor) => {
- // Get the current theme state
- const { isDark } = useTheme.getState()
-
- // If color is being set to default, use theme-appropriate default
- let finalColorPrimary = color
- if (isDefaultColorPrimary(color)) {
- finalColorPrimary = isDark
- ? defaultAppPrimaryBgColor
- : defaultLightAppPrimaryBgColor
- }
-
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColorPrimary.r / 255,
- g: finalColorPrimary.g / 255,
- b: finalColorPrimary.b / 255,
- alpha: finalColorPrimary.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
-
- // Update CSS variable with OKLCH
- document.documentElement.style.setProperty(
- '--app-primary',
- formatCss(oklchColor)
- )
-
- // Calculate text color based on background brightness or use default based on theme
- let textColor: string
-
- if (isDefaultColorPrimary(color)) {
- // If using default background, use default text color based on theme
- textColor = '#FFF'
- } else {
- // Otherwise calculate based on brightness
- textColor = getBrightness(finalColorPrimary) > 128 ? '#000' : '#FFF'
- }
-
- // Update CSS variable for text color
- document.documentElement.style.setProperty(
- '--app-primary-fg',
- textColor
- )
-
- // Store the original RGBA and calculated text color in state
- set({
- appPrimaryBgColor: finalColorPrimary,
- appPrimaryTextColor: textColor,
- })
- },
-
- setAppAccentBgColor: (color: RgbaColor) => {
- // Get the current theme state
- const { isDark } = useTheme.getState()
-
- // If color is being set to default, use theme-appropriate default
- let finalColorAccent = color
- if (isDefaultColorAccent(color)) {
- finalColorAccent = isDark
- ? defaultAppAccentBgColor
- : defaultLightAppAccentBgColor
- }
-
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColorAccent.r / 255,
- g: finalColorAccent.g / 255,
- b: finalColorAccent.b / 255,
- alpha: finalColorAccent.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
-
- // Update CSS variable with OKLCH
- document.documentElement.style.setProperty(
- '--app-accent',
- formatCss(oklchColor)
- )
-
- // Calculate text color based on background brightness or use default based on theme
- let textColor: string
-
- if (isDefaultColorAccent(color)) {
- // If using default background, use default text color based on theme
- textColor = '#FFF'
- } else {
- // Otherwise calculate based on brightness
- textColor = getBrightness(finalColorAccent) > 128 ? '#000' : '#FFF'
- }
-
- // Update CSS variable for text color
- document.documentElement.style.setProperty(
- '--app-accent-fg',
- textColor
- )
-
- // Store the original RGBA and calculated text color in state
- set({
- appAccentBgColor: finalColorAccent,
- appAccentTextColor: textColor,
- })
- },
-
- setAppDestructiveBgColor: (color: RgbaColor) => {
- // Get the current theme state
- const { isDark } = useTheme.getState()
-
- // If color is being set to default, use theme-appropriate default
- let finalColorDestructive = color
- if (isDefaultColorDestructive(color)) {
- finalColorDestructive = isDark
- ? defaultAppDestructiveBgColor
- : defaultLightAppDestructiveBgColor
- }
-
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColorDestructive.r / 255,
- g: finalColorDestructive.g / 255,
- b: finalColorDestructive.b / 255,
- alpha: finalColorDestructive.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
-
- // Update CSS variable with OKLCH
- document.documentElement.style.setProperty(
- '--app-destructive',
- formatCss(oklchColor)
- )
-
- // Calculate text color based on background brightness or use default based on theme
- let textColor: string
-
- if (isDefaultColorDestructive(color)) {
- // If using default background, use default text color based on theme
- textColor = '#FFF'
- } else {
- // Otherwise calculate based on brightness
- textColor =
- getBrightness(finalColorDestructive) > 128 ? '#000' : '#FFF'
- }
-
- // Update CSS variable for text color
- document.documentElement.style.setProperty(
- '--app-destructive-fg',
- textColor
- )
-
- // Store the original RGBA and calculated text color in state
- set({
- appDestructiveBgColor: finalColorDestructive,
- appDestructiveTextColor: textColor,
- })
- },
}
},
{
@@ -700,12 +181,8 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(
// Apply settings when hydrating from storage
onRehydrateStorage: () => (state) => {
if (state) {
- if (!isThreadScrollBehavior(state.threadScrollBehavior)) {
- state.threadScrollBehavior = DEFAULT_THREAD_SCROLL_BEHAVIOR
- }
-
// Migrate old font size value '15px' to '16px'
- if (state.fontSize === '15px' as FontSize) {
+ if ((state.fontSize as FontSize) === '15px') {
state.fontSize = '16px'
}
@@ -718,181 +195,9 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(
// Get the current theme state
const { isDark } = useTheme.getState()
- // Just use the stored color as-is during rehydration
- // The InterfaceProvider will handle alpha normalization after blur detection
- const finalColor = state.appBgColor
-
- let finalColorMainView = state.appMainViewBgColor
- if (isDefaultColorMainView(state.appMainViewBgColor)) {
- finalColorMainView = isDark
- ? defaultAppMainViewBgColor
- : defaultLightAppMainViewBgColor
- }
-
- let finalColorPrimary = state.appPrimaryBgColor
- if (isDefaultColorPrimary(state.appPrimaryBgColor)) {
- finalColorPrimary = isDark
- ? defaultAppPrimaryBgColor
- : defaultLightAppPrimaryBgColor
- }
-
- let finalColorAccent = state.appAccentBgColor
- if (isDefaultColorAccent(state.appAccentBgColor)) {
- finalColorAccent = isDark
- ? defaultAppAccentBgColor
- : defaultLightAppAccentBgColor
- }
-
- let finalColorDestructive = state.appDestructiveBgColor
- if (isDefaultColorDestructive(state.appDestructiveBgColor)) {
- finalColorDestructive = isDark
- ? defaultAppDestructiveBgColor
- : defaultLightAppDestructiveBgColor
- }
-
- // Apply app background color from storage
- // Convert RGBA to a format culori can work with
- const culoriRgb = rgb({
- mode: 'rgb',
- r: finalColor.r / 255,
- g: finalColor.g / 255,
- b: finalColor.b / 255,
- alpha: finalColor.a,
- })
-
- const culoriRgbMainViewColor = rgb({
- mode: 'rgb',
- r: finalColorMainView.r / 255,
- g: finalColorMainView.g / 255,
- b: finalColorMainView.b / 255,
- alpha: finalColorMainView.a,
- })
-
- const culoriRgbPrimaryColor = rgb({
- mode: 'rgb',
- r: finalColorPrimary.r / 255,
- g: finalColorPrimary.g / 255,
- b: finalColorPrimary.b / 255,
- alpha: finalColorPrimary.a,
- })
-
- const culoriRgbAccentColor = rgb({
- mode: 'rgb',
- r: finalColorAccent.r / 255,
- g: finalColorAccent.g / 255,
- b: finalColorAccent.b / 255,
- alpha: finalColorAccent.a,
- })
-
- const culoriRgbDestructiveColor = rgb({
- mode: 'rgb',
- r: finalColorDestructive.r / 255,
- g: finalColorDestructive.g / 255,
- b: finalColorDestructive.b / 255,
- alpha: finalColorDestructive.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
- const oklchMainViewColor = oklch(culoriRgbMainViewColor)
- const oklchPrimaryColor = oklch(culoriRgbPrimaryColor)
- const oklchAccentColor = oklch(culoriRgbAccentColor)
- const oklchDestructiveColor = oklch(culoriRgbDestructiveColor)
-
- document.documentElement.style.setProperty(
- '--app-bg',
- formatCss(oklchColor)
- )
-
- document.documentElement.style.setProperty(
- '--app-main-view',
- formatCss(oklchMainViewColor)
- )
-
- document.documentElement.style.setProperty(
- '--app-primary',
- formatCss(oklchPrimaryColor)
- )
-
- document.documentElement.style.setProperty(
- '--app-accent',
- formatCss(oklchAccentColor)
- )
-
- document.documentElement.style.setProperty(
- '--app-destructive',
- formatCss(oklchDestructiveColor)
- )
-
- // Calculate and apply text color
- let textColor: string
-
- if (isDefaultColor(state.appBgColor)) {
- // If using default background, use default text color based on theme
- textColor = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColor = getBrightness(finalColor) > 128 ? '#000' : '#FFF'
- }
-
- document.documentElement.style.setProperty(
- '--app-left-panel-fg',
- textColor
- )
-
- // Calculate and apply text color for main view
- let textColorMainView: string
-
- if (isDefaultColorMainView(state.appMainViewBgColor)) {
- // If using default background, use default text color based on theme
- textColorMainView = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColorMainView =
- getBrightness(finalColorMainView) > 128 ? '#000' : '#FFF'
- }
-
- document.documentElement.style.setProperty(
- '--app-main-view-fg',
- textColorMainView
- )
-
- // Calculate and apply text color for primary
- let textColorPrimary: string
-
- if (isDefaultColorPrimary(state.appPrimaryBgColor)) {
- // If using default background, use default text color based on theme
- textColorPrimary = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColorPrimary =
- getBrightness(finalColorPrimary) > 128 ? '#000' : '#FFF'
- }
-
- document.documentElement.style.setProperty(
- '--app-primary-fg',
- textColorPrimary
- )
-
- // Calculate and apply text color for accent
- let textColorAccent: string
-
- if (isDefaultColorAccent(state.appAccentBgColor)) {
- // If using default background, use default text color based on theme
- textColorAccent = getDefaultTextColor(isDark)
- } else {
- // Otherwise calculate based on brightness
- textColorAccent =
- getBrightness(finalColorAccent) > 128 ? '#000' : '#FFF'
- }
-
- document.documentElement.style.setProperty(
- '--app-accent-fg',
- textColorAccent
- )
-
- // We don't need to update the state here as it will be handled by the store
- // The state will be updated with the hydrated values automatically
+ // Apply accent color preset
+ const accentColorValue = state.accentColor || DEFAULT_ACCENT_COLOR
+ applyAccentColorToDOM(accentColorValue, isDark)
}
// Return the state to be used for hydration
@@ -901,3 +206,13 @@ export const useInterfaceSettings = create<InterfaceSettingsState>()(
}
)
)
+
+// Subscribe to theme changes to update accent color sidebar variant
+let prevIsDark = useTheme.getState().isDark
+useTheme.subscribe((state) => {
+ if (state.isDark !== prevIsDark) {
+ prevIsDark = state.isDark
+ const { accentColor } = useInterfaceSettings.getState()
+ applyAccentColorToDOM(accentColor, state.isDark)
+ }
+})
diff --git a/web-app/src/hooks/useLeftPanel.ts b/web-app/src/hooks/useLeftPanel.ts
index 69f999343..d1909f1ff 100644
--- a/web-app/src/hooks/useLeftPanel.ts
+++ b/web-app/src/hooks/useLeftPanel.ts
@@ -5,8 +5,10 @@ import { localStorageKey } from '@/constants/localStorage'
type LeftPanelStoreState = {
open: boolean
size: number
+ width: string // Sidebar width in rem (e.g., "15rem")
setLeftPanel: (value: boolean) => void
setLeftPanelSize: (value: number) => void
+ setLeftPanelWidth: (value: string) => void
}
export const useLeftPanel = create<LeftPanelStoreState>()(
@@ -14,8 +16,10 @@ export const useLeftPanel = create<LeftPanelStoreState>()(
(set) => ({
open: true,
size: 20, // Default size of 20%
+ width: '15rem', // Default sidebar width
setLeftPanel: (value) => set({ open: value }),
setLeftPanelSize: (value) => set({ size: value }),
+ setLeftPanelWidth: (value) => set({ width: value }),
}),
{
name: localStorageKey.LeftPanel,
diff --git a/web-app/src/hooks/useSearchDialog.ts b/web-app/src/hooks/useSearchDialog.ts
new file mode 100644
index 000000000..d068a3fb4
--- /dev/null
+++ b/web-app/src/hooks/useSearchDialog.ts
@@ -0,0 +1,11 @@
+import { create } from 'zustand'
+
+type SearchDialogState = {
+ open: boolean
+ setOpen: (value: boolean) => void
+}
+
+export const useSearchDialog = create<SearchDialogState>()((set) => ({
+ open: false,
+ setOpen: (value) => set({ open: value }),
+}))
diff --git a/web-app/src/index.css b/web-app/src/index.css
index 045159af6..086bec64d 100644
--- a/web-app/src/index.css
+++ b/web-app/src/index.css
@@ -12,21 +12,40 @@
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
- --font-studio: 'StudioFeixenSans', sans-serif;
- --color-app: var(--app-bg);
- --color-left-panel-fg: var(--app-left-panel-fg);
- --color-main-view: var(--app-main-view);
- --color-main-view-fg: var(--app-main-view-fg);
- --color-primary: var(--app-primary);
- --color-primary-fg: var(--app-primary-fg);
- --color-accent: var(--app-accent);
- --color-accent-fg: var(--app-accent-fg);
- --color-destructive: var(--app-destructive);
- --color-destructive-fg: var(--app-destructive-fg);
-
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
+ --color-accent: var(--accent);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
--color-border: var(--border);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-chart-1: var(--chart-1);
+ --color-chart-2: var(--chart-2);
+ --color-chart-3: var(--chart-3);
+ --color-chart-4: var(--chart-4);
+ --color-chart-5: var(--chart-5);
+ --color-sidebar: var(--sidebar);
+ --color-sidebar-foreground: var(--sidebar-foreground);
+ --color-sidebar-primary: var(--sidebar-primary);
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
+ --color-sidebar-accent: var(--sidebar-accent);
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
+ --color-sidebar-border: var(--sidebar-border);
+ --color-sidebar-ring: var(--sidebar-ring);
+ --animate-hue-rotate: hue-rotate 4s infinite;
+ --font-studio: "StudioFeixenSans";
+ --font-sans: "Inter", sans-serif;
/* Font scale based on --font-size-base */
--text-xs: calc(var(--font-size-base) * 0.75); /* ~12px */
@@ -43,120 +62,176 @@
--text-8xl: calc(var(--font-size-base) * 6); /* ~96px */
--text-9xl: calc(var(--font-size-base) * 8); /* ~128px */
- --muted-foreground: oklch(0.556 0 0);
- --color-background: var(--background);
- --color-foreground: var(--foreground);
- --color-card: var(--card);
- --color-card-foreground: var(--card-foreground);
- --color-popover: var(--popover);
- --color-popover-foreground: var(--popover-foreground);
- --color-primary-foreground: var(--primary-foreground);
- --color-secondary: var(--secondary);
- --color-secondary-foreground: var(--secondary-foreground);
- --color-muted-foreground: var(--muted-foreground);
- --color-border: var(--border);
- --color-input: var(--input);
- --color-chart-1: var(--chart-1);
- --color-chart-2: var(--chart-2);
- --color-chart-3: var(--chart-3);
- --color-chart-4: var(--chart-4);
- --color-chart-5: var(--chart-5);
- --color-streamdown-caret: var(--streamdown-caret);
}
:root {
- /* Button */
--radius: 0.625rem;
- --font-size-base: 16px;
- --app-bg: '';
- --app-left-panel-fg: '';
- --app-main-view: '';
- --app-main-view-fg: '';
- --app-primary: '';
- --app-primary-fg: '';
- --app-accent: '';
- --app-accent-fg: '';
- --app-destructive: '';
- --app-destructive-fg: '';
-
+ --background: oklch(1 0 0);
+ --foreground: oklch(0.145 0 0);
+ --card: oklch(1 0 0);
+ --card-foreground: oklch(0.145 0 0);
+ --popover: oklch(1 0 0);
+ --popover-foreground: oklch(0.145 0 0);
+ --primary: oklch(0.7003 0.1611 35.09);
+ --primary-foreground: oklch(0.985 0 0);
+ --secondary: oklch(0.97 0 0);
+ --secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
+ --accent: oklch(0.97 0 0);
+ --accent-foreground: oklch(0.205 0 0);
+ --destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
+ --input: oklch(0.922 0 0);
+ --ring: oklch(0.708 0 0);
+ --chart-1: oklch(0.646 0.222 41.116);
+ --chart-2: oklch(0.6 0.118 184.704);
+ --chart-3: oklch(0.398 0.07 227.392);
+ --chart-4: oklch(0.828 0.189 84.429);
+ --chart-5: oklch(0.769 0.188 70.08);
+ --sidebar: #194D24;
+ --sidebar-foreground: oklch(0.145 0 0);
+ --sidebar-primary: oklch(0.205 0 0);
+ --sidebar-primary-foreground: oklch(0.985 0 0);
+ --sidebar-accent: oklch(0.97 0 0);
+ --sidebar-accent-foreground: oklch(0.205 0 0);
+ --sidebar-border: oklch(0.922 0 0);
+ --sidebar-ring: oklch(0.708 0 0);
}
.dark {
+ --background: oklch(0.18 0 0);
+ --foreground: oklch(0.985 0 0);
+ --card: oklch(0.205 0 0);
+ --card-foreground: oklch(0.985 0 0);
+ --popover: oklch(0.205 0 0);
+ --popover-foreground: oklch(0.985 0 0);
+ --primary: oklch(0.7003 0.1611 35.09);
+ --primary-foreground: oklch(0.205 0 0);
+ --secondary: oklch(0.269 0 0);
+ --secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
+ --accent: oklch(0.269 0 0);
+ --accent-foreground: oklch(0.985 0 0);
+ --destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
+ --input: oklch(1 0 0 / 15%);
+ --ring: oklch(0.556 0 0);
+ --chart-1: oklch(0.488 0.243 264.376);
+ --chart-2: oklch(0.696 0.17 162.48);
+ --chart-3: oklch(0.769 0.188 70.08);
+ --chart-4: oklch(0.627 0.265 303.9);
+ --chart-5: oklch(0.645 0.246 16.439);
+ --sidebar: #194D24;
+ --sidebar-foreground: oklch(0.985 0 0);
+ --sidebar-primary: oklch(0.488 0.243 264.376);
+ --sidebar-primary-foreground: oklch(0.985 0 0);
+ --sidebar-accent: oklch(0.269 0 0);
+ --sidebar-accent-foreground: oklch(0.985 0 0);
+ --sidebar-border: oklch(1 0 0 / 10%);
+ --sidebar-ring: oklch(0.556 0 0);
}
@layer base {
+ * {
+ @apply border-border outline-ring/50 select-none;
+ caret-color: var(--foreground);
+ }
body {
- @apply overflow-hidden;
- min-height: 100vh;
- min-height: -webkit-fill-available;
- padding-top: env(safe-area-inset-top, 0px);
- padding-bottom: env(safe-area-inset-bottom);
- padding-left: env(safe-area-inset-left);
- padding-right: env(safe-area-inset-right);
- ::-webkit-scrollbar {
- width: 6px;
- height: 6px;
- }
-
- ::-webkit-scrollbar-thumb {
- border-radius: 10px;
- margin-left: 2px;
- @apply bg-main-view-fg/10;
- }
+ @apply bg-background text-foreground font-sans text-sm antialiased overflow-hidden;
+ }
+
+ ::-ms-reveal {
+ display: none;
+ }
+
+ /* WebKit (Safari/Tauri) input caret fix */
+ input,
+ textarea {
+ caret-color: var(--foreground) !important;
+ -webkit-text-fill-color: currentColor;
+ }
+
+ /* WebKit number input spin buttons */
+ input[type="number"]::-webkit-inner-spin-button,
+ input[type="number"]::-webkit-outer-spin-button {
+ -webkit-appearance: none;
+ appearance: none;
+ background: var(--foreground);
+ opacity: 0.5;
+ cursor: pointer;
+ }
+
+ input[type="number"]::-webkit-inner-spin-button:hover,
+ input[type="number"]::-webkit-outer-spin-button:hover {
+ opacity: 0.8;
+ }
+
+ code,
+ pre,
+ kbd,
+ samp {
+ @apply font-mono;
+ }
+
+ svg.lucide {
+ width: 14px;
+ height: 14px;
}
svg {
- stroke-width: 1.5;
+ stroke-width: 2;
}
- a {
- @apply !text-accent;
+ /* Scrollbar styles */
+ ::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
}
- ::-ms-reveal {
- display: none;
+ ::-webkit-scrollbar-track {
+ background: transparent;
}
- .reset-heading {
- :is(h1, h2, h3, h4, h5, h6) {
- font-weight: 600;
- font-size: 14px !important;
- margin-top: 0 !important;
- margin-bottom: 0.5em;
- }
+ ::-webkit-scrollbar-thumb {
+ background: oklch(0.708 0 0 / 30%);
+ border-radius: 4px;
}
-}
-@layer utilities {
- /* Hide scrollbar for Chrome, Safari and Opera */
- .scrollbar-hide::-webkit-scrollbar {
- display: none;
+ ::-webkit-scrollbar-thumb:hover {
+ background: oklch(0.708 0 0 / 50%);
}
- /* Hide scrollbar for IE, Edge and Firefox */
- .scrollbar-hide {
- -ms-overflow-style: none; /* IE and Edge */
- scrollbar-width: none; /* Firefox */
+ .dark ::-webkit-scrollbar-thumb {
+ background: oklch(0.985 0 0 / 20%);
+ }
+
+ .dark ::-webkit-scrollbar-thumb:hover {
+ background: oklch(0.985 0 0 / 35%);
}
-}
-@layer components {
- .search-highlight {
- @apply font-bold;
- color: color-mix(in srgb, currentColor 80%, white 20%);
+ /* Firefox scrollbar */
+ * {
+ scrollbar-width: thin;
+ scrollbar-color: oklch(0.708 0 0 / 30%) transparent;
}
- .epr-main {
- input {
- @apply border !border-main-view-fg/10 !h-9 !text-sm !bg-main-view;
- }
- input:focus {
- @apply !bg-main-view;
- }
+
+ .dark * {
+ scrollbar-color: oklch(0.985 0 0 / 20%) transparent;
}
+
}
+
+@layer base {
+ * {
+ @apply border-border outline-ring/50;
+ }
+ body {
+ @apply bg-background text-foreground;
+ }
+
+ [data-streamdown="code-block-header"] {
+ padding: 6px 16px !important;
+ }
+}
\ No newline at end of file
diff --git a/web-app/src/lib/haptic.ts b/web-app/src/lib/haptic.ts
new file mode 100644
index 000000000..005340ec7
--- /dev/null
+++ b/web-app/src/lib/haptic.ts
@@ -0,0 +1,138 @@
+/* eslint-disable @typescript-eslint/no-explicit-any */
+
+export const hapticFeedback = (type: HapticType) => {
+ if (type === "none" || typeof window === "undefined") return;
+
+ try {
+ const AudioContext =
+ window.AudioContext || (window as any).webkitAudioContext;
+ if (!AudioContext) return;
+
+ const ctx = new AudioContext();
+ const now = ctx.currentTime;
+
+ switch (type) {
+ case "heavy": {
+ const oscillator = ctx.createOscillator();
+ const gainNode = ctx.createGain();
+ oscillator.connect(gainNode);
+ gainNode.connect(ctx.destination);
+
+ oscillator.type = "triangle";
+ oscillator.frequency.setValueAtTime(180, now);
+ oscillator.frequency.exponentialRampToValueAtTime(40, now + 0.15);
+
+ gainNode.gain.setValueAtTime(0.4, now);
+ gainNode.gain.exponentialRampToValueAtTime(0.01, now + 0.12);
+
+ oscillator.start(now);
+ oscillator.stop(now + 0.15);
+ break;
+ }
+
+ case "light": {
+ const oscillator = ctx.createOscillator();
+ const gainNode = ctx.createGain();
+ oscillator.connect(gainNode);
+ gainNode.connect(ctx.destination);
+
+ oscillator.type = "sine";
+ oscillator.frequency.setValueAtTime(800, now);
+
+ gainNode.gain.setValueAtTime(0.15, now);
+ gainNode.gain.exponentialRampToValueAtTime(0.01, now + 0.08);
+
+ oscillator.start(now);
+ oscillator.stop(now + 0.08);
+ break;
+ }
+
+ case "pop": {
+ const oscillator = ctx.createOscillator();
+ const gainNode = ctx.createGain();
+ oscillator.connect(gainNode);
+ gainNode.connect(ctx.destination);
+
+ oscillator.type = "sine";
+ oscillator.frequency.setValueAtTime(1200, now);
+ oscillator.frequency.exponentialRampToValueAtTime(300, now + 0.05);
+
+ gainNode.gain.setValueAtTime(0.3, now);
+ gainNode.gain.exponentialRampToValueAtTime(0.01, now + 0.05);
+
+ oscillator.start(now);
+ oscillator.stop(now + 0.05);
+ break;
+ }
+
+ case "soft": {
+ const oscillator = ctx.createOscillator();
+ const gainNode = ctx.createGain();
+ oscillator.connect(gainNode);
+ gainNode.connect(ctx.destination);
+
+ oscillator.type = "sine";
+ oscillator.frequency.setValueAtTime(400, now);
+ oscillator.frequency.exponentialRampToValueAtTime(300, now + 0.1);
+
+ gainNode.gain.setValueAtTime(0.08, now);
+ gainNode.gain.exponentialRampToValueAtTime(0.01, now + 0.1);
+
+ oscillator.start(now);
+ oscillator.stop(now + 0.1);
+ break;
+ }
+
+ case "double": {
+ // First tap
+ const osc1 = ctx.createOscillator();
+ const gain1 = ctx.createGain();
+ osc1.connect(gain1);
+ gain1.connect(ctx.destination);
+
+ osc1.type = "sine";
+ osc1.frequency.setValueAtTime(600, now);
+ gain1.gain.setValueAtTime(0.2, now);
+ gain1.gain.exponentialRampToValueAtTime(0.01, now + 0.04);
+ osc1.start(now);
+ osc1.stop(now + 0.04);
+
+ // Second tap
+ const osc2 = ctx.createOscillator();
+ const gain2 = ctx.createGain();
+ osc2.connect(gain2);
+ gain2.connect(ctx.destination);
+
+ osc2.type = "sine";
+ osc2.frequency.setValueAtTime(800, now + 0.06);
+ gain2.gain.setValueAtTime(0.25, now + 0.06);
+ gain2.gain.exponentialRampToValueAtTime(0.01, now + 0.1);
+ osc2.start(now + 0.06);
+ osc2.stop(now + 0.1);
+ break;
+ }
+
+ case "swoosh": {
+ const oscillator = ctx.createOscillator();
+ const gainNode = ctx.createGain();
+ oscillator.connect(gainNode);
+ gainNode.connect(ctx.destination);
+
+ oscillator.type = "sawtooth";
+ oscillator.frequency.setValueAtTime(200, now);
+ oscillator.frequency.exponentialRampToValueAtTime(1000, now + 0.08);
+ oscillator.frequency.exponentialRampToValueAtTime(400, now + 0.12);
+
+ gainNode.gain.setValueAtTime(0.1, now);
+ gainNode.gain.linearRampToValueAtTime(0.15, now + 0.06);
+ gainNode.gain.exponentialRampToValueAtTime(0.01, now + 0.12);
+
+ oscillator.start(now);
+ oscillator.stop(now + 0.12);
+ break;
+ }
+ }
+ } catch (e) {
+ console.error("Audio haptic failed", e);
+ }
+};
diff --git a/web-app/src/lib/merge-button-refs.ts b/web-app/src/lib/merge-button-refs.ts
new file mode 100644
index 000000000..a5c8f9c39
--- /dev/null
+++ b/web-app/src/lib/merge-button-refs.ts
@@ -0,0 +1,19 @@
+/*
+ This function merges multiple refs into a single ref callback.
+ It ensures that the value is assigned to each ref, whether it's a function or a mutable ref object.
+ This is useful when you need to merge external refs with an internal ref.
+*/
+
+export function mergeButtonRefs<T extends HTMLButtonElement>(
+ refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>
+): React.RefCallback<T> {
+ return (value) => {
+ for (const ref of refs) {
+ if (typeof ref === "function") {
+ ref(value);
+ } else if (ref != null) {
+ (ref as React.MutableRefObject<T | null>).current = value;
+ }
+ }
+ };
+}
\ No newline at end of file
diff --git a/web-app/src/lib/shortcuts/const.ts b/web-app/src/lib/shortcuts/const.ts
index b8b4276db..cce632468 100644
--- a/web-app/src/lib/shortcuts/const.ts
+++ b/web-app/src/lib/shortcuts/const.ts
@@ -22,6 +22,9 @@ export const PlatformShortcuts: ShortcutMap = {
// Go to settings - different per platform to avoid browser "preferences" conflict
[ShortcutAction.GO_TO_SETTINGS]: { key: ',', usePlatformMetaKey: true },
+ // Search - opens search dialog
+ [ShortcutAction.SEARCH]: { key: 'k', usePlatformMetaKey: true },
+
// Zoom shortcuts - same on both platforms (standard shortcuts)
[ShortcutAction.ZOOM_IN]: {
key: '+',
diff --git a/web-app/src/lib/shortcuts/types.ts b/web-app/src/lib/shortcuts/types.ts
index 1ce5104e0..1bd51fffb 100644
--- a/web-app/src/lib/shortcuts/types.ts
+++ b/web-app/src/lib/shortcuts/types.ts
@@ -7,6 +7,7 @@ export enum ShortcutAction {
NEW_CHAT = 'newChat',
TOGGLE_SIDEBAR = 'toggleSidebar',
GO_TO_SETTINGS = 'goSettings',
+ SEARCH = 'search',
ZOOM_IN = 'zoomIn',
ZOOM_OUT = 'zoomOut',
}
diff --git a/web-app/src/locales/cs/settings.json b/web-app/src/locales/cs/settings.json
index 40aac2f3d..be0501d7f 100644
--- a/web-app/src/locales/cs/settings.json
+++ b/web-app/src/locales/cs/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Obnovit všechna nastavení rozhraní na výchozí.",
"resetInterfaceSuccess": "Rozhraní úspěšně obnoveno",
"resetInterfaceSuccessDesc": "Všechna nastavení rozhraní byla obnovena na výchozí.",
- "chatWidth": "Šířka rozložení chatu",
- "chatWidthDesc": "Vyberte předvolbu šířky chatu, která vyhovuje vašemu pracovnímu prostoru.",
"threadScrollTitle": "Chování rolování vlákna",
"threadScrollDesc": "Vyberte, jak má viewport chatu reagovat při příchodu nových zpráv.",
"threadScrollFlowTitle": "Plynulé rolování",
diff --git a/web-app/src/locales/de-DE/settings.json b/web-app/src/locales/de-DE/settings.json
index c49824918..c16bfc89f 100644
--- a/web-app/src/locales/de-DE/settings.json
+++ b/web-app/src/locales/de-DE/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Setzt alle Darstellungseinstellungen auf die Standardeinstellungen zurück.",
"resetInterfaceSuccess": "Erscheinungsbild erfolgreich zurückgesetzt",
"resetInterfaceSuccessDesc": "Alle Darstellungseinstellungen wurden auf die Standardeinstellungen zurückgesetzt.",
- "chatWidth": "Chat Breite",
- "chatWidthDesc": "Passe die Breite der Chatansicht an.",
"tokenCounterCompact": "Kompakter Token-Zähler",
"tokenCounterCompactDesc": "Token-Zähler im Chat-Eingabefeld anzeigen. Wenn deaktiviert, wird der Token-Zähler unter dem Eingabefeld angezeigt.",
"codeBlockTitle": "Code Block",
diff --git a/web-app/src/locales/en/common.json b/web-app/src/locales/en/common.json
index 7090fe42c..571ebc69d 100644
--- a/web-app/src/locales/en/common.json
+++ b/web-app/src/locales/en/common.json
@@ -246,6 +246,7 @@
},
"projects": {
"title": "Projects",
+ "new": "New Projects",
"addProject": "Add Project",
"addToProject": "Add to project",
"removeFromProject": "Remove from project",
@@ -287,6 +288,11 @@
"startNewConversation": "Start a new conversation with {{projectName}} below",
"conversationsIn": "Conversations in {{projectName}}",
"conversationsDescription": "Click on any conversation to continue chatting, or start a new one below.",
+ "conversation": "Conversation",
+ "instructions": "Instructions",
+ "setup": "Setup",
+ "instructionsDescription": "Customize tone and style of response",
+ "manageInstructions": "Manage Instructions",
"thread": "thread",
"threads": "threads",
"updated": "Updated:",
diff --git a/web-app/src/locales/en/settings.json b/web-app/src/locales/en/settings.json
index 1f6c6fe99..7bb0aa568 100644
--- a/web-app/src/locales/en/settings.json
+++ b/web-app/src/locales/en/settings.json
@@ -75,6 +75,8 @@
"newLineDesc": "Insert a new line.",
"shiftEnter": "Shift + Enter",
"navigation": "Navigation",
+ "search": "Search",
+ "searchDesc": "Open the search dialog.",
"goToSettings": "Go to Settings",
"goToSettingsDesc": "Open settings."
},
@@ -98,8 +100,6 @@
"resetToDefaultDesc": "Reset all interface settings to default.",
"resetInterfaceSuccess": "Interface reset successfully",
"resetInterfaceSuccessDesc": "All interface settings have been restored to default.",
- "chatWidth": "Chat Layout Width",
- "chatWidthDesc": "Pick a chat width preset that fits your workspace.",
"threadScrollTitle": "Thread Scroll Behavior",
"threadScrollDesc": "Choose how the chat viewport should react when new messages arrive.",
"threadScrollFlowTitle": "Flow scroll",
diff --git a/web-app/src/locales/fr/settings.json b/web-app/src/locales/fr/settings.json
index 63b78468b..b4689638b 100644
--- a/web-app/src/locales/fr/settings.json
+++ b/web-app/src/locales/fr/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Réinitialisez tous les paramètres d'interface par défaut.",
"resetInterfaceSuccess": "Interface réinitialisée avec succès",
"resetInterfaceSuccessDesc": "Tous les paramètres d'interface ont été restaurés par défaut.",
- "chatWidth": "Largeur de la disposition de la discussion",
- "chatWidthDesc": "Choisissez un préréglage de largeur de discussion qui correspond à votre espace de travail.",
"threadScrollTitle": "Comportement du défilement de la discussion",
"threadScrollDesc": "Choisissez comment la fenêtre de discussion doit réagir à l'arrivée de nouveaux messages.",
"threadScrollFlowTitle": "Défilement fluide",
diff --git a/web-app/src/locales/id/settings.json b/web-app/src/locales/id/settings.json
index 5ac30fafa..3f02b3fed 100644
--- a/web-app/src/locales/id/settings.json
+++ b/web-app/src/locales/id/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Setel ulang semua pengaturan tampilan ke default.",
"resetInterfaceSuccess": "Tampilan berhasil diatur ulang",
"resetInterfaceSuccessDesc": "Semua pengaturan tampilan telah dikembalikan ke default.",
- "chatWidth": "Lebar Obrolan",
- "chatWidthDesc": "Sesuaikan lebar tampilan obrolan.",
"tokenCounterCompact": "Penghitung Token Ringkas",
"tokenCounterCompactDesc": "Tampilkan penghitung token di dalam input obrolan. Saat dinonaktifkan, penghitung token muncul di bawah input.",
"codeBlockTitle": "Blok Kode",
diff --git a/web-app/src/locales/ja/settings.json b/web-app/src/locales/ja/settings.json
index 0f6b97748..83d85ed48 100644
--- a/web-app/src/locales/ja/settings.json
+++ b/web-app/src/locales/ja/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "すべての外観設定をデフォルトにリセットします。",
"resetInterfaceSuccess": "外観が正常にリセットされました",
"resetInterfaceSuccessDesc": "すべての外観設定がデフォルトに復元されました。",
- "chatWidth": "チャットの幅",
- "chatWidthDesc": "チャットビューの幅をカスタマイズします。",
"tokenCounterCompact": "コンパクトなトークンカウンター",
"tokenCounterCompactDesc": "チャット入力内にトークンカウンターを表示します。無効にすると、トークンカウンターは入力の下に表示されます。",
"codeBlockTitle": "コードブロック",
diff --git a/web-app/src/locales/pl/settings.json b/web-app/src/locales/pl/settings.json
index 10d847b96..9aa738d8c 100644
--- a/web-app/src/locales/pl/settings.json
+++ b/web-app/src/locales/pl/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Przywróć domyślne ustawienia wyglądu.",
"resetInterfaceSuccess": "Pomyślnie Przywrócono Ustawienia Wyglądu",
"resetInterfaceSuccessDesc": "Wszystkie ustawienia wyglądu zostały przywrócone do wartości domyślnych.",
- "chatWidth": "Szerokość Czatu",
- "chatWidthDesc": "Ustaw szerokość komponentu czatu.",
"codeBlockTitle": "Blok Kodu",
"codeBlockDesc": "Wybierz styl kolorowania składni w blokach kodu.",
"showLineNumbers": "Pokazuj Numery Linii",
diff --git a/web-app/src/locales/pt-BR/settings.json b/web-app/src/locales/pt-BR/settings.json
index 338c25ee8..da715a18f 100644
--- a/web-app/src/locales/pt-BR/settings.json
+++ b/web-app/src/locales/pt-BR/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Redefinir todas as configurações de aparência para padrão.",
"resetAppearanceSuccess": "Aparência redefinida com sucesso",
"resetAppearanceSuccessDesc": "Todas as configurações de aparência foram restauradas para padrão.",
- "chatWidth": "Largura do Chat",
- "chatWidthDesc": "Personalizar a largura da visualização do chat.",
"tokenCounterCompact": "Contador de Tokens Compacto",
"tokenCounterCompactDesc": "Mostrar contador de tokens dentro da entrada do chat. Quando desabilitado, contador de tokens aparece abaixo da entrada.",
"codeBlockTitle": "Bloco de Código",
diff --git a/web-app/src/locales/ru/settings.json b/web-app/src/locales/ru/settings.json
index 9ac3974dd..9af875a5f 100644
--- a/web-app/src/locales/ru/settings.json
+++ b/web-app/src/locales/ru/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Сбросить все настройки интерфейса к значениям по умолчанию.",
"resetInterfaceSuccess": "Интерфейс успешно сброшен.",
"resetInterfaceSuccessDesc": "Все настройки интерфейса возвращены к значениям по умолчанию.",
- "chatWidth": "Ширина макета чата",
- "chatWidthDesc": "Выберите предустановленную ширину чата, которая подходит для вашего рабочего пространства.",
"threadScrollTitle": "Поведение прокрутки ответов",
"threadScrollDesc": "Выберите, как окно чата должно реагировать на поступление новых сообщений.",
"threadScrollFlowTitle": "Следящая прокрутка",
diff --git a/web-app/src/locales/vn/settings.json b/web-app/src/locales/vn/settings.json
index 92a952aef..9a965d2a6 100644
--- a/web-app/src/locales/vn/settings.json
+++ b/web-app/src/locales/vn/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "Đặt lại tất cả cài đặt giao diện về mặc định.",
"resetInterfaceSuccess": "Giao diện đã được đặt lại thành công",
"resetInterfaceSuccessDesc": "Tất cả cài đặt giao diện đã được khôi phục về mặc định.",
- "chatWidth": "Chiều rộng trò chuyện",
- "chatWidthDesc": "Tùy chỉnh chiều rộng của chế độ xem trò chuyện.",
"tokenCounterCompact": "Bộ đếm token nhỏ gọn",
"tokenCounterCompactDesc": "Hiển thị bộ đếm token bên trong ô nhập trò chuyện. Khi tắt, bộ đếm token sẽ xuất hiện bên dưới ô nhập.",
"codeBlockTitle": "Khối mã",
diff --git a/web-app/src/locales/zh-CN/settings.json b/web-app/src/locales/zh-CN/settings.json
index b591d5d40..384213e29 100644
--- a/web-app/src/locales/zh-CN/settings.json
+++ b/web-app/src/locales/zh-CN/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "将所有外观设置重置为默认值。",
"resetInterfaceSuccess": "外观重置成功",
"resetInterfaceSuccessDesc": "所有外观设置已恢复为默认值。",
- "chatWidth": "聊天宽度",
- "chatWidthDesc": "自定义聊天视图的宽度。",
"tokenCounterCompact": "紧凑令牌计数器",
"tokenCounterCompactDesc": "在聊天输入框内显示令牌计数器。禁用时,令牌计数器显示在输入框下方。",
"codeBlockTitle": "代码块",
diff --git a/web-app/src/locales/zh-TW/settings.json b/web-app/src/locales/zh-TW/settings.json
index b55657811..f2d52dcae 100644
--- a/web-app/src/locales/zh-TW/settings.json
+++ b/web-app/src/locales/zh-TW/settings.json
@@ -98,8 +98,6 @@
"resetToDefaultDesc": "將所有外觀設定重設為預設值。",
"resetInterfaceSuccess": "外觀重設成功",
"resetInterfaceSuccessDesc": "所有外觀設定已還原為預設值。",
- "chatWidth": "聊天寬度",
- "chatWidthDesc": "自訂聊天檢視的寬度。",
"codeBlockTitle": "程式碼區塊",
"codeBlockDesc": "選擇語法高亮樣式。",
"showLineNumbers": "顯示行號",
diff --git a/web-app/src/providers/InterfaceProvider.tsx b/web-app/src/providers/InterfaceProvider.tsx
index bcc6d6260..657361cfe 100644
--- a/web-app/src/providers/InterfaceProvider.tsx
+++ b/web-app/src/providers/InterfaceProvider.tsx
@@ -1,317 +1,33 @@
-import { useEffect } from 'react'
-import { useInterfaceSettings, useBlurSupport } from '@/hooks/useInterfaceSettings'
+import { useEffect } from 'react'
+import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
import { useTheme } from '@/hooks/useTheme'
-import {
- isDefaultColor,
- getDefaultTextColor,
- isDefaultColorMainView,
- isDefaultColorPrimary,
- isDefaultColorAccent,
- isDefaultColorDestructive,
-} from '@/hooks/useInterfaceSettings'
+import { ACCENT_COLORS } from '@/hooks/useInterfaceSettings'
/**
* InterfaceProvider ensures interface settings are applied on every page load
* This component should be mounted at the root level of the application
*/
export function InterfaceProvider() {
- const {
- fontSize,
- appBgColor,
- appLeftPanelTextColor,
- appMainViewBgColor,
- appMainViewTextColor,
- appPrimaryBgColor,
- appPrimaryTextColor,
- appAccentBgColor,
- appAccentTextColor,
- appDestructiveBgColor,
- appDestructiveTextColor,
- } = useInterfaceSettings()
+ const { fontSize, accentColor } = useInterfaceSettings()
const { isDark } = useTheme()
- const showAlphaSlider = useBlurSupport()
-
- // Force re-apply interface settings on mount to fix theme desync issues on Windows
- // This ensures that when navigating to routes (like logs), the theme is properly applied
- useEffect(() => {
- const {
- setAppBgColor,
- setAppMainViewBgColor,
- appBgColor,
- appMainViewBgColor,
- } = useInterfaceSettings.getState()
-
- // Re-trigger setters to ensure CSS variables are applied with correct theme
- setAppBgColor(appBgColor)
- setAppMainViewBgColor(appMainViewBgColor)
- }, []) // Run once on mount
-
- // Update colors when blur support changes (important for Windows/Linux)
- useEffect(() => {
- const { setAppBgColor, appBgColor } = useInterfaceSettings.getState()
- // Re-apply color to update alpha based on blur support
- setAppBgColor(appBgColor)
- }, [showAlphaSlider])
// Apply interface settings on mount and when they change
useEffect(() => {
// Apply font size
document.documentElement.style.setProperty('--font-size-base', fontSize)
+ }, [fontSize])
- // Hide alpha slider when blur is not supported
- const shouldHideAlpha = !showAlphaSlider
- let alphaStyleElement = document.getElementById('alpha-slider-style')
-
- if (shouldHideAlpha) {
- if (!alphaStyleElement) {
- alphaStyleElement = document.createElement('style')
- alphaStyleElement.id = 'alpha-slider-style'
- document.head.appendChild(alphaStyleElement)
- }
- alphaStyleElement.textContent =
- '.react-colorful__alpha { display: none !important; }'
- } else if (alphaStyleElement) {
- alphaStyleElement.remove()
- }
-
- // Apply app background color
- // Import culori functions dynamically to avoid SSR issues
- import('culori').then(({ rgb, oklch, formatCss }) => {
- // Convert RGBA to a format culori can work with
- // Use alpha = 1 when blur is not supported
- const culoriRgb = rgb({
- mode: 'rgb',
- r: appBgColor.r / 255,
- g: appBgColor.g / 255,
- b: appBgColor.b / 255,
- alpha: showAlphaSlider ? appBgColor.a : 1,
- })
-
- const culoriRgbMainView = rgb({
- mode: 'rgb',
- r: appMainViewBgColor.r / 255,
- g: appMainViewBgColor.g / 255,
- b: appMainViewBgColor.b / 255,
- alpha: appMainViewBgColor.a,
- })
-
- const culoriRgbPrimary = rgb({
- mode: 'rgb',
- r: appPrimaryBgColor.r / 255,
- g: appPrimaryBgColor.g / 255,
- b: appPrimaryBgColor.b / 255,
- alpha: appPrimaryBgColor.a,
- })
-
- const culoriRgbAccent = rgb({
- mode: 'rgb',
- r: appAccentBgColor.r / 255,
- g: appAccentBgColor.g / 255,
- b: appAccentBgColor.b / 255,
- alpha: appAccentBgColor.a,
- })
-
- const culoriRgbDestructive = rgb({
- mode: 'rgb',
- r: appDestructiveBgColor.r / 255,
- g: appDestructiveBgColor.g / 255,
- b: appDestructiveBgColor.b / 255,
- alpha: appDestructiveBgColor.a,
- })
-
- // Convert to OKLCH for CSS variable
- const oklchColor = oklch(culoriRgb)
- const oklchColormainViewApp = oklch(culoriRgbMainView)
- const oklchColorPrimary = oklch(culoriRgbPrimary)
- const oklchColorAccent = oklch(culoriRgbAccent)
- const oklchColorDestructive = oklch(culoriRgbDestructive)
-
- if (oklchColor) {
- document.documentElement.style.setProperty(
- '--app-bg',
- formatCss(oklchColor)
- )
- }
- if (oklchColormainViewApp) {
- document.documentElement.style.setProperty(
- '--app-main-view',
- formatCss(oklchColormainViewApp)
- )
- }
- if (oklchColorPrimary) {
- document.documentElement.style.setProperty(
- '--app-primary',
- formatCss(oklchColorPrimary)
- )
- }
- if (oklchColorAccent) {
- document.documentElement.style.setProperty(
- '--app-accent',
- formatCss(oklchColorAccent)
- )
- }
- if (oklchColorDestructive) {
- document.documentElement.style.setProperty(
- '--app-destructive',
- formatCss(oklchColorDestructive)
- )
- }
- })
-
- // Apply text color based on background brightness
- document.documentElement.style.setProperty(
- '--app-left-panel-fg',
- appLeftPanelTextColor
- )
-
- // Apply text color based on background brightness
- document.documentElement.style.setProperty(
- '--app-main-view-fg',
- appMainViewTextColor
- )
-
- // Apply text color based on background brightness for primary
- document.documentElement.style.setProperty(
- '--app-primary-fg',
- appPrimaryTextColor
- )
-
- // Apply text color based on background brightness for accent
- document.documentElement.style.setProperty(
- '--app-accent-fg',
- appAccentTextColor
- )
-
- // Apply text color based on background brightness for destructive
- document.documentElement.style.setProperty(
- '--app-destructive-fg',
- appDestructiveTextColor
- )
- }, [
- fontSize,
- appBgColor,
- appLeftPanelTextColor,
- isDark,
- appMainViewBgColor,
- appMainViewTextColor,
- appPrimaryBgColor,
- appPrimaryTextColor,
- appAccentBgColor,
- appAccentTextColor,
- appDestructiveBgColor,
- appDestructiveTextColor,
- showAlphaSlider,
- ])
-
- // Update interface styling when theme changes
+ // Apply accent color when it changes or theme changes
useEffect(() => {
- // Get the current interface state
- const {
- appBgColor,
- appMainViewBgColor,
- appPrimaryBgColor,
- appAccentBgColor,
- appDestructiveBgColor,
- setAppBgColor,
- setAppMainViewBgColor,
- setAppPrimaryBgColor,
- setAppAccentBgColor,
- setAppDestructiveBgColor,
- } = useInterfaceSettings.getState()
-
- // Force re-apply all colors when theme changes to ensure correct dark/light defaults
- // This is especially important on Windows where the theme might not be properly
- // synchronized when navigating to different routes (e.g., logs page)
-
- // If using default background color, update it when theme changes
- if (isDefaultColor(appBgColor)) {
- // This will trigger the appropriate updates for both background and text color
- setAppBgColor(appBgColor)
- } else {
- // If using custom background, just update the text color if needed
- const textColor = isDefaultColor(appBgColor)
- ? getDefaultTextColor(isDark)
- : appLeftPanelTextColor
-
- document.documentElement.style.setProperty(
- '--app-left-panel-fg',
- textColor
- )
- }
-
- // If using default background color, update it when theme changes
- if (isDefaultColorMainView(appMainViewBgColor)) {
- // This will trigger the appropriate updates for both background and text color
- setAppMainViewBgColor(appMainViewBgColor)
- } else {
- // If using custom background, just update the text color if needed
- const textColorMainView = isDefaultColor(appMainViewBgColor)
- ? getDefaultTextColor(isDark)
- : appMainViewTextColor
-
- document.documentElement.style.setProperty(
- '--app-main-view-fg',
- textColorMainView
- )
- }
-
- // If using default primary color, update it when theme changes
- if (isDefaultColorPrimary(appPrimaryBgColor)) {
- // This will trigger the appropriate updates for both background and text color
- setAppPrimaryBgColor(appPrimaryBgColor)
- } else {
- // If using custom background, just update the text color if needed
- const textColorPrimary = isDefaultColorPrimary(appPrimaryBgColor)
- ? getDefaultTextColor(isDark)
- : appPrimaryTextColor
-
- document.documentElement.style.setProperty(
- '--app-primary-fg',
- textColorPrimary
- )
- }
-
- // If using default accent color, update it when theme changes
- if (isDefaultColorAccent(appAccentBgColor)) {
- // This will trigger the appropriate updates for both background and text color
- setAppAccentBgColor(appAccentBgColor)
- } else {
- // If using custom background, just update the text color if needed
- const textColorAccent = isDefaultColorAccent(appAccentBgColor)
- ? getDefaultTextColor(isDark)
- : appAccentTextColor
-
- document.documentElement.style.setProperty(
- '--app-accent-fg',
- textColorAccent
- )
- }
+ const color = ACCENT_COLORS.find((c) => c.value === accentColor)
+ if (!color) return
- // If using default destructive color, update it when theme changes
- if (isDefaultColorDestructive(appDestructiveBgColor)) {
- // This will trigger the appropriate updates for both background and text color
- setAppDestructiveBgColor(appDestructiveBgColor)
- } else {
- // If using custom background, just update the text color if needed
- const textColorDestructive = isDefaultColorDestructive(
- appDestructiveBgColor
- )
- ? getDefaultTextColor(isDark)
- : appDestructiveTextColor
+ const root = document.documentElement
+ const sidebarColor = isDark ? color.sidebar.dark : color.sidebar.light
- document.documentElement.style.setProperty(
- '--app-destructive-fg',
- textColorDestructive
- )
- }
- }, [
- isDark,
- appLeftPanelTextColor,
- appMainViewTextColor,
- appPrimaryTextColor,
- appAccentTextColor,
- appDestructiveTextColor,
- ])
+ root.style.setProperty('--sidebar', sidebarColor)
+ root.style.setProperty('--primary', color.primary)
+ }, [accentColor, isDark])
return null
}
diff --git a/web-app/src/providers/KeyboardShortcuts.tsx b/web-app/src/providers/KeyboardShortcuts.tsx
index a49e733aa..c165862f1 100644
--- a/web-app/src/providers/KeyboardShortcuts.tsx
+++ b/web-app/src/providers/KeyboardShortcuts.tsx
@@ -1,17 +1,20 @@
import { useKeyboardShortcut } from '@/hooks/useHotkeys'
import { useLeftPanel } from '@/hooks/useLeftPanel'
+import { useSearchDialog } from '@/hooks/useSearchDialog'
import { useRouter } from '@tanstack/react-router'
import { route } from '@/constants/routes'
import { PlatformShortcuts, ShortcutAction } from '@/lib/shortcuts'
export function KeyboardShortcutsProvider() {
const { open, setLeftPanel } = useLeftPanel()
+ const { setOpen: setSearchOpen } = useSearchDialog()
const router = useRouter()
// Get shortcut specs from centralized configuration
const sidebarShortcut = PlatformShortcuts[ShortcutAction.TOGGLE_SIDEBAR]
const newChatShortcut = PlatformShortcuts[ShortcutAction.NEW_CHAT]
const settingsShortcut = PlatformShortcuts[ShortcutAction.GO_TO_SETTINGS]
+ const searchShortcut = PlatformShortcuts[ShortcutAction.SEARCH]
// Toggle Sidebar
useKeyboardShortcut({
@@ -37,6 +40,14 @@ export function KeyboardShortcutsProvider() {
},
})
+ // Search
+ useKeyboardShortcut({
+ ...searchShortcut,
+ callback: () => {
+ setSearchOpen(true)
+ },
+ })
+
// This component doesn't render anything
return null
}
diff --git a/web-app/src/providers/ToasterProvider.tsx b/web-app/src/providers/ToasterProvider.tsx
index f0a178f67..8089aa3e7 100644
--- a/web-app/src/providers/ToasterProvider.tsx
+++ b/web-app/src/providers/ToasterProvider.tsx
@@ -8,11 +8,10 @@ export function ToasterProvider() {
offset={{ top: 8, right: 8 }}
toastOptions={{
style: {
- background: 'var(--app-main-view-fg)',
- padding: '0.5rem 0.8rem',
+ background: 'var(--background)',
+ padding: '1rem 0.8rem',
alignItems: 'start',
- borderColor:
- 'color-mix(in oklch, var(--app-main-view) 5%, transparent)',
+ borderColor: 'var(--border)',
userSelect: 'none',
WebkitUserSelect: 'none',
MozUserSelect: 'none',
@@ -20,8 +19,8 @@ export function ToasterProvider() {
},
classNames: {
toast: 'toast select-none',
- title: '!text-main-view/90 select-none',
- description: '!text-main-view/70 select-none',
+ title: 'text-foreground! select-none',
+ description: 'text-muted-foreground! select-none',
},
}}
/>
diff --git a/web-app/src/routeTree.gen.ts b/web-app/src/routeTree.gen.ts
index 8b5f126ae..9fec0f177 100644
--- a/web-app/src/routeTree.gen.ts
+++ b/web-app/src/routeTree.gen.ts
@@ -14,7 +14,6 @@ import { Route as rootRoute } from './routes/__root'
import { Route as SystemMonitorImport } from './routes/system-monitor'
import { Route as LogsImport } from './routes/logs'
import { Route as IndexImport } from './routes/index'
-import { Route as ProjectIndexImport } from './routes/project/index'
import { Route as HubIndexImport } from './routes/hub/index'
import { Route as ThreadsThreadIdImport } from './routes/threads/$threadId'
import { Route as SettingsShortcutsImport } from './routes/settings/shortcuts'
@@ -54,12 +53,6 @@ const IndexRoute = IndexImport.update({
getParentRoute: () => rootRoute,
} as any)
-const ProjectIndexRoute = ProjectIndexImport.update({
- id: '/project/',
- path: '/project/',
- getParentRoute: () => rootRoute,
-} as any)
-
const HubIndexRoute = HubIndexImport.update({
id: '/hub/',
path: '/hub/',
@@ -306,13 +299,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof HubIndexImport
parentRoute: typeof rootRoute
}
- '/project/': {
- id: '/project/'
- path: '/project'
- fullPath: '/project'
- preLoaderRoute: typeof ProjectIndexImport
- parentRoute: typeof rootRoute
- }
'/settings/providers/$providerName': {
id: '/settings/providers/$providerName'
path: '/settings/providers/$providerName'
@@ -352,7 +338,6 @@ export interface FileRoutesByFullPath {
'/settings/shortcuts': typeof SettingsShortcutsRoute
'/threads/$threadId': typeof ThreadsThreadIdRoute
'/hub': typeof HubIndexRoute
- '/project': typeof ProjectIndexRoute
'/settings/providers/$providerName': typeof SettingsProvidersProviderNameRoute
'/settings/providers': typeof SettingsProvidersIndexRoute
}
@@ -377,7 +362,6 @@ export interface FileRoutesByTo {
'/settings/shortcuts': typeof SettingsShortcutsRoute
'/threads/$threadId': typeof ThreadsThreadIdRoute
'/hub': typeof HubIndexRoute
- '/project': typeof ProjectIndexRoute
'/settings/providers/$providerName': typeof SettingsProvidersProviderNameRoute
'/settings/providers': typeof SettingsProvidersIndexRoute
}
@@ -403,7 +387,6 @@ export interface FileRoutesById {
'/settings/shortcuts': typeof SettingsShortcutsRoute
'/threads/$threadId': typeof ThreadsThreadIdRoute
'/hub/': typeof HubIndexRoute
- '/project/': typeof ProjectIndexRoute
'/settings/providers/$providerName': typeof SettingsProvidersProviderNameRoute
'/settings/providers/': typeof SettingsProvidersIndexRoute
}
@@ -430,7 +413,6 @@ export interface FileRouteTypes {
| '/settings/shortcuts'
| '/threads/$threadId'
| '/hub'
- | '/project'
| '/settings/providers/$providerName'
| '/settings/providers'
fileRoutesByTo: FileRoutesByTo
@@ -454,7 +436,6 @@ export interface FileRouteTypes {
| '/settings/shortcuts'
| '/threads/$threadId'
| '/hub'
- | '/project'
| '/settings/providers/$providerName'
| '/settings/providers'
id:
@@ -478,7 +459,6 @@ export interface FileRouteTypes {
| '/settings/shortcuts'
| '/threads/$threadId'
| '/hub/'
- | '/project/'
| '/settings/providers/$providerName'
| '/settings/providers/'
fileRoutesById: FileRoutesById
@@ -504,7 +484,6 @@ export interface RootRouteChildren {
SettingsShortcutsRoute: typeof SettingsShortcutsRoute
ThreadsThreadIdRoute: typeof ThreadsThreadIdRoute
HubIndexRoute: typeof HubIndexRoute
- ProjectIndexRoute: typeof ProjectIndexRoute
SettingsProvidersProviderNameRoute: typeof SettingsProvidersProviderNameRoute
SettingsProvidersIndexRoute: typeof SettingsProvidersIndexRoute
}
@@ -529,7 +508,6 @@ const rootRouteChildren: RootRouteChildren = {
SettingsShortcutsRoute: SettingsShortcutsRoute,
ThreadsThreadIdRoute: ThreadsThreadIdRoute,
HubIndexRoute: HubIndexRoute,
- ProjectIndexRoute: ProjectIndexRoute,
SettingsProvidersProviderNameRoute: SettingsProvidersProviderNameRoute,
SettingsProvidersIndexRoute: SettingsProvidersIndexRoute,
}
@@ -563,7 +541,6 @@ export const routeTree = rootRoute
"/settings/shortcuts",
"/threads/$threadId",
"/hub/",
- "/project/",
"/settings/providers/$providerName",
"/settings/providers/"
]
@@ -625,9 +602,6 @@ export const routeTree = rootRoute
"/hub/": {
"filePath": "hub/index.tsx"
},
- "/project/": {
- "filePath": "project/index.tsx"
- },
"/settings/providers/$providerName": {
"filePath": "settings/providers/$providerName.tsx"
},
diff --git a/web-app/src/routes/__root.tsx b/web-app/src/routes/__root.tsx
index 62265f04e..b3c441431 100644
--- a/web-app/src/routes/__root.tsx
+++ b/web-app/src/routes/__root.tsx
@@ -1,12 +1,11 @@
import { createRootRoute, Outlet } from '@tanstack/react-router'
// import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
-import LeftPanel from '@/containers/LeftPanel'
import DialogAppUpdater from '@/containers/dialogs/AppUpdater'
import BackendUpdater from '@/containers/dialogs/BackendUpdater'
import { Fragment } from 'react/jsx-runtime'
-import { InterfaceProvider } from '@/providers/InterfaceProvider'
import { ThemeProvider } from '@/providers/ThemeProvider'
+import { InterfaceProvider } from '@/providers/InterfaceProvider'
import { KeyboardShortcutsProvider } from '@/providers/KeyboardShortcuts'
import { DataProvider } from '@/providers/DataProvider'
import { route } from '@/constants/routes'
@@ -18,23 +17,17 @@ import { useJanModelPrompt } from '@/hooks/useJanModelPrompt'
import { PromptJanModel } from '@/containers/PromptJanModel'
import { AnalyticProvider } from '@/providers/AnalyticProvider'
import { useLeftPanel } from '@/hooks/useLeftPanel'
-import { cn } from '@/lib/utils'
import ToolApproval from '@/containers/dialogs/ToolApproval'
import { TranslationProvider } from '@/i18n/TranslationContext'
import OutOfContextPromiseModal from '@/containers/dialogs/OutOfContextDialog'
-import LoadModelErrorDialog from '@/containers/dialogs/LoadModelErrorDialog'
-import { useSmallScreen } from '@/hooks/useMediaQuery'
import AttachmentIngestionDialog from '@/containers/dialogs/AttachmentIngestionDialog'
-import {
- ResizablePanelGroup,
- ResizablePanel,
- ResizableHandle,
-} from '@/components/ui/resizable'
-import { useCallback, useEffect } from 'react'
+import { useEffect } from 'react'
import GlobalError from '@/containers/GlobalError'
import { GlobalEventHandler } from '@/providers/GlobalEventHandler'
-import ErrorDialog from '@/containers/dialogs/ErrorDialog'
import { ServiceHubProvider } from '@/providers/ServiceHubProvider'
+import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar"
+import { LeftSidebar } from '@/components/left-sidebar'
+
export const Route = createRootRoute({
component: RootLayout,
@@ -47,132 +40,38 @@ const AppLayout = () => {
const {
open: isLeftPanelOpen,
setLeftPanel,
- size: leftPanelSize,
- setLeftPanelSize,
+ width: sidebarWidth,
+ setLeftPanelWidth,
} = useLeftPanel()
- const isSmallScreen = useSmallScreen()
-
- // Minimum width threshold for auto-close (10% of screen width)
- const MIN_PANEL_WIDTH_THRESHOLD = 14
-
- // Handle panel size changes
- const handlePanelLayout = useCallback(
- (sizes: number[]) => {
- if (sizes.length > 0) {
- const newSize = sizes[0]
-
- // Close panel if resized below minimum threshold
- if (newSize < MIN_PANEL_WIDTH_THRESHOLD) {
- setLeftPanel(false)
- } else {
- setLeftPanelSize(newSize)
- }
- }
- },
- [setLeftPanelSize, setLeftPanel]
- )
-
- // Prevent default drag and drop behavior globally
- useEffect(() => {
- const preventDefaults = (e: DragEvent) => {
- e.preventDefault()
- e.stopPropagation()
- }
-
- const handleGlobalDrop = (e: DragEvent) => {
- e.preventDefault()
- e.stopPropagation()
-
- // Only prevent if the target is not within a chat input or other valid drop zone
- const target = e.target as Element
- const isValidDropZone =
- target?.closest('[data-drop-zone="true"]') ||
- target?.closest('.chat-input-drop-zone') ||
- target?.closest('[data-tauri-drag-region]')
-
- if (!isValidDropZone) {
- // Prevent the file from opening in the window
- return false
- }
- }
-
- // Add event listeners to prevent default drag/drop behavior
- window.addEventListener('dragenter', preventDefaults)
- window.addEventListener('dragover', preventDefaults)
- window.addEventListener('drop', handleGlobalDrop)
-
- return () => {
- window.removeEventListener('dragenter', preventDefaults)
- window.removeEventListener('dragover', preventDefaults)
- window.removeEventListener('drop', handleGlobalDrop)
- }
- }, [])
return (
- <Fragment>
- <AnalyticProvider />
- <KeyboardShortcutsProvider />
- <main className="relative h-svh text-sm antialiased select-none bg-app">
+ <div className='bg-neutral-50 dark:bg-background size-full'>
+ <SidebarProvider
+ open={isLeftPanelOpen}
+ onOpenChange={setLeftPanel}
+ defaultWidth={sidebarWidth}
+ onWidthChange={setLeftPanelWidth}
+ >
+ <AnalyticProvider />
+ <KeyboardShortcutsProvider />
{/* Fake absolute panel top to enable window drag */}
{IS_MACOS &&
- <div className="absolute w-full h-10 z-10" data-tauri-drag-region />
+ <div className="fixed w-full h-2 z-20 top-0" data-tauri-drag-region />
}
<DialogAppUpdater />
<BackendUpdater />
+ <LeftSidebar />
+ <SidebarInset >
+ <div className='bg-neutral-50 dark:bg-background size-full'>
+ <Outlet />
+ </div>
+ </SidebarInset>
- {/* Use ResizablePanelGroup only on larger screens */}
- {!isSmallScreen && isLeftPanelOpen ? (
- <ResizablePanelGroup
- direction="horizontal"
- className="h-full"
- onLayout={handlePanelLayout}
- >
- {/* Left Panel */}
- <ResizablePanel
- defaultSize={leftPanelSize}
- minSize={MIN_PANEL_WIDTH_THRESHOLD}
- maxSize={40}
- collapsible
- >
- <div className="h-full p-1">
- <LeftPanel />
- </div>
- </ResizablePanel>
-
- {/* Resize Handle */}
- <ResizableHandle withHandle />
-
- {/* Main Content Panel */}
- <ResizablePanel defaultSize={100 - leftPanelSize} minSize={60}>
- <div className="h-full p-1 pl-0">
- <div className="bg-main-view text-main-view-fg border border-main-view-fg/5 w-full h-full rounded-lg overflow-hidden">
- <Outlet />
- </div>
- </div>
- </ResizablePanel>
- </ResizablePanelGroup>
- ) : (
- <div className="flex h-full">
- {/* left content panel - only show if not logs route */}
- <LeftPanel />
+ {productAnalyticPrompt && <PromptAnalytic />}
+ {showJanModelPrompt && <PromptJanModel />}
- {/* Main content panel */}
- <div
- className={cn(
- 'h-svh flex w-full md:p-1',
- isLeftPanelOpen && 'w-full md:w-[calc(100%-198px)]'
- )}
- >
- <div className="bg-main-view text-main-view-fg border border-main-view-fg/5 w-full md:rounded-lg overflow-hidden">
- <Outlet />
- </div>
- </div>
- </div>
- )}
- </main>
- {productAnalyticPrompt && <PromptAnalytic />}
- {showJanModelPrompt && <PromptJanModel />}
- </Fragment>
+ </SidebarProvider>
+ </div>
)
}
@@ -183,7 +82,7 @@ const LogsLayout = () => {
<div className="flex h-full">
{/* Main content panel */}
<div className="h-full flex w-full">
- <div className="bg-main-view text-main-view-fg border border-main-view-fg/5 w-full overflow-hidden">
+ <div className="bg-background text-foreground border w-full overflow-hidden">
<Outlet />
</div>
</div>
@@ -240,11 +139,8 @@ function RootLayout() {
<GlobalEventHandler />
{IS_LOGS_ROUTE ? <LogsLayout /> : <AppLayout />}
</ExtensionProvider>
- {/* {isLocalAPIServerLogsRoute ? <LogsLayout /> : <AppLayout />} */}
{/* <TanStackRouterDevtools position="bottom-right" /> */}
<ToolApproval />
- <LoadModelErrorDialog />
- <ErrorDialog />
<AttachmentIngestionDialog />
<OutOfContextPromiseModal />
</TranslationProvider>
diff --git a/web-app/src/routes/hub/$modelId.tsx b/web-app/src/routes/hub/$modelId.tsx
index a95e8db3d..f20c60654 100644
--- a/web-app/src/routes/hub/$modelId.tsx
+++ b/web-app/src/routes/hub/$modelId.tsx
@@ -228,84 +228,291 @@ function HubModelDetailContent() {
if (!modelData) {
return (
- <div className="flex h-full w-full">
- <div className="flex flex-col h-full w-full">
- <HeaderPage>
- <button
- className="relative z-20 flex items-center gap-2 cursor-pointer"
- onClick={() => navigate({ to: route.hub.index })}
- aria-label="Go back"
- >
- <div className="flex items-center justify-center size-5 rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconArrowLeft size={18} className="text-main-view-fg" />
- </div>
- <span className="text-main-view-fg">Back to Hub</span>
- </button>
- </HeaderPage>
- <div className="flex-1 flex items-center justify-center">
- <p className="text-main-view-fg/60">Model not found</p>
- </div>
+ <div className="flex flex-col h-svh w-full">
+ <HeaderPage>
+ <Button
+ onClick={() => navigate({ to: route.hub.index })}
+ aria-label="Go back"
+ variant="ghost"
+ size="sm"
+ >
+ <IconArrowLeft size={18} className="text-muted-foreground" />
+ <span className="text-foreground">Back to Hub</span>
+ </Button>
+ </HeaderPage>
+ <div className="flex-1 flex items-center justify-center">
+ <p className="text-muted-foreground">Model not found</p>
</div>
</div>
)
}
return (
- <div className="flex h-full w-full">
- <div className="flex flex-col h-full w-full ">
- <HeaderPage>
- <button
- className="relative z-20 flex items-center gap-2 cursor-pointer"
+ <div className="flex flex-col h-svh w-full">
+ <HeaderPage>
+ <div className="flex items-center gap-2 w-full relative">
+ <Button
onClick={() => navigate({ to: route.hub.index })}
aria-label="Go back"
+ variant="ghost"
+ size="sm"
>
- <div className="flex items-center justify-center size-5 rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconArrowLeft size={18} className="text-main-view-fg" />
+ <IconArrowLeft size={18} className="text-muted-foreground" />
+ <span className="text-foreground">Back to Hub</span>
+ </Button>
+ </div>
+ </HeaderPage>
+
+ <div className="flex-1 overflow-y-auto ">
+ <div className="md:w-4/5 mx-auto">
+ <div className="max-w-4xl mx-auto p-6">
+ {/* Model Header */}
+ <div className="mb-8">
+ <h1
+ className="text-2xl font-semibold mb-4 capitalize wrap-break-word line-clamp-2"
+ title={
+ extractModelName(modelData.model_name) ||
+ modelData.model_name
+ }
+ >
+ {extractModelName(modelData.model_name) ||
+ modelData.model_name}
+ </h1>
+
+ {/* Stats */}
+ <div className="flex items-center gap-4 text-sm text-foreground mb-4 flex-wrap">
+ {modelData.developer && (
+ <>
+ <span>By {modelData.developer}</span>
+ </>
+ )}
+ <div className="flex items-center gap-2">
+ <IconDownload size={16} />
+ <span>{modelData.downloads || 0} Downloads</span>
+ </div>
+ {modelData.created_at && (
+ <div className="flex items-center gap-2">
+ <IconClock size={16} />
+ <span>Updated {formatDate(modelData.created_at)}</span>
+ </div>
+ )}
+ </div>
+
+ {/* Description */}
+ {modelData.description && (
+ <div className="text-muted-foreground mb-4">
+ <RenderMarkdown
+ className="select-none reset-heading"
+ components={{
+ a: ({ ...props }) => (
+ <a
+ {...props}
+ target="_blank"
+ rel="noopener noreferrer"
+ />
+ ),
+ }}
+ content={
+ extractDescription(modelData.description) ||
+ modelData.description
+ }
+ />
+ </div>
+ )}
+
+ {/* Tags */}
+ {tags.length > 0 && (
+ <div className="flex gap-2 flex-wrap">
+ {tags.map((tag) => (
+ <span
+ key={tag}
+ className="px-3 py-1 text-sm bg-secondary rounded-md"
+ >
+ {tag}
+ </span>
+ ))}
+ </div>
+ )}
</div>
- <span className="text-main-view-fg">Back to Hub</span>
- </button>
- </HeaderPage>
- <div className="flex-1 overflow-y-auto ">
- <div className="md:w-4/5 mx-auto">
- <div className="max-w-4xl mx-auto p-6">
- {/* Model Header */}
+ {/* Variants Section */}
+ {modelData.quants && modelData.quants.length > 0 && (
<div className="mb-8">
- <h1
- className="text-2xl font-semibold text-main-view-fg mb-4 capitalize break-words line-clamp-2"
- title={
- extractModelName(modelData.model_name) ||
- modelData.model_name
- }
- >
- {extractModelName(modelData.model_name) ||
- modelData.model_name}
- </h1>
-
- {/* Stats */}
- <div className="flex items-center gap-4 text-sm text-main-view-fg/60 mb-4 flex-wrap">
- {modelData.developer && (
- <>
- <span>By {modelData.developer}</span>
- </>
- )}
- <div className="flex items-center gap-2">
- <IconDownload size={16} />
- <span>{modelData.downloads || 0} Downloads</span>
- </div>
- {modelData.created_at && (
- <div className="flex items-center gap-2">
- <IconClock size={16} />
- <span>Updated {formatDate(modelData.created_at)}</span>
- </div>
- )}
+ <div className="flex items-center gap-2 mb-4">
+ <IconFileCode size={20} className="text-muted-foreground" />
+ <h2 className="text-lg font-semibold text-foreground">
+ Variants ({modelData.quants.length})
+ </h2>
+ </div>
+
+ <div className="w-full overflow-x-auto">
+ <table className="w-full min-w-[500px]">
+ <thead>
+ <tr className="border-b ">
+ <th className="text-left py-3 px-2 text-sm font-medium">
+ Version
+ </th>
+ <th className="text-left py-3 px-2 text-sm font-medium">
+ Format
+ </th>
+ <th className="text-left py-3 px-2 text-sm font-medium">
+ Size
+ </th>
+ <th></th>
+ <th className="text-right py-3 px-2 text-sm font-medium">
+ Action
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ {modelData.quants.map((variant) => {
+ const isDownloading =
+ localDownloadingModels.has(variant.model_id) ||
+ downloadProcesses.some(
+ (e) => e.id === variant.model_id
+ )
+ const downloadProgress =
+ downloadProcesses.find(
+ (e) => e.id === variant.model_id
+ )?.progress || 0
+ const isDownloaded = llamaProvider?.models.some(
+ (m: { id: string }) => m.id === variant.model_id
+ )
+
+ // Extract format from model_id
+ const format = variant.model_id
+ .toLowerCase()
+ .includes('tensorrt')
+ ? 'TensorRT'
+ : 'GGUF'
+
+ // Extract version name (remove format suffix)
+ const versionName = variant.model_id
+ .replace(/_GGUF$/i, '')
+ .replace(/-GGUF$/i, '')
+ .replace(/_TensorRT$/i, '')
+ .replace(/-TensorRT$/i, '')
+
+ return (
+ <tr
+ key={variant.model_id}
+ className="border-b border-border"
+ >
+ <td className="py-3 px-2">
+ <span className="text-sm font-medium">
+ {versionName}
+ </span>
+ </td>
+ <td className="py-3 px-2">
+ <span className="text-sm text-muted-foreground">
+ {format}
+ </span>
+ </td>
+ <td className="py-3 px-2">
+ <span className="text-sm text-muted-foreground">
+ {variant.file_size}
+ </span>
+ </td>
+ <td>
+ <ModelInfoHoverCard
+ model={modelData}
+ variant={variant}
+ defaultModelQuantizations={
+ DEFAULT_MODEL_QUANTIZATIONS
+ }
+ modelSupportStatus={modelSupportStatus}
+ onCheckModelSupport={checkModelSupport}
+ />
+ </td>
+ <td className="py-3 px-2 text-right ml-auto">
+ {(() => {
+ if (isDownloading && !isDownloaded) {
+ return (
+ <div className="flex items-center justify-end gap-2">
+ <Progress
+ value={downloadProgress * 100}
+ className="w-12"
+ />
+ <span className="text-xs text-muted-foreground text-right">
+ {Math.round(downloadProgress * 100)}%
+ </span>
+ </div>
+ )
+ }
+
+ if (isDownloaded) {
+ return (
+ <Button
+ variant="default"
+ size="sm"
+ onClick={() =>
+ handleUseModel(variant.model_id)
+ }
+ >
+ {t('hub:newChat')}
+ </Button>
+ )
+ }
+
+ return (
+ <Button
+ size="sm"
+ onClick={() => {
+ addLocalDownloadingModel(
+ variant.model_id
+ )
+ serviceHub
+ .models()
+ .pullModelWithMetadata(
+ variant.model_id,
+ variant.path,
+ (
+ modelData.mmproj_models?.find(
+ (e) =>
+ e.model_id.toLowerCase() ===
+ 'mmproj-f16'
+ ) || modelData.mmproj_models?.[0]
+ )?.path,
+ huggingfaceToken
+ )
+ }}
+ className={cn(isDownloading && 'hidden')}
+ variant="outline"
+ >
+ Download
+ </Button>
+ )
+ })()}
+ </td>
+ </tr>
+ )
+ })}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ )}
+
+ {/* README Section */}
+ {modelData.readme && (
+ <div className="mb-8">
+ <div className="flex items-center gap-2 mb-4">
+ <IconFileCode size={20} className="text-muted-foreground" />
+ <h2 className="text-lg font-semibold">
+ README
+ </h2>
</div>
- {/* Description */}
- {modelData.description && (
- <div className="text-main-view-fg/80 mb-4">
+ {isLoadingReadme ? (
+ <div className="flex items-center justify-center py-8">
+ <span className="text-muted-foreground">
+ Loading README...
+ </span>
+ </div>
+ ) : readmeContent ? (
+ <div className="prose prose-invert max-w-none">
<RenderMarkdown
- className="select-none reset-heading"
+ className="text-muted-foreground"
components={{
a: ({ ...props }) => (
<a
@@ -315,231 +522,18 @@ function HubModelDetailContent() {
/>
),
}}
- content={
- extractDescription(modelData.description) ||
- modelData.description
- }
+ content={readmeContent}
/>
</div>
- )}
-
- {/* Tags */}
- {tags.length > 0 && (
- <div className="flex gap-2 flex-wrap">
- {tags.map((tag) => (
- <span
- key={tag}
- className="px-3 py-1 text-sm bg-main-view-fg/10 text-main-view-fg rounded-md"
- >
- {tag}
- </span>
- ))}
+ ) : (
+ <div className="flex items-center justify-center py-8">
+ <span className="text-muted-foreground">
+ Failed to load README
+ </span>
</div>
)}
</div>
-
- {/* Variants Section */}
- {modelData.quants && modelData.quants.length > 0 && (
- <div className="mb-8">
- <div className="flex items-center gap-2 mb-4">
- <IconFileCode size={20} className="text-main-view-fg/50" />
- <h2 className="text-lg font-semibold text-main-view-fg">
- Variants ({modelData.quants.length})
- </h2>
- </div>
-
- <div className="w-full overflow-x-auto">
- <table className="w-full min-w-[500px]">
- <thead>
- <tr className="border-b border-main-view-fg/10">
- <th className="text-left py-3 px-2 text-sm font-medium text-main-view-fg/70">
- Version
- </th>
- <th className="text-left py-3 px-2 text-sm font-medium text-main-view-fg/70">
- Format
- </th>
- <th className="text-left py-3 px-2 text-sm font-medium text-main-view-fg/70">
- Size
- </th>
- <th></th>
- <th className="text-right py-3 px-2 text-sm font-medium text-main-view-fg/70">
- Action
- </th>
- </tr>
- </thead>
- <tbody>
- {modelData.quants.map((variant) => {
- const isDownloading =
- localDownloadingModels.has(variant.model_id) ||
- downloadProcesses.some(
- (e) => e.id === variant.model_id
- )
- const downloadProgress =
- downloadProcesses.find(
- (e) => e.id === variant.model_id
- )?.progress || 0
- const isDownloaded = llamaProvider?.models.some(
- (m: { id: string }) => m.id === variant.model_id
- )
-
- // Extract format from model_id
- const format = variant.model_id
- .toLowerCase()
- .includes('tensorrt')
- ? 'TensorRT'
- : 'GGUF'
-
- // Extract version name (remove format suffix)
- const versionName = variant.model_id
- .replace(/_GGUF$/i, '')
- .replace(/-GGUF$/i, '')
- .replace(/_TensorRT$/i, '')
- .replace(/-TensorRT$/i, '')
-
- return (
- <tr
- key={variant.model_id}
- className="border-b border-main-view-fg/5 hover:bg-main-view-fg/5"
- >
- <td className="py-3 px-2">
- <span className="text-sm text-main-view-fg/80 font-medium">
- {versionName}
- </span>
- </td>
- <td className="py-3 px-2">
- <span className="text-sm text-main-view-fg/60">
- {format}
- </span>
- </td>
- <td className="py-3 px-2">
- <span className="text-sm text-main-view-fg/60">
- {variant.file_size}
- </span>
- </td>
- <td>
- <ModelInfoHoverCard
- model={modelData}
- variant={variant}
- defaultModelQuantizations={
- DEFAULT_MODEL_QUANTIZATIONS
- }
- modelSupportStatus={modelSupportStatus}
- onCheckModelSupport={checkModelSupport}
- />
- </td>
- <td className="py-3 px-2 text-right ml-auto">
- {(() => {
- if (isDownloading && !isDownloaded) {
- return (
- <div className="flex items-center justify-end gap-2">
- <Progress
- value={downloadProgress * 100}
- className="w-12"
- />
- <span className="text-xs text-main-view-fg/70 text-right">
- {Math.round(downloadProgress * 100)}%
- </span>
- </div>
- )
- }
-
- if (isDownloaded) {
- return (
- <Button
- variant="link"
- size="sm"
- className="p-0"
- onClick={() =>
- handleUseModel(variant.model_id)
- }
- >
- <div className="rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1">
- {t('hub:newChat')}
- </div>
- </Button>
- )
- }
-
- return (
- <Button
- size="sm"
- onClick={() => {
- addLocalDownloadingModel(
- variant.model_id
- )
- serviceHub
- .models()
- .pullModelWithMetadata(
- variant.model_id,
- variant.path,
- (
- modelData.mmproj_models?.find(
- (e) =>
- e.model_id.toLowerCase() ===
- 'mmproj-f16'
- ) || modelData.mmproj_models?.[0]
- )?.path,
- huggingfaceToken
- )
- }}
- className={cn(isDownloading && 'hidden')}
- >
- Download
- </Button>
- )
- })()}
- </td>
- </tr>
- )
- })}
- </tbody>
- </table>
- </div>
- </div>
- )}
-
- {/* README Section */}
- {modelData.readme && (
- <div className="mb-8">
- <div className="flex items-center gap-2 mb-4">
- <IconFileCode size={20} className="text-main-view-fg/50" />
- <h2 className="text-lg font-semibold text-main-view-fg">
- README
- </h2>
- </div>
-
- {isLoadingReadme ? (
- <div className="flex items-center justify-center py-8">
- <span className="text-main-view-fg/60">
- Loading README...
- </span>
- </div>
- ) : readmeContent ? (
- <div className="prose prose-invert max-w-none">
- <RenderMarkdown
- className="text-main-view-fg/80"
- components={{
- a: ({ ...props }) => (
- <a
- {...props}
- target="_blank"
- rel="noopener noreferrer"
- />
- ),
- }}
- content={readmeContent}
- />
- </div>
- ) : (
- <div className="flex items-center justify-center py-8">
- <span className="text-main-view-fg/60">
- Failed to load README
- </span>
- </div>
- )}
- </div>
- )}
- </div>
+ )}
</div>
</div>
</div>
diff --git a/web-app/src/routes/hub/index.tsx b/web-app/src/routes/hub/index.tsx
index 5e7dbcec4..3562ac1fa 100644
--- a/web-app/src/routes/hub/index.tsx
+++ b/web-app/src/routes/hub/index.tsx
@@ -27,7 +27,6 @@ import { Switch } from '@/components/ui/switch'
import {
Tooltip,
TooltipContent,
- TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip'
import { ModelInfoHoverCard } from '@/containers/ModelInfoHoverCard'
@@ -302,7 +301,7 @@ function HubContent() {
{searchValue.length === 0 && (
<DropdownMenu>
<DropdownMenuTrigger>
- <span className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm bg-main-view-fg/15 text-sm outline-none text-main-view-fg font-medium">
+ <span className="flex cursor-pointer items-center gap-1 px-2 py-1 rounded-sm text-sm outline-none text-foreground font-medium">
{
sortOptions.find((option) => option.value === sortSelected)
?.name
@@ -314,7 +313,7 @@ function HubContent() {
<DropdownMenuItem
className={cn(
'cursor-pointer my-0.5',
- sortSelected === option.value && 'bg-main-view-fg/5'
+ sortSelected === option.value && 'bg-secondary'
)}
key={option.value}
onClick={() => setSortSelected(option.value)}
@@ -338,7 +337,7 @@ function HubContent() {
}
}}
/>
- <span className="text-xs text-main-view-fg/70 font-medium whitespace-nowrap">
+ <span className="text-xs text-foreground font-medium whitespace-nowrap">
{t('hub:downloaded')}
</span>
</div>
@@ -354,10 +353,10 @@ function HubContent() {
<div className="pr-4 py-3 h-10 w-full flex items-center justify-between relative z-20">
<div className="flex items-center gap-2 w-full">
{isSearching ? (
- <Loader className="shrink-0 size-4 animate-spin text-main-view-fg/60" />
+ <Loader className="shrink-0 size-4 animate-spin text-muted-foreground" />
) : (
<IconSearch
- className="shrink-0 text-main-view-fg/60"
+ className="shrink-0 text-muted-foreground"
size={14}
/>
)}
@@ -373,8 +372,8 @@ function HubContent() {
</div>
</div>
</HeaderPage>
- <div className="p-4 w-full h-[calc(100%-32px)] !overflow-y-auto first-step-setup-local-provider">
- <div className="flex flex-col h-full justify-between gap-4 gap-y-3 w-full md:w-4/5 mx-auto">
+ <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto! first-step-setup-local-provider">
+ <div className="flex flex-col h-full justify-between gap-4 gap-y-3 w-full md:w-4/5 xl:w-4/6 mx-auto">
{loading && !filteredModels.length ? (
<div className="flex items-center justify-center">
<div className="text-center text-muted-foreground">
@@ -419,7 +418,7 @@ function HubContent() {
>
<h1
className={cn(
- 'text-main-view-fg font-medium text-base capitalize sm:max-w-none',
+ 'text-foreground font-medium text-base capitalize sm:max-w-none',
isRecommendedModel(
filteredModels[virtualItem.index]
.model_name
@@ -440,7 +439,7 @@ function HubContent() {
</h1>
</div>
<div className="shrink-0 space-x-3 flex items-center">
- <span className="text-main-view-fg/70 font-medium text-xs">
+ <span className="text-muted-foreground font-medium text-xs">
{
(
filteredModels[
@@ -483,7 +482,7 @@ function HubContent() {
</div>
}
>
- <div className="line-clamp-2 mt-3 text-main-view-fg/60">
+ <div className="line-clamp-2 mt-3 text-muted-foreground leading-normal">
<RenderMarkdown
className="select-none reset-heading"
components={{
@@ -503,7 +502,7 @@ function HubContent() {
/>
</div>
<div className="flex items-center gap-2 mt-2">
- <span className="capitalize text-main-view-fg/80">
+ <span className="capitalize text-foreground">
{t('hub:by')}{' '}
{filteredModels[virtualItem.index]?.developer}
</span>
@@ -511,10 +510,10 @@ function HubContent() {
<div className="flex items-center gap-1">
<IconDownload
size={18}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
title={t('hub:downloads')}
/>
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{filteredModels[virtualItem.index]
.downloads || 0}
</span>
@@ -522,10 +521,10 @@ function HubContent() {
<div className="flex items-center gap-1">
<IconFileCode
size={20}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
title={t('hub:variants')}
/>
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{filteredModels[virtualItem.index].quants
?.length || 0}
</span>
@@ -534,40 +533,36 @@ function HubContent() {
{filteredModels[virtualItem.index].num_mmproj >
0 && (
<div className="flex items-center gap-1">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <IconEye
- size={17}
- className="text-main-view-fg/50"
- />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('vision')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <IconEye
+ size={17}
+ className="text-muted-foreground"
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('vision')}</p>
+ </TooltipContent>
+ </Tooltip>
</div>
)}
{filteredModels[virtualItem.index].tools && (
<div className="flex items-center gap-1">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <IconTool
- size={17}
- className="text-main-view-fg/50"
- />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('tools')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <IconTool
+ size={17}
+ className="text-muted-foreground"
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('tools')}</p>
+ </TooltipContent>
+ </Tooltip>
</div>
)}
</div>
@@ -588,7 +583,7 @@ function HubContent() {
)
}
/>
- <p className="text-main-view-fg/70">
+ <p className="text-muted-foreground">
{t('hub:showVariants')}
</p>
</div>
@@ -614,41 +609,37 @@ function HubContent() {
{filteredModels[virtualItem.index]
.num_mmproj > 0 && (
<div className="flex items-center gap-1">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <IconEye
- size={17}
- className="text-main-view-fg/50"
- />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('vision')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <IconEye
+ size={17}
+ className="text-muted-foreground"
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('vision')}</p>
+ </TooltipContent>
+ </Tooltip>
</div>
)}
{filteredModels[virtualItem.index]
.tools && (
<div className="flex items-center gap-1">
- <TooltipProvider>
- <Tooltip>
- <TooltipTrigger asChild>
- <div>
- <IconTool
- size={17}
- className="text-main-view-fg/50"
- />
- </div>
- </TooltipTrigger>
- <TooltipContent>
- <p>{t('tools')}</p>
- </TooltipContent>
- </Tooltip>
- </TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <IconTool
+ size={17}
+ className="text-muted-foreground"
+ />
+ </div>
+ </TooltipTrigger>
+ <TooltipContent>
+ <p>{t('tools')}</p>
+ </TooltipContent>
+ </Tooltip>
</div>
)}
</div>
@@ -656,7 +647,7 @@ function HubContent() {
}
actions={
<div className="flex items-center gap-2">
- <p className="text-main-view-fg/70 font-medium text-xs">
+ <p className="text-muted-foreground font-medium text-xs">
{variant.file_size}
</p>
<ModelInfoHoverCard
diff --git a/web-app/src/routes/index.tsx b/web-app/src/routes/index.tsx
index 9f7f5de15..9a22d1f15 100644
--- a/web-app/src/routes/index.tsx
+++ b/web-app/src/routes/index.tsx
@@ -16,13 +16,10 @@ type SearchParams = {
id: string
provider: string
}
- 'temporary-chat'?: boolean
}
-import DropdownAssistant from '@/containers/DropdownAssistant'
import { useEffect } from 'react'
import { useThreads } from '@/hooks/useThreads'
-import { useMobileScreen } from '@/hooks/useMediaQuery'
-import { TEMPORARY_CHAT_QUERY_ID } from '@/constants/chat'
+import DropdownModelProvider from '@/containers/DropdownModelProvider'
export const Route = createFileRoute(route.home as any)({
component: Index,
@@ -31,14 +28,6 @@ export const Route = createFileRoute(route.home as any)({
model: search.model as SearchParams['model'],
}
- // Only include temporary-chat if it's explicitly true
- if (
- search[TEMPORARY_CHAT_QUERY_ID] === 'true' ||
- search[TEMPORARY_CHAT_QUERY_ID] === true
- ) {
- result['temporary-chat'] = true
- }
-
return result
},
})
@@ -48,9 +37,7 @@ function Index() {
const { providers } = useModelProvider()
const search = useSearch({ from: route.home as any })
const selectedModel = search.model
- const isTemporaryChat = search['temporary-chat']
const { setCurrentThreadId } = useThreads()
- const isMobile = useMobileScreen()
useTools()
// Conditional to check if there are any valid providers
@@ -83,35 +70,29 @@ function Index() {
}
return (
- <div className="flex h-full flex-col justify-center pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))]">
+ <div className="flex h-full flex-col justify-center">
<HeaderPage>
- <div className="flex items-center justify-between w-full pr-2">
- <DropdownAssistant />
+ <div className="flex items-center gap-2 w-full">
+ <DropdownModelProvider />
</div>
</HeaderPage>
<div
className={cn(
- 'h-full overflow-y-auto inline-flex flex-col gap-2 justify-center px-3 sm:px-4 md:px-8 py-4 md:py-0'
+ 'h-full overflow-y-auto inline-flex flex-col gap-2 justify-center px-3'
)}
>
<div
className={cn(
- 'mx-auto',
- // Full width on mobile, constrained on desktop
- isMobile ? 'w-full max-w-full' : 'w-full md:w-4/6'
+ 'mx-auto w-full md:w-4/5 xl:w-4/6 -mt-20',
)}
>
<div className={cn('text-center mb-4')}>
<h1
className={cn(
- 'text-main-view-fg/90 mt-2 font-studio font-medium',
- // Responsive description size
- isMobile ? 'text-base' : 'text-2xl'
+ 'text-2xl mt-2 font-studio font-medium',
)}
>
- {isTemporaryChat
- ? t('chat:temporaryChatDescription')
- : t('chat:description')}
+ {t('chat:description')}
</h1>
</div>
<div className="flex-1 shrink-0">
diff --git a/web-app/src/routes/local-api-server/logs.tsx b/web-app/src/routes/local-api-server/logs.tsx
index 2b6a9fda9..c84071c8e 100644
--- a/web-app/src/routes/local-api-server/logs.tsx
+++ b/web-app/src/routes/local-api-server/logs.tsx
@@ -91,11 +91,11 @@ function LogsViewer() {
}
return (
- <div className="flex flex-col h-full bg-main-view">
+ <div className="flex flex-col h-full bg-background">
<div className="flex-1 overflow-auto" ref={logsContainerRef}>
<div className="font-mono p-2">
{logs.length === 0 ? (
- <div className="text-center text-main-view-fg/50 py-8">
+ <div className="text-center text-muted-foreground py-8">
{t('logs:noLogs')}
</div>
) : (
diff --git a/web-app/src/routes/logs.tsx b/web-app/src/routes/logs.tsx
index c245ab0fd..c20f51fde 100644
--- a/web-app/src/routes/logs.tsx
+++ b/web-app/src/routes/logs.tsx
@@ -83,11 +83,11 @@ function LogsViewer() {
}
return (
- <div className="flex flex-col h-full bg-main-view">
+ <div className="flex flex-col h-full bg-background">
<div className="flex-1 overflow-auto" ref={logsContainerRef}>
<div className="font-mono p-2">
{logs.length === 0 ? (
- <div className="text-center text-main-view-fg/50 py-8">
+ <div className="text-center text-muted-foreground py-8">
{t('logs:noLogs')}
</div>
) : (
diff --git a/web-app/src/routes/project/$projectId.tsx b/web-app/src/routes/project/$projectId.tsx
index 9389cfdb3..7009f6d95 100644
--- a/web-app/src/routes/project/$projectId.tsx
+++ b/web-app/src/routes/project/$projectId.tsx
@@ -1,5 +1,5 @@
-import { createFileRoute, useParams } from '@tanstack/react-router'
-import { useMemo } from 'react'
+import { createFileRoute, useParams } from '@tanstack/react-router'
+import { useMemo, useState } from 'react'
import { useThreadManagement } from '@/hooks/useThreadManagement'
import { useThreads } from '@/hooks/useThreads'
@@ -8,12 +8,20 @@ import { useTranslation } from '@/i18n/react-i18next-compat'
import ChatInput from '@/containers/ChatInput'
import HeaderPage from '@/containers/HeaderPage'
import ThreadList from '@/containers/ThreadList'
-import DropdownAssistant from '@/containers/DropdownAssistant'
-import { IconMessage } from '@tabler/icons-react'
-import { cn } from '@/lib/utils'
-import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
-import { useSmallScreen } from '@/hooks/useMediaQuery'
+import { FolderPenIcon, MessageCircle, MoreHorizontal, Trash2 } from 'lucide-react'
+import DropdownModelProvider from '@/containers/DropdownModelProvider'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+import { Button } from '@/components/ui/button'
+import AddProjectDialog from '@/containers/dialogs/AddProjectDialog'
+import { DeleteProjectDialog } from '@/containers/dialogs/DeleteProjectDialog'
+import { SidebarMenu } from '@/components/ui/sidebar'
export const Route = createFileRoute('/project/$projectId')({
component: ProjectPageContent,
@@ -22,11 +30,11 @@ export const Route = createFileRoute('/project/$projectId')({
function ProjectPageContent() {
const { t } = useTranslation()
const { projectId } = useParams({ from: '/project/$projectId' })
- const { getFolderById } = useThreadManagement()
+ const { getFolderById, updateFolder } = useThreadManagement()
const threads = useThreads((state) => state.threads)
- const chatWidth = useInterfaceSettings((state) => state.chatWidth)
- const isSmallScreen = useSmallScreen()
+ const [editDialogOpen, setEditDialogOpen] = useState(false)
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState(false)
// Find the project
const project = getFolderById(projectId)
@@ -38,14 +46,21 @@ function ProjectPageContent() {
.sort((a, b) => (b.updated || 0) - (a.updated || 0))
}, [threads, projectId])
+ const handleSaveEdit = async (name: string) => {
+ if (project) {
+ await updateFolder(project.id, name)
+ setEditDialogOpen(false)
+ }
+ }
+
if (!project) {
return (
<div className="flex h-full flex-col items-center justify-center">
<div className="text-center">
- <h1 className="text-2xl font-semibold text-main-view-fg mb-2">
+ <h1 className="text-2xl font-semibold mb-2">
{t('projects.projectNotFound')}
</h1>
- <p className="text-main-view-fg/70">
+ <p className="text-muted-foreground">
{t('projects.projectNotFoundDesc')}
</p>
</div>
@@ -57,78 +72,100 @@ function ProjectPageContent() {
<div className="flex h-full flex-col">
<HeaderPage>
<div className="flex items-center justify-between w-full">
- <DropdownAssistant />
+ <DropdownModelProvider />
</div>
</HeaderPage>
- <div className="h-full relative flex flex-col justify-between px-4 md:px-8 py-4 overflow-y-auto">
- <div
- className={cn(
- 'mx-auto flex h-full flex-col justify-between',
- chatWidth === 'compact' ? 'w-full md:w-4/6' : 'w-full',
- isSmallScreen && 'w-full'
- )}
- >
- <div className="flex h-full flex-col">
- <div className="mb-6 mt-2">
- {projectThreads.length > 0 && (
- <>
- <h2 className="text-xl font-semibold text-main-view-fg mb-2">
- {t('projects.conversationsIn', {
- projectName: project.name,
- })}
- </h2>
- <p className="text-main-view-fg/70">
- {t('projects.conversationsDescription')}
- </p>
- </>
- )}
- </div>
+ <div className="h-full relative flex flex-col px-4 md:px-8 py-4 overflow-y-auto">
+ <div className="mx-auto w-full md:w-4/5 xl:w-4/6">
+ {/* Project Name with Dropdown */}
+ <div className="flex items-center justify-between gap-2 mb-4">
+ <h1 className="text-2xl font-semibold">
+ {project.name}
+ </h1>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="icon-xs">
+ <MoreHorizontal className="size-4" />
+ <span className="sr-only">More options</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onSelect={() => setEditDialogOpen(true)}>
+ <FolderPenIcon className="size-4" />
+ <span>{t('projects.editProject')}</span>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ onSelect={() => setDeleteDialogOpen(true)}
+ >
+ <Trash2 className="size-4" />
+ <span>{t('projects.deleteProject')}</span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+
+ {/* Chat Input */}
+ <div className="mb-6">
+ <ChatInput
+ showSpeedToken={false}
+ initialMessage={true}
+ projectId={projectId}
+ />
+ </div>
- {/* Thread List or Empty State */}
- <div className="mb-0">
- {projectThreads.length > 0 ? (
+ {/* Conversation Section */}
+ {projectThreads.length > 0 && (
+ <div className="flex flex-col">
+ <h2 className="text-base font-medium mb-4">
+ {t('projects.conversation')}
+ </h2>
+ <SidebarMenu className='space-y-2'>
<ThreadList
threads={projectThreads}
- variant="project"
currentProjectId={projectId}
/>
- ) : (
- <div className="flex flex-col items-center justify-center py-12 text-center">
- <IconMessage
- size={48}
- className="text-main-view-fg/30 mb-4"
- />
- <h3 className="text-lg font-medium text-main-view-fg/60 mb-2">
- {t('projects.noConversationsIn', {
- projectName: project.name,
- })}
- </h3>
- <p className="text-main-view-fg/50 text-sm">
- {t('projects.startNewConversation', {
- projectName: project.name,
- })}
- </p>
- </div>
- )}
+ </SidebarMenu>
</div>
- </div>
+ )}
+
+ {/* Empty State */}
+ {projectThreads.length === 0 && (
+ <div className="flex flex-col items-center justify-center py-12 text-center">
+ <MessageCircle
+ className="text-muted-foreground size-8 mb-4"
+ />
+ <h3 className="text-lg font-medium text-foreground mb-1">
+ {t('projects.noConversationsIn', {
+ projectName: project.name,
+ })}
+ </h3>
+ <p className="text-muted-foreground/70 text-sm">
+ {t('projects.startNewConversation', {
+ projectName: project.name,
+ })}
+ </p>
+ </div>
+ )}
</div>
</div>
- {/* New Chat Input */}
- <div
- className={cn(
- 'mx-auto pt-2 pb-3 shrink-0 relative px-2',
- chatWidth === 'compact' ? 'w-full md:w-4/6' : 'w-full',
- isSmallScreen && 'w-full'
- )}
- >
- <ChatInput
- showSpeedToken={false}
- initialMessage={true}
- projectId={projectId}
- />
- </div>
+
+ <AddProjectDialog
+ open={editDialogOpen}
+ onOpenChange={setEditDialogOpen}
+ editingKey={project.id}
+ initialData={project}
+ onSave={handleSaveEdit}
+ />
+
+ <DeleteProjectDialog
+ open={deleteDialogOpen}
+ onOpenChange={setDeleteDialogOpen}
+ projectId={project.id}
+ projectName={project.name}
+ />
</div>
)
}
diff --git a/web-app/src/routes/project/index.tsx b/web-app/src/routes/project/index.tsx
deleted file mode 100644
index fd6a2c1d1..000000000
--- a/web-app/src/routes/project/index.tsx
+++ /dev/null
@@ -1,296 +0,0 @@
-import { createFileRoute, useNavigate } from '@tanstack/react-router'
-import { useState, useMemo } from 'react'
-
-import { useThreadManagement } from '@/hooks/useThreadManagement'
-import { useThreads } from '@/hooks/useThreads'
-import { useTranslation } from '@/i18n/react-i18next-compat'
-
-import HeaderPage from '@/containers/HeaderPage'
-import ThreadList from '@/containers/ThreadList'
-import {
- IconCirclePlus,
- IconPencil,
- IconTrash,
- IconFolder,
- IconChevronDown,
- IconChevronRight,
- IconSearch,
- IconX,
-} from '@tabler/icons-react'
-import AddProjectDialog from '@/containers/dialogs/AddProjectDialog'
-import { DeleteProjectDialog } from '@/containers/dialogs/DeleteProjectDialog'
-import { Button } from '@/components/ui/button'
-
-import { formatDate } from '@/utils/formatDate'
-
-export const Route = createFileRoute('/project/')({
- component: ProjectContent,
-})
-
-function ProjectContent() {
- const { t } = useTranslation()
- const navigate = useNavigate()
- const { folders, addFolder, updateFolder, getFolderById } =
- useThreadManagement()
- const threads = useThreads((state) => state.threads)
- const [open, setOpen] = useState(false)
- const [editingKey, setEditingKey] = useState<string | null>(null)
- const [deleteConfirmOpen, setDeleteConfirmOpen] = useState(false)
- const [deletingId, setDeletingId] = useState<string | null>(null)
- const [expandedProjects, setExpandedProjects] = useState<Set<string>>(
- new Set()
- )
- const [searchQuery, setSearchQuery] = useState('')
-
- const handleDelete = (id: string) => {
- setDeletingId(id)
- setDeleteConfirmOpen(true)
- }
-
- const handleDeleteClose = () => {
- setDeleteConfirmOpen(false)
- setDeletingId(null)
- }
-
- const handleSave = async (name: string) => {
- if (editingKey) {
- await updateFolder(editingKey, name)
- } else {
- const newProject = await addFolder(name)
- // Navigate to the newly created project
- navigate({
- to: '/project/$projectId',
- params: { projectId: newProject.id },
- })
- }
- setOpen(false)
- setEditingKey(null)
- }
-
- const formatProjectDate = (timestamp: number) => {
- return formatDate(new Date(timestamp), { includeTime: false })
- }
-
- // Get threads for a specific project
- const getThreadsForProject = useMemo(() => {
- return (projectId: string) => {
- return Object.values(threads)
- .filter((thread) => thread.metadata?.project?.id === projectId)
- .sort((a, b) => (b.updated || 0) - (a.updated || 0))
- }
- }, [threads])
-
- const toggleProjectExpansion = (projectId: string) => {
- setExpandedProjects((prev) => {
- const newSet = new Set(prev)
- if (newSet.has(projectId)) {
- newSet.delete(projectId)
- } else {
- newSet.add(projectId)
- }
- return newSet
- })
- }
-
- // Filter projects based on search query
- const filteredProjects = useMemo(() => {
- if (!searchQuery.trim()) {
- return folders
- }
- return folders.filter((folder) =>
- folder.name.toLowerCase().includes(searchQuery.toLowerCase())
- )
- }, [folders, searchQuery])
-
- return (
- <div className="flex h-full flex-col justify-center">
- <HeaderPage>
- <div className="flex items-center justify-between w-full mr-2">
- <span>{t('projects.title')}</span>
- <Button
- onClick={() => {
- setEditingKey(null)
- setOpen(true)
- }}
- size="sm"
- className="relative z-50"
- >
- <IconCirclePlus size={16} />
- {t('projects.addProject')}
- </Button>
- </div>
- </HeaderPage>
- <div className="h-full overflow-y-auto flex flex-col">
- <div className="p-4 w-full md:w-3/4 mx-auto mt-2">
- {/* Search Bar */}
- {folders.length > 0 && (
- <div className="mb-4">
- <div className="relative">
- <IconSearch
- size={18}
- className="absolute left-3 top-1/2 transform -translate-y-1/2 text-main-view-fg/50"
- />
- <input
- type="text"
- placeholder={t('projects.searchProjects')}
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- className="w-full pl-10 pr-4 py-2.5 bg-main-view-fg/5 border border-main-view-fg/10 rounded-lg text-main-view-fg placeholder:text-main-view-fg/50 focus:outline-none focus:ring-2 focus:ring-main-view-fg/20 focus:border-main-view-fg/20 transition-all"
- />
- {searchQuery && (
- <button
- onClick={() => setSearchQuery('')}
- className="absolute right-3 top-1/2 transform -translate-y-1/2 text-main-view-fg/50 hover:text-main-view-fg transition-colors"
- >
- <IconX size={18} />
- </button>
- )}
- </div>
- </div>
- )}
-
- {folders.length === 0 ? (
- <div className="flex flex-col items-center justify-center py-12 text-center">
- <IconFolder size={48} className="text-main-view-fg/30 mb-4" />
- <h3 className="text-lg font-medium text-main-view-fg/60 mb-2">
- {t('projects.noProjectsYet')}
- </h3>
- <p className="text-main-view-fg/50 text-sm">
- {t('projects.noProjectsYetDesc')}
- </p>
- </div>
- ) : filteredProjects.length === 0 ? (
- <div className="flex flex-col items-center justify-center py-12 text-center">
- <IconSearch size={48} className="text-main-view-fg/30 mb-4" />
- <h3 className="text-lg font-medium text-main-view-fg/60 mb-2">
- {t('projects.noProjectsFound')}
- </h3>
- <p className="text-main-view-fg/50 text-sm">
- {t('projects.tryDifferentSearch')}
- </p>
- </div>
- ) : (
- <div className="space-y-3">
- {filteredProjects
- .slice()
- .sort((a, b) => b.updated_at - a.updated_at)
- .map((folder) => {
- const projectThreads = getThreadsForProject(folder.id)
- const isExpanded = expandedProjects.has(folder.id)
-
- return (
- <div
- className="bg-main-view-fg/3 py-2 px-4 rounded-lg"
- key={folder.id}
- >
- <div className="flex items-center gap-4 min-w-0">
- <div className="flex items-start gap-3 flex-1 min-w-0">
- <div className="shrink-0 w-8 h-8 relative flex items-center justify-center bg-main-view-fg/4 rounded-md">
- <IconFolder
- size={16}
- className="text-main-view-fg/50"
- />
- </div>
- <div className="flex-1 min-w-0 overflow-hidden">
- <div className="flex items-center gap-2 min-w-0">
- <h3
- className="text-base font-medium text-main-view-fg/80 truncate flex-1 min-w-0"
- title={folder.name}
- >
- {folder.name}
- </h3>
- </div>
- <p className="text-main-view-fg/50 text-xs line-clamp-2 mt-0.5">
- {t('projects.updated')}{' '}
- {formatProjectDate(folder.updated_at)}
- </p>
- </div>
- </div>
- <div className="flex items-center">
- <span className="text-xs mr-4 bg-main-view-fg/10 text-main-view-fg/60 px-2 py-0.5 rounded-full shrink-0 whitespace-nowrap">
- {projectThreads.length}{' '}
- {projectThreads.length === 1
- ? t('projects.thread')
- : t('projects.threads')}
- </span>
- {projectThreads.length > 0 && (
- <button
- className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out mr-1"
- title={
- isExpanded
- ? t('projects.collapseProject')
- : t('projects.expandProject')
- }
- onClick={() => toggleProjectExpansion(folder.id)}
- >
- {isExpanded ? (
- <IconChevronDown
- size={16}
- className="text-main-view-fg/50"
- />
- ) : (
- <IconChevronRight
- size={16}
- className="text-main-view-fg/50"
- />
- )}
- </button>
- )}
- <button
- className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- title={t('projects.editProject')}
- onClick={() => {
- setEditingKey(folder.id)
- setOpen(true)
- }}
- >
- <IconPencil
- size={16}
- className="text-main-view-fg/50"
- />
- </button>
- <button
- className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- title={t('projects.deleteProject')}
- onClick={() => handleDelete(folder.id)}
- >
- <IconTrash
- size={16}
- className="text-main-view-fg/50"
- />
- </button>
- </div>
- </div>
-
- {/* Thread List */}
- {isExpanded && projectThreads.length > 0 && (
- <div className="mt-3 pl-2 pr-2 max-h-[190px] overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-main-view-fg/20 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-main-view-fg/30">
- <ThreadList
- threads={projectThreads}
- variant="project"
- />
- </div>
- )}
- </div>
- )
- })}
- </div>
- )}
- </div>
- </div>
- <AddProjectDialog
- open={open}
- onOpenChange={setOpen}
- editingKey={editingKey}
- initialData={editingKey ? getFolderById(editingKey) : undefined}
- onSave={handleSave}
- />
- <DeleteProjectDialog
- open={deleteConfirmOpen}
- onOpenChange={handleDeleteClose}
- projectId={deletingId ?? undefined}
- projectName={deletingId ? getFolderById(deletingId)?.name : undefined}
- />
- </div>
- )
-}
diff --git a/web-app/src/routes/settings/__tests__/extensions.test.tsx b/web-app/src/routes/settings/__tests__/extensions.test.tsx
index a111ab741..02e73dcf1 100644
--- a/web-app/src/routes/settings/__tests__/extensions.test.tsx
+++ b/web-app/src/routes/settings/__tests__/extensions.test.tsx
@@ -224,6 +224,6 @@ describe('Extensions Settings Route', () => {
render(<Component />)
const settingsContent = screen.getByTestId('settings-menu').nextElementSibling
- expect(settingsContent).toHaveClass('p-4', 'w-full', 'h-[calc(100%-32px)]', 'overflow-y-auto')
+ expect(settingsContent).toHaveClass('p-4', 'pt-0', 'w-full', 'overflow-y-auto')
})
})
diff --git a/web-app/src/routes/settings/__tests__/hardware.test.tsx b/web-app/src/routes/settings/__tests__/hardware.test.tsx
index a57b5d7c7..bfa220be7 100644
--- a/web-app/src/routes/settings/__tests__/hardware.test.tsx
+++ b/web-app/src/routes/settings/__tests__/hardware.test.tsx
@@ -84,7 +84,10 @@ vi.mock('@/services/hardware', () => ({
}))
vi.mock('@/services/models', () => ({ stopAllModels: vi.fn() }))
-vi.mock('@/lib/utils', () => ({ formatMegaBytes: (mb: number) => `${mb} MB` }))
+vi.mock('@/lib/utils', () => ({
+ formatMegaBytes: (mb: number) => `${mb} MB`,
+ cn: (...classes: any[]) => classes.filter(Boolean).join(' '),
+}))
vi.mock('@/utils/number', () => ({ toNumber: (n: number) => n }))
vi.mock('@tauri-apps/api/webviewWindow', () => ({ WebviewWindow: vi.fn() }))
vi.mock('@/constants/routes', () => ({
diff --git a/web-app/src/routes/settings/__tests__/interface.test.tsx b/web-app/src/routes/settings/__tests__/interface.test.tsx
index 17a5b771b..451f10d18 100644
--- a/web-app/src/routes/settings/__tests__/interface.test.tsx
+++ b/web-app/src/routes/settings/__tests__/interface.test.tsx
@@ -1,4 +1,4 @@
-import { describe, it, expect, beforeEach, vi } from 'vitest'
+import { describe, it, expect, beforeEach, vi } from 'vitest'
import { render, screen, fireEvent } from '@testing-library/react'
import { Route as InterfaceRoute } from '../interface'
@@ -13,14 +13,6 @@ vi.mock('@/containers/HeaderPage', () => ({
),
}))
-vi.mock('@/containers/ColorPickerAppBgColor', () => ({
- ColorPickerAppBgColor: () => <div data-testid="color-picker-bg">Color Picker BG</div>,
-}))
-
-vi.mock('@/containers/ColorPickerAppMainView', () => ({
- ColorPickerAppMainView: () => <div data-testid="color-picker-main-view">Color Picker Main View</div>,
-}))
-
vi.mock('@/containers/Card', () => ({
Card: ({ title, children }: { title?: string; children: React.ReactNode }) => (
<div data-testid="card" data-title={title}>
@@ -45,23 +37,10 @@ vi.mock('@/containers/FontSizeSwitcher', () => ({
FontSizeSwitcher: () => <div data-testid="font-size-switcher">Font Size Switcher</div>,
}))
-vi.mock('@/containers/ColorPickerAppPrimaryColor', () => ({
- ColorPickerAppPrimaryColor: () => <div data-testid="color-picker-primary">Color Picker Primary</div>,
-}))
-
-vi.mock('@/containers/ColorPickerAppAccentColor', () => ({
- ColorPickerAppAccentColor: () => <div data-testid="color-picker-accent">Color Picker Accent</div>,
-}))
-
-vi.mock('@/containers/ColorPickerAppDestructiveColor', () => ({
- ColorPickerAppDestructiveColor: () => <div data-testid="color-picker-destructive">Color Picker Destructive</div>,
+vi.mock('@/containers/AccentColorPicker', () => ({
+ AccentColorPicker: () => <div data-testid="accent-color-picker">Accent Color Picker</div>,
}))
-vi.mock('@/containers/ChatWidthSwitcher', () => ({
- ChatWidthSwitcher: () => <div data-testid="chat-width-switcher">Chat Width Switcher</div>,
-}))
-
-
vi.mock('@/hooks/useInterfaceSettings', () => ({
useInterfaceSettings: () => ({
resetInterface: vi.fn(),
@@ -123,18 +102,7 @@ describe('Interface Settings Route', () => {
expect(screen.getByTestId('theme-switcher')).toBeInTheDocument()
expect(screen.getByTestId('font-size-switcher')).toBeInTheDocument()
- expect(screen.getByTestId('color-picker-bg')).toBeInTheDocument()
- expect(screen.getByTestId('color-picker-main-view')).toBeInTheDocument()
- expect(screen.getByTestId('color-picker-primary')).toBeInTheDocument()
- expect(screen.getByTestId('color-picker-accent')).toBeInTheDocument()
- expect(screen.getByTestId('color-picker-destructive')).toBeInTheDocument()
- })
-
- it('should render chat width controls', () => {
- const Component = InterfaceRoute.component as React.ComponentType
- render(<Component />)
-
- expect(screen.getByTestId('chat-width-switcher')).toBeInTheDocument()
+ expect(screen.getByTestId('accent-color-picker')).toBeInTheDocument()
})
it('should render reset interface button', () => {
diff --git a/web-app/src/routes/settings/assistant.tsx b/web-app/src/routes/settings/assistant.tsx
index cfd70c1cb..7dc03db61 100644
--- a/web-app/src/routes/settings/assistant.tsx
+++ b/web-app/src/routes/settings/assistant.tsx
@@ -51,89 +51,94 @@ function AssistantContent() {
}
return (
- <div className="flex h-full flex-col justify-center">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <div className="flex items-center justify-between w-full mr-2">
- <span>{t('assistants:title')}</span>
+ <div className="flex items-center justify-between w-full mr-2 pr-4">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
<Button
onClick={() => {
setEditingKey(null)
setOpen(true)
}}
size="sm"
+ variant="secondary"
className="relative z-50"
>
<IconCirclePlus size={16} />
- Add Assistant
+ {t('assistants:addAssistant')}
</Button>
</div>
</HeaderPage>
- <div className="flex h-full w-full">
- <SettingsMenu />
- <div className="space-y-3 p-4">
- {assistants
- .slice()
- .sort((a, b) => a.created_at - b.created_at)
- .map((assistant) => (
- <div
- className="bg-main-view-fg/3 py-2 px-4 rounded-lg flex items-center gap-4"
- key={assistant.id}
- >
- <div className="flex items-start gap-3 flex-1">
- {assistant?.avatar && (
- <div className="shrink-0 w-8 h-8 relative flex items-center justify-center bg-main-view-fg/4 rounded-md">
- <AvatarEmoji
- avatar={assistant?.avatar}
- imageClassName="w-5 h-5 object-contain"
- textClassName="text-lg"
- />
+ <div className="flex h-[calc(100%-60px)]">
+ <div className="flex h-svh w-full">
+ <SettingsMenu />
+ <div className="space-y-3 p-4 pt-0 w-full overflow-y-auto">
+ {assistants
+ .slice()
+ .sort((a, b) => a.created_at - b.created_at)
+ .map((assistant) => (
+ <div
+ className="bg-secondary dark:bg-secondary/20 p-4 rounded-lg flex items-center gap-4"
+ key={assistant.id}
+ >
+ <div className="flex items-start gap-3 flex-1">
+ {assistant?.avatar && (
+ <div className="shrink-0 w-8 h-8 relative flex items-center justify-center bg-secondary rounded-md">
+ <AvatarEmoji
+ avatar={assistant?.avatar}
+ imageClassName="w-5 h-5 object-contain"
+ textClassName="text-lg"
+ />
+ </div>
+ )}
+ <div className="flex-1 min-w-0">
+ <h3 className="text-base font-studio font-medium line-clamp-1">
+ {assistant.name}
+ </h3>
+ <p className="text-muted-foreground leading-normal text-xs line-clamp-2 mt-1">
+ {assistant.description}
+ </p>
</div>
- )}
- <div className="flex-1 min-w-0">
- <h3 className="text-base font-medium text-main-view-fg/80 line-clamp-1">
- {assistant.name}
- </h3>
- <p className="text-main-view-fg/50 text-sm line-clamp-2 mt-0.5">
- {assistant.description}
- </p>
+ </div>
+ <div className="flex items-center">
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ title={t('assistants:editAssistant')}
+ onClick={() => {
+ setEditingKey(assistant.id)
+ setOpen(true)
+ }}
+ >
+ <IconPencil className="text-muted-foreground size-4" />
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon-sm"
+ title={t('assistants:deleteAssistant')}
+ onClick={() => handleDelete(assistant.id)}
+ >
+ <IconTrash className="text-destructive size-4" />
+ </Button>
</div>
</div>
- <div className="flex items-center">
- <button
- className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- title={t('assistants:editAssistant')}
- onClick={() => {
- setEditingKey(assistant.id)
- setOpen(true)
- }}
- >
- <IconPencil size={16} className="text-main-view-fg/50" />
- </button>
- <button
- className="size-8 cursor-pointer flex items-center justify-center rounded-md hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- title={t('assistants:deleteAssistant')}
- onClick={() => handleDelete(assistant.id)}
- >
- <IconTrash size={16} className="text-main-view-fg/50" />
- </button>
- </div>
- </div>
- ))}
+ ))}
+ </div>
+ <AddEditAssistant
+ open={open}
+ onOpenChange={setOpen}
+ editingKey={editingKey}
+ initialData={
+ editingKey ? assistants.find((a) => a.id === editingKey) : undefined
+ }
+ onSave={handleSave}
+ />
+ <DeleteAssistantDialog
+ open={deleteConfirmOpen}
+ onOpenChange={setDeleteConfirmOpen}
+ onConfirm={confirmDelete}
+ />
</div>
- <AddEditAssistant
- open={open}
- onOpenChange={setOpen}
- editingKey={editingKey}
- initialData={
- editingKey ? assistants.find((a) => a.id === editingKey) : undefined
- }
- onSave={handleSave}
- />
- <DeleteAssistantDialog
- open={deleteConfirmOpen}
- onOpenChange={setDeleteConfirmOpen}
- onConfirm={confirmDelete}
- />
</div>
</div>
)
diff --git a/web-app/src/routes/settings/attachments.tsx b/web-app/src/routes/settings/attachments.tsx
index c11aee97e..0f6567f97 100644
--- a/web-app/src/routes/settings/attachments.tsx
+++ b/web-app/src/routes/settings/attachments.tsx
@@ -176,13 +176,15 @@ function AttachmentsSettings() {
)
return (
- <div className="flex flex-col h-full pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))]">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full flex-col sm:flex-row">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
<Card title={t('common:attachments') || 'Attachments'}>
{defs.map((d) => {
diff --git a/web-app/src/routes/settings/extensions.tsx b/web-app/src/routes/settings/extensions.tsx
index e1b4ef0f1..13e870e00 100644
--- a/web-app/src/routes/settings/extensions.tsx
+++ b/web-app/src/routes/settings/extensions.tsx
@@ -2,12 +2,11 @@ import { createFileRoute } from '@tanstack/react-router'
import { route } from '@/constants/routes'
import { Card, CardItem } from '@/containers/Card'
-import HeaderPage from '@/containers/HeaderPage'
-
import SettingsMenu from '@/containers/SettingsMenu'
import { RenderMarkdown } from '@/containers/RenderMarkdown'
import { ExtensionManager } from '@/lib/extension'
import { useTranslation } from '@/i18n/react-i18next-compat'
+import HeaderPage from '@/containers/HeaderPage'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Route = createFileRoute(route.settings.extensions as any)({
@@ -18,19 +17,21 @@ function ExtensionsContent() {
const { t } = useTranslation()
const extensions = ExtensionManager.getInstance().listExtensions()
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* General */}
<Card
header={
<div className="flex items-center justify-between mb-4">
- <h1 className="text-main-view-fg font-medium text-base">
+ <h1 className="text-foreground font-studio font-medium text-base">
{t('settings:extensions.title')}
</h1>
{/* <div className="flex items-center gap-2">
@@ -45,10 +46,10 @@ function ExtensionsContent() {
key={i}
title={
<div className="flex items-center gap-x-2">
- <h1 className="text-main-view-fg">
+ <h1 className="text-foreground font-studio font-medium text-base">
{item.productName ?? item.name}
</h1>
- <div className="bg-main-view-fg/10 px-1 py-0.5 rounded text-main-view-fg/70 text-xs">
+ <div className="bg-foreground/10 px-1 py-0.5 rounded text-foreground/70 text-xs">
v{item.version}
</div>
</div>
@@ -67,7 +68,7 @@ function ExtensionsContent() {
),
// Custom paragraph component remove margin
p: ({ ...props }) => (
- <p {...props} className="!mb-0" />
+ <p {...props} className="mb-0!" />
),
}}
/>
diff --git a/web-app/src/routes/settings/general.tsx b/web-app/src/routes/settings/general.tsx
index 5c5f8eefa..1bad6a779 100644
--- a/web-app/src/routes/settings/general.tsx
+++ b/web-app/src/routes/settings/general.tsx
@@ -21,7 +21,6 @@ import {
IconCopy,
IconCopyCheck,
} from '@tabler/icons-react'
-// import { windowKey } from '@/constants/windows'
import { toast } from 'sonner'
import { isDev } from '@/lib/utils'
import { SystemEvent } from '@/types/events'
@@ -170,20 +169,23 @@ function General() {
}, [t, checkForUpdate])
return (
- <div className="flex flex-col h-full pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))]">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full flex-col sm:flex-row">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
+
{/* General */}
<Card title={t('common:general')}>
<CardItem
title={t('settings:general.appVersion')}
actions={
- <span className="text-main-view-fg/80 font-medium">
+ <span className="text-foreground font-medium">
v{VERSION}
</span>
}
@@ -192,20 +194,17 @@ function General() {
<CardItem
title={t('settings:general.checkForUpdates')}
description={t('settings:general.checkForUpdatesDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
+ className="items-center flex-row gap-y-2"
actions={
<Button
- variant="link"
+ variant="secondary"
size="sm"
- className="p-0"
onClick={handleCheckForUpdate}
disabled={isCheckingUpdate}
>
- <div className="cursor-pointer rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- {isCheckingUpdate
- ? t('settings:general.checkingForUpdates')
- : t('settings:general.checkForUpdates')}
- </div>
+ {isCheckingUpdate
+ ? t('settings:general.checkingForUpdates')
+ : t('settings:general.checkForUpdates')}
</Button>
}
/>
@@ -223,7 +222,7 @@ function General() {
ns: 'settings',
})}
align="start"
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
+ className="items-start flex-row gap-2"
description={
<>
<span>
@@ -233,10 +232,10 @@ function General() {
&nbsp;
</span>
<div className="flex items-center gap-2 mt-1 ">
- <div className="">
+ <div className="truncate">
<span
title={janDataFolder}
- className="bg-main-view-fg/10 text-xs px-1 py-0.5 rounded-sm text-main-view-fg/80 line-clamp-1 w-fit"
+ className="bg-secondary text-xs p-1 rounded-sm"
>
{janDataFolder}
</span>
@@ -245,7 +244,7 @@ function General() {
onClick={() =>
janDataFolder && copyToClipboard(janDataFolder)
}
- className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out p-1"
+ className="cursor-pointer flex items-center justify-center rounded-sm bg-secondary transition-all duration-200 ease-in-out p-1"
title={
isCopied
? t('settings:general.copied')
@@ -254,15 +253,15 @@ function General() {
>
{isCopied ? (
<div className="flex items-center gap-1">
- <IconCopyCheck size={12} className="text-accent" />
+ <IconCopyCheck size={14} className="text-green-500 dark:text-green-600" />
<span className="text-xs leading-0">
{t('settings:general.copied')}
</span>
</div>
) : (
<IconCopy
- size={12}
- className="text-main-view-fg/50"
+ size={14}
+ className="text-muted-foreground"
/>
)}
</button>
@@ -272,19 +271,16 @@ function General() {
actions={
<>
<Button
- variant="link"
+ variant="outline"
size="sm"
- className="p-0"
title={t('settings:dataFolder.appData')}
onClick={handleDataFolderChange}
>
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
<IconFolder
size={12}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
/>
<span>{t('settings:general.changeLocation')}</span>
- </div>
</Button>
{selectedNewPath && (
<ChangeDataFolderLocation
@@ -310,23 +306,11 @@ function General() {
ns: 'settings',
})}
description={t('settings:dataFolder.appLogsDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
+ className="items-start flex-row gap-y-2"
actions={
<div className="flex items-center gap-2">
<Button
- variant="link"
- size="sm"
- className="p-0"
- onClick={handleOpenLogs}
- title={t('settings:dataFolder.appLogs')}
- >
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- <IconLogs size={12} className="text-main-view-fg/50" />
- <span>{t('settings:general.openLogs')}</span>
- </div>
- </Button>
- <Button
- variant="link"
+ variant="outline"
size="sm"
className="p-0"
onClick={async () => {
@@ -344,18 +328,26 @@ function General() {
}}
title={t('settings:general.revealLogs')}
>
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- <IconFolder
- size={12}
- className="text-main-view-fg/50"
- />
- <span>{openFileTitle()}</span>
- </div>
+ <IconFolder
+ size={12}
+ className="text-muted-foreground"
+ />
+ <span>{openFileTitle()}</span>
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={handleOpenLogs}
+ title={t('settings:dataFolder.appLogs')}
+ >
+ <IconLogs size={12} className="text-muted-foreground" />
+ <span>{t('settings:general.openLogs')}</span>
</Button>
</div>
}
/>
</Card>
+
{/* Advanced - Desktop only */}
<Card title="Advanced">
<CardItem
@@ -404,18 +396,12 @@ function General() {
id="hf-token"
value={huggingfaceToken || ''}
onChange={(e) => setHuggingfaceToken(e.target.value)}
- placeholder={'hf_xxx'}
+ placeholder={'hf_xxx_xxx'}
required
/>
<Button
- variant={
- (huggingfaceToken || '').trim() ? 'default' : 'link'
- }
- className={
- (huggingfaceToken || '').trim()
- ? 'bg-green-600 text-white hover:bg-green-700'
- : ''
- }
+ variant="outline"
+ size='sm'
disabled={isValidatingToken}
onClick={async () => {
const token = (huggingfaceToken || '').trim()
@@ -525,12 +511,10 @@ function General() {
target="_blank"
rel="noopener noreferrer"
>
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out">
<IconBrandGithub
size={18}
- className="text-main-view-fg/50"
+ className="text-muted-foreground"
/>
- </div>
</a>
}
/>
@@ -543,12 +527,10 @@ function General() {
target="_blank"
rel="noopener noreferrer"
>
- <div className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out">
- <IconBrandDiscord
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
+ <IconBrandDiscord
+ size={18}
+ className="text-muted-foreground"
+ />
</a>
}
/>
@@ -578,7 +560,7 @@ function General() {
<CardItem
align="start"
description={
- <div className="text-main-view-fg/70 -mt-2">
+ <div className="text-muted-foreground -mt-2">
<p>{t('settings:general.creditsDesc1')}</p>
<p className="mt-2">{t('settings:general.creditsDesc2')}</p>
</div>
diff --git a/web-app/src/routes/settings/hardware.tsx b/web-app/src/routes/settings/hardware.tsx
index 90ae06e04..81b0758de 100644
--- a/web-app/src/routes/settings/hardware.tsx
+++ b/web-app/src/routes/settings/hardware.tsx
@@ -16,6 +16,7 @@ import { formatMegaBytes } from '@/lib/utils'
import { toNumber } from '@/utils/number'
import { useModelProvider } from '@/hooks/useModelProvider'
import { useAppState } from '@/hooks/useAppState'
+import { Button } from '@/components/ui/button'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Route = createFileRoute(route.settings.hardware as any)({
@@ -118,25 +119,27 @@ function HardwareContent() {
}
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
<div className="flex items-center gap-2 justify-between w-full pr-3">
- <h1 className="font-medium">{t('common:settings')}</h1>
- <div
- className="flex items-center gap-1 hover:bg-main-view-fg/8 px-1.5 py-0.5 rounded relative z-10 cursor-pointer"
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ <Button
+ variant="secondary"
+ size="sm"
+ className="flex items-center gap-2"
onClick={handleClickSystemMonitor}
>
- <IconDeviceDesktopAnalytics className="text-main-view-fg/50 size-5" />
+ <IconDeviceDesktopAnalytics className="text-muted-foreground size-5" />
<p>{t('settings:hardware.systemMonitor')}</p>
- </div>
+ </Button>
</div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
{isLoading ? (
<div className="flex items-center justify-center h-32">
- <div className="text-main-view-fg/50">
+ <div className="text-muted-foreground">
Loading hardware information...
</div>
</div>
@@ -147,7 +150,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.name')}
actions={
- <span className="text-main-view-fg/80 capitalize">
+ <span className="text-foreground capitalize">
{hardwareData.os_type}
</span>
}
@@ -155,7 +158,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.version')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{hardwareData.os_name}
</span>
}
@@ -167,7 +170,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.model')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{hardwareData.cpu?.name}
</span>
}
@@ -175,7 +178,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.architecture')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{hardwareData.cpu?.arch}
</span>
}
@@ -183,7 +186,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.cores')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{hardwareData.cpu?.core_count}
</span>
}
@@ -193,7 +196,7 @@ function HardwareContent() {
title={t('settings:hardware.instructions')}
column={hardwareData.cpu?.extensions.length > 6}
actions={
- <span className="text-main-view-fg/80 break-words">
+ <span className="text-foreground wrap-break-word">
{hardwareData.cpu?.extensions?.join(', ')}
</span>
}
@@ -209,7 +212,7 @@ function HardwareContent() {
value={systemUsage.cpu}
className="h-2 w-10"
/>
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{systemUsage.cpu?.toFixed(2)}%
</span>
</>
@@ -224,7 +227,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.totalRam')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{formatMegaBytes(hardwareData.total_memory)}
</span>
}
@@ -232,7 +235,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.availableRam')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{formatMegaBytes(
hardwareData.total_memory - systemUsage.used_memory
)}
@@ -254,7 +257,7 @@ function HardwareContent() {
}
className="h-2 w-10"
/>
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{(
toNumber(
systemUsage.used_memory /
@@ -292,10 +295,10 @@ function HardwareContent() {
actions={
<div className="flex items-center gap-4">
{/* <div className="flex flex-col items-end gap-1">
- <span className="text-main-view-fg/80 text-sm">
+ <span className="text-foreground text-sm">
ID: {device.id}
</span>
- <span className="text-main-view-fg/80 text-sm">
+ <span className="text-foreground text-sm">
Memory: {formatMegaBytes(device.mem)} /{' '}
{formatMegaBytes(device.free)} free
</span>
@@ -322,7 +325,7 @@ function HardwareContent() {
<CardItem
title={t('settings:hardware.vram')}
actions={
- <span className="text-main-view-fg/80">
+ <span className="text-foreground">
{formatMegaBytes(device.free)}{' '}
{t('settings:hardware.freeOf')}{' '}
{formatMegaBytes(device.mem)}
diff --git a/web-app/src/routes/settings/https-proxy.tsx b/web-app/src/routes/settings/https-proxy.tsx
index 1b12a63af..26e51ae56 100644
--- a/web-app/src/routes/settings/https-proxy.tsx
+++ b/web-app/src/routes/settings/https-proxy.tsx
@@ -41,19 +41,21 @@ function HTTPSProxyContent() {
)
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* Proxy Configuration */}
<Card
header={
<div className="flex items-center justify-between">
- <h1 className="text-main-view-fg font-medium text-base mb-2">
+ <h1 className="text-foreground font-studio font-medium text-base mb-2">
{t('settings:httpsProxy.proxy')}
</h1>
<Switch
@@ -101,7 +103,7 @@ function HTTPSProxyContent() {
<div className="absolute right-2 top-1/2 transform -translate-y-1/2 flex items-center gap-1">
<button
onClick={() => setShowPassword(!showPassword)}
- className="p-1 rounded hover:bg-main-view-fg/5 text-main-view-fg/70"
+ className="p-1 rounded hover:bg-foreground/5 text-foreground/70"
>
{showPassword ? (
<EyeOff size={16} />
diff --git a/web-app/src/routes/settings/interface.tsx b/web-app/src/routes/settings/interface.tsx
index ccb271c15..f8510ad95 100644
--- a/web-app/src/routes/settings/interface.tsx
+++ b/web-app/src/routes/settings/interface.tsx
@@ -2,21 +2,14 @@
import { route } from '@/constants/routes'
import SettingsMenu from '@/containers/SettingsMenu'
import HeaderPage from '@/containers/HeaderPage'
-import { ColorPickerAppBgColor } from '@/containers/ColorPickerAppBgColor'
-import { ColorPickerAppMainView } from '@/containers/ColorPickerAppMainView'
import { Card, CardItem } from '@/containers/Card'
import { useTranslation } from '@/i18n/react-i18next-compat'
import { ThemeSwitcher } from '@/containers/ThemeSwitcher'
import { FontSizeSwitcher } from '@/containers/FontSizeSwitcher'
-import { ColorPickerAppPrimaryColor } from '@/containers/ColorPickerAppPrimaryColor'
-import { ColorPickerAppAccentColor } from '@/containers/ColorPickerAppAccentColor'
-import { ColorPickerAppDestructiveColor } from '@/containers/ColorPickerAppDestructiveColor'
+import { AccentColorPicker } from '@/containers/AccentColorPicker'
import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
-
import { Button } from '@/components/ui/button'
import { toast } from 'sonner'
-import { ChatWidthSwitcher } from '@/containers/ChatWidthSwitcher'
-import { TokenCounterCompactSwitcher } from '@/containers/TokenCounterCompactSwitcher'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Route = createFileRoute(route.settings.interface as any)({
@@ -28,13 +21,15 @@ function InterfaceSettings() {
const { resetInterface } = useInterfaceSettings()
return (
- <div className="flex flex-col h-full pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))]">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full flex-col sm:flex-row">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* Interface */}
<Card title={t('settings:interface.title')}>
@@ -48,36 +43,11 @@ function InterfaceSettings() {
description={t('settings:interface.fontSizeDesc')}
actions={<FontSizeSwitcher />}
/>
-
- <CardItem
- title={t('settings:interface.windowBackground')}
- description={t('settings:interface.windowBackgroundDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
- actions={<ColorPickerAppBgColor />}
- />
<CardItem
- title={t('settings:interface.appMainView')}
- description={t('settings:interface.appMainViewDesc')}
+ title="Accent color"
+ description="Customize the accent color of the application."
className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
- actions={<ColorPickerAppMainView />}
- />
- <CardItem
- title={t('settings:interface.primary')}
- description={t('settings:interface.primaryDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
- actions={<ColorPickerAppPrimaryColor />}
- />
- <CardItem
- title={t('settings:interface.accent')}
- description={t('settings:interface.accentDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
- actions={<ColorPickerAppAccentColor />}
- />
- <CardItem
- title={t('settings:interface.destructive')}
- description={t('settings:interface.destructiveDesc')}
- className="flex-col sm:flex-row items-start sm:items-center sm:justify-between gap-y-2"
- actions={<ColorPickerAppDestructiveColor />}
+ actions={<AccentColorPicker />}
/>
<CardItem
title={t('settings:interface.resetToDefault')}
@@ -104,20 +74,6 @@ function InterfaceSettings() {
}
/>
</Card>
-
- {/* Chat Message */}
- <Card>
- <CardItem
- title={t('settings:interface.chatWidth')}
- description={t('settings:interface.chatWidthDesc')}
- />
- <ChatWidthSwitcher />
- <CardItem
- title={t('settings:interface.tokenCounterCompact')}
- description={t('settings:interface.tokenCounterCompactDesc')}
- actions={<TokenCounterCompactSwitcher />}
- />
- </Card>
</div>
</div>
</div>
diff --git a/web-app/src/routes/settings/local-api-server.tsx b/web-app/src/routes/settings/local-api-server.tsx
index 673b9c1a4..060143587 100644
--- a/web-app/src/routes/settings/local-api-server.tsx
+++ b/web-app/src/routes/settings/local-api-server.tsx
@@ -227,23 +227,25 @@ function LocalAPIServerContent() {
const isServerRunning = serverStatus !== 'stopped'
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* General Settings */}
<Card
header={
- <div className="mb-3 flex w-full items-center border-b border-main-view-fg/4 pb-2">
+ <div className="mb-3 flex w-full items-center border-b pb-2">
<div className="w-full space-y-2">
- <h1 className="text-base font-medium">
+ <h1 className="text-base font-medium text-foreground font-studio">
{t('settings:localApiServer.title')}
</h1>
- <p className="text-main-view-fg/70 mb-2">
+ <p className="text-muted-foreground mb-2">
{t('settings:localApiServer.description')}
</p>
</div>
@@ -281,16 +283,14 @@ function LocalAPIServerContent() {
description={t('settings:localApiServer.serverLogsDesc')}
actions={
<Button
- variant="link"
+ variant="secondary"
size="sm"
className="p-0"
onClick={handleOpenLogs}
title={t('settings:localApiServer.serverLogs')}
>
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- <IconLogs size={18} className="text-main-view-fg/50" />
- <span>{t('settings:localApiServer.openLogs')}</span>
- </div>
+ <IconLogs size={18} className="text-muted-foreground" />
+ <span>{t('settings:localApiServer.openLogs')}</span>
</Button>
}
/>
@@ -305,21 +305,12 @@ function LocalAPIServerContent() {
rel="noopener noreferrer"
>
<Button
- asChild
- variant="link"
+ variant="secondary"
size="sm"
- className="p-0 text-main-view-fg/80"
disabled={!isServerRunning}
title={t('settings:localApiServer.swaggerDocs')}
>
- <div
- className={cn(
- 'cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1',
- !isServerRunning && 'opacity-50 cursor-not-allowed'
- )}
- >
- <span>{t('settings:localApiServer.openDocs')}</span>
- </div>
+ <span>{t('settings:localApiServer.openDocs')}</span>
</Button>
</a>
}
diff --git a/web-app/src/routes/settings/mcp-servers.tsx b/web-app/src/routes/settings/mcp-servers.tsx
index 4bbe78936..d1cde6511 100644
--- a/web-app/src/routes/settings/mcp-servers.tsx
+++ b/web-app/src/routes/settings/mcp-servers.tsx
@@ -15,7 +15,7 @@ import {
MCPSettings,
DEFAULT_MCP_SETTINGS,
} from '@/hooks/useMCPServers'
-import { useEffect, useState } from 'react'
+import { Fragment, useEffect, useState } from 'react'
import AddEditMCPServer from '@/containers/dialogs/AddEditMCPServer'
import DeleteMCPServerConfirm from '@/containers/dialogs/DeleteMCPServerConfirm'
import EditJsonMCPserver from '@/containers/dialogs/EditJsonMCPserver'
@@ -29,6 +29,8 @@ import { useTranslation } from '@/i18n/react-i18next-compat'
import { useAppState } from '@/hooks/useAppState'
import { listen } from '@tauri-apps/api/event'
import { SystemEvent } from '@/types/events'
+import { Button } from '@/components/ui/button'
+
// Function to mask sensitive URL parameters
const maskSensitiveUrl = (url: string) => {
@@ -358,244 +360,249 @@ function MCPServersDesktop() {
}, [serviceHub, setConnectedServers])
return (
- <div className="flex flex-col h-full">
- <HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
- </HeaderPage>
- <div className="flex h-full w-full">
- <SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
- <div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
- <Card
- header={
- <div className="flex flex-col mb-4">
- <div className="flex items-center justify-between">
- <div className="flex items-center gap-2">
- <h1 className="text-main-view-fg font-medium text-base">
- {t('mcp-servers:title')}
- </h1>
- <div className="text-xs bg-main-view-fg/10 border border-main-view-fg/20 text-main-view-fg/70 rounded-full py-0.5 px-2">
- <span>{t('mcp-servers:experimental')}</span>
+ <Fragment>
+ <div className="flex flex-col h-svh w-full">
+ <HeaderPage>
+ <div className="flex items-center gap-2 w-full justify-between pr-4">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ <Button variant="secondary" size="sm" onClick={() => handleOpenDialog()}>
+ <IconPlus size={18} className="text-muted-foreground" />
+ {t('mcp-servers:addServer')}
+ </Button>
+ </div>
+ </HeaderPage>
+ <div className="flex h-[calc(100%-60px)]">
+ <SettingsMenu />
+ <div className="p-4 pt-0 w-full overflow-y-auto">
+ <div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
+ <Card
+ header={
+ <div className="flex flex-col mb-4">
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <h1 className="text-foreground font-medium text-base font-studio">
+ {t('mcp-servers:title')}
+ </h1>
+ <div className="text-xs bg-secondary border text-muted-foreground rounded-full py-0.5 px-2">
+ <span>{t('mcp-servers:experimental')}</span>
+ </div>
</div>
- </div>
- <div className="flex items-center gap-0.5">
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- onClick={() => handleOpenJsonEditor()}
- title={t('mcp-servers:editAllJson')}
- >
- <IconCodeCircle
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- onClick={() => handleOpenDialog()}
- title={t('mcp-servers:addServer')}
- >
- <IconPlus size={18} className="text-main-view-fg/50" />
+ <div className="flex items-center gap-0.5">
+ <Button
+ onClick={() => handleOpenJsonEditor()}
+ title={t('mcp-servers:editAllJson')}
+ size="icon-xs"
+ variant="ghost"
+ >
+ <IconCodeCircle
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
</div>
</div>
+ <p className="text-sm mt-1">
+ {t('mcp-servers:findMore')}{' '}
+ <a
+ href="https://mcp.so/"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-primary hover:underline"
+ >
+ mcp.so
+ </a>
+ </p>
</div>
- <p className="text-sm text-main-view-fg/70 mt-1">
- {t('mcp-servers:findMore')}{' '}
- <a
- href="https://mcp.so/"
- target="_blank"
- rel="noopener noreferrer"
- className="text-primary hover:underline"
- >
- mcp.so
- </a>
- </p>
- </div>
- }
- >
- <CardItem
- title={t('mcp-servers:allowPermissions')}
- description={t('mcp-servers:allowPermissionsDesc')}
- actions={
- <div className="flex-shrink-0 ml-4">
- <Switch
- checked={allowAllMCPPermissions}
- onCheckedChange={setAllowAllMCPPermissions}
- />
- </div>
- }
- />
- <CardItem
- title={t('mcp-servers:runtimeSettings.toolCallTimeout')}
- description={t(
- 'mcp-servers:runtimeSettings.toolCallTimeoutDesc'
- )}
- actions={
- <Input
- type="number"
- min={1}
- step={1}
- value={settings.toolCallTimeoutSeconds}
- onChange={(event) =>
- updateToolCallTimeout(event.target.value)
- }
- onBlur={() => {
- void syncServers()
- }}
- className="w-28"
- />
}
- />
- </Card>
-
- {Object.keys(mcpServers).length === 0 ? (
- <div className="py-4 text-center font-medium text-main-view-fg/50">
- {t('mcp-servers:noServers')}
- </div>
- ) : (
- Object.entries(mcpServers).map(([key, config], index) => (
- <Card key={`${key}-${index}`}>
- <CardItem
- align="start"
- title={
- <div className="flex items-center gap-x-2">
- <div
- className={twMerge(
- 'size-2 rounded-full',
- connectedServers.includes(key)
- ? 'bg-accent'
- : 'bg-main-view-fg/50'
+ >
+ <CardItem
+ title={t('mcp-servers:allowPermissions')}
+ description={t('mcp-servers:allowPermissionsDesc')}
+ actions={
+ <div className="shrink-0 ml-4">
+ <Switch
+ checked={allowAllMCPPermissions}
+ onCheckedChange={setAllowAllMCPPermissions}
+ />
+ </div>
+ }
+ />
+ <CardItem
+ title={t('mcp-servers:runtimeSettings.toolCallTimeout')}
+ description={t(
+ 'mcp-servers:runtimeSettings.toolCallTimeoutDesc'
+ )}
+ actions={
+ <Input
+ type="number"
+ min={1}
+ step={1}
+ value={settings.toolCallTimeoutSeconds}
+ onChange={(event) =>
+ updateToolCallTimeout(event.target.value)
+ }
+ onBlur={() => {
+ void syncServers()
+ }}
+ className="w-28"
+ />
+ }
+ />
+ </Card>
+
+ {Object.keys(mcpServers).length === 0 ? (
+ <div className="py-4 text-center font-medium text-muted-foreground">
+ {t('mcp-servers:noServers')}
+ </div>
+ ) : (
+ Object.entries(mcpServers).map(([key, config], index) => (
+ <Card key={`${key}-${index}`}>
+ <CardItem
+ align="start"
+ title={
+ <div className="flex items-center gap-x-2">
+ <div
+ className={twMerge(
+ 'size-2 rounded-full',
+ connectedServers.includes(key)
+ ? 'bg-green-600 dark:bg-green-600'
+ : 'bg-secondary'
+ )}
+ />
+ <h1 className="text-foreground text-base capitalize font-studio">
+ {key}
+ </h1>
+ {config.official && (
+ <div className="flex items-center gap-1.5 px-2 py-0.5 text-xs bg-secondary border rounded-sm">
+ <img
+ src="/images/jan-logo.png"
+ alt="Jan"
+ className="w-3 h-3 object-contain"
+ />
+ <span>Official</span>
+ </div>
)}
- />
- <h1 className="text-main-view-fg text-base capitalize">
- {key}
- </h1>
- {config.official && (
- <div className="flex items-center gap-1.5 px-2 py-0.5 text-xs bg-blue-500/10 text-blue-500 rounded">
- <img
- src="/images/jan-logo.png"
- alt="Jan"
- className="w-3 h-3 object-contain"
- />
- <span>Official</span>
- </div>
- )}
- </div>
- }
- descriptionOutside={
- <div className="text-sm text-main-view-fg/70">
- <div className="mb-1">
- Transport:{' '}
- <span className="uppercase">
- {config.type || 'stdio'}
- </span>
</div>
+ }
+ descriptionOutside={
+ <div className="text-sm text-muted-foreground">
+ <div className="mb-1">
+ Transport:{' '}
+ <span className="uppercase">
+ {config.type || 'stdio'}
+ </span>
+ </div>
- {config.type === 'stdio' || !config.type ? (
- <>
- <div>
- {t('mcp-servers:command')}: {config.command}
- </div>
- <div className="my-1 break-all">
- {t('mcp-servers:args')}:{' '}
- {config?.args?.join(', ')}
- </div>
- {config.env &&
- Object.keys(config.env).length > 0 && (
- <div className="break-all">
- {t('mcp-servers:env')}:{' '}
- {Object.entries(config.env)
- .map(([key]) => `${key}=******`)
- .join(', ')}
+ {config.type === 'stdio' || !config.type ? (
+ <>
+ <div>
+ {t('mcp-servers:command')}: {config.command}
+ </div>
+ <div className="my-1 break-all">
+ {t('mcp-servers:args')}:{' '}
+ {config?.args?.join(', ')}
+ </div>
+ {config.env &&
+ Object.keys(config.env).length > 0 && (
+ <div className="break-all">
+ {t('mcp-servers:env')}:{' '}
+ {Object.entries(config.env)
+ .map(([key]) => `${key}=******`)
+ .join(', ')}
+ </div>
+ )}
+ {config.official && (
+ <div className="mt-2 text-xs text-muted-foreground pt-2">
+ <p className="mb-1">
+ Requires Jan Browser Extension to be installed
+ in your Chrome-based browser.
+ </p>
+ <a
+ href="https://chromewebstore.google.com/detail/jan-browser-mcp/mkciifcjehgnpaigoiaakdgabbpfppal"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-blue-500 hover:underline"
+ >
+ Install Extension →
+ </a>
</div>
)}
- {config.official && (
- <div className="mt-2 text-xs text-main-view-fg/60 border-t border-main-view-fg/10 pt-2">
- <p className="mb-1">
- Requires Jan Browser Extension to be installed
- in your Chrome-based browser.
- </p>
- <a
- href="https://chromewebstore.google.com/detail/jan-browser-mcp/mkciifcjehgnpaigoiaakdgabbpfppal"
- target="_blank"
- rel="noopener noreferrer"
- className="text-blue-500 hover:underline"
- >
- Install Extension →
- </a>
+ </>
+ ) : (
+ <>
+ <div className="break-all">
+ URL: {maskSensitiveUrl(config.url || '')}
</div>
- )}
- </>
- ) : (
- <>
- <div className="break-all">
- URL: {maskSensitiveUrl(config.url || '')}
- </div>
- {config.headers &&
- Object.keys(config.headers).length > 0 && (
- <div className="my-1 break-all">
- Headers:{' '}
- {Object.entries(config.headers)
- .map(([key]) => `${key}=******`)
- .join(', ')}
- </div>
+ {config.headers &&
+ Object.keys(config.headers).length > 0 && (
+ <div className="my-1 break-all">
+ Headers:{' '}
+ {Object.entries(config.headers)
+ .map(([key]) => `${key}=******`)
+ .join(', ')}
+ </div>
+ )}
+ {config.timeout && (
+ <div>Timeout: {config.timeout}s</div>
)}
- {config.timeout && (
- <div>Timeout: {config.timeout}s</div>
- )}
- </>
- )}
- </div>
- }
- actions={
- <div className="flex items-center gap-0.5">
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- onClick={() => handleOpenJsonEditor(key)}
- title={t('mcp-servers:editJson.title', {
- serverName: key,
- })}
- >
- <IconCodeCircle
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- onClick={() => handleEdit(key)}
- title={t('mcp-servers:editServer')}
- >
- <IconPencil
- size={18}
- className="text-main-view-fg/50"
- />
- </div>
- <div
- className="size-6 cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/10 transition-all duration-200 ease-in-out"
- onClick={() => handleDeleteClick(key)}
- title={t('mcp-servers:deleteServer.title')}
- >
- <IconTrash
- size={18}
- className="text-main-view-fg/50"
- />
+ </>
+ )}
</div>
- <div className="ml-2">
- <Switch
- checked={config.active}
- loading={!!loadingServers[key]}
- onCheckedChange={(checked) =>
- toggleServer(key, checked)
- }
- />
+ }
+ actions={
+ <div className="flex items-center gap-0.5">
+ <Button
+ size="icon-xs"
+ variant="ghost"
+ onClick={() => handleOpenJsonEditor(key)}
+ title={t('mcp-servers:editJson.title', {
+ serverName: key,
+ })}
+ >
+ <IconCodeCircle
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ <Button
+ size="icon-xs"
+ variant="ghost"
+ onClick={() => handleEdit(key)}
+ title={t('mcp-servers:editServer')}
+ >
+ <IconPencil
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ <Button
+ size="icon-xs"
+ variant="ghost"
+ onClick={() => handleDeleteClick(key)}
+ title={t('mcp-servers:deleteServer.title')}
+ >
+ <IconTrash
+ size={18}
+ className="text-muted-foreground"
+ />
+ </Button>
+ <div className="ml-2">
+ <Switch
+ checked={config.active}
+ loading={!!loadingServers[key]}
+ onCheckedChange={(checked) =>
+ toggleServer(key, checked)
+ }
+ />
+ </div>
</div>
- </div>
- }
- />
- </Card>
- ))
- )}
+ }
+ />
+ </Card>
+ ))
+ )}
+ </div>
</div>
</div>
</div>
@@ -630,6 +637,6 @@ function MCPServersDesktop() {
}
onSave={handleSaveJson}
/>
- </div>
+ </Fragment>
)
}
diff --git a/web-app/src/routes/settings/privacy.tsx b/web-app/src/routes/settings/privacy.tsx
index 425c4865a..0b2691170 100644
--- a/web-app/src/routes/settings/privacy.tsx
+++ b/web-app/src/routes/settings/privacy.tsx
@@ -18,18 +18,20 @@ function Privacy() {
const { setProductAnalytic, productAnalytic } = useAnalytic()
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
<Card
header={
<div className="flex items-center justify-between mb-4">
- <h1 className="text-main-view-fg font-medium text-base">
+ <h1 className="font-medium text-foreground text-base">
{t('settings:privacy.analytics')}
</h1>
<div className="flex items-center gap-2">
@@ -55,7 +57,7 @@ function Privacy() {
/>
<CardItem
description={
- <div className="text-main-view-fg/90">
+ <div className="text-foreground">
<p>{t('settings:privacy.privacyPolicy')}</p>
<p className="my-1">
{t('settings:privacy.analyticsDesc')}
diff --git a/web-app/src/routes/settings/providers/$providerName.tsx b/web-app/src/routes/settings/providers/$providerName.tsx
index 3ba284267..d07fec333 100644
--- a/web-app/src/routes/settings/providers/$providerName.tsx
+++ b/web-app/src/routes/settings/providers/$providerName.tsx
@@ -14,7 +14,6 @@ import Capabilities from '@/containers/Capabilities'
import { DynamicControllerSetting } from '@/containers/dynamicControllerSetting'
import { RenderMarkdown } from '@/containers/RenderMarkdown'
import { DialogEditModel } from '@/containers/dialogs/EditModel'
-import { DialogAddModel } from '@/containers/dialogs/AddModel'
import { ImportVisionModelDialog } from '@/containers/dialogs/ImportVisionModelDialog'
import { ModelSetting } from '@/containers/ModelSetting'
import { DialogDeleteModel } from '@/containers/dialogs/DeleteModel'
@@ -58,7 +57,6 @@ function ProviderDetail() {
useShallow((state) => [state.activeModels, state.setActiveModels])
)
const [loadingModels, setLoadingModels] = useState<string[]>([])
- const [refreshingModels, setRefreshingModels] = useState(false)
const [isCheckingBackendUpdate, setIsCheckingBackendUpdate] = useState(false)
const [isInstallingBackend, setIsInstallingBackend] = useState(false)
const [importingModel, setImportingModel] = useState<string | null>(null)
@@ -199,69 +197,6 @@ function ProviderDetail() {
// Note: settingsChanged event is now handled globally in GlobalEventHandler
// This ensures all screens receive the event intermediately
- const handleRefreshModels = async () => {
- if (!provider || !provider.base_url) {
- toast.error(t('providers:models'), {
- description: t('providers:refreshModelsError'),
- })
- return
- }
-
- setRefreshingModels(true)
- try {
- const modelIds = await serviceHub
- .providers()
- .fetchModelsFromProvider(provider)
-
- // Create new models from the fetched IDs
- const newModels: Model[] = modelIds.map((id) => ({
- id,
- model: id,
- name: id,
- capabilities: ['completion'], // Default capability
- version: '1.0',
- }))
-
- // Filter out models that already exist
- const existingModelIds = provider.models.map((m) => m.id)
- const modelsToAdd = newModels.filter(
- (model) => !existingModelIds.includes(model.id)
- )
-
- if (modelsToAdd.length > 0) {
- // Update the provider with new models
- const updatedModels = [...provider.models, ...modelsToAdd]
- updateProvider(providerName, {
- ...provider,
- models: updatedModels,
- })
-
- toast.success(t('providers:models'), {
- description: t('providers:refreshModelsSuccess', {
- count: modelsToAdd.length,
- provider: provider.provider,
- }),
- })
- } else {
- toast.success(t('providers:models'), {
- description: t('providers:noNewModels'),
- })
- }
- } catch (error) {
- console.error(
- t('providers:refreshModelsFailed', { provider: provider.provider }),
- error
- )
- toast.error(t('providers:models'), {
- description: t('providers:refreshModelsFailed', {
- provider: provider.provider,
- }),
- })
- } finally {
- setRefreshingModels(false)
- }
- }
-
const handleStartModel = async (modelId: string) => {
// Add model to loading state
setLoadingModels((prev) => [...prev, modelId])
@@ -364,438 +299,395 @@ function ProviderDetail() {
}, [provider, serviceHub, refreshSettings, t, installBackend])
return (
- <>
- <div className="flex flex-col h-full pb-[calc(env(safe-area-inset-bottom)+env(safe-area-inset-top))]">
- <HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
- </HeaderPage>
- <div className="flex h-full w-full">
- <SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
- <div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
- <div className="flex items-center justify-between">
- <h1 className="font-medium text-base">
- {getProviderTitle(providerName)}
- </h1>
- </div>
-
- <div
- className={cn(
- 'flex flex-col gap-3',
- provider &&
- provider.provider === 'llamacpp' &&
- 'flex-col-reverse'
- )}
- >
- {/* Settings */}
- <Card>
- {provider?.settings.map((setting, settingIndex) => {
- // Use the DynamicController component
- const actionComponent = (
- <div className="mt-2">
- {needsBackendConfig &&
- setting.key === 'version_backend' ? (
- <div className="flex items-center gap-1 text-sm text-main-view-fg/70">
- <IconLoader size={16} className="animate-spin" />
- <span>loading</span>
- </div>
- ) : (
- <DynamicControllerSetting
- controllerType={setting.controller_type}
- controllerProps={setting.controller_props}
- className={cn(
- setting.key === 'device' && 'hidden'
- )}
- onChange={(newValue) => {
- if (provider) {
- const newSettings = [...provider.settings]
- // Handle different value types by forcing the type
- // Use type assertion to bypass type checking
-
- ; (
- newSettings[settingIndex]
+ <div className="flex flex-col h-svh w-full">
+ <HeaderPage>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
+ </HeaderPage>
+ <div className="flex h-[calc(100%-60px)]">
+ <SettingsMenu />
+ <div className="p-4 pt-0 w-full overflow-y-auto">
+ <div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
+ <div className="flex items-center justify-between">
+ <h1 className="font-medium text-base">
+ {getProviderTitle(providerName)}
+ </h1>
+ </div>
+
+ <div
+ className={cn(
+ 'flex flex-col gap-3',
+ provider &&
+ provider.provider === 'llamacpp' &&
+ 'flex-col-reverse'
+ )}
+ >
+ {/* Settings */}
+ <Card>
+ {provider?.settings.map((setting, settingIndex) => {
+ // Use the DynamicController component
+ const actionComponent = (
+ <div className="mt-2">
+ {needsBackendConfig &&
+ setting.key === 'version_backend' ? (
+ <div className="flex items-center gap-1 text-sm">
+ <IconLoader size={16} className="animate-spin" />
+ <span>loading</span>
+ </div>
+ ) : (
+ <DynamicControllerSetting
+ controllerType={setting.controller_type}
+ controllerProps={setting.controller_props}
+ className={cn(
+ setting.key === 'device' && 'hidden'
+ )}
+ onChange={(newValue) => {
+ if (provider) {
+ const newSettings = [...provider.settings]
+ // Handle different value types by forcing the type
+ // Use type assertion to bypass type checking
+
+ ; (
+ newSettings[settingIndex]
+ .controller_props as {
+ value: string | boolean | number
+ }
+ ).value = newValue
+
+ // Create update object with updated settings
+ const updateObj: Partial<ModelProvider> = {
+ settings: newSettings,
+ }
+ // Check if this is an API key or base URL setting and update the corresponding top-level field
+ const settingKey = setting.key
+ if (
+ settingKey === 'api-key' &&
+ typeof newValue === 'string'
+ ) {
+ updateObj.api_key = newValue
+ } else if (
+ settingKey === 'base-url' &&
+ typeof newValue === 'string'
+ ) {
+ updateObj.base_url = newValue
+ }
+
+ // Reset device setting to empty when backend version changes
+ if (settingKey === 'version_backend') {
+ const deviceSettingIndex =
+ newSettings.findIndex(
+ (s) => s.key === 'device'
+ )
+
+ if (deviceSettingIndex !== -1) {
+ (
+ newSettings[deviceSettingIndex]
.controller_props as {
- value: string | boolean | number
+ value: string
}
- ).value = newValue
-
- // Create update object with updated settings
- const updateObj: Partial<ModelProvider> = {
- settings: newSettings,
- }
- // Check if this is an API key or base URL setting and update the corresponding top-level field
- const settingKey = setting.key
- if (
- settingKey === 'api-key' &&
- typeof newValue === 'string'
- ) {
- updateObj.api_key = newValue
- } else if (
- settingKey === 'base-url' &&
- typeof newValue === 'string'
- ) {
- updateObj.base_url = newValue
+ ).value = ''
}
- // Reset device setting to empty when backend version changes
- if (settingKey === 'version_backend') {
- const deviceSettingIndex =
- newSettings.findIndex(
- (s) => s.key === 'device'
- )
-
- if (deviceSettingIndex !== -1) {
- (
- newSettings[deviceSettingIndex]
- .controller_props as {
- value: string
- }
- ).value = ''
- }
-
- // Reset llamacpp device activations when backend version changes
- if (providerName === 'llamacpp') {
- // Refresh devices to update activation status from provider settings
- const { fetchDevices } =
- useLlamacppDevices.getState()
- fetchDevices()
- }
+ // Reset llamacpp device activations when backend version changes
+ if (providerName === 'llamacpp') {
+ // Refresh devices to update activation status from provider settings
+ const { fetchDevices } =
+ useLlamacppDevices.getState()
+ fetchDevices()
}
-
- serviceHub
- .providers()
- .updateSettings(
- providerName,
- updateObj.settings ?? []
- )
- updateProvider(providerName, {
- ...provider,
- ...updateObj,
- })
-
- serviceHub.models().stopAllModels()
-
- // Refresh active models after stopping
- serviceHub
- .models()
- .getActiveModels()
- .then((models) =>
- setActiveModels(models || [])
- )
}
+
+ serviceHub
+ .providers()
+ .updateSettings(
+ providerName,
+ updateObj.settings ?? []
+ )
+ updateProvider(providerName, {
+ ...provider,
+ ...updateObj,
+ })
+
+ serviceHub.models().stopAllModels()
+
+ // Refresh active models after stopping
+ serviceHub
+ .models()
+ .getActiveModels()
+ .then((models) =>
+ setActiveModels(models || [])
+ )
+ }
+ }}
+ />
+ )}
+ </div>
+ )
+
+ return (
+ <CardItem
+ key={settingIndex}
+ title={setting.title}
+ className={cn(setting.key === 'device' && 'hidden')}
+ column={
+ setting.controller_type === 'input' &&
+ setting.controller_props.type !== 'number'
+ ? true
+ : false
+ }
+ description={
+ <>
+ <RenderMarkdown
+ className="![>p]:text-muted-foreground select-none"
+ content={setting.description}
+ components={{
+ // Make links open in a new tab
+ a: ({ ...props }) => {
+ return (
+ <a
+ {...props}
+ target="_blank"
+ rel="noopener noreferrer"
+ />
+ )
+ },
+ p: ({ ...props }) => (
+ <p {...props} className="mb-0!" />
+ ),
}}
/>
- )}
- </div>
- )
-
+ {setting.key === 'version_backend' &&
+ setting.controller_props?.recommended && (
+ <div className="mt-1 text-sm text-muted-foreground">
+ <span className="font-medium">
+ {setting.controller_props.recommended
+ ?.split('/')
+ .pop() ||
+ setting.controller_props.recommended}
+ </span>
+ <span> is the recommended backend.</span>
+ </div>
+ )}
+ {setting.key === 'version_backend' &&
+ provider?.provider === 'llamacpp' && (
+ <div className="mt-2 flex flex-wrap gap-2">
+ <Button
+ variant="outline"
+ size="sm"
+ className={cn(
+ 'p-0',
+ isCheckingBackendUpdate &&
+ 'pointer-events-none'
+ )}
+ onClick={handleCheckForBackendUpdate}
+ >
+ <IconRefresh
+ size={12}
+ className={cn(
+ 'text-muted-foreground',
+ isCheckingBackendUpdate &&
+ 'animate-spin'
+ )}
+ />
+ <span>
+ {isCheckingBackendUpdate
+ ? t(
+ 'settings:checkingForBackendUpdates'
+ )
+ : t(
+ 'settings:checkForBackendUpdates'
+ )}
+ </span>
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ className="p-0"
+ onClick={handleInstallBackendFromFile}
+ disabled={isInstallingBackend}
+ >
+ <IconUpload
+ size={12}
+ className={cn(
+ 'text-muted-foreground',
+ isInstallingBackend && 'animate-pulse'
+ )}
+ />
+ <span>
+ {isInstallingBackend
+ ? 'Installing Backend...'
+ : 'Install Backend from File'}
+ </span>
+ </Button>
+ </div>
+ )}
+ </>
+ }
+ actions={actionComponent}
+ />
+ )
+ })}
+
+ <DeleteProvider provider={provider} />
+ </Card>
+
+ {/* Models */}
+ <Card
+ header={
+ <div className="flex items-center justify-between mb-4">
+ <h1 className="text-foreground font-medium text-base">
+ {t('providers:models')}
+ </h1>
+ <div className="flex items-center gap-2">
+ {provider && provider.provider === 'llamacpp' && (
+ <ImportVisionModelDialog
+ provider={provider}
+ onSuccess={handleModelImportSuccess}
+ trigger={
+ <Button
+ variant="secondary"
+ size="sm"
+ >
+ <IconFolderPlus
+ size={18}
+ className="text-muted-foreground"
+ />
+ <span>
+ {t('providers:import')}
+ </span>
+ </Button>
+ }
+ />
+ )}
+ </div>
+ </div>
+ }
+ >
+ {provider?.models.length ? (
+ provider?.models.map((model, modelIndex) => {
+ const capabilities = model.capabilities || []
return (
<CardItem
- key={settingIndex}
- title={setting.title}
- className={cn(setting.key === 'device' && 'hidden')}
- column={
- setting.controller_type === 'input' &&
- setting.controller_props.type !== 'number'
- ? true
- : false
+ key={modelIndex}
+ title={
+ <div className="flex items-center gap-2">
+ <h1
+ className="font-medium line-clamp-1"
+ title={model.id}
+ >
+ {getModelDisplayName(model)}
+ </h1>
+ <Capabilities capabilities={capabilities} />
+ </div>
}
- description={
- <>
- <RenderMarkdown
- className="![>p]:text-main-view-fg/70 select-none"
- content={setting.description}
- components={{
- // Make links open in a new tab
- a: ({ ...props }) => {
- return (
- <a
- {...props}
- target="_blank"
- rel="noopener noreferrer"
- />
- )
- },
- p: ({ ...props }) => (
- <p {...props} className="!mb-0" />
- ),
- }}
+ actions={
+ <div className="flex items-center gap-0.5">
+ <DialogEditModel
+ provider={provider}
+ modelId={model.id}
/>
- {setting.key === 'version_backend' &&
- setting.controller_props?.recommended && (
- <div className="mt-1 text-sm text-main-view-fg/60">
- <span className="font-medium">
- {setting.controller_props.recommended
- ?.split('/')
- .pop() ||
- setting.controller_props.recommended}
- </span>
- <span> is the recommended backend.</span>
- </div>
+ {model.settings && (
+ <ModelSetting
+ provider={provider}
+ model={model}
+ />
+ )}
+ {((provider &&
+ !predefinedProviders.some(
+ (p) => p.provider === provider.provider
+ )) ||
+ (provider &&
+ predefinedProviders.some(
+ (p) => p.provider === provider.provider
+ ) &&
+ Boolean(provider.api_key?.length))) && (
+ <FavoriteModelAction model={model} />
)}
- {setting.key === 'version_backend' &&
- provider?.provider === 'llamacpp' && (
- <div className="mt-2 flex flex-wrap gap-2">
+ <DialogDeleteModel
+ provider={provider}
+ modelId={model.id}
+ />
+ {provider && provider.provider === 'llamacpp' && (
+ <div className="ml-2">
+ {activeModels.some(
+ (activeModel) => activeModel === model.id
+ ) ? (
<Button
- variant="link"
size="sm"
- className={cn(
- 'p-0',
- isCheckingBackendUpdate &&
- 'pointer-events-none'
- )}
- onClick={handleCheckForBackendUpdate}
+ variant="destructive"
+ onClick={() => handleStopModel(model.id)}
>
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- <IconRefresh
- size={12}
- className={cn(
- 'text-main-view-fg/50',
- isCheckingBackendUpdate &&
- 'animate-spin'
- )}
- />
- <span>
- {isCheckingBackendUpdate
- ? t(
- 'settings:checkingForBackendUpdates'
- )
- : t(
- 'settings:checkForBackendUpdates'
- )}
- </span>
- </div>
+ {t('providers:stop')}
</Button>
+ ) : (
<Button
- variant="link"
size="sm"
- className="p-0"
- onClick={handleInstallBackendFromFile}
- disabled={isInstallingBackend}
+ disabled={loadingModels.includes(
+ model.id
+ )}
+ onClick={() => handleStartModel(model.id)}
>
- <div className="cursor-pointer flex items-center justify-center rounded-sm hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-2 py-1 gap-1">
- <IconUpload
- size={12}
- className={cn(
- 'text-main-view-fg/50',
- isInstallingBackend && 'animate-pulse'
- )}
- />
- <span>
- {isInstallingBackend
- ? 'Installing Backend...'
- : 'Install Backend from File'}
- </span>
- </div>
+ {loadingModels.includes(model.id) ? (
+ <div className="flex items-center gap-2">
+ <IconLoader
+ size={16}
+ className="animate-spin"
+ />
+ </div>
+ ) : (
+ t('providers:start')
+ )}
</Button>
- </div>
- )}
- </>
+ )}
+ </div>
+ )}
+ </div>
}
- actions={actionComponent}
/>
)
- })}
-
- <DeleteProvider provider={provider} />
- </Card>
-
- {/* Models */}
- <Card
- header={
- <div className="flex items-center justify-between mb-4">
- <h1 className="text-main-view-fg font-medium text-base">
- {t('providers:models')}
- </h1>
- <div className="flex items-center gap-2">
- {provider && provider.provider !== 'llamacpp' && (
- <>
- {!predefinedProviders.some(
- (p) => p.provider === provider.provider
- ) && (
- <Button
- variant="link"
- size="sm"
- className="hover:no-underline"
- onClick={handleRefreshModels}
- disabled={refreshingModels}
- >
- <div className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out px-1.5 py-1 gap-1">
- {refreshingModels ? (
- <IconLoader
- size={18}
- className="text-main-view-fg/50 animate-spin"
- />
- ) : (
- <IconRefresh
- size={18}
- className="text-main-view-fg/50"
- />
- )}
- <span className="text-main-view-fg/70">
- {refreshingModels
- ? t('providers:refreshing')
- : t('providers:refresh')}
- </span>
- </div>
- </Button>
- )}
- <DialogAddModel provider={provider} />
- </>
- )}
- {provider && provider.provider === 'llamacpp' && (
- <ImportVisionModelDialog
- provider={provider}
- onSuccess={handleModelImportSuccess}
- trigger={
- <Button
- variant="link"
- size="sm"
- className="hover:no-underline !outline-none focus:outline-none active:outline-none"
- asChild
- >
- <div className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out p-1.5 py-1 gap-1 -mr-2">
- <IconFolderPlus
- size={18}
- className="text-main-view-fg/50"
- />
- <span className="text-main-view-fg/70">
- {t('providers:import')}
- </span>
- </div>
- </Button>
- }
- />
- )}
- </div>
- </div>
- }
- >
- {provider?.models.length ? (
- provider?.models.map((model, modelIndex) => {
- const capabilities = model.capabilities || []
- return (
- <CardItem
- key={modelIndex}
- title={
- <div className="flex items-center gap-2">
- <h1
- className="font-medium line-clamp-1"
- title={model.id}
- >
- {getModelDisplayName(model)}
- </h1>
- <Capabilities capabilities={capabilities} />
- </div>
- }
- actions={
- <div className="flex items-center gap-0.5">
- <DialogEditModel
- provider={provider}
- modelId={model.id}
- />
- {model.settings && (
- <ModelSetting
- provider={provider}
- model={model}
- />
- )}
- {((provider &&
- !predefinedProviders.some(
- (p) => p.provider === provider.provider
- )) ||
- (provider &&
- predefinedProviders.some(
- (p) => p.provider === provider.provider
- ) &&
- Boolean(provider.api_key?.length))) && (
- <FavoriteModelAction model={model} />
- )}
- <DialogDeleteModel
- provider={provider}
- modelId={model.id}
- />
- {provider && provider.provider === 'llamacpp' && (
- <div className="ml-2">
- {activeModels.some(
- (activeModel) => activeModel === model.id
- ) ? (
- <Button
- size="sm"
- variant="destructive"
- onClick={() => handleStopModel(model.id)}
- >
- {t('providers:stop')}
- </Button>
- ) : (
- <Button
- size="sm"
- disabled={loadingModels.includes(
- model.id
- )}
- onClick={() => handleStartModel(model.id)}
- >
- {loadingModels.includes(model.id) ? (
- <div className="flex items-center gap-2">
- <IconLoader
- size={16}
- className="animate-spin"
- />
- </div>
- ) : (
- t('providers:start')
- )}
- </Button>
- )}
- </div>
- )}
- </div>
- }
- />
- )
- })
- ) : (
- <div className="-mt-2">
- <div className="flex items-center gap-2 text-main-view-fg/80">
- <h6 className="font-medium text-base">
- {t('providers:noModelFound')}
- </h6>
- </div>
- <p className="text-main-view-fg/70 mt-1 text-xs leading-relaxed">
- {t('providers:noModelFoundDesc')}
- &nbsp;
- <Link to={route.hub.index}>{t('common:hub')}</Link>
- </p>
+ })
+ ) : (
+ <div className="-mt-2">
+ <div className="flex items-center gap-2">
+ <h6 className="font-medium text-base">
+ {t('providers:noModelFound')}
+ </h6>
</div>
- )}
- {/* Show importing skeleton first if there's one */}
- {importingModel && (
- <CardItem
- key="importing-skeleton"
- title={
- <div className="flex items-center gap-2">
- <div className="flex items-center gap-2 animate-pulse">
- <div className="bg-accent/20 flex gap-2 text-accent px-2 py-1 rounded-full text-xs">
- <IconLoader
- size={16}
- className="animate-spin text-accent"
- />
- Importing...
- </div>
- <h1 className="font-medium line-clamp-1">
- {importingModel}
- </h1>
+ <p className="text-muted-foreground mt-1 text-xs leading-relaxed">
+ {t('providers:noModelFoundDesc')}
+ &nbsp;
+ <Link to={route.hub.index}>{t('common:hub')}</Link>
+ </p>
+ </div>
+ )}
+ {/* Show importing skeleton first if there's one */}
+ {importingModel && (
+ <CardItem
+ key="importing-skeleton"
+ title={
+ <div className="flex items-center gap-2">
+ <div className="flex items-center gap-2 animate-pulse">
+ <div className="bg-accent/20 flex gap-2 text-accent px-2 py-1 rounded-full text-xs">
+ <IconLoader
+ size={16}
+ className="animate-spin text-accent"
+ />
+ Importing...
</div>
+ <h1 className="font-medium line-clamp-1">
+ {importingModel}
+ </h1>
</div>
- }
- />
- )}
- </Card>
- </div>
+ </div>
+ }
+ />
+ )}
+ </Card>
</div>
</div>
</div>
</div>
- </>
+ </div>
)
}
diff --git a/web-app/src/routes/settings/providers/index.tsx b/web-app/src/routes/settings/providers/index.tsx
index 34c1770ec..f7e887d90 100644
--- a/web-app/src/routes/settings/providers/index.tsx
+++ b/web-app/src/routes/settings/providers/index.tsx
@@ -59,31 +59,31 @@ function ModelProviders() {
)
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full flex-col sm:flex-row">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full h-[calc(100%-32px)] overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* Model Providers */}
<Card
header={
<div className="flex items-center justify-between w-full mb-6">
- <span className="text-main-view-fg font-medium text-base">
+ <span className="font-medium text-base font-studio text-foreground">
{t('common:modelProviders')}
</span>
<AddProviderDialog onCreateProvider={createProvider}>
<Button
- variant="link"
+ variant="secondary"
size="sm"
className="flex items-center gap-2"
>
- <div className="cursor-pointer flex items-center justify-center rounded hover:bg-main-view-fg/15 bg-main-view-fg/10 transition-all duration-200 ease-in-out p-1.5 py-1 gap-1 -mr-2">
- <IconCirclePlus size={16} />
- <span>{t('provider:addProvider')}</span>
- </div>
+ <IconCirclePlus size={16} />
+ <span>{t('provider:addProvider')}</span>
</Button>
</AddProviderDialog>
</div>
@@ -99,7 +99,7 @@ function ModelProviders() {
<h3 className="font-medium">
{getProviderTitle(provider.provider)}
</h3>
- <p className="text-xs text-main-view-fg/70">
+ <p className="text-xs text-muted-foreground mt-1">
{provider.models.length} Models
</p>
</div>
@@ -109,9 +109,8 @@ function ModelProviders() {
<div className="flex items-center gap-2">
{provider.active && (
<Button
- variant="default"
- size="sm"
- className="h-6 w-6 p-0 bg-transparent hover:bg-main-view-fg/10 border-none shadow-none"
+ variant="ghost"
+ size="icon-xs"
onClick={() => {
navigate({
to: route.settings.providers,
@@ -122,7 +121,7 @@ function ModelProviders() {
}}
>
<IconSettings
- className="text-main-view-fg/60"
+ className="text-muted-foreground"
size={16}
/>
</Button>
diff --git a/web-app/src/routes/settings/shortcuts.tsx b/web-app/src/routes/settings/shortcuts.tsx
index 1bad0cb2c..24ade1f71 100644
--- a/web-app/src/routes/settings/shortcuts.tsx
+++ b/web-app/src/routes/settings/shortcuts.tsx
@@ -1,11 +1,12 @@
import { createFileRoute } from '@tanstack/react-router'
import { route } from '@/constants/routes'
import SettingsMenu from '@/containers/SettingsMenu'
-import HeaderPage from '@/containers/HeaderPage'
import { Card, CardItem } from '@/containers/Card'
import { useTranslation } from '@/i18n/react-i18next-compat'
import { ShortcutAction, PlatformShortcuts, type ShortcutSpec } from '@/lib/shortcuts'
import { PlatformMetaKey } from '@/containers/PlatformMetaKey'
+import { Kbd, KbdGroup } from '@/components/ui/kbd'
+import HeaderPage from '@/containers/HeaderPage'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const Route = createFileRoute(route.settings.shortcuts as any)({
@@ -24,11 +25,9 @@ function ShortcutLabel({ action, className = '' }: ShortcutLabelProps) {
const spec = PlatformShortcuts[action]
return (
- <div className={`flex items-center justify-center px-3 py-1 bg-main-view-fg/5 rounded-md ${className}`}>
- <span className="font-medium">
- <ShortcutKeys spec={spec} />
- </span>
- </div>
+ <KbdGroup className={className}>
+ <ShortcutKeys spec={spec} />
+ </KbdGroup>
)
}
@@ -50,48 +49,40 @@ function ShortcutKeys({ spec }: { spec: ShortcutSpec }) {
// Add modifier keys
if (spec.usePlatformMetaKey) {
- parts.push(<PlatformMetaKey key="meta" />)
+ parts.push(<Kbd key="meta"><PlatformMetaKey /></Kbd>)
}
if (spec.ctrlKey) {
- parts.push('Ctrl')
+ parts.push(<Kbd key="ctrl">Ctrl</Kbd>)
}
if (spec.metaKey) {
- parts.push('⌘')
+ parts.push(<Kbd key="cmd">⌘</Kbd>)
}
if (spec.altKey) {
- parts.push('Alt')
+ parts.push(<Kbd key="alt">Alt</Kbd>)
}
if (spec.shiftKey) {
- parts.push('Shift')
+ parts.push(<Kbd key="shift">Shift</Kbd>)
}
// Add the main key with proper formatting
- parts.push(formatKey(spec.key))
+ parts.push(<Kbd key="main">{formatKey(spec.key)}</Kbd>)
- // Join with spaces
- return (
- <>
- {parts.map((part, index) => (
- <span key={index}>
- {part}
- {index < parts.length - 1 && ' '}
- </span>
- ))}
- </>
- )
+ return <>{parts}</>
}
function Shortcuts() {
const { t } = useTranslation()
return (
- <div className="flex flex-col h-full">
+ <div className="flex flex-col h-svh w-full">
<HeaderPage>
- <h1 className="font-medium">{t('common:settings')}</h1>
+ <div className="flex items-center gap-2 w-full">
+ <span className='font-medium text-base font-studio'>{t('common:settings')}</span>
+ </div>
</HeaderPage>
- <div className="flex h-full w-full">
+ <div className="flex h-[calc(100%-60px)]">
<SettingsMenu />
- <div className="p-4 w-full h-[calc(100%-32px)] overflow-y-auto">
+ <div className="p-4 pt-0 w-full overflow-y-auto">
<div className="flex flex-col justify-between gap-4 gap-y-3 w-full">
{/* Application */}
<Card title={t('settings:shortcuts.application')}>
@@ -123,28 +114,30 @@ function Shortcuts() {
title={t('settings:shortcuts.sendMessage')}
description={t('settings:shortcuts.sendMessageDesc')}
actions={
- <div className="flex items-center justify-center px-3 py-1 bg-main-view-fg/5 rounded-md">
- <span className="font-medium">
- {t('settings:shortcuts.enter')}
- </span>
- </div>
+ <KbdGroup>
+ <Kbd>Enter</Kbd>
+ </KbdGroup>
}
/>
<CardItem
title={t('settings:shortcuts.newLine')}
description={t('settings:shortcuts.newLineDesc')}
actions={
- <div className="flex items-center justify-center px-3 py-1 bg-main-view-fg/5 rounded-md">
- <span className="font-medium">
- {t('settings:shortcuts.shiftEnter')}
- </span>
- </div>
+ <KbdGroup>
+ <Kbd>Shift</Kbd>
+ <Kbd>Enter</Kbd>
+ </KbdGroup>
}
/>
</Card>
{/* Navigation */}
<Card title={t('settings:shortcuts.navigation')}>
+ <CardItem
+ title={t('settings:shortcuts.search')}
+ description={t('settings:shortcuts.searchDesc')}
+ actions={<ShortcutLabel action={ShortcutAction.SEARCH} />}
+ />
<CardItem
title={t('settings:shortcuts.goToSettings')}
description={t('settings:shortcuts.goToSettingsDesc')}
diff --git a/web-app/src/routes/system-monitor.tsx b/web-app/src/routes/system-monitor.tsx
index 74669d1b4..00073155d 100644
--- a/web-app/src/routes/system-monitor.tsx
+++ b/web-app/src/routes/system-monitor.tsx
@@ -49,47 +49,47 @@ function SystemMonitorContent() {
toNumber(systemUsage.used_memory / hardwareData.total_memory) * 100
return (
- <div className="flex flex-col h-full bg-main-view overflow-y-auto p-6">
+ <div className="flex flex-col h-full bg-background overflow-y-auto p-6">
<div className="flex items-center mb-4 gap-2">
- <IconDeviceDesktopAnalytics className="text-main-view-fg/80 size-6" />
- <h1 className="text-xl font-bold text-main-view-fg">
+ <IconDeviceDesktopAnalytics className="text-muted-foreground/80 size-6" />
+ <h1 className="text-xl font-bold text-muted-foreground">
{t('system-monitor:title')}
</h1>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{/* CPU Usage Card */}
- <div className="bg-main-view-fg/2 rounded-lg p-6 shadow-sm">
- <h2 className="text-base font-semibold text-main-view-fg mb-4">
+ <div className="bg-secondary/50 rounded-lg p-6 shadow-sm">
+ <h2 className="text-base font-semibold mb-4">
{t('system-monitor:cpuUsage')}
</h2>
<div className="flex flex-col gap-2">
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:model')}
</span>
- <span className="text-main-view-fg">{hardwareData.cpu.name}</span>
+ <span className="text-foreground">{hardwareData.cpu.name}</span>
</div>
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:cores')}
</span>
- <span className="text-main-view-fg">
+ <span className="text-foreground">
{hardwareData.cpu.core_count}
</span>
</div>
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:architecture')}
</span>
- <span className="text-main-view-fg">{hardwareData.cpu.arch}</span>
+ <span className="text-foreground">{hardwareData.cpu.arch}</span>
</div>
<div className="mt-4">
<div className="flex justify-between items-center mb-2">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:currentUsage')}
</span>
- <span className="text-main-view-fg font-bold">
+ <span className="text-foreground font-bold">
{systemUsage.cpu.toFixed(2)}%
</span>
</div>
@@ -99,43 +99,43 @@ function SystemMonitorContent() {
</div>
{/* RAM Usage Card */}
- <div className="bg-main-view-fg/2 rounded-lg p-6 shadow-sm">
- <h2 className="text-base font-semibold text-main-view-fg mb-4">
+ <div className="bg-secondary/50 rounded-lg p-6 shadow-sm">
+ <h2 className="text-base font-semibold mb-4">
{t('system-monitor:memoryUsage')}
</h2>
<div className="flex flex-col gap-2">
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:totalRam')}
</span>
- <span className="text-main-view-fg">
+ <span className="text-foreground">
{formatMegaBytes(hardwareData.total_memory)}
</span>
</div>
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:availableRam')}
</span>
- <span className="text-main-view-fg">
+ <span className="text-foreground">
{formatMegaBytes(
hardwareData.total_memory - systemUsage.used_memory
)}
</span>
</div>
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:usedRam')}
</span>
- <span className="text-main-view-fg">
+ <span className="text-foreground">
{formatMegaBytes(systemUsage.used_memory)}
</span>
</div>
<div className="mt-4">
<div className="flex justify-between items-center mb-2">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{t('system-monitor:currentUsage')}
</span>
- <span className="text-main-view-fg font-bold">
+ <span className="text-foreground font-bold">
{ramUsagePercentage.toFixed(2)}%
</span>
</div>
@@ -146,8 +146,8 @@ function SystemMonitorContent() {
{/* GPU Usage Card */}
{!IS_MACOS && (
- <div className="bg-main-view-fg/2 rounded-lg p-6 shadow-sm">
- <h2 className="text-base font-semibold text-main-view-fg mb-4">
+ <div className="bg-secondary/50 rounded-lg p-6 shadow-sm">
+ <h2 className="text-base font-semibold mb-4">
{t('system-monitor:activeGpus')}
</h2>
<div className="flex flex-col gap-2">
@@ -155,7 +155,7 @@ function SystemMonitorContent() {
llamacppDevices.map((device) => (
<div key={device.id} className="flex flex-col gap-1">
<div className="flex justify-between items-center">
- <span className="text-main-view-fg/70">
+ <span className="text-muted-foreground">
{device.name}
</span>
<span
@@ -171,21 +171,21 @@ function SystemMonitorContent() {
</span>
</div>
<div className="flex justify-between items-center text-sm">
- <span className="text-main-view-fg/70">VRAM:</span>
- <span className="text-main-view-fg">
+ <span className="text-muted-foreground">VRAM:</span>
+ <span className="text-foreground">
{formatMegaBytes(device.mem)}
</span>
</div>
<div className="flex justify-between items-center text-sm">
- <span className="text-main-view-fg/70">Free:</span>
- <span className="text-main-view-fg">
+ <span className="text-muted-foreground">Free:</span>
+ <span className="text-foreground">
{formatMegaBytes(device.free)}
</span>
</div>
</div>
))
) : (
- <div className="text-main-view-fg/70 text-center py-4">
+ <div className="text-muted-foreground text-center py-4">
{t('system-monitor:noGpus')}
</div>
)}
diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsx
index 6acfb8167..804911d1f 100644
--- a/web-app/src/routes/threads/$threadId.tsx
+++ b/web-app/src/routes/threads/$threadId.tsx
@@ -10,10 +10,7 @@ import { MessageItem } from '@/containers/MessageItem'
import { useMessages } from '@/hooks/useMessages'
import { useServiceHub } from '@/hooks/useServiceHub'
-import DropdownAssistant from '@/containers/DropdownAssistant'
import { useAssistant } from '@/hooks/useAssistant'
-import { useInterfaceSettings } from '@/hooks/useInterfaceSettings'
-import { useSmallScreen, useMobileScreen } from '@/hooks/useMediaQuery'
import { useTools } from '@/hooks/useTools'
import { useAppState } from '@/hooks/useAppState'
import { SESSION_STORAGE_PREFIX } from '@/constants/chat'
@@ -24,7 +21,7 @@ import {
Conversation,
ConversationContent,
ConversationScrollButton,
-} from '@/ai-elements/conversation'
+} from '@/components/ai-elements/conversation'
import { generateId, lastAssistantMessageIsCompleteWithToolCalls } from 'ai'
import type { UIMessage } from '@ai-sdk/react'
import { useChatSessions } from '@/stores/chat-session-store'
@@ -47,6 +44,7 @@ import { OUT_OF_CONTEXT_SIZE } from '@/utils/error'
import { Button } from '@/components/ui/button'
import { IconAlertCircle } from '@tabler/icons-react'
import { useToolApproval } from '@/hooks/useToolApproval'
+import DropdownModelProvider from '@/containers/DropdownModelProvider'
const CHAT_STATUS = {
STREAMING: 'streaming',
@@ -71,9 +69,6 @@ function ThreadDetail() {
const deleteMessage = useMessages((state) => state.deleteMessage)
const currentThread = useRef<string | undefined>(undefined)
- const chatWidth = useInterfaceSettings((state) => state.chatWidth)
- const isSmallScreen = useSmallScreen()
- const isMobile = useMobileScreen()
useTools()
// Get attachments for this thread
@@ -700,9 +695,7 @@ function ThreadDetail() {
<div className="flex flex-col h-[calc(100dvh-(env(safe-area-inset-bottom)+env(safe-area-inset-top)))]">
<HeaderPage>
<div className="flex items-center justify-between w-full pr-2">
- <div>
- <DropdownAssistant />
- </div>
+ <DropdownModelProvider model={threadModel} />
</div>
</HeaderPage>
<div className="flex flex-1 flex-col h-full overflow-hidden">
@@ -711,10 +704,7 @@ function ThreadDetail() {
<Conversation className="absolute inset-0 text-start">
<ConversationContent
className={cn(
- 'mx-auto',
- isMobile || isSmallScreen || chatWidth !== 'compact'
- ? 'w-full'
- : 'w-full md:w-4/5'
+ 'mx-auto w-full md:w-4/5 xl:w-4/6',
)}
>
{chatMessages.map((message, index) => {
@@ -736,14 +726,14 @@ function ThreadDetail() {
})}
{status === CHAT_STATUS.SUBMITTED && <PromptProgress />}
{error && (
- <div className="px-4 py-3 mx-4 my-2 rounded-lg border border-destructive/50 bg-destructive/10">
+ <div className="px-4 py-3 mx-4 my-2 rounded-lg border border-destructive/10 bg-destructive/10">
<div className="flex items-start gap-3">
- <IconAlertCircle className="size-5 text-destructive flex-shrink-0 mt-0.5" />
+ <IconAlertCircle className="size-5 text-destructive shrink-0 mt-0.5" />
<div className="flex-1">
<p className="text-sm font-medium text-destructive mb-1">
Error generating response
</p>
- <p className="text-sm text-main-view-fg/70">
+ <p className="text-sm text-muted-foreground">
{error.message}
</p>
{(error.message.toLowerCase().includes('context') &&
@@ -771,14 +761,7 @@ function ThreadDetail() {
</div>
{/* Chat Input - Fixed at bottom */}
- <div
- className={cn(
- 'px-4 py-4 mx-auto w-full',
- isMobile || isSmallScreen || chatWidth !== 'compact'
- ? 'max-w-full'
- : 'w-full md:w-4/5'
- )}
- >
+ <div className="py-4 mx-auto w-full md:w-4/5 xl:w-4/6">
<ChatInput
model={threadModel}
onSubmit={handleSubmit}
diff --git a/web-app/src/styles/markdown.css b/web-app/src/styles/markdown.css
index 6f8914ef7..c63072081 100644
--- a/web-app/src/styles/markdown.css
+++ b/web-app/src/styles/markdown.css
@@ -117,14 +117,14 @@
/* Code */
code {
font-family: monospace;
- @apply bg-main-view-fg/6 text-main-view-fg;
+ @apply bg-secondary text-foreground;
padding: 0.2em 0.4em;
border-radius: 3px;
}
pre {
font-family: monospace;
- @apply bg-main-view-fg/6 text-main-view-fg px-0!;
+ @apply bg-secondary text-foreground px-0!;
overflow-x: auto;
/* border-radius: 8px; */
margin-bottom: 8px;
@@ -133,37 +133,10 @@
pre code {
background-color: transparent;
padding: 2px;
- @apply !text-sm;
+ @apply text-sm!;
display: inline-block;
}
- /* Tables */
- /* table {
- border-collapse: collapse;
- margin-bottom: 1em;
- border-spacing: 0;
- display: block;
- max-width: max-content;
- overflow-x: auto;
- font-variant: tabular-nums;
- }
-
- th {
- font-weight: 600;
- text-align: left;
- padding: 0.75em 1em;
- @apply border border-main-view-fg/20;
- }
-
- td {
- padding: 0.75em 1em;
- @apply border border-main-view-fg/20;
- }
-
- tr:nth-child(even) {
- @apply bg-main-view-fg/5;
- } */
-
/* Links */
a {
color: var(--color-primary);
@@ -204,7 +177,6 @@
hr {
border: 0;
height: 1px;
- @apply bg-main-view-fg/50;
opacity: 0.2;
margin: 2em 0;
}
diff --git a/web-app/src/types/haptic.d.ts b/web-app/src/types/haptic.d.ts
new file mode 100644
index 000000000..d5c1d86cd
--- /dev/null
+++ b/web-app/src/types/haptic.d.ts
@@ -0,0 +1,8 @@
+type HapticType =
+ | "heavy"
+ | "light"
+ | "pop"
+ | "soft"
+ | "double"
+ | "swoosh"
+ | "none";
diff --git a/web-app/src/ui/avatar.tsx b/web-app/src/ui/avatar.tsx
deleted file mode 100644
index 70b4c5c50..000000000
--- a/web-app/src/ui/avatar.tsx
+++ /dev/null
@@ -1,51 +0,0 @@
-import * as React from "react";
-import * as AvatarPrimitive from "@radix-ui/react-avatar";
-
-import { cn } from "../lib/utils";
-
-function Avatar({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Root>) {
- return (
- <AvatarPrimitive.Root
- data-slot="avatar"
- className={cn(
- "relative flex size-8 shrink-0 overflow-hidden rounded-full",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AvatarImage({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Image>) {
- return (
- <AvatarPrimitive.Image
- data-slot="avatar-image"
- className={cn("aspect-square size-full", className)}
- {...props}
- />
- );
-}
-
-function AvatarFallback({
- className,
- ...props
-}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
- return (
- <AvatarPrimitive.Fallback
- data-slot="avatar-fallback"
- className={cn(
- "bg-muted flex size-full items-center justify-center rounded-full",
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Avatar, AvatarImage, AvatarFallback };
diff --git a/web-app/src/ui/badge.tsx b/web-app/src/ui/badge.tsx
deleted file mode 100644
index e9a456d9c..000000000
--- a/web-app/src/ui/badge.tsx
+++ /dev/null
@@ -1,47 +0,0 @@
-/* eslint-disable react-refresh/only-export-components */
-import * as React from "react";
-import { Slot } from "@radix-ui/react-slot";
-import { cva, type VariantProps } from "class-variance-authority";
-
-import { cn } from "../lib/utils";
-
-const badgeVariants = cva(
- "inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
- {
- variants: {
- variant: {
- default:
- "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
- secondary:
- "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
- destructive:
- "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
- outline:
- "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- },
-);
-
-function Badge({
- className,
- variant,
- asChild = false,
- ...props
-}: React.ComponentProps<"span"> &
- VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
- const Comp = asChild ? Slot : "span";
-
- return (
- <Comp
- data-slot="badge"
- className={cn(badgeVariants({ variant }), className)}
- {...props}
- />
- );
-}
-
-export { Badge, badgeVariants };
diff --git a/web-app/src/ui/border-animate.tsx b/web-app/src/ui/border-animate.tsx
deleted file mode 100644
index 5259557ee..000000000
--- a/web-app/src/ui/border-animate.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
-import { useRef } from "react";
-import {
- motion,
- useAnimationFrame,
- useMotionTemplate,
- useMotionValue,
- useTransform,
-} from "motion/react";
-
-export const BorderAnimate = ({
- children,
- duration = 3000,
- rx,
- ry,
-}: {
- children: React.ReactNode;
- duration?: number;
- rx?: string;
- ry?: string;
- [key: string]: any;
-}) => {
- const pathRef = useRef<any>(null);
- const progress = useMotionValue<number>(0);
-
- useAnimationFrame((time) => {
- const length = pathRef.current?.getTotalLength();
- if (length) {
- const pxPerMillisecond = length / duration;
- progress.set((time * pxPerMillisecond) % length);
- }
- });
-
- const x = useTransform(
- progress,
- (val) => pathRef.current?.getPointAtLength(val).x,
- );
- const y = useTransform(
- progress,
- (val) => pathRef.current?.getPointAtLength(val).y,
- );
-
- const transform = useMotionTemplate`translateX(${x}px) translateY(${y}px) translateX(-50%) translateY(-50%)`;
-
- return (
- <>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- preserveAspectRatio="none"
- className="absolute h-full w-full"
- width="100%"
- height="100%"
- >
- <rect
- fill="none"
- width="100%"
- height="100%"
- rx={rx}
- ry={ry}
- ref={pathRef}
- />
- </svg>
- <motion.div
- style={{
- position: "absolute",
- top: 0,
- left: 0,
- display: "inline-block",
- transform,
- }}
- >
- {children}
- </motion.div>
- </>
- );
-};
diff --git a/web-app/src/ui/button.tsx b/web-app/src/ui/button.tsx
deleted file mode 100644
index 90d457964..000000000
--- a/web-app/src/ui/button.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-import * as React from "react";
-import { Slot } from "@radix-ui/react-slot";
-import { cva, type VariantProps } from "class-variance-authority";
-
-import { cn } from "../lib/utils";
-
-const buttonVariants = cva(
- "inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
- {
- variants: {
- variant: {
- default:
- "bg-primary text-primary-foreground ring-0 transition-[filter] duration-200 hover:brightness-110 active:brightness-95",
- destructive:
- "bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
- outline:
- "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
- secondary:
- "bg-secondary text-secondary-foreground hover:bg-secondary/80",
- ghost:
- "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
- link: "text-primary underline-offset-4 hover:underline",
- },
- size: {
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
- sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
- icon: "size-9",
- "icon-sm": "size-8",
- "icon-lg": "size-10",
- },
- },
- defaultVariants: {
- variant: "default",
- size: "default",
- },
- },
-);
-
-function Button({
- className,
- variant,
- size,
- asChild = false,
- ...props
-}: React.ComponentProps<"button"> &
- VariantProps<typeof buttonVariants> & {
- asChild?: boolean;
- }) {
- const Comp = asChild ? Slot : "button";
-
- return (
- <Comp
- data-slot="button"
- className={cn(buttonVariants({ variant, size, className }))}
- {...props}
- />
- );
-}
-
-// eslint-disable-next-line react-refresh/only-export-components
-export { Button, buttonVariants };
diff --git a/web-app/src/ui/card.tsx b/web-app/src/ui/card.tsx
deleted file mode 100644
index 1c5e0f12c..000000000
--- a/web-app/src/ui/card.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-import * as React from "react";
-
-import { cn } from "../lib/utils";
-
-function Card({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card"
- className={cn(
- "bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
- className,
- )}
- {...props}
- />
- );
-}
-
-function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-header"
- className={cn(
- "@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
- className,
- )}
- {...props}
- />
- );
-}
-
-function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-title"
- className={cn("leading-none font-semibold", className)}
- {...props}
- />
- );
-}
-
-function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- );
-}
-
-function CardAction({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-action"
- className={cn(
- "col-start-2 row-span-2 row-start-1 self-start justify-self-end",
- className,
- )}
- {...props}
- />
- );
-}
-
-function CardContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-content"
- className={cn("px-6", className)}
- {...props}
- />
- );
-}
-
-function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="card-footer"
- className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
- {...props}
- />
- );
-}
-
-export {
- Card,
- CardHeader,
- CardFooter,
- CardTitle,
- CardAction,
- CardDescription,
- CardContent,
-};
diff --git a/web-app/src/ui/command.tsx b/web-app/src/ui/command.tsx
deleted file mode 100644
index 7bf967efe..000000000
--- a/web-app/src/ui/command.tsx
+++ /dev/null
@@ -1,182 +0,0 @@
-import * as React from 'react'
-import { Command as CommandPrimitive } from 'cmdk'
-import { SearchIcon } from 'lucide-react'
-import { cn } from '../lib/utils'
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogHeader,
- DialogTitle,
-} from './dialog'
-
-function Command({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive>) {
- return (
- <CommandPrimitive
- data-slot="command"
- className={cn(
- 'bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md',
- className
- )}
- {...props}
- />
- )
-}
-
-function CommandDialog({
- title = 'Command Palette',
- description = 'Search for a command to run...',
- children,
- className,
- showCloseButton = true,
- ...props
-}: React.ComponentProps<typeof Dialog> & {
- title?: string
- description?: string
- className?: string
- showCloseButton?: boolean
-}) {
- return (
- <Dialog {...props}>
- <DialogHeader className="sr-only">
- <DialogTitle>{title}</DialogTitle>
- <DialogDescription>{description}</DialogDescription>
- </DialogHeader>
- <DialogContent
- onOpenAutoFocus={() => undefined}
- className={cn('overflow-hidden p-0', className)}
- showCloseButton={showCloseButton}
- >
- <Command className="**:[[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 **:[[cmdk-input]]:h-12 **:[[cmdk-item]]:px-2 **:[[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
- {children}
- </Command>
- </DialogContent>
- </Dialog>
- )
-}
-
-function CommandInput({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Input>) {
- return (
- <div
- data-slot="command-input-wrapper"
- className="flex h-9 items-center gap-2 border-b px-3"
- >
- <SearchIcon className="size-4 shrink-0 opacity-50" />
- <CommandPrimitive.Input
- data-slot="command-input"
- className={cn(
- 'placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
- className
- )}
- {...props}
- />
- </div>
- )
-}
-
-function CommandList({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.List>) {
- return (
- <CommandPrimitive.List
- data-slot="command-list"
- className={cn(
- 'max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto',
- className
- )}
- {...props}
- />
- )
-}
-
-function CommandEmpty({
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
- return (
- <CommandPrimitive.Empty
- data-slot="command-empty"
- className="py-6 text-center text-sm"
- {...props}
- />
- )
-}
-
-function CommandGroup({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Group>) {
- return (
- <CommandPrimitive.Group
- data-slot="command-group"
- className={cn(
- 'text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium',
- className
- )}
- {...props}
- />
- )
-}
-
-function CommandSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
- return (
- <CommandPrimitive.Separator
- data-slot="command-separator"
- className={cn('bg-border -mx-1 h-px', className)}
- {...props}
- />
- )
-}
-
-function CommandItem({
- className,
- ...props
-}: React.ComponentProps<typeof CommandPrimitive.Item>) {
- return (
- <CommandPrimitive.Item
- data-slot="command-item"
- className={cn(
- "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className
- )}
- {...props}
- />
- )
-}
-
-function CommandShortcut({
- className,
- ...props
-}: React.ComponentProps<'span'>) {
- return (
- <span
- data-slot="command-shortcut"
- className={cn(
- 'text-muted-foreground ml-auto text-xs tracking-widest',
- className
- )}
- {...props}
- />
- )
-}
-
-export {
- Command,
- CommandDialog,
- CommandInput,
- CommandList,
- CommandEmpty,
- CommandGroup,
- CommandItem,
- CommandShortcut,
- CommandSeparator,
-}
diff --git a/web-app/src/ui/dialog.tsx b/web-app/src/ui/dialog.tsx
deleted file mode 100644
index f960e2359..000000000
--- a/web-app/src/ui/dialog.tsx
+++ /dev/null
@@ -1,144 +0,0 @@
-import * as React from "react";
-import * as DialogPrimitive from "@radix-ui/react-dialog";
-import { XIcon } from "lucide-react";
-
-import { cn } from "../lib/utils";
-
-function Dialog({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Root>) {
- return <DialogPrimitive.Root data-slot="dialog" {...props} />;
-}
-
-function DialogTrigger({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
- return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
-}
-
-function DialogPortal({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Portal>) {
- return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
-}
-
-function DialogClose({
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Close>) {
- return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
-}
-
-function DialogOverlay({
- className,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
- return (
- <DialogPrimitive.Overlay
- data-slot="dialog-overlay"
- className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DialogContent({
- className,
- children,
- showCloseButton = true,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Content> & {
- showCloseButton?: boolean;
-}) {
- return (
- <DialogPortal data-slot="dialog-portal">
- <DialogOverlay />
- <DialogPrimitive.Content
- data-slot="dialog-content"
- className={cn(
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 max-w-full data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed md:top-[50%] left-[50%] bottom-0 md:bottom-auto translate-y-0 z-50 grid w-full translate-x-[-50%] md:translate-y-[-50%] gap-4 rounded-xl border p-6 shadow-lg duration-200 md:max-w-lg max-h-[calc(100vh-2rem)]",
- className,
- )}
- {...props}
- >
- {children}
- {showCloseButton && (
- <DialogPrimitive.Close
- data-slot="dialog-close"
- className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
- >
- <XIcon />
- <span className="sr-only">Close</span>
- </DialogPrimitive.Close>
- )}
- </DialogPrimitive.Content>
- </DialogPortal>
- );
-}
-
-function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="dialog-header"
- className={cn("flex flex-col gap-2 text-left", className)}
- {...props}
- />
- );
-}
-
-function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="dialog-footer"
- className={cn(
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DialogTitle({
- className,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Title>) {
- return (
- <DialogPrimitive.Title
- data-slot="dialog-title"
- className={cn(
- "text-base font-studio leading-none font-semibold",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DialogDescription({
- className,
- ...props
-}: React.ComponentProps<typeof DialogPrimitive.Description>) {
- return (
- <DialogPrimitive.Description
- data-slot="dialog-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- );
-}
-
-export {
- Dialog,
- DialogClose,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogOverlay,
- DialogPortal,
- DialogTitle,
- DialogTrigger,
-};
diff --git a/web-app/src/ui/drawer.tsx b/web-app/src/ui/drawer.tsx
deleted file mode 100644
index 4000a1ba1..000000000
--- a/web-app/src/ui/drawer.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-import * as React from "react";
-import { Drawer as DrawerPrimitive } from "vaul";
-
-import { cn } from "../lib/utils";
-
-function Drawer({
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
- return <DrawerPrimitive.Root data-slot="drawer" {...props} />;
-}
-
-function DrawerTrigger({
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
- return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />;
-}
-
-function DrawerPortal({
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
- return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />;
-}
-
-function DrawerClose({
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
- return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />;
-}
-
-function DrawerOverlay({
- className,
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
- return (
- <DrawerPrimitive.Overlay
- data-slot="drawer-overlay"
- className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DrawerContent({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
- return (
- <DrawerPortal data-slot="drawer-portal">
- <DrawerOverlay />
- <DrawerPrimitive.Content
- data-slot="drawer-content"
- className={cn(
- "group/drawer-content bg-background fixed z-50 flex h-auto flex-col",
- "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
- "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
- "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
- "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
- className,
- )}
- {...props}
- >
- <div className="bg-muted mx-auto mt-2 hidden h-2 w-[60px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
- {children}
- </DrawerPrimitive.Content>
- </DrawerPortal>
- );
-}
-
-function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="drawer-header"
- className={cn(
- "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="drawer-footer"
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
- {...props}
- />
- );
-}
-
-function DrawerTitle({
- className,
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
- return (
- <DrawerPrimitive.Title
- data-slot="drawer-title"
- className={cn("text-foreground font-semibold", className)}
- {...props}
- />
- );
-}
-
-function DrawerDescription({
- className,
- ...props
-}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
- return (
- <DrawerPrimitive.Description
- data-slot="drawer-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- );
-}
-
-export {
- Drawer,
- DrawerPortal,
- DrawerOverlay,
- DrawerTrigger,
- DrawerClose,
- DrawerContent,
- DrawerHeader,
- DrawerFooter,
- DrawerTitle,
- DrawerDescription,
-};
diff --git a/web-app/src/ui/dropdown-menu.tsx b/web-app/src/ui/dropdown-menu.tsx
deleted file mode 100644
index 43c4f8138..000000000
--- a/web-app/src/ui/dropdown-menu.tsx
+++ /dev/null
@@ -1,255 +0,0 @@
-import * as React from "react";
-import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
-import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
-
-import { cn } from "../lib/utils";
-
-function DropdownMenu({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
-}
-
-function DropdownMenuPortal({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
- return (
- <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
- );
-}
-
-function DropdownMenuTrigger({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
- return (
- <DropdownMenuPrimitive.Trigger
- data-slot="dropdown-menu-trigger"
- {...props}
- />
- );
-}
-
-function DropdownMenuContent({
- className,
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
- return (
- <DropdownMenuPrimitive.Portal>
- <DropdownMenuPrimitive.Content
- data-slot="dropdown-menu-content"
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",
- className,
- )}
- {...props}
- />
- </DropdownMenuPrimitive.Portal>
- );
-}
-
-function DropdownMenuGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
- return (
- <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
- );
-}
-
-function DropdownMenuItem({
- className,
- inset,
- variant = "default",
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
- inset?: boolean;
- variant?: "default" | "destructive";
-}) {
- return (
- <DropdownMenuPrimitive.Item
- data-slot="dropdown-menu-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive! [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DropdownMenuCheckboxItem({
- className,
- children,
- checked,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
- return (
- <DropdownMenuPrimitive.CheckboxItem
- data-slot="dropdown-menu-checkbox-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.CheckboxItem>
- );
-}
-
-function DropdownMenuRadioGroup({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
- return (
- <DropdownMenuPrimitive.RadioGroup
- data-slot="dropdown-menu-radio-group"
- {...props}
- />
- );
-}
-
-function DropdownMenuRadioItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
- return (
- <DropdownMenuPrimitive.RadioItem
- data-slot="dropdown-menu-radio-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
- <DropdownMenuPrimitive.ItemIndicator>
- <CircleIcon className="size-2 fill-current" />
- </DropdownMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </DropdownMenuPrimitive.RadioItem>
- );
-}
-
-function DropdownMenuLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
- inset?: boolean;
-}) {
- return (
- <DropdownMenuPrimitive.Label
- data-slot="dropdown-menu-label"
- data-inset={inset}
- className={cn(
- "px-2 py-1.5 text-sm font-medium data-inset:pl-8",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DropdownMenuSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
- return (
- <DropdownMenuPrimitive.Separator
- data-slot="dropdown-menu-separator"
- className={cn("bg-border -mx-1 my-1 h-px", className)}
- {...props}
- />
- );
-}
-
-function DropdownMenuShortcut({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="dropdown-menu-shortcut"
- className={cn(
- "text-muted-foreground ml-auto text-xs tracking-widest",
- className,
- )}
- {...props}
- />
- );
-}
-
-function DropdownMenuSub({
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
- return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
-}
-
-function DropdownMenuSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
- inset?: boolean;
-}) {
- return (
- <DropdownMenuPrimitive.SubTrigger
- data-slot="dropdown-menu-sub-trigger"
- data-inset={inset}
- className={cn(
- "focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-inset:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto size-4" />
- </DropdownMenuPrimitive.SubTrigger>
- );
-}
-
-function DropdownMenuSubContent({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
- return (
- <DropdownMenuPrimitive.SubContent
- data-slot="dropdown-menu-sub-content"
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- DropdownMenu,
- DropdownMenuPortal,
- DropdownMenuTrigger,
- DropdownMenuContent,
- DropdownMenuGroup,
- DropdownMenuLabel,
- DropdownMenuItem,
- DropdownMenuCheckboxItem,
- DropdownMenuRadioGroup,
- DropdownMenuRadioItem,
- DropdownMenuSeparator,
- DropdownMenuShortcut,
- DropdownMenuSub,
- DropdownMenuSubTrigger,
- DropdownMenuSubContent,
-};
diff --git a/web-app/src/ui/dropdrawer.tsx b/web-app/src/ui/dropdrawer.tsx
deleted file mode 100644
index 9659b634e..000000000
--- a/web-app/src/ui/dropdrawer.tsx
+++ /dev/null
@@ -1,971 +0,0 @@
-import { AnimatePresence, motion } from "framer-motion";
-import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
-import * as React from "react";
-
-import {
- Drawer,
- DrawerClose,
- DrawerContent,
- DrawerFooter,
- DrawerHeader,
- DrawerTitle,
- DrawerTrigger,
-} from "./drawer";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
- DropdownMenuTrigger,
-} from "./dropdown-menu";
-import { cn } from "../lib/utils";
-
-const DropDrawerContext = React.createContext<{ isMobile: boolean }>({
- isMobile: false,
-});
-
-const useDropDrawerContext = () => {
- const context = React.useContext(DropDrawerContext);
- if (!context) {
- throw new Error(
- "DropDrawer components cannot be rendered outside the DropDrawer Context",
- );
- }
- return context;
-};
-
-function DropDrawer({
- children,
- ...props
-}:
- | React.ComponentProps<typeof Drawer>
- | React.ComponentProps<typeof DropdownMenu>) {
- const DropdownComponent = DropdownMenu;
-
- return (
- <DropDrawerContext.Provider value={{ isMobile: false }}>
- <DropdownComponent
- data-slot="drop-drawer"
- {...props}
- >
- {children}
- </DropdownComponent>
- </DropDrawerContext.Provider>
- );
-}
-
-function DropDrawerTrigger({
- className,
- children,
- ...props
-}:
- | React.ComponentProps<typeof DrawerTrigger>
- | React.ComponentProps<typeof DropdownMenuTrigger>) {
- const { isMobile } = useDropDrawerContext();
- const TriggerComponent = isMobile ? DrawerTrigger : DropdownMenuTrigger;
-
- return (
- <TriggerComponent
- data-slot="drop-drawer-trigger"
- className={className}
- {...props}
- >
- {children}
- </TriggerComponent>
- );
-}
-
-function DropDrawerContent({
- className,
- children,
- ...props
-}:
- | React.ComponentProps<typeof DrawerContent>
- | React.ComponentProps<typeof DropdownMenuContent>) {
- const { isMobile } = useDropDrawerContext();
- const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null);
- const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null);
- const [submenuStack, setSubmenuStack] = React.useState<
- { id: string; title: string }[]
- >([]);
- // Add animation direction state
- const [animationDirection, setAnimationDirection] = React.useState<
- "forward" | "backward"
- >("forward");
-
- // Store submenu content by ID using state instead of ref
- const [submenuContentCache, setSubmenuContentCache] = React.useState<
- Map<string, React.ReactNode[]>
- >(new Map());
-
- // Function to navigate to a submenu
- const navigateToSubmenu = React.useCallback((id: string, title: string) => {
- // Set animation direction to forward when navigating to a submenu
- setAnimationDirection("forward");
- setActiveSubmenu(id);
- setSubmenuTitle(title);
- setSubmenuStack((prev) => [...prev, { id, title }]);
- }, []);
-
- // Function to go back to previous menu
- const goBack = React.useCallback(() => {
- // Set animation direction to backward when going back
- setAnimationDirection("backward");
-
- if (submenuStack.length <= 1) {
- // If we're at the first level, go back to main menu
- setActiveSubmenu(null);
- setSubmenuTitle(null);
- setSubmenuStack([]);
- } else {
- // Go back to previous submenu
- const newStack = [...submenuStack];
- newStack.pop(); // Remove current
- const previous = newStack[newStack.length - 1];
- setActiveSubmenu(previous.id);
- setSubmenuTitle(previous.title);
- setSubmenuStack(newStack);
- }
- }, [submenuStack]);
-
- // Function to register submenu content
- const registerSubmenuContent = React.useCallback(
- (id: string, content: React.ReactNode[]) => {
- setSubmenuContentCache((prev) => {
- const newCache = new Map(prev);
- newCache.set(id, content);
- return newCache;
- });
- },
- [],
- );
-
- // Function to extract submenu content
- const extractSubmenuContent = React.useCallback(
- (elements: React.ReactNode, targetId: string): React.ReactNode[] => {
- const result: React.ReactNode[] = [];
-
- // Recursive function to search through all children
- const findSubmenuContent = (node: React.ReactNode) => {
- // Skip if not a valid element
- if (!React.isValidElement(node)) return;
-
- const element = node as React.ReactElement;
- // Use a more specific type to avoid 'any'
- const props = element.props as {
- id?: string;
- "data-submenu-id"?: string;
- children?: React.ReactNode;
- };
-
- // Check if this is a DropDrawerSub
- if (element.type === DropDrawerSub) {
- // Get all possible ID values
- const elementId = props.id;
- const dataSubmenuId = props["data-submenu-id"];
-
- // If this is the submenu we're looking for
- if (elementId === targetId || dataSubmenuId === targetId) {
- // Find the SubContent within this Sub
- if (props.children) {
- React.Children.forEach(props.children, (child) => {
- if (
- React.isValidElement(child) &&
- child.type === DropDrawerSubContent
- ) {
- // Add all children of the SubContent to the result
- const subContentProps = child.props as {
- children?: React.ReactNode;
- };
- if (subContentProps.children) {
- React.Children.forEach(
- subContentProps.children,
- (contentChild) => {
- result.push(contentChild);
- },
- );
- }
- }
- });
- }
- return; // Found what we needed, no need to search deeper
- }
- }
-
- // If this element has children, search through them
- if (props.children) {
- if (Array.isArray(props.children)) {
- props.children.forEach((child: React.ReactNode) =>
- findSubmenuContent(child),
- );
- } else {
- findSubmenuContent(props.children);
- }
- }
- };
-
- // Start the search from the root elements
- if (Array.isArray(elements)) {
- elements.forEach((child) => findSubmenuContent(child));
- } else {
- findSubmenuContent(elements);
- }
-
- return result;
- },
- [],
- );
-
- // Get submenu content (either from cache or extract it)
- const getSubmenuContent = React.useCallback(
- (id: string) => {
- // Check if we have the content in our cache
- const cachedContent = submenuContentCache.get(id || "");
- if (cachedContent && cachedContent.length > 0) {
- return cachedContent;
- }
-
- // If not in cache, extract it
- const submenuContent = extractSubmenuContent(children, id);
-
- if (submenuContent.length === 0) {
- return [];
- }
-
- // Store in cache for future use
- if (id) {
- setSubmenuContentCache((prev) => {
- const newCache = new Map(prev);
- newCache.set(id, submenuContent);
- return newCache;
- });
- }
-
- return submenuContent;
- },
- [children, extractSubmenuContent, submenuContentCache],
- );
-
- // Animation variants for Framer Motion
- const variants = {
- enter: (direction: "forward" | "backward") => ({
- x: direction === "forward" ? "100%" : "-100%",
- opacity: 0,
- }),
- center: {
- x: 0,
- opacity: 1,
- },
- exit: (direction: "forward" | "backward") => ({
- x: direction === "forward" ? "-100%" : "100%",
- opacity: 0,
- }),
- };
-
- if (isMobile) {
- return (
- <SubmenuContext.Provider
- value={{
- activeSubmenu,
- setActiveSubmenu: (id) => {
- if (id === null) {
- setActiveSubmenu(null);
- setSubmenuTitle(null);
- setSubmenuStack([]);
- }
- },
- submenuTitle,
- setSubmenuTitle,
- navigateToSubmenu,
- registerSubmenuContent,
- }}
- >
- <DrawerContent
- data-slot="drop-drawer-content"
- className={cn("max-h-[90vh]", className)}
- {...props}
- >
- {activeSubmenu ? (
- <>
- <DrawerHeader>
- <div className="flex items-center gap-2">
- <button
- onClick={goBack}
- className="hover:bg-muted/50 rounded-full p-1"
- >
- <ChevronLeftIcon className="size-5" />
- </button>
- <DrawerTitle>{submenuTitle || "Submenu"}</DrawerTitle>
- </div>
- </DrawerHeader>
- <div className="flex-1 relative overflow-y-auto max-h-[70vh]">
- {/* Use AnimatePresence to handle exit animations */}
- <AnimatePresence
- initial={false}
- mode="wait"
- custom={animationDirection}
- >
- <motion.div
- key={activeSubmenu || "main"}
- custom={animationDirection}
- variants={variants}
- initial="enter"
- animate="center"
- exit="exit"
- className="pb-6 space-y-1.5 w-full h-full"
- >
- {activeSubmenu
- ? getSubmenuContent(activeSubmenu)
- : children}
- </motion.div>
- </AnimatePresence>
- </div>
- </>
- ) : (
- <>
- <DrawerHeader className="sr-only">
- <DrawerTitle>Menu</DrawerTitle>
- </DrawerHeader>
- <div className="overflow-y-auto max-h-[70vh]">
- <AnimatePresence
- initial={false}
- mode="wait"
- custom={animationDirection}
- >
- <motion.div
- key="main-menu"
- custom={animationDirection}
- variants={variants}
- initial="enter"
- animate="center"
- exit="exit"
- className="pb-6 space-y-1.5 w-full"
- >
- {children}
- </motion.div>
- </AnimatePresence>
- </div>
- </>
- )}
- </DrawerContent>
- </SubmenuContext.Provider>
- );
- }
-
- return (
- <SubmenuContext.Provider
- value={{
- activeSubmenu,
- setActiveSubmenu,
- submenuTitle,
- setSubmenuTitle,
- registerSubmenuContent,
- }}
- >
- <DropdownMenuContent
- data-slot="drop-drawer-content"
- align="end"
- sideOffset={4}
- className={cn(
- "max-h-(--radix-dropdown-menu-content-available-height) min-w-[220px] overflow-y-auto",
- className,
- )}
- {...props}
- >
- {children}
- </DropdownMenuContent>
- </SubmenuContext.Provider>
- );
-}
-
-function DropDrawerItem({
- className,
- children,
- onSelect,
- onClick,
- icon,
- variant = "default",
- inset,
- disabled,
- ...props
-}: React.ComponentProps<typeof DropdownMenuItem> & {
- icon?: React.ReactNode;
-}) {
- const { isMobile } = useDropDrawerContext();
-
- // Define hooks outside of conditionals to follow React rules
- // Check if this item is inside a group by looking at parent elements
- const isInGroup = React.useCallback(
- (element: HTMLElement | null): boolean => {
- if (!element) return false;
-
- // Check if any parent has a data-drop-drawer-group attribute
- let parent = element.parentElement;
- while (parent) {
- if (parent.hasAttribute("data-drop-drawer-group")) {
- return true;
- }
- parent = parent.parentElement;
- }
- return false;
- },
- [],
- );
-
- // Create a ref to check if the item is in a group
- const itemRef = React.useRef<HTMLDivElement>(null);
- const [isInsideGroup, setIsInsideGroup] = React.useState(false);
-
- React.useEffect(() => {
- // Only run this effect in mobile mode
- if (!isMobile) return;
-
- // Use a short timeout to ensure the DOM is fully rendered
- const timer = setTimeout(() => {
- if (itemRef.current) {
- setIsInsideGroup(isInGroup(itemRef.current));
- }
- }, 0);
-
- return () => clearTimeout(timer);
- }, [isInGroup, isMobile]);
-
- if (isMobile) {
- const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
- if (disabled) return;
- if (onClick) onClick(e);
- if (onSelect) onSelect(e as unknown as Event);
- };
-
- // Only wrap in DrawerClose if it's not a submenu item
- const content = (
- <div
- ref={itemRef}
- data-slot="drop-drawer-item"
- data-variant={variant}
- data-inset={inset}
- data-disabled={disabled}
- className={cn(
- "flex cursor-pointer items-center justify-between px-4 py-2",
- // Only apply margin, background and rounded corners if not in a group
- !isInsideGroup && "mx-2 my-1.5 rounded-md",
- // For items in a group, don't add background but add more padding
- isInsideGroup && "bg-transparent py-4",
- inset && "pl-8",
- variant === "destructive" && "text-destructive dark:text-destructive",
- disabled && "pointer-events-none opacity-50",
- className,
- )}
- onClick={handleClick}
- aria-disabled={disabled}
- {...props}
- >
- <div className="flex items-center gap-2 size-full">{children}</div>
- {icon && <div className="shrink-0">{icon}</div>}
- </div>
- );
-
- // Check if this is inside a submenu
- const isInSubmenu =
- (props as Record<string, unknown>)["data-parent-submenu-id"] ||
- (props as Record<string, unknown>)["data-parent-submenu"];
-
- if (isInSubmenu) {
- return content;
- }
-
- return <DrawerClose asChild>{content}</DrawerClose>;
- }
-
- return (
- <DropdownMenuItem
- data-slot="drop-drawer-item"
- data-variant={variant}
- data-inset={inset}
- className={className}
- onSelect={onSelect}
- onClick={onClick as React.MouseEventHandler<HTMLDivElement>}
- variant={variant}
- inset={inset}
- disabled={disabled}
- {...props}
- >
- {icon ? (
- <div className="flex w-full items-center justify-between">
- {children}
- <div>{icon}</div>
- </div>
- ) : (
- children
- )}
- </DropdownMenuItem>
- );
-}
-
-function DropDrawerSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof DropdownMenuSeparator>) {
- const { isMobile } = useDropDrawerContext();
-
- // For mobile, render a simple divider
- if (isMobile) {
- return null;
- }
-
- // For desktop, use the standard dropdown separator
- return (
- <DropdownMenuSeparator
- data-slot="drop-drawer-separator"
- className={className}
- {...props}
- />
- );
-}
-
-function DropDrawerLabel({
- className,
- children,
- ...props
-}:
- | React.ComponentProps<typeof DropdownMenuLabel>
- | React.ComponentProps<typeof DrawerTitle>) {
- const { isMobile } = useDropDrawerContext();
-
- if (isMobile) {
- return (
- <DrawerHeader className="p-0">
- <DrawerTitle
- data-slot="drop-drawer-label"
- className={cn(
- "text-muted-foreground px-4 py-2 text-sm font-medium",
- className,
- )}
- {...props}
- >
- {children}
- </DrawerTitle>
- </DrawerHeader>
- );
- }
-
- return (
- <DropdownMenuLabel
- data-slot="drop-drawer-label"
- className={className}
- {...props}
- >
- {children}
- </DropdownMenuLabel>
- );
-}
-
-function DropDrawerFooter({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<"div">) {
- const { isMobile } = useDropDrawerContext();
-
- if (isMobile) {
- return (
- <DrawerFooter
- data-slot="drop-drawer-footer"
- className={cn("p-4", className)}
- {...props}
- >
- {children}
- </DrawerFooter>
- );
- }
-
- // No direct equivalent in DropdownMenu, so we'll just render a div
- return (
- <div
- data-slot="drop-drawer-footer"
- className={cn("p-2", className)}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-function DropDrawerGroup({
- className,
- children,
- ...props
-}: React.ComponentProps<"div"> & {
- children: React.ReactNode;
-}) {
- const { isMobile } = useDropDrawerContext();
-
- // Add separators between children on mobile
- const childrenWithSeparators = React.useMemo(() => {
- if (!isMobile) return children;
-
- const childArray = React.Children.toArray(children);
-
- // Filter out any existing separators
- const filteredChildren = childArray.filter(
- (child) =>
- React.isValidElement(child) && child.type !== DropDrawerSeparator,
- );
-
- // Add separators between items
- return filteredChildren.flatMap((child, index) => {
- if (index === filteredChildren.length - 1) return [child];
- return [
- child,
- <div
- key={`separator-${index}`}
- className="bg-border h-px"
- aria-hidden="true"
- />,
- ];
- });
- }, [children, isMobile]);
-
- if (isMobile) {
- return (
- <div
- data-drop-drawer-group
- data-slot="drop-drawer-group"
- role="group"
- className={cn(
- "bg-accent dark:bg-accent mx-2 my-3 overflow-hidden rounded-xl",
- className,
- )}
- {...props}
- >
- {childrenWithSeparators}
- </div>
- );
- }
-
- // On desktop, use a div with proper role and attributes
- return (
- <div
- data-drop-drawer-group
- data-slot="drop-drawer-group"
- role="group"
- className={className}
- {...props}
- >
- {children}
- </div>
- );
-}
-
-// Context for managing submenu state on mobile
-interface SubmenuContextType {
- activeSubmenu: string | null;
- setActiveSubmenu: (id: string | null) => void;
- submenuTitle: string | null;
- setSubmenuTitle: (title: string | null) => void;
- navigateToSubmenu?: (id: string, title: string) => void;
- registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void;
-}
-
-const SubmenuContext = React.createContext<SubmenuContextType>({
- activeSubmenu: null,
- setActiveSubmenu: () => {},
- submenuTitle: null,
- setSubmenuTitle: () => {},
- navigateToSubmenu: undefined,
- registerSubmenuContent: undefined,
-});
-
-// Submenu components
-// Counter for generating simple numeric IDs
-let submenuIdCounter = 0;
-
-function DropDrawerSub({
- children,
- id,
- ...props
-}: React.ComponentProps<typeof DropdownMenuSub> & {
- id?: string;
-}) {
- const { isMobile } = useDropDrawerContext();
- const { registerSubmenuContent } = React.useContext(SubmenuContext);
-
- // Generate a simple numeric ID instead of using React.useId()
- const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`);
- const submenuId = id || generatedId;
-
- // Extract submenu content to register with parent
- React.useEffect(() => {
- if (!registerSubmenuContent) return;
-
- // Find the SubContent within this Sub
- const contentItems: React.ReactNode[] = [];
- React.Children.forEach(children, (child) => {
- if (React.isValidElement(child) && child.type === DropDrawerSubContent) {
- // Add all children of the SubContent to the result
- React.Children.forEach(
- (child.props as { children?: React.ReactNode }).children,
- (contentChild) => {
- contentItems.push(contentChild);
- },
- );
- }
- });
-
- // Register the content with the parent
- if (contentItems.length > 0) {
- registerSubmenuContent(submenuId, contentItems);
- }
- }, [children, registerSubmenuContent, submenuId]);
-
- if (isMobile) {
- // For mobile, we'll use the context to manage submenu state
- // Process children to pass the submenu ID to the trigger and content
- const processedChildren = React.Children.map(children, (child) => {
- if (!React.isValidElement(child)) return child;
-
- if (child.type === DropDrawerSubTrigger) {
- return React.cloneElement(
- child as React.ReactElement,
- {
- ...(child.props as object),
- "data-parent-submenu-id": submenuId,
- "data-submenu-id": submenuId,
- // Use only data attributes, not custom props
- "data-parent-submenu": submenuId,
- } as React.HTMLAttributes<HTMLElement>,
- );
- }
-
- if (child.type === DropDrawerSubContent) {
- return React.cloneElement(
- child as React.ReactElement,
- {
- ...(child.props as object),
- "data-parent-submenu-id": submenuId,
- "data-submenu-id": submenuId,
- // Use only data attributes, not custom props
- "data-parent-submenu": submenuId,
- } as React.HTMLAttributes<HTMLElement>,
- );
- }
-
- return child;
- });
-
- return (
- <div
- data-slot="drop-drawer-sub"
- data-submenu-id={submenuId}
- id={submenuId}
- >
- {processedChildren}
- </div>
- );
- }
-
- // For desktop, pass the generated ID to the DropdownMenuSub
- return (
- <DropdownMenuSub
- data-slot="drop-drawer-sub"
- data-submenu-id={submenuId}
- // Don't pass id to DropdownMenuSub as it doesn't accept this prop
- {...props}
- >
- {children}
- </DropdownMenuSub>
- );
-}
-
-function DropDrawerSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {
- icon?: React.ReactNode;
-}) {
- const { isMobile } = useDropDrawerContext();
- const { navigateToSubmenu } = React.useContext(SubmenuContext);
-
- // Define hooks outside of conditionals to follow React rules
- // Check if this item is inside a group by looking at parent elements
- const isInGroup = React.useCallback(
- (element: HTMLElement | null): boolean => {
- if (!element) return false;
-
- // Check if any parent has a data-drop-drawer-group attribute
- let parent = element.parentElement;
- while (parent) {
- if (parent.hasAttribute("data-drop-drawer-group")) {
- return true;
- }
- parent = parent.parentElement;
- }
- return false;
- },
- [],
- );
-
- // Create a ref to check if the item is in a group
- const itemRef = React.useRef<HTMLDivElement>(null);
- const [isInsideGroup, setIsInsideGroup] = React.useState(false);
-
- React.useEffect(() => {
- // Only run this effect in mobile mode
- if (!isMobile) return;
-
- // Use a short timeout to ensure the DOM is fully rendered
- const timer = setTimeout(() => {
- if (itemRef.current) {
- setIsInsideGroup(isInGroup(itemRef.current));
- }
- }, 0);
-
- return () => clearTimeout(timer);
- }, [isInGroup, isMobile]);
-
- if (isMobile) {
- // Find the parent submenu ID
- const handleClick = (e: React.MouseEvent) => {
- e.preventDefault();
- e.stopPropagation();
-
- // Get the closest parent with data-submenu-id attribute
- const element = e.currentTarget as HTMLElement;
- let submenuId: string | null = null;
-
- // First check if the element itself has the data attribute
- if (element.closest("[data-submenu-id]")) {
- const closestElement = element.closest("[data-submenu-id]");
- const id = closestElement?.getAttribute("data-submenu-id");
- if (id) {
- submenuId = id;
- }
- }
-
- // If not found, try props
- if (!submenuId) {
- submenuId =
- ((props as Record<string, unknown>)[
- "data-parent-submenu-id"
- ] as string) ||
- ((props as Record<string, unknown>)["data-parent-submenu"] as string);
- }
-
- if (!submenuId) {
- return;
- }
-
- // Get the title
- const triggerElement = e.currentTarget as HTMLElement;
- const mobileTitle = triggerElement.getAttribute("data-mobile-title");
- const title =
- mobileTitle || (typeof children === "string" ? children : "Submenu");
-
- // Navigate to the submenu
- if (navigateToSubmenu) {
- navigateToSubmenu(submenuId, title);
- }
- };
-
- // Combine onClick handlers
- const combinedOnClick = (e: React.MouseEvent) => {
- // Call the original onClick if provided
- const typedProps = props as Record<string, unknown>;
- if (typedProps.onClick) {
- const originalOnClick =
- typedProps.onClick as React.MouseEventHandler<HTMLDivElement>;
- originalOnClick(e as React.MouseEvent<HTMLDivElement>);
- }
-
- // Call our navigation handler
- handleClick(e);
- };
-
- // Remove onClick from props to avoid duplicate handlers
- const { ...restProps } = props as Record<string, unknown>;
-
- // Don't wrap in DrawerClose for submenu triggers
- return (
- <div
- ref={itemRef}
- data-slot="drop-drawer-sub-trigger"
- data-inset={inset}
- className={cn(
- "flex cursor-pointer items-center justify-between px-4 py-4",
- // Only apply margin, background and rounded corners if not in a group
- !isInsideGroup && "mx-2 my-1.5 rounded-md",
- // For items in a group, don't add background but add more padding
- isInsideGroup && "bg-transparent py-4",
- inset && "pl-8",
- className,
- )}
- onClick={combinedOnClick}
- {...restProps}
- >
- <div className="flex items-center gap-2">{children}</div>
- <ChevronRightIcon className="size-5" />
- </div>
- );
- }
-
- return (
- <DropdownMenuSubTrigger
- data-slot="drop-drawer-sub-trigger"
- data-inset={inset}
- className={className}
- inset={inset}
- {...props}
- >
- {children}
- </DropdownMenuSubTrigger>
- );
-}
-
-function DropDrawerSubContent({
- className,
- sideOffset = 4,
- children,
- ...props
-}: React.ComponentProps<typeof DropdownMenuSubContent>) {
- const { isMobile } = useDropDrawerContext();
-
- if (isMobile) {
- // For mobile, we don't render the content directly
- // It will be rendered by the DropDrawerContent component when active
- return null;
- }
-
- return (
- <DropdownMenuSubContent
- data-slot="drop-drawer-sub-content"
- sideOffset={sideOffset}
- className={cn(
- "z-50 min-w-32 overflow-hidden rounded-md border p-1 shadow-lg",
- className,
- )}
- {...props}
- >
- {children}
- </DropdownMenuSubContent>
- );
-}
-
-export {
- DropDrawer,
- DropDrawerContent,
- DropDrawerFooter,
- DropDrawerGroup,
- DropDrawerItem,
- DropDrawerLabel,
- DropDrawerSeparator,
- DropDrawerSub,
- DropDrawerSubContent,
- DropDrawerSubTrigger,
- DropDrawerTrigger,
-};
diff --git a/web-app/src/ui/empty.tsx b/web-app/src/ui/empty.tsx
deleted file mode 100644
index a061adae3..000000000
--- a/web-app/src/ui/empty.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import { cva, type VariantProps } from "class-variance-authority";
-
-import { cn } from "../lib/utils";
-
-function Empty({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="empty"
- className={cn(
- "flex min-w-0 flex-1 flex-col items-center justify-center gap-6 rounded-lg border-dashed p-6 text-center text-balance md:p-12",
- className,
- )}
- {...props}
- />
- );
-}
-
-function EmptyHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="empty-header"
- className={cn(
- "flex max-w-sm flex-col items-center gap-2 text-center",
- className,
- )}
- {...props}
- />
- );
-}
-
-const emptyMediaVariants = cva(
- "flex shrink-0 items-center justify-center mb-2 [&_svg]:pointer-events-none [&_svg]:shrink-0",
- {
- variants: {
- variant: {
- default: "bg-transparent",
- icon: "bg-muted text-foreground flex size-10 shrink-0 items-center justify-center rounded-lg [&_svg:not([class*='size-'])]:size-6",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- },
-);
-
-function EmptyMedia({
- className,
- variant = "default",
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>) {
- return (
- <div
- data-slot="empty-icon"
- data-variant={variant}
- className={cn(emptyMediaVariants({ variant, className }))}
- {...props}
- />
- );
-}
-
-function EmptyTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="empty-title"
- className={cn("text-lg font-medium tracking-tight", className)}
- {...props}
- />
- );
-}
-
-function EmptyDescription({ className, ...props }: React.ComponentProps<"p">) {
- return (
- <div
- data-slot="empty-description"
- className={cn(
- "text-muted-foreground [&>a:hover]:text-primary text-sm/relaxed [&>a]:underline [&>a]:underline-offset-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function EmptyContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="empty-content"
- className={cn(
- "flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm text-balance",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Empty,
- EmptyHeader,
- EmptyTitle,
- EmptyDescription,
- EmptyContent,
- EmptyMedia,
-};
diff --git a/web-app/src/ui/field.tsx b/web-app/src/ui/field.tsx
deleted file mode 100644
index 7270c2660..000000000
--- a/web-app/src/ui/field.tsx
+++ /dev/null
@@ -1,246 +0,0 @@
-import { useMemo } from "react";
-import { cva, type VariantProps } from "class-variance-authority";
-
-import { cn } from "../lib/utils";
-import { Label } from "./label";
-import { Separator } from "./separator";
-
-function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
- return (
- <fieldset
- data-slot="field-set"
- className={cn(
- "flex flex-col gap-6",
- "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldLegend({
- className,
- variant = "legend",
- ...props
-}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
- return (
- <legend
- data-slot="field-legend"
- data-variant={variant}
- className={cn(
- "mb-3 font-medium",
- "data-[variant=legend]:text-base",
- "data-[variant=label]:text-sm",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="field-group"
- className={cn(
- "group/field-group @container/field-group flex w-full flex-col gap-4 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-const fieldVariants = cva(
- "group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
- {
- variants: {
- orientation: {
- vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
- horizontal: [
- "flex-row items-center",
- "[&>[data-slot=field-label]]:flex-auto",
- "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
- ],
- responsive: [
- "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
- "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
- "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
- ],
- },
- },
- defaultVariants: {
- orientation: "vertical",
- },
- },
-);
-
-function Field({
- className,
- orientation = "vertical",
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
- return (
- <div
- role="group"
- data-slot="field"
- data-orientation={orientation}
- className={cn(fieldVariants({ orientation }), className)}
- {...props}
- />
- );
-}
-
-function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="field-content"
- className={cn(
- "group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldLabel({
- className,
- ...props
-}: React.ComponentProps<typeof Label>) {
- return (
- <Label
- data-slot="field-label"
- className={cn(
- "group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
- "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-4",
- "has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="field-label"
- className={cn(
- "flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
- return (
- <p
- data-slot="field-description"
- className={cn(
- "text-muted-foreground text-sm leading-normal font-normal group-has-data-[orientation=horizontal]/field:text-balance",
- "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
- "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function FieldSeparator({
- children,
- className,
- ...props
-}: React.ComponentProps<"div"> & {
- children?: React.ReactNode;
-}) {
- return (
- <div
- data-slot="field-separator"
- data-content={!!children}
- className={cn(
- "relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
- className,
- )}
- {...props}
- >
- <Separator className="absolute inset-0 top-1/2" />
- {children && (
- <span
- className="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
- data-slot="field-separator-content"
- >
- {children}
- </span>
- )}
- </div>
- );
-}
-
-function FieldError({
- className,
- children,
- errors,
- ...props
-}: React.ComponentProps<"div"> & {
- errors?: Array<{ message?: string } | undefined>;
-}) {
- const content = useMemo(() => {
- if (children) {
- return children;
- }
-
- if (!errors?.length) {
- return null;
- }
-
- const uniqueErrors = [
- ...new Map(errors.map((error) => [error?.message, error])).values(),
- ];
-
- if (uniqueErrors?.length == 1) {
- return uniqueErrors[0]?.message;
- }
-
- return (
- <ul className="ml-4 flex list-disc flex-col gap-1">
- {uniqueErrors.map(
- (error, index) =>
- error?.message && <li key={index}>{error.message}</li>,
- )}
- </ul>
- );
- }, [children, errors]);
-
- if (!content) {
- return null;
- }
-
- return (
- <div
- role="alert"
- data-slot="field-error"
- className={cn("text-destructive text-sm font-normal", className)}
- {...props}
- >
- {content}
- </div>
- );
-}
-
-export {
- Field,
- FieldLabel,
- FieldDescription,
- FieldError,
- FieldGroup,
- FieldLegend,
- FieldSeparator,
- FieldSet,
- FieldContent,
- FieldTitle,
-};
diff --git a/web-app/src/ui/hover-card.tsx b/web-app/src/ui/hover-card.tsx
deleted file mode 100644
index 52346e229..000000000
--- a/web-app/src/ui/hover-card.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import * as React from "react";
-import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
-
-import { cn } from "../lib/utils";
-
-function HoverCard({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
-}
-
-function HoverCardTrigger({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
- return (
- <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
- );
-}
-
-function HoverCardContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
- return (
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
- <HoverCardPrimitive.Content
- data-slot="hover-card-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
- className,
- )}
- {...props}
- />
- </HoverCardPrimitive.Portal>
- );
-}
-
-export { HoverCard, HoverCardTrigger, HoverCardContent };
diff --git a/web-app/src/ui/input-group.tsx b/web-app/src/ui/input-group.tsx
deleted file mode 100644
index 203766201..000000000
--- a/web-app/src/ui/input-group.tsx
+++ /dev/null
@@ -1,168 +0,0 @@
-import * as React from "react";
-import { cva, type VariantProps } from "class-variance-authority";
-
-import { cn } from "../lib/utils";
-import { Button } from "./button";
-import { Input } from "./input";
-import { Textarea } from "./textarea";
-
-function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="input-group"
- role="group"
- className={cn(
- "group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none",
- "h-9 min-w-0 has-[>textarea]:h-auto",
-
- // Variants based on alignment.
- "has-[>[data-align=inline-start]]:[&>input]:pl-2",
- "has-[>[data-align=inline-end]]:[&>input]:pr-2",
- "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
- "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
-
- // Focus state.
- "has-[[data-slot=input-group-control]:focus-visible]:border-ring/60 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-0",
-
- // Error state.
- "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
-
- className,
- )}
- {...props}
- />
- );
-}
-
-const inputGroupAddonVariants = cva(
- "text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",
- {
- variants: {
- align: {
- "inline-start":
- "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
- "inline-end":
- "order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]",
- "block-start":
- "order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5",
- "block-end":
- "order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5",
- },
- },
- defaultVariants: {
- align: "inline-start",
- },
- },
-);
-
-function InputGroupAddon({
- className,
- align = "inline-start",
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
- return (
- <div
- role="group"
- data-slot="input-group-addon"
- data-align={align}
- className={cn(inputGroupAddonVariants({ align }), className)}
- onClick={(e) => {
- if ((e.target as HTMLElement).closest("button")) {
- return;
- }
- e.currentTarget.parentElement?.querySelector("input")?.focus();
- }}
- {...props}
- />
- );
-}
-
-const inputGroupButtonVariants = cva(
- "text-sm shadow-none flex gap-2 items-center",
- {
- variants: {
- size: {
- xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
- sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
- "icon-xs":
- "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
- "icon-sm": "size-8 p-0 has-[>svg]:p-0",
- },
- },
- defaultVariants: {
- size: "xs",
- },
- },
-);
-
-function InputGroupButton({
- className,
- type = "button",
- variant = "ghost",
- size = "xs",
- ...props
-}: Omit<React.ComponentProps<typeof Button>, "size"> &
- VariantProps<typeof inputGroupButtonVariants>) {
- return (
- <Button
- type={type}
- data-size={size}
- variant={variant}
- className={cn(inputGroupButtonVariants({ size }), className)}
- {...props}
- />
- );
-}
-
-function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
- return (
- <span
- className={cn(
- "text-muted-foreground flex items-center gap-2 text-sm [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function InputGroupInput({
- className,
- ...props
-}: React.ComponentProps<"input">) {
- return (
- <Input
- data-slot="input-group-control"
- className={cn(
- "flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:ring-0 dark:bg-transparent",
- className,
- )}
- {...props}
- />
- );
-}
-
-function InputGroupTextarea({
- className,
- ...props
-}: React.ComponentProps<"textarea">) {
- return (
- <Textarea
- data-slot="input-group-control"
- className={cn(
- "flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- InputGroup,
- InputGroupAddon,
- InputGroupButton,
- InputGroupText,
- InputGroupInput,
- InputGroupTextarea,
-};
diff --git a/web-app/src/ui/input.tsx b/web-app/src/ui/input.tsx
deleted file mode 100644
index 172301b5c..000000000
--- a/web-app/src/ui/input.tsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import * as React from "react";
-
-import { cn } from "../lib/utils";
-
-function Input({ className, type, ...props }: React.ComponentProps<"input">) {
- return (
- <input
- type={type}
- data-slot="input"
- className={cn(
- "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
- "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Input };
diff --git a/web-app/src/ui/label.tsx b/web-app/src/ui/label.tsx
deleted file mode 100644
index 630cd0bf5..000000000
--- a/web-app/src/ui/label.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import * as React from "react";
-import * as LabelPrimitive from "@radix-ui/react-label";
-
-import { cn } from "../lib/utils";
-
-function Label({
- className,
- ...props
-}: React.ComponentProps<typeof LabelPrimitive.Root>) {
- return (
- <LabelPrimitive.Root
- data-slot="label"
- className={cn(
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Label };
diff --git a/web-app/src/ui/popover.tsx b/web-app/src/ui/popover.tsx
deleted file mode 100644
index b977c0956..000000000
--- a/web-app/src/ui/popover.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import * as React from "react";
-import * as PopoverPrimitive from "@radix-ui/react-popover";
-
-import { cn } from "../lib/utils";
-
-function Popover({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
- return <PopoverPrimitive.Root data-slot="popover" {...props} />;
-}
-
-function PopoverTrigger({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
- return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
-}
-
-function PopoverContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
- return (
- <PopoverPrimitive.Portal>
- <PopoverPrimitive.Content
- data-slot="popover-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
- className,
- )}
- {...props}
- />
- </PopoverPrimitive.Portal>
- );
-}
-
-function PopoverAnchor({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
- return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
-}
-
-export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
diff --git a/web-app/src/ui/select.tsx b/web-app/src/ui/select.tsx
deleted file mode 100644
index 09b1179c2..000000000
--- a/web-app/src/ui/select.tsx
+++ /dev/null
@@ -1,185 +0,0 @@
-import * as React from "react";
-import * as SelectPrimitive from "@radix-ui/react-select";
-import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
-
-import { cn } from "../lib/utils";
-
-function Select({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Root>) {
- return <SelectPrimitive.Root data-slot="select" {...props} />;
-}
-
-function SelectGroup({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Group>) {
- return <SelectPrimitive.Group data-slot="select-group" {...props} />;
-}
-
-function SelectValue({
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Value>) {
- return <SelectPrimitive.Value data-slot="select-value" {...props} />;
-}
-
-function SelectTrigger({
- className,
- size = "default",
- children,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
- size?: "sm" | "default";
-}) {
- return (
- <SelectPrimitive.Trigger
- data-slot="select-trigger"
- data-size={size}
- className={cn(
- "border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- {children}
- <SelectPrimitive.Icon asChild>
- <ChevronDownIcon className="size-4 opacity-50" />
- </SelectPrimitive.Icon>
- </SelectPrimitive.Trigger>
- );
-}
-
-function SelectContent({
- className,
- children,
- position = "popper",
- align = "center",
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Content>) {
- return (
- <SelectPrimitive.Portal>
- <SelectPrimitive.Content
- data-slot="select-content"
- className={cn(
- "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
- position === "popper" &&
- "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
- className,
- )}
- position={position}
- align={align}
- {...props}
- >
- <SelectScrollUpButton />
- <SelectPrimitive.Viewport
- className={cn(
- "p-1",
- position === "popper" &&
- "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1",
- )}
- >
- {children}
- </SelectPrimitive.Viewport>
- <SelectScrollDownButton />
- </SelectPrimitive.Content>
- </SelectPrimitive.Portal>
- );
-}
-
-function SelectLabel({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Label>) {
- return (
- <SelectPrimitive.Label
- data-slot="select-label"
- className={cn("text-muted-foreground px-2 py-1.5 text-xs", className)}
- {...props}
- />
- );
-}
-
-function SelectItem({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Item>) {
- return (
- <SelectPrimitive.Item
- data-slot="select-item"
- className={cn(
- "focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
- className,
- )}
- {...props}
- >
- <span className="absolute right-2 flex size-3.5 items-center justify-center">
- <SelectPrimitive.ItemIndicator>
- <CheckIcon className="size-4" />
- </SelectPrimitive.ItemIndicator>
- </span>
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
- </SelectPrimitive.Item>
- );
-}
-
-function SelectSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.Separator>) {
- return (
- <SelectPrimitive.Separator
- data-slot="select-separator"
- className={cn("bg-border pointer-events-none -mx-1 my-1 h-px", className)}
- {...props}
- />
- );
-}
-
-function SelectScrollUpButton({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {
- return (
- <SelectPrimitive.ScrollUpButton
- data-slot="select-scroll-up-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className,
- )}
- {...props}
- >
- <ChevronUpIcon className="size-4" />
- </SelectPrimitive.ScrollUpButton>
- );
-}
-
-function SelectScrollDownButton({
- className,
- ...props
-}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {
- return (
- <SelectPrimitive.ScrollDownButton
- data-slot="select-scroll-down-button"
- className={cn(
- "flex cursor-default items-center justify-center py-1",
- className,
- )}
- {...props}
- >
- <ChevronDownIcon className="size-4" />
- </SelectPrimitive.ScrollDownButton>
- );
-}
-
-export {
- Select,
- SelectContent,
- SelectGroup,
- SelectItem,
- SelectLabel,
- SelectScrollDownButton,
- SelectScrollUpButton,
- SelectSeparator,
- SelectTrigger,
- SelectValue,
-};
diff --git a/web-app/src/ui/sheet.tsx b/web-app/src/ui/sheet.tsx
deleted file mode 100644
index ca8cc2e87..000000000
--- a/web-app/src/ui/sheet.tsx
+++ /dev/null
@@ -1,143 +0,0 @@
-import * as React from "react";
-import * as SheetPrimitive from "@radix-ui/react-dialog";
-import { XIcon } from "lucide-react";
-
-import { cn } from "../lib/utils";
-
-function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
- return <SheetPrimitive.Root data-slot="sheet" {...props} />;
-}
-
-function SheetTrigger({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
- return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />;
-}
-
-function SheetClose({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Close>) {
- return <SheetPrimitive.Close data-slot="sheet-close" {...props} />;
-}
-
-function SheetPortal({
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
- return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />;
-}
-
-function SheetOverlay({
- className,
- hideOverlayBackdrop,
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Overlay> & {
- hideOverlayBackdrop?: boolean;
-}) {
- return (
- <SheetPrimitive.Overlay
- data-slot="sheet-overlay"
- className={cn(
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
- hideOverlayBackdrop && "bg-transparent",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SheetContent({
- className,
- children,
- side = "right",
- hideOverlayBackdrop = false,
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Content> & {
- side?: "top" | "right" | "bottom" | "left";
- hideOverlayBackdrop?: boolean;
-}) {
- return (
- <SheetPortal>
- <SheetOverlay hideOverlayBackdrop={hideOverlayBackdrop} />
- <SheetPrimitive.Content
- data-slot="sheet-content"
- className={cn(
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
- side === "right" &&
- "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
- side === "left" &&
- "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
- side === "top" &&
- "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
- side === "bottom" &&
- "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
- className,
- )}
- {...props}
- >
- {children}
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
- <XIcon className="size-4" />
- <span className="sr-only">Close</span>
- </SheetPrimitive.Close>
- </SheetPrimitive.Content>
- </SheetPortal>
- );
-}
-
-function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sheet-header"
- className={cn("flex flex-col gap-1.5 p-4", className)}
- {...props}
- />
- );
-}
-
-function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sheet-footer"
- className={cn("mt-auto flex flex-col gap-2 p-4", className)}
- {...props}
- />
- );
-}
-
-function SheetTitle({
- className,
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Title>) {
- return (
- <SheetPrimitive.Title
- data-slot="sheet-title"
- className={cn("text-foreground font-semibold", className)}
- {...props}
- />
- );
-}
-
-function SheetDescription({
- className,
- ...props
-}: React.ComponentProps<typeof SheetPrimitive.Description>) {
- return (
- <SheetPrimitive.Description
- data-slot="sheet-description"
- className={cn("text-muted-foreground text-sm", className)}
- {...props}
- />
- );
-}
-
-export {
- Sheet,
- SheetTrigger,
- SheetClose,
- SheetContent,
- SheetHeader,
- SheetFooter,
- SheetTitle,
- SheetDescription,
-};
diff --git a/web-app/src/ui/skeleton.tsx b/web-app/src/ui/skeleton.tsx
deleted file mode 100644
index 6f53ff979..000000000
--- a/web-app/src/ui/skeleton.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { cn } from "../lib/utils";
-
-function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="skeleton"
- className={cn("bg-accent animate-pulse rounded-md", className)}
- {...props}
- />
- );
-}
-
-export { Skeleton };
diff --git a/web-app/src/ui/switch.tsx b/web-app/src/ui/switch.tsx
deleted file mode 100644
index 082d1cff0..000000000
--- a/web-app/src/ui/switch.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import * as React from "react";
-import * as SwitchPrimitive from "@radix-ui/react-switch";
-
-import { cn } from "../lib/utils";
-
-function Switch({
- className,
- ...props
-}: React.ComponentProps<typeof SwitchPrimitive.Root>) {
- return (
- <SwitchPrimitive.Root
- data-slot="switch"
- className={cn(
- "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-10 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
- className,
- )}
- {...props}
- >
- <SwitchPrimitive.Thumb
- data-slot="switch-thumb"
- className={cn(
- "bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%+6px)] data-[state=unchecked]:translate-x-0",
- )}
- />
- </SwitchPrimitive.Root>
- );
-}
-
-export { Switch };
diff --git a/web-app/src/ui/textarea.tsx b/web-app/src/ui/textarea.tsx
deleted file mode 100644
index a04a420b9..000000000
--- a/web-app/src/ui/textarea.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as React from "react";
-
-import { cn } from "../lib/utils";
-
-function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
- return (
- <textarea
- data-slot="textarea"
- className={cn(
- "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Textarea };
diff --git a/web-app/src/ui/tooltip.tsx b/web-app/src/ui/tooltip.tsx
deleted file mode 100644
index f41fd9bf6..000000000
--- a/web-app/src/ui/tooltip.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import * as React from "react";
-import * as TooltipPrimitive from "@radix-ui/react-tooltip";
-
-import { cn } from "../lib/utils";
-
-function TooltipProvider({
- delayDuration = 0,
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
- return (
- <TooltipPrimitive.Provider
- data-slot="tooltip-provider"
- delayDuration={delayDuration}
- {...props}
- />
- );
-}
-
-function Tooltip({
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Root>) {
- return (
- <TooltipProvider>
- <TooltipPrimitive.Root data-slot="tooltip" {...props} />
- </TooltipProvider>
- );
-}
-
-function TooltipTrigger({
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
-}
-
-function TooltipContent({
- className,
- sideOffset = 0,
- children,
- ...props
-}: React.ComponentProps<typeof TooltipPrimitive.Content>) {
- return (
- <TooltipPrimitive.Portal>
- <TooltipPrimitive.Content
- data-slot="tooltip-content"
- sideOffset={sideOffset}
- className={cn(
- "bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
- className,
- )}
- {...props}
- >
- {children}
- <TooltipPrimitive.Arrow className="bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]" />
- </TooltipPrimitive.Content>
- </TooltipPrimitive.Portal>
- );
-}
-
-export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };