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.

✨ feat(home): restore agent switcher in minimal home layout (#17990)

Innei17bd46655597
diff --git a/package.json b/package.json
index 751ef816412..a2519adbcb9 100644
--- a/package.json
+++ b/package.json
@@ -496,7 +496,7 @@
"@types/ip": "^1.1.3",
"@types/json-schema": "^7.0.15",
"@types/keygrip": "^1.0.6",
- "@types/node": "^24.13.2",
+ "@types/node": "^24.13.3",
"@types/nodemailer": "^7.0.12",
"@types/numeral": "^2.0.5",
"@types/oidc-provider": "^9.5.0",
@@ -559,7 +559,7 @@
"stylelint": "^16.26.1",
"tsx": "^4.22.4",
"type-fest": "^5.7.0",
- "typescript": "^6.0.3",
+ "typescript": "6.0.3",
"unified": "^11.0.5",
"unist-util-visit": "^5.1.0",
"vite": "8.0.16",
diff --git a/src/features/Home/HomeHeader.tsx b/src/features/Home/HomeHeader.tsx
index b0088828f2d..5eac2cd6e07 100644
--- a/src/features/Home/HomeHeader.tsx
+++ b/src/features/Home/HomeHeader.tsx
@@ -1,5 +1,5 @@
import { Flexbox, Text } from '@lobehub/ui';
-import { createStaticStyles, cx } from 'antd-style';
+import { createStaticStyles } from 'antd-style';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,12 +26,6 @@ const styles = createStaticStyles(({ css }) => ({
line-height: 1.4;
letter-spacing: -0.01em;
`,
- // The measure is the layout's answer to the portrait, which the centered
- // block does not have β€” so the headline runs to the block's own width.
- greetingCentered: css`
- max-width: none;
- text-align: center;
- `,
toolbar: css`
width: 100%;
min-width: 0;
@@ -60,17 +54,19 @@ const HomeHeader = memo<HomeHeaderProps>(({ centered }) => {
: t(`dashboard.greeting.${greetingKey}Guest`);
return (
- <Flexbox gap={16} justify={'center'}>
- {!centered && (
+ // Minimal mode keeps the full layout's stacking order β€” the switcher names
+ // who speaks, the greeting answers below β€” but drops the toolbar chrome and
+ // its 48px lane, so the pair reads as one compact block flush with the
+ // composer. The layout's lift math (MINIMAL_LIFT) counts on these heights.
+ <Flexbox gap={centered ? 8 : 16} justify={'center'}>
+ {centered ? (
+ <AgentSelect />
+ ) : (
<Flexbox horizontal align={'center'} className={styles.toolbar} gap={16}>
<AgentSelect />
</Flexbox>
)}
- <Text
- as={'h1'}
- className={cx(styles.greeting, centered && styles.greetingCentered)}
- weight={600}
- >
+ <Text as={'h1'} className={styles.greeting} weight={600}>
{greeting}
</Text>
</Flexbox>
diff --git a/src/features/Home/index.tsx b/src/features/Home/index.tsx
index f552e646185..816098745c6 100644
--- a/src/features/Home/index.tsx
+++ b/src/features/Home/index.tsx
@@ -56,12 +56,17 @@ const GREETING_LANE = COLLAPSED_CONTENT_OFFSET * 2 + PORTRAIT_LANE + BUBBLE_MAX_
const BUBBLE_INLINE_MIN = 1080;
const MINIMAL_STACK_GAP = 24;
/**
- * The greeting's line box β€” 22px at a 1.4 line-height, from HomeHeader. Its
- * height plus the gap is what the block must shed below itself to land the
- * composer, not the pair's midpoint, on the center of the lane.
+ * The minimal header stacks the agent switcher (24px avatar + 2px paddings,
+ * from AgentSelect) over the greeting line (22px Γ— 1.4, from HomeHeader) with
+ * an 8px gap. That stack's height plus the gap below it is what the block must
+ * shed under itself to land the composer, not the stack's midpoint, on the
+ * center of the lane.
*/
const MINIMAL_GREETING_LINE = Math.round(22 * 1.4);
-const MINIMAL_LIFT = MINIMAL_GREETING_LINE + MINIMAL_STACK_GAP;
+const MINIMAL_SWITCHER_ROW = 28;
+const MINIMAL_HEADER_GAP = 8;
+const MINIMAL_HEADER_HEIGHT = MINIMAL_SWITCHER_ROW + MINIMAL_HEADER_GAP + MINIMAL_GREETING_LINE;
+const MINIMAL_LIFT = MINIMAL_HEADER_HEIGHT + MINIMAL_STACK_GAP;
const styles = createStaticStyles(({ css }) => ({
// Both rows size to their content and the page scrolls around the whole grid