mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
❇️ style(ModelSpecs): optimize for Long/Chinese name and mobile styling (#2731)
* style: hide nav toggle for mobile
* ❇️ style: optimize for Long/Chinese `modelSpec` name and mobile styling
This commit is contained in:
parent
fc9368e0e7
commit
4a5d06a774
4 changed files with 15 additions and 5 deletions
|
|
@ -2,14 +2,19 @@ import { Trigger } from '@radix-ui/react-popover';
|
||||||
import type { TModelSpec, TEndpointsConfig } from 'librechat-data-provider';
|
import type { TModelSpec, TEndpointsConfig } from 'librechat-data-provider';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
import SpecIcon from './SpecIcon';
|
import SpecIcon from './SpecIcon';
|
||||||
|
import { cn } from '~/utils';
|
||||||
|
|
||||||
export default function MenuButton({
|
export default function MenuButton({
|
||||||
selected,
|
selected,
|
||||||
|
className = '',
|
||||||
|
textClassName = '',
|
||||||
primaryText = '',
|
primaryText = '',
|
||||||
secondaryText = '',
|
secondaryText = '',
|
||||||
endpointsConfig,
|
endpointsConfig,
|
||||||
}: {
|
}: {
|
||||||
selected?: TModelSpec;
|
selected?: TModelSpec;
|
||||||
|
className?: string;
|
||||||
|
textClassName?: string;
|
||||||
primaryText?: string;
|
primaryText?: string;
|
||||||
secondaryText?: string;
|
secondaryText?: string;
|
||||||
endpointsConfig: TEndpointsConfig;
|
endpointsConfig: TEndpointsConfig;
|
||||||
|
|
@ -18,13 +23,16 @@ export default function MenuButton({
|
||||||
return (
|
return (
|
||||||
<Trigger asChild>
|
<Trigger asChild>
|
||||||
<div
|
<div
|
||||||
className="group flex cursor-pointer items-center gap-1 rounded-xl px-3 py-2 text-lg font-medium hover:bg-gray-50 radix-state-open:bg-gray-50 dark:hover:bg-gray-700 dark:radix-state-open:bg-gray-700"
|
className={cn(
|
||||||
|
'group flex cursor-pointer items-center gap-1 rounded-xl px-3 py-2 text-lg font-medium hover:bg-gray-50 radix-state-open:bg-gray-50 dark:hover:bg-gray-700 dark:radix-state-open:bg-gray-700',
|
||||||
|
className,
|
||||||
|
)}
|
||||||
// type="button"
|
// type="button"
|
||||||
>
|
>
|
||||||
{selected && selected.showIconInHeader && (
|
{selected && selected.showIconInHeader && (
|
||||||
<SpecIcon currentSpec={selected} endpointsConfig={endpointsConfig} />
|
<SpecIcon currentSpec={selected} endpointsConfig={endpointsConfig} />
|
||||||
)}
|
)}
|
||||||
<div>
|
<div className={textClassName}>
|
||||||
{!selected ? localize('com_ui_none_selected') : primaryText}{' '}
|
{!selected ? localize('com_ui_none_selected') : primaryText}{' '}
|
||||||
{!!secondaryText && <span className="text-token-text-secondary">{secondaryText}</span>}
|
{!!secondaryText && <span className="text-token-text-secondary">{secondaryText}</span>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ const MenuItem: FC<MenuItemProps> = ({
|
||||||
<div>
|
<div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
{showIconInMenu && <SpecIcon currentSpec={spec} endpointsConfig={endpointsConfig} />}
|
{showIconInMenu && <SpecIcon currentSpec={spec} endpointsConfig={endpointsConfig} />}
|
||||||
<div>
|
<div className="break-all">
|
||||||
{title}
|
{title}
|
||||||
<div className="text-token-text-tertiary">{description}</div>
|
<div className="text-token-text-tertiary">{description}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,10 @@ export default function ModelSpecsMenu({ modelSpecs }: { modelSpecs: TModelSpec[
|
||||||
return (
|
return (
|
||||||
<Root>
|
<Root>
|
||||||
<MenuButton
|
<MenuButton
|
||||||
primaryText={selected?.label ?? ''}
|
|
||||||
selected={selected}
|
selected={selected}
|
||||||
|
className="min-h-11"
|
||||||
|
textClassName="block items-center justify-start text-xs md:text-base whitespace-nowrap max-w-64 overflow-hidden shrink-0 text-ellipsis"
|
||||||
|
primaryText={selected?.label ?? ''}
|
||||||
endpointsConfig={endpointsConfig}
|
endpointsConfig={endpointsConfig}
|
||||||
/>
|
/>
|
||||||
<Portal>
|
<Portal>
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ const Nav = ({ navVisible, setNavVisible }) => {
|
||||||
setIsHovering={setIsToggleHovering}
|
setIsHovering={setIsToggleHovering}
|
||||||
onToggle={toggleNavVisible}
|
onToggle={toggleNavVisible}
|
||||||
navVisible={navVisible}
|
navVisible={navVisible}
|
||||||
className="fixed left-0 top-1/2 z-40"
|
className="fixed left-0 top-1/2 z-40 hidden md:flex"
|
||||||
/>
|
/>
|
||||||
<div className={`nav-mask${navVisible ? ' active' : ''}`} onClick={toggleNavVisible} />
|
<div className={`nav-mask${navVisible ? ' active' : ''}`} onClick={toggleNavVisible} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue