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
2 changes: 1 addition & 1 deletion apps/api/src/services/notification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function getStub(env: NotificationEnv, userId: string): DurableObjectStub<Notifi
* when a sessionId is available.
*
* Returns a frontend-relative path consumed exclusively by the React app
* via `navigate(notification.actionUrl)` in NotificationCenter. MUST NOT
* via `navigate(notification.actionUrl)` in the inbox Updates list (`InboxUpdatesList`). MUST NOT
* be used for server-side redirects, web push click_action, or external
* integrations — those require absolute `https://app.${BASE_DOMAIN}/...` URLs.
*
Expand Down
14 changes: 9 additions & 5 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,8 @@ const ProjectCommentReader = lazyNamed(
const ProjectFiles = lazyNamed(() => import('./pages/ProjectFiles'), 'ProjectFiles');
const ProjectInvite = lazyNamed(() => import('./pages/ProjectInvite'), 'ProjectInvite');
const ProjectLibrary = lazyNamed(() => import('./pages/ProjectLibrary'), 'ProjectLibrary');
const ProjectNotifications = lazyNamed(
() => import('./pages/ProjectNotifications'),
'ProjectNotifications'
);
const Inbox = lazyNamed(() => import('./pages/inbox'), 'Inbox');
const ProjectInbox = lazyNamed(() => import('./pages/inbox'), 'ProjectInbox');
const ProjectProfiles = lazyNamed(() => import('./pages/ProjectProfiles'), 'ProjectProfiles');
const Projects = lazyNamed(() => import('./pages/Projects'), 'Projects');
const ProjectSettings = lazyNamed(loadProjectSettings, 'ProjectSettings');
Expand Down Expand Up @@ -305,6 +303,7 @@ export default function App() {
<Route element={<ProtectedLayout />}>
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/sam" element={page(<Sam />)} />
<Route path="/inbox" element={page(<Inbox />)} />
<Route path="/chats" element={page(<Chats />)} />
<Route path="/projects" element={page(<Projects />)} />
<Route path="/projects/new" element={page(<ProjectCreate />)} />
Expand Down Expand Up @@ -371,7 +370,12 @@ export default function App() {
<Route path="deploy" element={page(<ProjectSettingsDeploy />)} />
</Route>
<Route path="activity" element={page(<ProjectActivity />)} />
<Route path="notifications" element={page(<ProjectNotifications />)} />
<Route path="inbox" element={page(<ProjectInbox />)} />
{/* The project Notifications page became the inbox's Updates chip. */}
<Route
path="notifications"
element={<Navigate to="../inbox?filter=updates" replace />}
/>
<Route path="automation" element={page(<AutomationOverview />)} />
<Route path="automation/new" element={page(<AutomationEditor />)} />
<Route path="automation/history" element={page(<AutomationHistory />)} />
Expand Down
42 changes: 23 additions & 19 deletions apps/web/src/components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Outlet, useLocation, useNavigate } from 'react-router';

import { useGlobalCommandPalette } from '../hooks/useGlobalCommandPalette';
import { useIsMobile } from '../hooks/useIsMobile';
import { useNotificationSocket } from '../hooks/useNotificationSocket';
import { useProjectList } from '../hooks/useProjectData';
import { useSamSettings } from '../hooks/useSamSettings';
import { signOut } from '../lib/auth';
Expand All @@ -30,6 +31,7 @@ import { useAuth } from './AuthProvider';
import { CredentialHealthNavItem } from './CredentialHealthNavItem';
import { GlobalAudioPlayer } from './GlobalAudioPlayer';
import { GlobalCommandPalette } from './GlobalCommandPalette';
import { useInboxCount } from './inbox/useInbox';
import { MobileNavDrawer, type MobileNavItem } from './MobileNavDrawer';
import { extractProjectId, getGlobalNavItems, PROJECT_NAV_ITEMS } from './NavSidebar';
import { OnboardingProvider } from './onboarding';
Expand Down Expand Up @@ -165,36 +167,38 @@ export function AppShell({ children }: AppShellProps) {
// Detect project context from URL (excludes reserved paths like /projects/new)
const projectId = extractProjectId(location.pathname);

const mobileNavItems = useMemo((): MobileNavItem[] => {
if (projectId) {
return PROJECT_NAV_ITEMS.map((item) => ({
label: item.label,
path: `/projects/${projectId}/${item.path}`,
icon: item.icon,
}));
}
const items: MobileNavItem[] = getGlobalNavItems(sam.enabled).map((item) => ({
label: item.label,
path: item.path,
icon: item.icon,
}));
if (isSuperadmin) {
items.push({ label: 'Admin', path: '/admin', icon: <Shield size={18} /> });
}
return items;
}, [isSuperadmin, projectId, sam.enabled]);
// One notification socket for the app: its events refresh the inbox counts and lists (and the
// Updates chip), so nothing polls.
useNotificationSocket();

// The phone drawer shows the same inbox counts as the desktop nav (nav parity, rule 15).
const globalInboxCount = useInboxCount(null).data?.needsYou;
const projectInboxCount = useInboxCount(projectId ?? null).data?.needsYou;

const mobileGlobalNavItems = useMemo((): MobileNavItem[] => {
const items: MobileNavItem[] = getGlobalNavItems(sam.enabled).map((item) => ({
label: item.label,
path: item.path,
icon: item.icon,
count: item.inboxCount ? globalInboxCount : undefined,
}));
if (isSuperadmin) {
items.push({ label: 'Admin', path: '/admin', icon: <Shield size={18} /> });
}
return items;
}, [isSuperadmin, sam.enabled]);
}, [globalInboxCount, isSuperadmin, sam.enabled]);

const mobileNavItems = useMemo((): MobileNavItem[] => {
if (projectId) {
return PROJECT_NAV_ITEMS.map((item) => ({
label: item.label,
path: `/projects/${projectId}/${item.path}`,
icon: item.icon,
count: item.inboxCount ? projectInboxCount : undefined,
}));
}
return mobileGlobalNavItems;
}, [mobileGlobalNavItems, projectId, projectInboxCount]);

const handleProjectNavigate = useCallback(
(path: string) => {
Expand Down
12 changes: 10 additions & 2 deletions apps/web/src/components/MobileNavDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface MobileNavItem {
label: string;
path: string;
icon?: ReactNode;
/** Items waiting on the user (the inbox), shown as an amber count. */
count?: number;
}

interface MobileNavDrawerProps {
Expand Down Expand Up @@ -93,6 +95,8 @@ export function MobileNavDrawer({
icon={item.icon}
current={isNavItemActive(item.path, currentPath)}
onClick={() => onNavigate(item.path)}
count={item.count}
countTone="attention"
size="lg"
/>
));
Expand Down Expand Up @@ -120,7 +124,9 @@ export function MobileNavDrawer({
<PersonAvatar name={user.name || user.email} person="you" size={32} />
)}
<div className="min-w-0 flex-1">
<p className="m-0 truncate text-sm font-semibold text-fg-primary">{user.name || 'User'}</p>
<p className="m-0 truncate text-sm font-semibold text-fg-primary">
{user.name || 'User'}
</p>
<p className="m-0 truncate text-xs text-fg-muted">{user.email}</p>
</div>
<IconButton
Expand Down Expand Up @@ -153,7 +159,9 @@ export function MobileNavDrawer({
onClick={onToggleGlobalNav}
data-testid="mobile-nav-toggle"
className={`flex min-h-11 w-full shrink-0 cursor-pointer items-center gap-3 rounded-[11px] border-none bg-transparent px-3 text-left text-[15px] text-fg-muted transition-colors hover:bg-[var(--sam-glass-v2-raised)] hover:text-fg-primary ${FOCUS_RING}`}
aria-label={showGlobalNav ? `Back to ${projectName} navigation` : 'Show global navigation'}
aria-label={
showGlobalNav ? `Back to ${projectName} navigation` : 'Show global navigation'
}
>
{showGlobalNav ? (
<>
Expand Down
22 changes: 16 additions & 6 deletions apps/web/src/components/NavSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { NavItem as GlassNavItem, NavLabel } from '@simple-agent-manager/ui';
import {
ArrowLeft,
ArrowRight,
Bell,
Bot,
Brain,
FileCode,
FolderKanban,
FolderOpen,
Home,
Inbox,
LayoutDashboard,
Lightbulb,
Map,
Expand All @@ -29,17 +29,21 @@ import { useLocation } from 'react-router';

import { useSamSettings } from '../hooks/useSamSettings';
import { useAuth } from './AuthProvider';
import { useInboxCount } from './inbox/useInbox';
import { useOnboarding } from './onboarding';

export interface NavItem {
label: string;
path: string;
icon: React.ReactNode;
/** Shows the inbox count (all projects in the global nav, this project in the project nav). */
inboxCount?: true;
}

/** Global nav items shown when NOT inside a project */
export const GLOBAL_NAV_ITEMS: NavItem[] = [
{ label: 'Home', path: '/dashboard', icon: <Home size={18} /> },
{ label: 'Inbox', path: '/inbox', icon: <Inbox size={18} />, inboxCount: true },
{ label: 'Chats', path: '/chats', icon: <MessageSquare size={18} /> },
{ label: 'Projects', path: '/projects', icon: <FolderKanban size={18} /> },
{ label: 'Map', path: '/account-map', icon: <Map size={18} /> },
Expand All @@ -65,6 +69,8 @@ export const PROJECT_NAV_ITEMS: NavItem[] = [
// the index route); until then the project still opens in Chat.
{ label: 'Overview', path: 'overview', icon: <LayoutDashboard size={18} /> },
{ label: 'Chat', path: 'chat', icon: <MessageSquare size={18} /> },
// The inbox replaced the project Notifications page (its FYI list is the Updates chip).
{ label: 'Inbox', path: 'inbox', icon: <Inbox size={18} />, inboxCount: true },
// { label: 'Agent', path: 'agent', icon: <Bot size={18} /> }, // Hidden — experimental, not ready for users yet
// MessageSquareQuote, not MessageSquare: Chat already owns the plain speech
// bubble, and two bubbles side by side in the same rail are indistinguishable
Expand All @@ -75,7 +81,6 @@ export const PROJECT_NAV_ITEMS: NavItem[] = [
{ label: 'Ideas', path: 'ideas', icon: <Lightbulb size={18} /> },
{ label: 'Deployments', path: 'deployments', icon: <Rocket size={18} /> },
{ label: 'Agent Context', path: 'agent-context', icon: <Brain size={18} /> },
{ label: 'Notifications', path: 'notifications', icon: <Bell size={18} /> },
// One item for everything that starts work on its own (it replaced Events and Triggers).
{ label: 'Automation', path: 'automation', icon: <Workflow size={18} /> },
{ label: 'Profiles', path: 'profiles', icon: <UserCog size={18} /> },
Expand Down Expand Up @@ -138,6 +143,8 @@ export function NavSidebar({

const projectId = extractProjectId(location.pathname);
const insideProject = Boolean(projectId);
const globalInboxCount = useInboxCount(null).data?.needsYou;
const projectInboxCount = useInboxCount(projectId ?? null).data?.needsYou;
const projectToggleRef = useRef<HTMLButtonElement>(null);
const globalToggleRef = useRef<HTMLButtonElement>(null);
const restoreToggleFocus = useRef(false);
Expand All @@ -153,14 +160,16 @@ export function NavSidebar({
onToggleGlobalNav?.();
};

const renderItem = (item: NavItem, to: string, active: boolean) => (
const renderItem = (item: NavItem, to: string, active: boolean, inboxCount?: number) => (
<GlassNavItem
key={item.path}
to={to}
label={item.label}
icon={item.icon}
current={active}
iconOnly={iconOnly}
count={item.inboxCount ? inboxCount : undefined}
countTone="attention"
/>
);

Expand Down Expand Up @@ -236,7 +245,8 @@ export function NavSidebar({
renderItem(
item,
`/projects/${projectId}/${item.path}`,
isProjectSubActive(item.path, projectId, location.pathname)
isProjectSubActive(item.path, projectId, location.pathname),
projectInboxCount
)
)}
</nav>
Expand All @@ -262,7 +272,7 @@ export function NavSidebar({

{/* Global nav items */}
{globalItems.map((item) =>
renderItem(item, item.path, isActive(item.path, location.pathname))
renderItem(item, item.path, isActive(item.path, location.pathname), globalInboxCount)
)}

{onboardingResume}
Expand All @@ -289,7 +299,7 @@ export function NavSidebar({
className={`flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-3 py-2 ${className ?? ''}`}
>
{globalItems.map((item) =>
renderItem(item, item.path, isActive(item.path, location.pathname))
renderItem(item, item.path, isActive(item.path, location.pathname), globalInboxCount)
)}

{onboardingResume}
Expand Down
Loading
Loading