fix: use more appropriate html tag for 'ModelDropdown' trigger and 'Settings' button (#4841)
This commit is contained in:
parent
5d9dd92625
commit
bcc9f74607
@ -49,4 +49,4 @@ const Badge = ({ className, theme, size, variant, ...props }: BadgeProps) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Badge }
|
export { Badge, badgeVariants }
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import Image from 'next/image'
|
|||||||
|
|
||||||
import { EngineConfig, InferenceEngine } from '@janhq/core'
|
import { EngineConfig, InferenceEngine } from '@janhq/core'
|
||||||
import {
|
import {
|
||||||
Badge,
|
badgeVariants,
|
||||||
Button,
|
Button,
|
||||||
Input,
|
Input,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
@ -318,11 +318,13 @@ const ModelDropdown = ({
|
|||||||
>
|
>
|
||||||
<div className="flex [&>div]:w-full" ref={setToggle}>
|
<div className="flex [&>div]:w-full" ref={setToggle}>
|
||||||
{chatInputMode ? (
|
{chatInputMode ? (
|
||||||
<Badge
|
<button
|
||||||
data-testid="model-selector-badge"
|
data-testid="model-selector-badge"
|
||||||
theme="secondary"
|
|
||||||
variant={open ? 'solid' : 'outline'}
|
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
|
badgeVariants({
|
||||||
|
theme: 'secondary',
|
||||||
|
variant: open ? 'solid' : 'outline',
|
||||||
|
}),
|
||||||
'inline-block max-w-[200px] cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap',
|
'inline-block max-w-[200px] cursor-pointer overflow-hidden text-ellipsis whitespace-nowrap',
|
||||||
open && 'border border-transparent'
|
open && 'border border-transparent'
|
||||||
)}
|
)}
|
||||||
@ -335,7 +337,7 @@ const ModelDropdown = ({
|
|||||||
>
|
>
|
||||||
{selectedModel?.name || 'Select a model'}
|
{selectedModel?.name || 'Select a model'}
|
||||||
</span>
|
</span>
|
||||||
</Badge>
|
</button>
|
||||||
) : (
|
) : (
|
||||||
<Input
|
<Input
|
||||||
value={selectedModel?.name || ''}
|
value={selectedModel?.name || ''}
|
||||||
|
|||||||
@ -3,7 +3,13 @@ import { useEffect, useRef, useState } from 'react'
|
|||||||
|
|
||||||
import { InferenceEngine } from '@janhq/core'
|
import { InferenceEngine } from '@janhq/core'
|
||||||
|
|
||||||
import { TextArea, Button, Tooltip, useClickOutside, Badge } from '@janhq/joi'
|
import {
|
||||||
|
TextArea,
|
||||||
|
Button,
|
||||||
|
Tooltip,
|
||||||
|
useClickOutside,
|
||||||
|
badgeVariants,
|
||||||
|
} from '@janhq/joi'
|
||||||
import { useAtom, useAtomValue } from 'jotai'
|
import { useAtom, useAtomValue } from 'jotai'
|
||||||
import {
|
import {
|
||||||
FileTextIcon,
|
FileTextIcon,
|
||||||
@ -350,16 +356,17 @@ const ChatInput = () => {
|
|||||||
>
|
>
|
||||||
<div className="flex items-center gap-x-2">
|
<div className="flex items-center gap-x-2">
|
||||||
<ModelDropdown chatInputMode />
|
<ModelDropdown chatInputMode />
|
||||||
<Badge
|
<button
|
||||||
theme="secondary"
|
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
|
badgeVariants({
|
||||||
|
theme: 'secondary',
|
||||||
|
variant:
|
||||||
|
activeTabThreadRightPanel === 'model' ? 'solid' : 'outline',
|
||||||
|
}),
|
||||||
'flex cursor-pointer items-center gap-x-1',
|
'flex cursor-pointer items-center gap-x-1',
|
||||||
activeTabThreadRightPanel === 'model' &&
|
activeTabThreadRightPanel === 'model' &&
|
||||||
'border border-transparent'
|
'border border-transparent'
|
||||||
)}
|
)}
|
||||||
variant={
|
|
||||||
activeTabThreadRightPanel === 'model' ? 'solid' : 'outline'
|
|
||||||
}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
// TODO @faisal: should be refactor later and better experience beetwen tab and toggle button
|
// TODO @faisal: should be refactor later and better experience beetwen tab and toggle button
|
||||||
if (showRightPanel && activeTabThreadRightPanel !== 'model') {
|
if (showRightPanel && activeTabThreadRightPanel !== 'model') {
|
||||||
@ -384,7 +391,7 @@ const ChatInput = () => {
|
|||||||
size={16}
|
size={16}
|
||||||
className="flex-shrink-0 cursor-pointer text-[hsla(var(--text-secondary))]"
|
className="flex-shrink-0 cursor-pointer text-[hsla(var(--text-secondary))]"
|
||||||
/>
|
/>
|
||||||
</Badge>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{selectedModel && (
|
{selectedModel && (
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user