diff --git a/ui/src/components/ActivityBar.tsx b/ui/src/components/ActivityBar.tsx index 0db49cb0..c65d9b97 100644 --- a/ui/src/components/ActivityBar.tsx +++ b/ui/src/components/ActivityBar.tsx @@ -1,6 +1,7 @@ import { type LucideIcon, MessageSquare, Inbox, Telescope, LineChart, GitBranch, BarChart3, Newspaper, Zap, Settings, Code2, TerminalSquare, ChevronDown, Info } from 'lucide-react' import { useState } from 'react' import { type Page } from '../App' +import { findSectionForActivity } from '../sections' import { useWorkspace } from '../tabs/store' import type { ActivitySection, ViewSpec } from '../tabs/types' import { useUnreadInboxCount } from '../live/inbox-read' @@ -233,9 +234,13 @@ export function ActivityBar({ open, onClose, onItemActivated }: ActivityBarProps const sec = activitySectionFor(item.page) const isActive = selectedSidebar === sec const Icon = item.icon + // Sidebar-less activity (no entry in SECTION_BY_KEY): + // pure navigation — clicking opens the default tab + // full-width; no collapse toggle, no secondary drawer. + const hasSidebar = findSectionForActivity(sec) != null const handleClick = () => { let landedOn: ActivitySection | null - if (selectedSidebar === sec) { + if (selectedSidebar === sec && hasSidebar) { // Same section re-clicked: toggle sidebar off. Don't // touch the focused tab — collapsing the sidebar // shouldn't change what's in the editor. @@ -248,7 +253,9 @@ export function ActivityBar({ open, onClose, onItemActivated }: ActivityBarProps // activities (Chat, Settings, Trading-as-Git, …) leave // tab focus alone — user picks from the sidebar. if (item.defaultTab) openOrFocus(item.defaultTab) - landedOn = sec + // Sidebar-less activities report null so mobile + // dismisses instead of opening the secondary drawer. + landedOn = hasSidebar ? sec : null } // Let parent decide the mobile transition (drill into // secondary drawer vs dismiss). Default: just close. diff --git a/ui/src/components/NewsSidebar.tsx b/ui/src/components/NewsSidebar.tsx deleted file mode 100644 index e2ac0754..00000000 --- a/ui/src/components/NewsSidebar.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { useTranslation } from 'react-i18next' -import { useWorkspace } from '../tabs/store' -import { getFocusedTab } from '../tabs/types' -import { SidebarRow } from './SidebarRow' - -/** - * News sidebar — phase-2 placeholder. Single "All News" item that opens - * the existing NewsPage. Phase 3+ adds source list, category filters, - * and saved articles, each opening filtered news tabs. - */ -export function NewsSidebar() { - const focusedKind = useWorkspace((state) => getFocusedTab(state)?.spec.kind ?? null) - const openOrFocus = useWorkspace((state) => state.openOrFocus) - const { t } = useTranslation() - - return ( -
- openOrFocus({ kind: 'news', params: {} })} - /> -
- ) -} diff --git a/ui/src/i18n/locales/en.ts b/ui/src/i18n/locales/en.ts index d04e620b..415f6a50 100644 --- a/ui/src/i18n/locales/en.ts +++ b/ui/src/i18n/locales/en.ts @@ -233,7 +233,6 @@ export const en = { webhook: 'Webhook', }, news: { - allNews: 'All News', lookback1h: '1 hour', lookback12h: '12 hours', lookback24h: '24 hours', diff --git a/ui/src/i18n/locales/ja.ts b/ui/src/i18n/locales/ja.ts index 771aaf78..fddc9a7a 100644 --- a/ui/src/i18n/locales/ja.ts +++ b/ui/src/i18n/locales/ja.ts @@ -222,7 +222,6 @@ export const ja: Resources = { webhook: 'Webhook', }, news: { - allNews: 'すべてのニュース', lookback1h: '1 時間', lookback12h: '12 時間', lookback24h: '24 時間', diff --git a/ui/src/i18n/locales/zh-Hant.ts b/ui/src/i18n/locales/zh-Hant.ts index 634f2c6f..d0f57d07 100644 --- a/ui/src/i18n/locales/zh-Hant.ts +++ b/ui/src/i18n/locales/zh-Hant.ts @@ -230,7 +230,6 @@ export const zhHant: Resources = { webhook: 'Webhook', }, news: { - allNews: '所有新聞', lookback1h: '1 小時', lookback12h: '12 小時', lookback24h: '24 小時', diff --git a/ui/src/i18n/locales/zh.ts b/ui/src/i18n/locales/zh.ts index 5964df51..8948fe3e 100644 --- a/ui/src/i18n/locales/zh.ts +++ b/ui/src/i18n/locales/zh.ts @@ -222,7 +222,6 @@ export const zh: Resources = { webhook: 'Webhook', }, news: { - allNews: '全部新闻', lookback1h: '1 小时', lookback12h: '12 小时', lookback24h: '24 小时', diff --git a/ui/src/sections.tsx b/ui/src/sections.tsx index e8b93a74..5c226af7 100644 --- a/ui/src/sections.tsx +++ b/ui/src/sections.tsx @@ -30,10 +30,9 @@ import { DevCategoryList } from './components/DevCategoryList' import { MarketSidebar } from './components/MarketSidebar' import { PortfolioSidebar } from './components/PortfolioSidebar' import { AutomationSidebar } from './components/AutomationSidebar' -import { NewsSidebar } from './components/NewsSidebar' import type { ActivitySection } from './tabs/types' -type NavTitleKey = 'nav.item.chat' | 'nav.item.inbox' | 'nav.item.tracked' | 'nav.item.workspaces' | 'nav.item.tradingAsGit' | 'nav.item.settings' | 'nav.item.dev' | 'nav.item.market' | 'nav.item.portfolio' | 'nav.item.automation' | 'nav.item.news' +type NavTitleKey = 'nav.item.chat' | 'nav.item.inbox' | 'nav.item.tracked' | 'nav.item.workspaces' | 'nav.item.tradingAsGit' | 'nav.item.settings' | 'nav.item.dev' | 'nav.item.market' | 'nav.item.portfolio' | 'nav.item.automation' export interface SidebarSection { /** Header title shown at the top of the sidebar. */ @@ -44,7 +43,12 @@ export interface SidebarSection { Actions?: ComponentType } -const SECTION_BY_KEY: Record = { +/** + * Activities WITHOUT an entry here are sidebar-less: clicking them in the + * ActivityBar opens their default tab full-width, no secondary column. + * (News is the first — its sidebar was a single-row placeholder.) + */ +const SECTION_BY_KEY: Partial> = { // Chat is the workspace-chat shortcut now — the "夺舍" of the Chat // shortcut by chat-template workspaces. Channel creation is no longer // an Action here; that affordance moved to traditional-chat. @@ -88,10 +92,6 @@ const SECTION_BY_KEY: Record = { titleKey: 'nav.item.automation', Secondary: AutomationSidebar, }, - news: { - titleKey: 'nav.item.news', - Secondary: NewsSidebar, - }, } /** Resolve the sidebar config for the currently selected ActivitySection. */ @@ -99,5 +99,5 @@ export function findSectionForActivity( section: ActivitySection | null | undefined, ): SidebarSection | null { if (!section) return null - return SECTION_BY_KEY[section] + return SECTION_BY_KEY[section] ?? null }