💄 style: adjust ControlsForm component to adapt to mobile phone display (#9013)

* 🐛 fix: adjust ControlsForm component to use responsive widths for descriptions

* 🐛 fix: update ControlsForm component for responsive description widths on narrow screens
This commit is contained in:
bbbugg
2025-09-01 09:56:23 +08:00
committed by GitHub
parent 4ccf4c341b
commit c6038c0670
@@ -1,6 +1,6 @@
import { Form } from '@lobehub/ui';
import type { FormItemProps } from '@lobehub/ui';
import { Form as AntdForm, Switch } from 'antd';
import { Form as AntdForm, Switch, Grid } from 'antd';
import isEqual from 'fast-deep-equal';
import Link from 'next/link';
import { memo } from 'react';
@@ -32,11 +32,21 @@ const ControlsForm = memo(() => {
const modelExtendParams = useAiInfraStore(aiModelSelectors.modelExtendParams(model, provider));
const screens = Grid.useBreakpoint();
const isNarrow = !screens.sm;
const descWide = { display: 'inline-block', width: 300 } as const;
const descNarrow = {
display: 'block',
maxWidth: '100%',
whiteSpace: 'normal',
} as const;
const items = [
{
children: <ContextCachingSwitch />,
desc: (
<span style={{ display: 'inline-block', width: 300 }}>
<span style={isNarrow ? descNarrow : descWide}>
<Trans i18nKey={'extendParams.disableContextCaching.desc'} ns={'chat'}>
90% 4
<Link
@@ -50,13 +60,14 @@ const ControlsForm = memo(() => {
</span>
),
label: t('extendParams.disableContextCaching.title'),
layout: isNarrow ? 'vertical' : 'horizontal',
minWidth: undefined,
name: 'disableContextCaching',
},
{
children: <Switch />,
desc: (
<span style={{ display: 'inline-block', width: 300 }}>
<span style={isNarrow ? descNarrow : descWide}>
<Trans i18nKey={'extendParams.enableReasoning.desc'} ns={'chat'}>
Claude Thinking
<Link
@@ -72,7 +83,7 @@ const ControlsForm = memo(() => {
</span>
),
label: t('extendParams.enableReasoning.title'),
layout: 'horizontal',
layout: isNarrow ? 'vertical' : 'horizontal',
minWidth: undefined,
name: 'enableReasoning',
},
@@ -132,14 +143,16 @@ const ControlsForm = memo(() => {
},
{
children: <Switch />,
desc: t('extendParams.urlContext.desc'),
desc: isNarrow ? (
<span style={descNarrow}>{t('extendParams.urlContext.desc')}</span>
) : (
t('extendParams.urlContext.desc')
),
label: t('extendParams.urlContext.title'),
layout: 'horizontal',
layout: isNarrow ? 'vertical' : 'horizontal',
minWidth: undefined,
name: 'urlContext',
style: {
width: 445,
},
style: isNarrow ? undefined : { width: 445 },
tag: 'urlContext',
},
{