π€― 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π style(home): fold the rail's sections into the main column when it collapses (#17885)
Arvin Xu624f50921a07
diff --git a/src/features/Home/EmptySuggestions.tsx b/src/features/Home/EmptySuggestions.tsxindex af288b3ee3a..38002858ab0 100644--- a/src/features/Home/EmptySuggestions.tsx+++ b/src/features/Home/EmptySuggestions.tsx@@ -53,7 +53,10 @@ const EmptySuggestions = memo<EmptySuggestionsProps>(({ onSelect }) => {const { t } = useTranslation('home');return (- <Flexbox gap={8}>+ // Inset from the column edge: the composer above and the list rows below+ // are both padded surfaces, so a flush-left block here reads as hanging+ // outside the page's own rhythm.+ <Flexbox gap={12} paddingBlock={8} paddingInline={12}><Flexbox gap={2}><Text className={homeType.sectionLabel}>{t('dashboard.empty.title')}</Text><Text className={homeType.supporting}>{t('dashboard.empty.subtitle')}</Text>diff --git a/src/features/Home/HomeModeContent.tsx b/src/features/Home/HomeModeContent.tsxindex 69617203292..72aa89656e0 100644--- a/src/features/Home/HomeModeContent.tsx+++ b/src/features/Home/HomeModeContent.tsx@@ -15,6 +15,7 @@ import HomeInbox from '@/features/HomeInbox';import { filterTopicsForInboxScope } from '@/features/HomeInbox/scopeTogglePlacement';import { splitBriefs } from '@/features/HomeInbox/splitBriefs';import { useHomeInboxTopics } from '@/features/HomeInbox/useHomeInboxTopics';+import Recommendations from '@/features/Recommendations';import WorkspaceLink from '@/features/Workspace/WorkspaceLink';import { useClientDataSWR } from '@/libs/swr';import { recentKeys } from '@/libs/swr/keys';@@ -77,6 +78,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({}));interface HomeModeContentProps {+ /**+ * The rail is folded away, so this column carries the sections it owns: what+ * is in flight and what happened stay above the recent topics, and the+ * suggestions β nothing that happened, only what you could do β land after.+ */+ inlineRail?: boolean;mode: HomeMode;onSuggestionSelect: (prompt: string) => void;}@@ -243,7 +250,7 @@ const TaskContent = memo(() => {);});-const HomeModeContent = memo<HomeModeContentProps>(({ mode, onSuggestionSelect }) => {+const HomeModeContent = memo<HomeModeContentProps>(({ inlineRail, mode, onSuggestionSelect }) => {const { t } = useTranslation('home');const isLogin = useUserStore(authSelectors.isLogin);const authLoaded = useUserStore(authSelectors.isLoaded);@@ -285,11 +292,26 @@ const HomeModeContent = memo<HomeModeContentProps>(({ mode, onSuggestionSelect }(briefsInit || Boolean(briefsSWR.error)),});- if (state === 'empty') return <EmptySuggestions onSelect={onSuggestionSelect} />;+ // The empty short-circuit predates the fold-in: with the rail open it only+ // skips the main column's own blocks, while news and suggestions live on in+ // the rail. Folded, it would swallow them too β news needs no activity to+ // exist. Mirror the expanded page instead: suggestions first, then whatever+ // folded in (both sections render null when there is nothing to carry).+ if (state === 'empty') {+ if (!inlineRail) return <EmptySuggestions onSelect={onSuggestionSelect} />;++ return (+ <Flexbox gap={32}>+ <EmptySuggestions onSelect={onSuggestionSelect} />+ <HomeInbox inlineRail variant={'main'} />+ <Recommendations variant={'main'} />+ </Flexbox>+ );+ }return (<Flexbox gap={32}>- <HomeInbox variant={'main'} />+ <HomeInbox inlineRail={inlineRail} variant={'main'} />{(state !== 'ready' || topicRecents.length > 0) && (<GroupBlock count={topicRecents.length || undefined} title={t('dashboard.chat.recents')}>{state === 'error' ? (@@ -305,6 +327,7 @@ const HomeModeContent = memo<HomeModeContentProps>(({ mode, onSuggestionSelect })}</GroupBlock>)}+ {inlineRail && <Recommendations variant={'main'} />}</Flexbox>);}@@ -312,7 +335,19 @@ const HomeModeContent = memo<HomeModeContentProps>(({ mode, onSuggestionSelect }if (!isLogin) return null;if (mode === 'task') {- return <TaskContent />;+ if (!inlineRail) return <TaskContent />;++ // The rail's sections sit beside task mode while it is open, so a folded+ // rail must not take them away here either: in flight and what happened+ // above the task list, suggestions after it. Unread and needs-you stay+ // hidden β task mode never surfaces them, folded or not.+ return (+ <Flexbox gap={32}>+ <HomeInbox hideNeedsYou hideUnread inlineRail variant={'main'} />+ <TaskContent />+ <Recommendations variant={'main'} />+ </Flexbox>+ );}return null;diff --git a/src/features/Home/index.tsx b/src/features/Home/index.tsxindex 4f906735a92..39a570114d3 100644--- a/src/features/Home/index.tsx+++ b/src/features/Home/index.tsx@@ -285,7 +285,11 @@ const Home = memo(() => {onModeChange={setMode}/></div>- <HomeModeContent mode={mode} onSuggestionSelect={handleSuggestionSelect} />+ <HomeModeContent+ inlineRail={railCollapsed && isLogin}+ mode={mode}+ onSuggestionSelect={handleSuggestionSelect}+ /></Flexbox>{isLogin && (diff --git a/src/features/HomeInbox/index.tsx b/src/features/HomeInbox/index.tsxindex f52a480f22f..e6dafeff2e3 100644--- a/src/features/HomeInbox/index.tsx+++ b/src/features/HomeInbox/index.tsx@@ -20,6 +20,7 @@ import InboxBriefCard from './InboxBriefCard';import MarkAllReadButton from './MarkAllReadButton';import NeedsYouRailCard from './NeedsYouRailCard';import NewsList from './NewsList';+import { ownsRailSections } from './railSectionPlacement';import RunningTasksCard from './RunningTasksCard';import { filterTopicsForInboxScope, resolveScopeToggleSection } from './scopeTogglePlacement';import { splitBriefs } from './splitBriefs';@@ -80,12 +81,19 @@ interface InboxSection {interface HomeInboxProps {hideNeedsYou?: boolean;hideUnread?: boolean;+ /**+ * Main column only: the rail is collapsed, so the sections it owns (running,+ * news) fold into this column instead of disappearing with it.+ */+ inlineRail?: boolean;variant?: 'default' | 'main' | 'rail';}-const HomeInbox = memo<HomeInboxProps>(({ hideNeedsYou, hideUnread, variant = 'default' }) => {+const HomeInbox = memo<HomeInboxProps>((props) => {+ const { hideNeedsYou, hideUnread, inlineRail, variant = 'default' } = props;const isRail = variant === 'rail';const isMain = variant === 'main';+ const showRailSections = ownsRailSections({ inlineRail, variant });const { t } = useTranslation('home');const isLogin = useUserStore(authSelectors.isLogin);const myId = useUserStore(userProfileSelectors.userId);@@ -259,7 +267,7 @@ const HomeInbox = memo<HomeInboxProps>(({ hideNeedsYou, hideUnread, variant = 'd}// No title: the card already says "3 tasks running" on its own head.- if (!isMain && runningTopics.length > 0)+ if (showRailSections && runningTopics.length > 0)sections.push({key: 'running',node: (@@ -272,7 +280,7 @@ const HomeInbox = memo<HomeInboxProps>(({ hideNeedsYou, hideUnread, variant = 'd),});- if (!isMain && news.length > 0)+ if (showRailSections && news.length > 0)sections.push({action: <MarkAllReadButton news={news} />,// Team view: News is still only mine (briefs are per-user), so say sodiff --git a/src/features/HomeInbox/railSectionPlacement.test.ts b/src/features/HomeInbox/railSectionPlacement.test.tsnew file mode 100644index 00000000000..8d4a2b4f338--- /dev/null+++ b/src/features/HomeInbox/railSectionPlacement.test.ts@@ -0,0 +1,23 @@+import { describe, expect, it } from 'vitest';++import { ownsRailSections } from './railSectionPlacement';++describe('ownsRailSections', () => {+ it('leaves running and news to the rail while it is open', () => {+ expect(ownsRailSections({ variant: 'main' })).toBe(false);+ expect(ownsRailSections({ inlineRail: false, variant: 'main' })).toBe(false);+ });++ it('hands them to the main column once the rail folds away', () => {+ expect(ownsRailSections({ inlineRail: true, variant: 'main' })).toBe(true);+ });++ it('keeps them in the rail itself, folded or not', () => {+ expect(ownsRailSections({ variant: 'rail' })).toBe(true);+ expect(ownsRailSections({ inlineRail: true, variant: 'rail' })).toBe(true);+ });++ it('keeps the single-column default carrying everything', () => {+ expect(ownsRailSections({ variant: 'default' })).toBe(true);+ });+});diff --git a/src/features/HomeInbox/railSectionPlacement.ts b/src/features/HomeInbox/railSectionPlacement.tsnew file mode 100644index 00000000000..f6424baa2ed--- /dev/null+++ b/src/features/HomeInbox/railSectionPlacement.ts@@ -0,0 +1,15 @@+interface RailSectionPlacementInput {+ /** The rail is folded away, so the main column carries the sections it owns. */+ inlineRail?: boolean;+ variant: 'default' | 'main' | 'rail';+}++/**+ * Whether this column carries the sections the rail owns β running and news.+ *+ * They live in the rail while it is open; the main column takes them only once+ * it folds away, which is the difference between "collapsed" and "gone": a+ * folded rail must not take what is in flight and what happened off the page.+ */+export const ownsRailSections = ({ inlineRail, variant }: RailSectionPlacementInput): boolean =>+ variant !== 'main' || Boolean(inlineRail);diff --git a/src/features/Recommendations/index.tsx b/src/features/Recommendations/index.tsxindex 3a8cedfa358..d2cc63e3f44 100644--- a/src/features/Recommendations/index.tsx+++ b/src/features/Recommendations/index.tsx@@ -9,6 +9,7 @@ import {type DailyBriefRecommendationsUIState,useDailyBriefRecommendationsUI,} from '@/business/client/useDailyBriefRecommendationsUI';+import GroupBlock from '@/features/Home/components/GroupBlock';import RailCard from '@/features/Home/components/RailCard';import { useEligibleActions } from './hooks/useEligibleActions';@@ -26,7 +27,7 @@ export const useRecommendationsVisible = (): boolean => {};interface RecommendationsProps {- variant?: 'default' | 'rail';+ variant?: 'default' | 'main' | 'rail';}const Recommendations = memo<RecommendationsProps>(({ variant = 'default' }) => {@@ -112,6 +113,15 @@ const Recommendations = memo<RecommendationsProps>(({ variant = 'default' }) =></RailCard>);+ // In the main column it is one section among the page's other headed blocks,+ // so it wears the same heading they do instead of its own subtitle line.+ if (variant === 'main')+ return (+ <GroupBlock action={refresh} title={t('recommendations.title')}>+ {body}+ </GroupBlock>+ );+return (<Flexbox gap={12}><Flexbox horizontal align={'center'} gap={8} justify={'space-between'}>