* Make thread screen as default screen * Blank state when user have not any model * Cleanup topbar thread screen * Improve style right panel * Add instructions right panel * Styling thread list history * Resolve conflict * Default title new thread * Fix trigger panel sidebar * Make default right panel false when no activethread * Fix CI test * chore: assistant instruction with system prompt * Fix title and blank state explore the hub * Claenup style thread screen and add buble message for assitant * Remove unused import * Styling more menus on thread list and right panel, and make max height textarea 400 pixel * Finished revamp ui thread * Finished system monitor UI * Style box running models * Make animate right panel more smooth * Add status arround textarea for starting model info * Temporary disable hide left panel * chore: system resource monitoring update * copy nits * chore: typo * Reverse icon chevron accordion * Move my models into setting page --------- Co-authored-by: Louis <louis@jan.ai> Co-authored-by: 0xSage <n@pragmatic.vc>
140 lines
4.0 KiB
TypeScript
140 lines
4.0 KiB
TypeScript
'use client'
|
|
|
|
import * as React from 'react'
|
|
import {
|
|
CaretSortIcon,
|
|
// CheckIcon,
|
|
ChevronDownIcon,
|
|
ChevronUpIcon,
|
|
} from '@radix-ui/react-icons'
|
|
|
|
import * as SelectPrimitive from '@radix-ui/react-select'
|
|
|
|
import { twMerge } from 'tailwind-merge'
|
|
|
|
const Select = SelectPrimitive.Root
|
|
|
|
const SelectGroup = SelectPrimitive.Group
|
|
|
|
const SelectValue = SelectPrimitive.Value
|
|
|
|
const SelectTrigger = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
|
>(({ className, children, ...props }, ref) => (
|
|
<SelectPrimitive.Trigger
|
|
ref={ref}
|
|
className={twMerge('select', className)}
|
|
{...props}
|
|
>
|
|
{children}
|
|
<SelectPrimitive.Icon asChild>
|
|
<CaretSortIcon className="select-caret" />
|
|
</SelectPrimitive.Icon>
|
|
</SelectPrimitive.Trigger>
|
|
))
|
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
|
|
|
const SelectScrollUpButton = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
|
>(({ className, ...props }, ref) => (
|
|
<SelectPrimitive.ScrollUpButton
|
|
ref={ref}
|
|
className={twMerge('select-scroll-up-button', className)}
|
|
{...props}
|
|
>
|
|
<ChevronUpIcon />
|
|
</SelectPrimitive.ScrollUpButton>
|
|
))
|
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
|
|
|
const SelectScrollDownButton = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
|
>(({ className, ...props }, ref) => (
|
|
<SelectPrimitive.ScrollDownButton
|
|
ref={ref}
|
|
className={twMerge('select-scroll-down-button', className)}
|
|
{...props}
|
|
>
|
|
<ChevronDownIcon />
|
|
</SelectPrimitive.ScrollDownButton>
|
|
))
|
|
SelectScrollDownButton.displayName =
|
|
SelectPrimitive.ScrollDownButton.displayName
|
|
|
|
const SelectContent = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.Content>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
|
>(({ className, children, position = 'popper', ...props }, ref) => (
|
|
<SelectPrimitive.Portal>
|
|
<SelectPrimitive.Content
|
|
ref={ref}
|
|
className={twMerge(
|
|
'select-content',
|
|
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}
|
|
{...props}
|
|
>
|
|
<SelectScrollUpButton />
|
|
<SelectPrimitive.Viewport
|
|
className={twMerge(
|
|
'select-trigger-viewport',
|
|
position === 'popper' && 'w-full'
|
|
)}
|
|
>
|
|
{children}
|
|
</SelectPrimitive.Viewport>
|
|
<SelectScrollDownButton />
|
|
</SelectPrimitive.Content>
|
|
</SelectPrimitive.Portal>
|
|
))
|
|
SelectContent.displayName = SelectPrimitive.Content.displayName
|
|
|
|
const SelectLabel = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.Label>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
|
>(({ className, ...props }, ref) => (
|
|
<SelectPrimitive.Label
|
|
ref={ref}
|
|
className={twMerge('select-label', className)}
|
|
{...props}
|
|
/>
|
|
))
|
|
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
|
|
|
const SelectItem = React.forwardRef<
|
|
React.ElementRef<typeof SelectPrimitive.Item>,
|
|
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
|
>(({ className, children, ...props }, ref) => (
|
|
<SelectPrimitive.Item
|
|
ref={ref}
|
|
className={twMerge('select-item', className)}
|
|
{...props}
|
|
>
|
|
{/* <span className="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
<SelectPrimitive.ItemIndicator>
|
|
<CheckIcon className="h-4 w-4" />
|
|
</SelectPrimitive.ItemIndicator>
|
|
</span> */}
|
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
|
</SelectPrimitive.Item>
|
|
))
|
|
SelectItem.displayName = SelectPrimitive.Item.displayName
|
|
|
|
export {
|
|
Select,
|
|
SelectGroup,
|
|
SelectValue,
|
|
SelectTrigger,
|
|
SelectContent,
|
|
SelectLabel,
|
|
SelectItem,
|
|
SelectScrollUpButton,
|
|
SelectScrollDownButton,
|
|
}
|