Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

💄 style(settings): keep the devices tab in the shared content column (#23061)

YuTengjingcc16101a52b3
diff --git a/locales/en-US/subscription.json b/locales/en-US/subscription.json
index 3e2073b1136..0e98b017e4f 100644
--- a/locales/en-US/subscription.json
+++ b/locales/en-US/subscription.json
@@ -151,7 +151,7 @@
"credits.budgetPage.allocate.title": "Shared allowances",
"credits.budgetPage.limit.desc": "Cap what each member and externally shared agents can use.",
"credits.budgetPage.limit.title": "Spending limits",
- "credits.costEstimateHint.desc": "Show a lightweight warning before sending when the estimated model cost reaches your threshold",
+ "credits.costEstimateHint.desc": "Before you send a message, warn above the chat input if its estimated model cost reaches this amount",
"credits.costEstimateHint.saveError": "Failed to save cost estimate alert settings",
"credits.costEstimateHint.saveSuccess": "Cost estimate alert settings saved",
"credits.costEstimateHint.threshold": "Warning threshold",
diff --git a/locales/zh-CN/subscription.json b/locales/zh-CN/subscription.json
index c8f83288c17..05242a73d00 100644
--- a/locales/zh-CN/subscription.json
+++ b/locales/zh-CN/subscription.json
@@ -151,7 +151,7 @@
"credits.budgetPage.allocate.title": "共享额度",
"credits.budgetPage.limit.desc": "限制每位成员和对外分享的智能体可使用的额度。",
"credits.budgetPage.limit.title": "消费上限",
- "credits.costEstimateHint.desc": "当估算的模型成本达到你的阈值时,发送前显示一个轻量级警告",
+ "credits.costEstimateHint.desc": "发送消息前,若预估模型成本达到该金额,会在对话输入框上方提醒你",
"credits.costEstimateHint.saveError": "无法保存成本估算警报设置",
"credits.costEstimateHint.saveSuccess": "成本估算警报设置已保存",
"credits.costEstimateHint.threshold": "警告阈值",
diff --git a/packages/locales/src/default/subscription.ts b/packages/locales/src/default/subscription.ts
index e60c732da5e..8726e142796 100644
--- a/packages/locales/src/default/subscription.ts
+++ b/packages/locales/src/default/subscription.ts
@@ -310,7 +310,7 @@ export default {
'Set an all-members rule first before adding an unlimited override for a single member.',
'credits.memberBudget.emptyTitle': 'No member limits yet',
'credits.costEstimateHint.desc':
- 'Show a lightweight warning before sending when the estimated model cost reaches your threshold',
+ 'Before you send a message, warn above the chat input if its estimated model cost reaches this amount',
'credits.costEstimateHint.saveError': 'Failed to save cost estimate alert settings',
'credits.costEstimateHint.saveSuccess': 'Cost estimate alert settings saved',
'credits.costEstimateHint.threshold': 'Warning threshold',
diff --git a/src/components/Skeleton/Settings/Frame.tsx b/src/components/Skeleton/Settings/Frame.tsx
index 52ee305ba46..9f497de852d 100644
--- a/src/components/Skeleton/Settings/Frame.tsx
+++ b/src/components/Skeleton/Settings/Frame.tsx
@@ -5,7 +5,7 @@ import type { ReactNode } from 'react';
import NavHeader from '@/features/NavHeader';
import SettingContainer from '@/features/Setting/SettingContainer';
-import { getSettingsContainerMaxWidth } from '@/features/Settings/features/ownFrameTabs';
+import { SETTINGS_CONTAINER_MAX_WIDTH } from '@/features/Settings/features/ownFrameTabs';
import { SettingsPageActionsRow } from '@/features/Settings/features/SettingsPageActions';
import { useSettingsTabTitle } from '@/features/Settings/features/tabTitles';
@@ -26,7 +26,7 @@ export const SettingsSkeletonHeader = ({ tab }: { tab: string }) => {
};
/**
- * Same header + padded container (1024px, or full width for `FULL_WIDTH_TABS`)
+ * Same header + padded 1024px container
* `SettingsContent` draws around a tab body, with the page-action placeholders
* in the same row at the top of the content column.
*/
@@ -42,7 +42,7 @@ export const SettingsSkeletonFrame = ({
<Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>
<SettingsSkeletonHeader tab={tab} />
<SettingContainer
- maxWidth={getSettingsContainerMaxWidth(tab)}
+ maxWidth={SETTINGS_CONTAINER_MAX_WIDTH}
paddingBlock={'24px 128px'}
paddingInline={24}
>
diff --git a/src/features/DeviceManager/DeviceGrid.tsx b/src/features/DeviceManager/DeviceGrid.tsx
index b65a4976928..2de9a004dae 100644
--- a/src/features/DeviceManager/DeviceGrid.tsx
+++ b/src/features/DeviceManager/DeviceGrid.tsx
@@ -2,9 +2,10 @@ import { createStaticStyles, cx } from '@lobehub/ui';
import type { ReactNode } from 'react';
const styles = createStaticStyles(({ css }) => ({
- // Cards carry their own frame, so the grid sits bare in its host. The page
- // is full width, so columns step by the host's own width — one on a phone,
- // then two, three and four — keeping every card at least ~270px wide.
+ // Cards carry their own frame, so the grid sits bare in its host. Columns
+ // step by the host's own width — one on a phone, then two, three and four —
+ // keeping every card at least ~270px wide. In the 1024px settings column the
+ // grid tops out at three; the four-column step serves wider hosts.
grid: css`
display: grid;
grid-template-columns: minmax(0, 1fr);
diff --git a/src/features/Settings/features/SettingsContent.tsx b/src/features/Settings/features/SettingsContent.tsx
index 72d45a2e538..75af051f31f 100644
--- a/src/features/Settings/features/SettingsContent.tsx
+++ b/src/features/Settings/features/SettingsContent.tsx
@@ -12,7 +12,7 @@ import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfi
import { ManageMemoryButton } from '../memory/features/ManageMemoryButton';
import { componentMap } from './componentMap';
-import { getSettingsContainerMaxWidth, OWN_FRAME_TABS } from './ownFrameTabs';
+import { OWN_FRAME_TABS, SETTINGS_CONTAINER_MAX_WIDTH } from './ownFrameTabs';
import { SettingsPageActionsContext, SettingsPageActionsRow } from './SettingsPageActions';
import { useSettingsTabTitle } from './tabTitles';
@@ -97,7 +97,7 @@ const SettingsContent = ({ mobile, activeTab }: SettingsContentProps) => {
</NavHeader>
<SettingsPageActionsContext value={pageActions}>
<SettingContainer
- maxWidth={getSettingsContainerMaxWidth(tabKey)}
+ maxWidth={SETTINGS_CONTAINER_MAX_WIDTH}
paddingBlock={'24px 128px'}
paddingInline={24}
>
diff --git a/src/features/Settings/features/ownFrameTabs.ts b/src/features/Settings/features/ownFrameTabs.ts
index 056b843e430..e4b577b3f18 100644
--- a/src/features/Settings/features/ownFrameTabs.ts
+++ b/src/features/Settings/features/ownFrameTabs.ts
@@ -12,8 +12,9 @@ export const OWN_FRAME_TABS = new Set<string>([
SettingsTabs.Skill,
]);
-/** In-frame tabs whose container spans the pane, e.g. a card grid that adds columns as it widens. */
-export const FULL_WIDTH_TABS = new Set<string>([SettingsTabs.Devices]);
-
-export const getSettingsContainerMaxWidth = (tab: string | undefined) =>
- tab && FULL_WIDTH_TABS.has(tab) ? '100%' : 1024;
+/**
+ * Width of the content column every in-frame tab shares, so switching tabs
+ * keeps the content edges in place. Card grids such as Devices fit their
+ * columns to this width instead of spanning the pane.
+ */
+export const SETTINGS_CONTAINER_MAX_WIDTH = 1024;
diff --git a/src/features/WorkspaceSetting/Layout.test.tsx b/src/features/WorkspaceSetting/Layout.test.tsx
index 095d42d3eca..f742f1c0553 100644
--- a/src/features/WorkspaceSetting/Layout.test.tsx
+++ b/src/features/WorkspaceSetting/Layout.test.tsx
@@ -92,9 +92,10 @@ describe('WorkspaceSettingsContentLayout', () => {
expect(html).toContain('<div>Page content</div></main>');
});
- it('spans the full pane on the devices tab and keeps the 1024 column elsewhere', () => {
- expect(renderLayout('devices')).toContain('<main data-max-width="100%">');
+ it('keeps the devices tab in the shared 1024 column and spans only the account list', () => {
+ expect(renderLayout('devices')).toContain('<main data-max-width="1024">');
expect(renderLayout('members')).toContain('<main data-max-width="1024">');
+ expect(renderLayout('subscription-accounts')).toContain('<main data-max-width="100%">');
});
it.each(['audit-log', 'advanced'])('keeps the %s tab on the content-only layout', (tab) => {
diff --git a/src/features/WorkspaceSetting/Layout.tsx b/src/features/WorkspaceSetting/Layout.tsx
index 7dc12510f9e..0cca9c438e1 100644
--- a/src/features/WorkspaceSetting/Layout.tsx
+++ b/src/features/WorkspaceSetting/Layout.tsx
@@ -45,14 +45,10 @@ const COMPACT_HEADER_TABS = new Set<string>([
]);
/**
- * Tabs whose content spans the full pane instead of the centered 1024 column —
- * card grids that add columns as the pane widens (Devices), and the
- * subscription account list, whose usage columns need the room.
+ * Tabs whose content spans the full pane instead of the centered 1024 column:
+ * the subscription account list, whose usage columns need the room.
*/
-const FULL_WIDTH_TABS = new Set<string>([
- WorkspaceSettingsTabs.Devices,
- WorkspaceSettingsTabs.SubscriptionAccounts,
-]);
+const FULL_WIDTH_TABS = new Set<string>([WorkspaceSettingsTabs.SubscriptionAccounts]);
const outletContainerStyle: CSSProperties = { overflow: 'hidden', position: 'relative' };