diff --git a/AgentCompany-New/src/renderer/src/app/App.tsx b/AgentCompany-New/src/renderer/src/app/App.tsx index 08dbe9ea..77117009 100644 --- a/AgentCompany-New/src/renderer/src/app/App.tsx +++ b/AgentCompany-New/src/renderer/src/app/App.tsx @@ -12,7 +12,7 @@ import { SocialPage } from "../pages/SocialPage"; import { SettingsPage } from "../pages/SettingsPage"; export function App() { - const { snapshot, error, actions } = useSnapshot(); + const { snapshot, actions } = useSnapshot(); const [route, setRoute] = useState("home"); if (!snapshot) { @@ -36,11 +36,6 @@ export function App() { return ( - {error && ( -
- {error} -
- )} {page}
); diff --git a/AgentCompany-New/src/renderer/src/app/useSnapshot.ts b/AgentCompany-New/src/renderer/src/app/useSnapshot.ts index 0d56ebf5..c824661c 100644 --- a/AgentCompany-New/src/renderer/src/app/useSnapshot.ts +++ b/AgentCompany-New/src/renderer/src/app/useSnapshot.ts @@ -9,33 +9,23 @@ export interface SnapshotActions { export function useSnapshot(): { snapshot: AppSnapshot | null; - error: string | null; actions: SnapshotActions; } { const [snapshot, setSnapshot] = useState(null); - const [error, setError] = useState(null); const load = useCallback(async () => { const result = await window.agentCompany.loadSnapshot(); - if (result.ok) { - setSnapshot(result.data); - setError(null); - } else { - setError(result.error.message); - } + if (!result.ok) throw new Error(result.error.message); + setSnapshot(result.data); }, []); const run = useCallback(async ( operation: () => Promise>, ): Promise => { const result = await operation(); - if (result.ok) { - if (result.data) setSnapshot(result.data as AppSnapshot); - setError(null); - return result.data; - } - setError(result.error.message); - return null; + if (!result.ok) throw new Error(result.error.message); + if (result.data) setSnapshot(result.data as AppSnapshot); + return result.data; }, []); useEffect(() => { @@ -45,5 +35,5 @@ export function useSnapshot(): { }); }, [load]); - return { snapshot, error, actions: { run, reload: load } }; + return { snapshot, actions: { run, reload: load } }; } diff --git a/AgentCompany-New/src/renderer/src/pages/ApprovalsPage.tsx b/AgentCompany-New/src/renderer/src/pages/ApprovalsPage.tsx index 2f75c4ab..24f99adb 100644 --- a/AgentCompany-New/src/renderer/src/pages/ApprovalsPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/ApprovalsPage.tsx @@ -77,10 +77,8 @@ export function ApprovalsPage({ snapshot, actions }: PageProps) { -
Pending
- {filteredPending.length === 0 ? ( -
Nothing in the queue.
- ) : filteredPending.map((approval) => ( + {filteredPending.length > 0 &&
Pending
} + {filteredPending.map((approval) => ( ))} -
Recently decided
-
- {decided.length === 0 ? ( -
No decisions yet.
- ) : decided.slice(0, 24).map((approval, index) => ( - - ))} -
+ {decided.length > 0 && ( + <> +
Recently decided
+
+ {decided.slice(0, 24).map((approval, index) => ( + + ))} +
+ + )} ); } diff --git a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx index f31df76b..9d08efc8 100644 --- a/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/FilesPage.tsx @@ -230,9 +230,7 @@ function FilesTable({ >
Name
Size
Owner
Modified
- {files.length === 0 ? ( -
No files here yet.
- ) : files.map((file, index) => ( + {files.map((file, index) => ( void; }) { - if (files.length === 0) { - return
No files here yet.
; - } return (
{files.map((file) => ( diff --git a/AgentCompany-New/src/renderer/src/pages/HomePage.tsx b/AgentCompany-New/src/renderer/src/pages/HomePage.tsx index 9a0a9f08..d748799c 100644 --- a/AgentCompany-New/src/renderer/src/pages/HomePage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/HomePage.tsx @@ -98,28 +98,24 @@ function TodayCard({ Today {formatted}
- {rows.length === 0 ? ( - No items on today's agenda. - ) : ( -
- {rows.map((task) => { - const owner = agents.find((agent) => agent.id === task.assigneeAgentId); - const ownerName = owner?.name ?? employee.displayName; - const time = formatTime(task.updatedAt); - const requiresApproval = approvals.some((approval) => approval.title === task.title); - return ( -
- {time} -
- {task.title} - · {ownerName} -
- {requiresApproval && You} +
+ {rows.map((task) => { + const owner = agents.find((agent) => agent.id === task.assigneeAgentId); + const ownerName = owner?.name ?? employee.displayName; + const time = formatTime(task.updatedAt); + const requiresApproval = approvals.some((approval) => approval.title === task.title); + return ( +
+ {time} +
+ {task.title} + · {ownerName}
- ); - })} -
- )} + {requiresApproval && You} +
+ ); + })} +
); } @@ -141,27 +137,23 @@ function WaitingCard({ Waiting on you {approvals.length > 0 && {approvals.length}}
- {approvals.length === 0 ? ( - Nothing pending. - ) : ( -
- {approvals.slice(0, 2).map((approval) => { - const from = resolveRequester(approval, employees, agents); - return ( -
-
{approval.title}
-
- {approval.kind} · {approval.risk} risk · from {from} -
-
- - -
+
+ {approvals.slice(0, 2).map((approval) => { + const from = resolveRequester(approval, employees, agents); + return ( +
+
{approval.title}
+
+ {approval.kind} · {approval.risk} risk · from {from}
- ); - })} -
- )} +
+ + +
+
+ ); + })} +
); } @@ -188,23 +180,19 @@ function SpendCard({
- {connected.length === 0 ? ( - No providers connected. - ) : ( -
- {connected.slice(0, 3).map((provider) => { - const usingAgents = agents.filter((agent) => agent.modelProviderId === provider.id).length; - return ( -
- {provider.label} - - {usingAgents} {usingAgents === 1 ? "agent" : "agents"} - -
- ); - })} -
- )} +
+ {connected.slice(0, 3).map((provider) => { + const usingAgents = agents.filter((agent) => agent.modelProviderId === provider.id).length; + return ( +
+ {provider.label} + + {usingAgents} {usingAgents === 1 ? "agent" : "agents"} + +
+ ); + })} +
); } @@ -217,9 +205,7 @@ function InProgressCard({ tasks, agents }: { tasks: TaskRecord[]; agents: AgentR In progress {tasks.length} active
- {rows.length === 0 ? ( - No tasks in progress. - ) : rows.map((task, index) => { + {rows.map((task, index) => { const owner = agents.find((agent) => agent.id === task.assigneeAgentId); const last = index === rows.length - 1; return ( @@ -293,12 +279,6 @@ function GoalCard({ ); } -function EmptyLine({ children, style }: { children: string; style?: React.CSSProperties }) { - return ( -
{children}
- ); -} - function collectAgendaTasks(tasks: TaskRecord[], reference: Date): TaskRecord[] { const startOfDay = new Date(reference.getFullYear(), reference.getMonth(), reference.getDate()).getTime(); const endOfDay = startOfDay + 24 * 60 * 60 * 1000; diff --git a/AgentCompany-New/src/renderer/src/pages/SettingsPage.tsx b/AgentCompany-New/src/renderer/src/pages/SettingsPage.tsx index e08a0fa0..0a588e21 100644 --- a/AgentCompany-New/src/renderer/src/pages/SettingsPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/SettingsPage.tsx @@ -47,20 +47,6 @@ const ACCOUNT_GROUP: NavSpec[] = [ { id: "security", label: "Security" }, ]; -const TAB_TITLES: Record = { - workspace: "Workspace", - members: "Members", - billing: "Billing", - models: "Models", - providers: "Providers", - skills: "Skills", - policies: "Policies", - migration: "Migration", - profile: "Profile", - notifications: "Notifications", - security: "Security", -}; - export function SettingsPage({ snapshot, actions }: PageProps) { const orgId = activeOrgId(snapshot); const organization = requireActiveOrganization(snapshot); @@ -93,11 +79,6 @@ export function SettingsPage({ snapshot, actions }: PageProps) {
-
- Settings - / - {TAB_TITLES[tab]} -
{tab === "workspace" && } {tab === "members" && } diff --git a/AgentCompany-New/src/renderer/src/pages/SocialPage.tsx b/AgentCompany-New/src/renderer/src/pages/SocialPage.tsx index 3ec17b91..e060ed71 100644 --- a/AgentCompany-New/src/renderer/src/pages/SocialPage.tsx +++ b/AgentCompany-New/src/renderer/src/pages/SocialPage.tsx @@ -82,26 +82,26 @@ export function SocialPage({ snapshot, actions }: PageProps) {
-
Accounts
-
- {accounts.length === 0 ? ( -
No social accounts connected.
- ) : accounts.map((account) => ( - item.id === account.authorizedEmployeeId)?.displayName ?? null : null} - onSignIn={() => void actions.run(() => window.agentCompany.launchSocialLogin({ socialAccountId: account.id }))} - /> - ))} -
+ {accounts.length > 0 && ( + <> +
Accounts
+
+ {accounts.map((account) => ( + item.id === account.authorizedEmployeeId)?.displayName ?? null : null} + onSignIn={() => void actions.run(() => window.agentCompany.launchSocialLogin({ socialAccountId: account.id }))} + /> + ))} +
+ + )}
-
Scheduled
- {scheduled.length === 0 ? ( -
No posts scheduled.
- ) : scheduled.map((post) => ( + {scheduled.length > 0 &&
Scheduled
} + {scheduled.map((post) => ( updatePostState(post, "published")} /> ))} - -
Drafts
- {drafts.length === 0 ? ( -
No drafts.
- ) : drafts.map((post) => ( + {drafts.length > 0 &&
Drafts
} + {drafts.map((post) => ( ) : null} {agents.length > 0 && } -
+
{agents.slice(0, 4).map((agent) => ( ))}
- {agents.length > 4 && ( -
- + {agents.length - 4} more agents in the roster below -
- )}
Roster
@@ -94,9 +97,7 @@ export function TeamPage({ snapshot, actions }: PageProps) { >
Member
Department
Model
Budget
- {rosterRows.length === 0 ? ( -
No members for this filter.
- ) : rosterRows.map((row, index) => ( + {rosterRows.map((row, index) => ( ))}
@@ -156,15 +157,22 @@ function OrgCard({ name, role, human = false }: { name: string; role: string; hu } function OrgConnector({ slots }: { slots: number }) { - const count = Math.max(1, Math.min(4, slots)); + if (slots <= 1) { + return ( + + ); + } + const count = Math.min(4, slots); const step = 100 / (count * 2); const positions = Array.from({ length: count }, (_, i) => step * (2 * i + 1)); + const left = positions[0]; + const right = positions[positions.length - 1]; return (
Empty.
- )}
); })} @@ -139,9 +136,7 @@ function ListView({ tasks, agents, projects }: { tasks: TaskRecord[]; agents: Ag >
Title
Status
Priority
Assignee
- {tasks.length === 0 ? ( -
No tasks.
- ) : tasks.map((task, index) => { + {tasks.map((task, index) => { const assignee = agents.find((agent) => agent.id === task.assigneeAgentId) ?? null; const project = projects.find((p) => p.id === task.projectId) ?? null; const last = index === tasks.length - 1; @@ -182,9 +177,7 @@ function TimelineView({ tasks, goals }: { tasks: TaskRecord[]; goals: GoalRecord return (
By goal
- {goals.length === 0 ? ( -
No goals defined.
- ) : goals.map((goal) => { + {goals.map((goal) => { const linked = tasks.filter((task) => task.goalId === goal.id); const done = linked.filter((task) => task.status === TASK_STATUS.DONE).length; const pct = linked.length === 0 ? 0 : Math.round((done / linked.length) * 100); diff --git a/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx b/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx index 9d5832c0..fcd192c9 100644 --- a/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx +++ b/AgentCompany-New/src/renderer/src/pages/chat/ChatConversation.tsx @@ -1,4 +1,4 @@ -import type { FormEvent, MutableRefObject, ReactNode } from "react"; +import type { FormEvent, MutableRefObject } from "react"; import { AvatarStack, Icon, IconButton } from "../../shared/ui"; import type { ApprovalRecord, @@ -51,11 +51,7 @@ export function ChatConversation({
{space && }
- {!space ? ( - Select a channel to start. - ) : rootMessages.length === 0 && pendingApprovals.length === 0 ? ( - No messages in {space.name} yet. - ) : ( + {space && ( {children}
; -} diff --git a/AgentCompany-New/src/renderer/src/pages/settings/AccountPanels.tsx b/AgentCompany-New/src/renderer/src/pages/settings/AccountPanels.tsx index 535a8060..465bae11 100644 --- a/AgentCompany-New/src/renderer/src/pages/settings/AccountPanels.tsx +++ b/AgentCompany-New/src/renderer/src/pages/settings/AccountPanels.tsx @@ -34,21 +34,21 @@ export function NotificationsPanel({ events, employee }: { events: AuditEventRec

Notifications

Real audit events flagged for you.

-
- {visible.length === 0 ? ( -
Quiet inbox.
- ) : visible.map((event, index) => ( -
- {event.entityType.replaceAll("_", " ")} - {event.action} - {formatRelative(event.createdAt)} -
- ))} -
+ {visible.length > 0 && ( +
+ {visible.map((event, index) => ( +
+ {event.entityType.replaceAll("_", " ")} + {event.action} + {formatRelative(event.createdAt)} +
+ ))} +
+ )}
); } @@ -59,21 +59,21 @@ export function SecurityPanel({ events }: { events: AuditEventRecord[] }) {

Security

Recent security-relevant audit events.

-
- {security.length === 0 ? ( -
No security events recorded.
- ) : security.map((event, index) => ( -
- {event.entityType.replaceAll("_", " ")} - {event.action} - {formatRelative(event.createdAt)} -
- ))} -
+ {security.length > 0 && ( +
+ {security.map((event, index) => ( +
+ {event.entityType.replaceAll("_", " ")} + {event.action} + {formatRelative(event.createdAt)} +
+ ))} +
+ )}
); } diff --git a/AgentCompany-New/src/renderer/src/pages/settings/BillingPanel.tsx b/AgentCompany-New/src/renderer/src/pages/settings/BillingPanel.tsx index e4485eb2..2b4d544f 100644 --- a/AgentCompany-New/src/renderer/src/pages/settings/BillingPanel.tsx +++ b/AgentCompany-New/src/renderer/src/pages/settings/BillingPanel.tsx @@ -31,9 +31,7 @@ export function BillingPanel({ >
Provider
Requests
Errors
Agents
- {providers.length === 0 ? ( -
No providers configured.
- ) : providers.map((provider, index) => { + {providers.map((provider, index) => { const requests = monthRequests.filter((request) => request.providerId === provider.id); const errors = requests.filter((request) => request.state === "failed").length; const boundAgents = agents.filter((agent) => agent.modelProviderId === provider.id).length; @@ -46,7 +44,9 @@ export function BillingPanel({ >
{provider.label}
-
{provider.model ?? "no default model"}
+ {provider.model && ( +
{provider.model}
+ )}
{requests.length}
{errors > 0 ? {errors} : 0}
diff --git a/AgentCompany-New/src/renderer/src/pages/settings/MigrationPanel.tsx b/AgentCompany-New/src/renderer/src/pages/settings/MigrationPanel.tsx index a8abd938..e7e5e912 100644 --- a/AgentCompany-New/src/renderer/src/pages/settings/MigrationPanel.tsx +++ b/AgentCompany-New/src/renderer/src/pages/settings/MigrationPanel.tsx @@ -44,13 +44,13 @@ export function MigrationPanel({
-
- {reports.length === 0 ? ( -
No migration reports yet.
- ) : reports.map((report, index) => ( - - ))} -
+ {reports.length > 0 && ( +
+ {reports.map((report, index) => ( + + ))} +
+ )} setOpen(false)} onSubmit={submit}> diff --git a/AgentCompany-New/src/renderer/src/pages/settings/ModelsPanel.tsx b/AgentCompany-New/src/renderer/src/pages/settings/ModelsPanel.tsx index 1a064a81..0bb46b93 100644 --- a/AgentCompany-New/src/renderer/src/pages/settings/ModelsPanel.tsx +++ b/AgentCompany-New/src/renderer/src/pages/settings/ModelsPanel.tsx @@ -20,9 +20,7 @@ export function ModelsPanel({ >
Provider
Model
Agents
Source
- {rows.length === 0 ? ( -
No models configured.
- ) : rows.map((row, index) => ( + {rows.map((row, index) => (
Action
Effect
Risk ceiling
Subject
- {policies.length === 0 ? ( -
No policies.
- ) : policies.map((policy, index) => ( + {policies.map((policy, index) => (
)} -
Available
- {available.length === 0 ? ( -
All providers connected.
- ) : ( -
- {available.map((provider) => ( - setActive(provider)} /> - ))} -
+ {available.length > 0 && ( + <> +
Available
+
+ {available.map((provider) => ( + setActive(provider)} /> + ))} +
+ )} setActive(null)} onSubmit={save}> diff --git a/AgentCompany-New/src/renderer/src/pages/settings/SkillsPanel.tsx b/AgentCompany-New/src/renderer/src/pages/settings/SkillsPanel.tsx index d38be21c..19de087b 100644 --- a/AgentCompany-New/src/renderer/src/pages/settings/SkillsPanel.tsx +++ b/AgentCompany-New/src/renderer/src/pages/settings/SkillsPanel.tsx @@ -58,9 +58,7 @@ export function SkillsPanel({ orgId, skills, revisions, bindings, agents, action >
Skill
Version
Bindings
Bind to agent
- {skills.length === 0 ? ( -
No skills imported yet.
- ) : skills.map((skill, index) => { + {skills.map((skill, index) => { const last = index === skills.length - 1; const latest = revisions.find((revision) => revision.skillId === skill.id); const skillBindings = bindings.filter((binding) => binding.skillId === skill.id && binding.enabled); @@ -76,9 +74,7 @@ export function SkillsPanel({ orgId, skills, revisions, bindings, agents, action {latest ? latest.versionSemver : "—"}
- {skillBindings.length === 0 ? ( - Not bound - ) : skillBindings.map((binding) => ( + {skillBindings.map((binding) => ( {agentName(binding.agentId, agents)} ))}
@@ -107,7 +103,7 @@ function BindAgent({ onBind: (agentId: string) => void; disabled: boolean; }) { - if (agents.length === 0) return No agents available; + if (agents.length === 0) return null; return (