Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ui/src/components/ActivityBar.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
25 changes: 0 additions & 25 deletions ui/src/components/NewsSidebar.tsx

This file was deleted.

1 change: 0 additions & 1 deletion ui/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ export const en = {
webhook: 'Webhook',
},
news: {
allNews: 'All News',
lookback1h: '1 hour',
lookback12h: '12 hours',
lookback24h: '24 hours',
Expand Down
1 change: 0 additions & 1 deletion ui/src/i18n/locales/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export const ja: Resources = {
webhook: 'Webhook',
},
news: {
allNews: 'すべてのニュース',
lookback1h: '1 時間',
lookback12h: '12 時間',
lookback24h: '24 時間',
Expand Down
1 change: 0 additions & 1 deletion ui/src/i18n/locales/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ export const zhHant: Resources = {
webhook: 'Webhook',
},
news: {
allNews: '所有新聞',
lookback1h: '1 小時',
lookback12h: '12 小時',
lookback24h: '24 小時',
Expand Down
1 change: 0 additions & 1 deletion ui/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ export const zh: Resources = {
webhook: 'Webhook',
},
news: {
allNews: '全部新闻',
lookback1h: '1 小时',
lookback12h: '12 小时',
lookback24h: '24 小时',
Expand Down
16 changes: 8 additions & 8 deletions ui/src/sections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -44,7 +43,12 @@ export interface SidebarSection {
Actions?: ComponentType
}

const SECTION_BY_KEY: Record<ActivitySection, SidebarSection> = {
/**
* 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<Record<ActivitySection, SidebarSection>> = {
// 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.
Expand Down Expand Up @@ -88,16 +92,12 @@ const SECTION_BY_KEY: Record<ActivitySection, SidebarSection> = {
titleKey: 'nav.item.automation',
Secondary: AutomationSidebar,
},
news: {
titleKey: 'nav.item.news',
Secondary: NewsSidebar,
},
}

/** Resolve the sidebar config for the currently selected ActivitySection. */
export function findSectionForActivity(
section: ActivitySection | null | undefined,
): SidebarSection | null {
if (!section) return null
return SECTION_BY_KEY[section]
return SECTION_BY_KEY[section] ?? null
}
Loading