Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(web): add shared EmptyState and rewrite empty state texts and small refactoring (#26)

Croffcb0ca238b6f2
diff --git a/apps/web/src/components/common/page/EmptyState.tsx b/apps/web/src/components/common/page/EmptyState.tsx
new file mode 100644
index 00000000..2ad8a9d0
--- /dev/null
+++ b/apps/web/src/components/common/page/EmptyState.tsx
@@ -0,0 +1,32 @@
+import type { ReactNode } from 'react';
+import {
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
+} from '@/components/ui/empty';
+
+// The "nothing here yet" block. `children` holds the action; pages with no action
+// to offer omit it. It grows to fill the space left over (`flex-1`), so mount it in
+// a flex column of a known height — in a plain block parent it keeps content height
+// and sits at the top.
+export function EmptyState({
+ title,
+ description,
+ children,
+}: {
+ title: string;
+ description: string;
+ children?: ReactNode;
+}) {
+ return (
+ <Empty>
+ <EmptyHeader>
+ <EmptyTitle>{title}</EmptyTitle>
+ <EmptyDescription>{description}</EmptyDescription>
+ </EmptyHeader>
+ {children && <EmptyContent>{children}</EmptyContent>}
+ </Empty>
+ );
+}
diff --git a/apps/web/src/components/common/page/SectionPageView.tsx b/apps/web/src/components/common/page/SectionPageView.tsx
index 248bdcd3..d4282841 100644
--- a/apps/web/src/components/common/page/SectionPageView.tsx
+++ b/apps/web/src/components/common/page/SectionPageView.tsx
@@ -6,6 +6,8 @@ import PageHeader from './PageHeader';
// container, a centered column, and a header (title and description). Used by
// the settings and members section pages. `widthClassName` overrides the centered
// column's width constraints (e.g. a section that wants a narrower cap than `wide`).
+// The column is a flex column at least as tall as the viewport area, so a child
+// marked `flex-1` (an empty state) fills the space left under the header.
export default function SectionPageView({
title,
description,
@@ -28,7 +30,7 @@ export default function SectionPageView({
const align = widthClassName ? '' : 'mx-auto';
return (
<div className="flex-1 overflow-y-auto">
- <div className={cn(align, 'w-full', width, padding)}>
+ <div className={cn(align, 'flex min-h-full w-full flex-col', width, padding)}>
<PageHeader title={title} description={description} actions={actions} />
{children}
</div>
diff --git a/apps/web/src/features/ai-chat/AiChatPage.tsx b/apps/web/src/features/ai-chat/AiChatPage.tsx
index 6e14a64e..bd65b54b 100644
--- a/apps/web/src/features/ai-chat/AiChatPage.tsx
+++ b/apps/web/src/features/ai-chat/AiChatPage.tsx
@@ -1,19 +1,11 @@
'use client';
import Link from 'next/link';
-import { Bot } from 'lucide-react';
import { useShell } from '@/context/shellContext';
import { usePermissions } from '@/hooks/usePermissions';
import { aiAgentsPath } from '@/utils/paths';
import { Button } from '@/components/ui/button';
-import {
- Empty,
- EmptyContent,
- EmptyDescription,
- EmptyHeader,
- EmptyMedia,
- EmptyTitle,
-} from '@/components/ui/empty';
+import { EmptyState } from '@/components/common/page/EmptyState';
import { AiChatAgentRail } from './components/page/AiChatAgentRail';
import { AiChatThreadRail } from './components/page/AiChatThreadRail';
import { AiChatConversation } from './components/page/AiChatConversation';
@@ -57,26 +49,17 @@ export default function AiChatPage() {
if (agents.length === 0) {
return (
- <div className="flex h-full items-center justify-center p-6">
- <Empty>
- <EmptyHeader>
- <EmptyMedia variant="icon">
- <Bot />
- </EmptyMedia>
- <EmptyTitle>No agents to chat with</EmptyTitle>
- <EmptyDescription>
- Add an internal agent run by the built-in runtime, then come back here to chat with it
- in test mode.
- </EmptyDescription>
- </EmptyHeader>
+ <div className="flex h-full">
+ <EmptyState
+ title="No agents to chat with"
+ description="Only internal agents can chat here, in test mode."
+ >
{can('ai_agents', 'edit') && (
- <EmptyContent>
- <Button asChild size="sm">
- <Link href={aiAgentsPath(project.project.key)}>Manage agents</Link>
- </Button>
- </EmptyContent>
+ <Button asChild size="sm">
+ <Link href={aiAgentsPath(project.project.key)}>Create an agent</Link>
+ </Button>
)}
- </Empty>
+ </EmptyState>
</div>
);
}
diff --git a/apps/web/src/features/initiatives/InitiativesPage.tsx b/apps/web/src/features/initiatives/InitiativesPage.tsx
index b9696474..c1600c8f 100644
--- a/apps/web/src/features/initiatives/InitiativesPage.tsx
+++ b/apps/web/src/features/initiatives/InitiativesPage.tsx
@@ -56,10 +56,10 @@ export default function InitiativesPage() {
const [creating, setCreating] = useState(false);
const projectKey = project?.project.key ?? null;
- const statuses = TABS.find((t) => t.value === tab)!.statuses;
+ const activeTab = TABS.find((t) => t.value === tab)!;
const query = useInitiativesQuery(projectKey, {
- statuses,
+ statuses: activeTab.statuses,
sort: sort?.key,
dir: sort?.dir,
page,
@@ -86,7 +86,7 @@ export default function InitiativesPage() {
};
return (
- <div className="flex-1 overflow-y-auto">
+ <div className="flex flex-1 flex-col overflow-y-auto">
<div className="flex items-center justify-between px-4 py-3">
<h1 className="text-lg font-semibold">Initiatives</h1>
{can('initiatives', 'create') && (
@@ -116,6 +116,7 @@ export default function InitiativesPage() {
isLoading={query.isLoading}
canCreate={can('initiatives', 'create')}
onCreate={() => setCreating(true)}
+ statusLabel={activeTab.statuses ? activeTab.label : undefined}
sort={sort?.key}
dir={sort?.dir}
onSort={changeSort}
diff --git a/apps/web/src/features/initiatives/components/list/InitiativesEmpty.tsx b/apps/web/src/features/initiatives/components/list/InitiativesEmpty.tsx
deleted file mode 100644
index dc84fa2a..00000000
--- a/apps/web/src/features/initiatives/components/list/InitiativesEmpty.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Plus, Target } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-
-export default function InitiativesEmpty({
- canCreate,
- onCreate,
-}: {
- canCreate: boolean;
- onCreate: () => void;
-}) {
- return (
- <div className="mx-4 mt-2 flex min-h-[320px] flex-col items-center justify-center gap-4 rounded-xl bg-muted/30 px-6 py-16 text-center">
- <div className="flex size-11 items-center justify-center rounded-xl bg-background text-muted-foreground shadow-sm">
- <Target className="size-5" />
- </div>
- <div className="space-y-1">
- <p className="text-sm font-medium text-foreground">No initiatives yet</p>
- <p className="mx-auto max-w-xs text-xs leading-relaxed text-muted-foreground">
- Group related issues under a larger goal to track its progress and health in one place.
- </p>
- </div>
- {canCreate && (
- <Button size="sm" className="h-8 gap-1.5" onClick={onCreate}>
- <Plus className="size-3.5" />
- New initiative
- </Button>
- )}
- </div>
- );
-}
diff --git a/apps/web/src/features/initiatives/components/list/InitiativesList.tsx b/apps/web/src/features/initiatives/components/list/InitiativesList.tsx
index 7921ecfe..9438fefb 100644
--- a/apps/web/src/features/initiatives/components/list/InitiativesList.tsx
+++ b/apps/web/src/features/initiatives/components/list/InitiativesList.tsx
@@ -1,8 +1,9 @@
-import { ChevronDown, ChevronUp } from 'lucide-react';
+import { ChevronDown, ChevronUp, Plus } from 'lucide-react';
import type { Initiative, InitiativeSort, ProjectDetail } from '@/lib/api';
+import { Button } from '@/components/ui/button';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import InitiativeRow from './InitiativeRow';
-import InitiativesEmpty from './InitiativesEmpty';
// Columns in table order. A `sort` key marks the column as sortable; progress and
// health are derived per row and cannot be sorted server-side.
@@ -21,6 +22,7 @@ export default function InitiativesList({
isLoading,
canCreate,
onCreate,
+ statusLabel,
sort,
dir,
onSort,
@@ -30,6 +32,9 @@ export default function InitiativesList({
isLoading: boolean;
canCreate: boolean;
onCreate: () => void;
+ // The label of the open status tab, absent on the tab that lists every status.
+ // An empty status tab is a filtered view, not a first run, so it says so.
+ statusLabel: string | undefined;
sort: InitiativeSort | undefined;
dir: 'asc' | 'desc' | undefined;
onSort: (key: InitiativeSort) => void;
@@ -37,8 +42,29 @@ export default function InitiativesList({
const ownerById = new Map(project.assignees.map((a) => [a.userId, a]));
if (isLoading) return <p className="px-4 py-6 text-sm text-muted-foreground">Loading…</p>;
- if (initiatives.length === 0)
- return <InitiativesEmpty canCreate={canCreate} onCreate={onCreate} />;
+
+ if (initiatives.length === 0) {
+ if (statusLabel)
+ return (
+ <EmptyState
+ title={`No ${statusLabel.toLowerCase()} initiatives`}
+ description="Initiatives move between tabs as their status changes."
+ />
+ );
+ return (
+ <EmptyState
+ title="No initiatives yet"
+ description="An initiative groups related issues under one goal."
+ >
+ {canCreate && (
+ <Button size="sm" onClick={onCreate}>
+ <Plus className="size-3.5" />
+ New initiative
+ </Button>
+ )}
+ </EmptyState>
+ );
+ }
return (
<div className="px-4 pb-2">
diff --git a/apps/web/src/features/notes/components/NotesEmptyState.tsx b/apps/web/src/features/notes/components/NotesEmptyState.tsx
index 4e6d1300..65e5a7f4 100644
--- a/apps/web/src/features/notes/components/NotesEmptyState.tsx
+++ b/apps/web/src/features/notes/components/NotesEmptyState.tsx
@@ -1,6 +1,7 @@
import { useState } from 'react';
import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
+import { EmptyState } from '@/components/common/page/EmptyState';
import NoteBoardNameDialog from './NoteBoardNameDialog';
// Shown when a project has no note boards. Names what a board is and offers to
@@ -15,15 +16,16 @@ export default function NotesEmptyState({
const [open, setOpen] = useState(false);
return (
- <div className="flex flex-1 flex-col items-center justify-center px-6 text-center">
- <h2 className="text-base font-medium text-foreground">No boards yet</h2>
- <p className="mt-1.5 max-w-xs text-sm text-muted-foreground">
- A board is a freeform canvas for sticky notes. Create one to start jotting things down.
- </p>
-
- <Button className="mt-6" onClick={() => setOpen(true)}>
- <Plus className="size-4" /> New board
- </Button>
+ <>
+ <EmptyState
+ title="No boards yet"
+ description="A board is a freeform canvas for sticky notes."
+ >
+ <Button size="sm" onClick={() => setOpen(true)}>
+ <Plus className="size-3.5" />
+ New board
+ </Button>
+ </EmptyState>
<NoteBoardNameDialog
key={open ? 'open' : 'closed'}
@@ -39,6 +41,6 @@ export default function NotesEmptyState({
setOpen(false);
}}
/>
- </div>
+ </>
);
}
diff --git a/apps/web/src/features/settings/components/actions/SettingsActions.tsx b/apps/web/src/features/settings/components/actions/SettingsActions.tsx
index f4039c33..932f647e 100644
--- a/apps/web/src/features/settings/components/actions/SettingsActions.tsx
+++ b/apps/web/src/features/settings/components/actions/SettingsActions.tsx
@@ -7,14 +7,11 @@ import {
useUpdateAction,
} from '@/services/actions.service';
import { EMPTY_FILTER_SET, type FilterSet } from '@/utils/filters';
-import { settingsSection } from '@/utils/settingsSections';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { SettingsActionDialog } from './SettingsActionDialog';
import { SettingsActionsTable } from './SettingsActionsTable';
-const section = settingsSection('actions');
-
type ActionSeed = { name: string; icon: string; condition: FilterSet; effect: ActionEffect };
// Project settings tab for manual actions. Each action is a saved macro: a
@@ -79,10 +76,9 @@ export default function SettingsActions({
return (
<>
{actions.length === 0 ? (
- <SettingsListEmpty
- icon={section.icon}
+ <EmptyState
title="No actions yet"
- description="Create a one-click action that applies field changes when its conditions match."
+ description="Pick which issues an action shows on, then what it sets."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/agent-skills/SettingsAgentSkills.tsx b/apps/web/src/features/settings/components/agent-skills/SettingsAgentSkills.tsx
index b0480d12..9157d083 100644
--- a/apps/web/src/features/settings/components/agent-skills/SettingsAgentSkills.tsx
+++ b/apps/web/src/features/settings/components/agent-skills/SettingsAgentSkills.tsx
@@ -1,10 +1,9 @@
import { useState } from 'react';
import type { AgentSkill, ProjectDetail } from '@/lib/api';
-import { AGENT_SKILLS_SECTION } from '@/utils/settingsSections';
import { useSkillsQuery, useDeleteSkill } from '@/services/agentSkills.service';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { useSettingsCan } from '../../context/settingsPermission';
import { SkillEditDialog } from './SkillEditDialog';
import { SkillRow } from './SkillRow';
@@ -26,10 +25,9 @@ export default function SettingsAgentSkills({ project }: { project: ProjectDetai
return (
<>
{skills.length === 0 ? (
- <SettingsListEmpty
- icon={AGENT_SKILLS_SECTION.icon}
+ <EmptyState
title="No skills yet"
- description="Add a skill: reusable instructions an internal agent loads on demand. Write markdown, upload a file, or import from GitHub."
+ description="Write markdown, upload a file, or import from GitHub."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx b/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx
index 89d9b079..848b4c47 100644
--- a/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx
+++ b/apps/web/src/features/settings/components/agent-tools/SettingsAgentTools.tsx
@@ -1,11 +1,10 @@
import { useMemo, useState } from 'react';
import type { ConfiguredTool, ProjectDetail } from '@/lib/api';
-import { AGENT_TOOLS_SECTION } from '@/utils/settingsSections';
import { useConfiguredToolsQuery, useDeleteConfiguredTool } from '@/services/customTools.service';
import { useIntegrationCatalogQuery } from '@/services/integrations.service';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { useSettingsCan } from '../../context/settingsPermission';
import { ToolConfigRow } from './ToolConfigRow';
import { integrationLabel } from '../../utils/integrationLabels';
@@ -32,10 +31,9 @@ export default function SettingsAgentTools({ project }: { project: ProjectDetail
return (
<>
{tools.length === 0 ? (
- <SettingsListEmpty
- icon={AGENT_TOOLS_SECTION.icon}
- title="No tools configured yet"
- description="Connect a tool to an integration credential so agents can call it, then enable it on an agent."
+ <EmptyState
+ title="No tools yet"
+ description="Configure a tool once, then enable it on any agent."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgents.tsx b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgents.tsx
index 465f9c94..898688b3 100644
--- a/apps/web/src/features/settings/components/ai-agents/SettingsAiAgents.tsx
+++ b/apps/web/src/features/settings/components/ai-agents/SettingsAiAgents.tsx
@@ -6,18 +6,15 @@ import {
useRegenerateAiAgentKey,
} from '@/services/aiAgents.service';
import { useIntegrationCatalogQuery } from '@/services/integrations.service';
-import { AI_AGENTS_SECTION } from '@/utils/settingsSections';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { SettingsAiAgentRow } from './SettingsAiAgentRow';
import AgentKeyRevealModal from './AgentKeyRevealModal';
import { SettingsAiAgentSheet } from './SettingsAiAgentSheet';
import { SettingsAiAgentRunsSheet } from './SettingsAiAgentRunsSheet';
import { integrationLabel } from '../../utils/integrationLabels';
-const section = AI_AGENTS_SECTION;
-
// Project settings tab for AI agents: bot users that issues can be delegated to.
// An external agent is driven through the API; an internal agent runs on the
// built-in runtime and carries provider/model/instructions/tools. Creating and
@@ -55,10 +52,9 @@ export default function SettingsAiAgents({ project }: { project: ProjectDetail }
return (
<>
{agents.length === 0 ? (
- <SettingsListEmpty
- icon={section.icon}
+ <EmptyState
title="No agents yet"
- description="Add a bot user you can delegate issues to, driven through the API or by the built-in runtime."
+ description="An agent runs on the built-in runtime or through the API."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/crud/SettingsListEmpty.tsx b/apps/web/src/features/settings/components/crud/SettingsListEmpty.tsx
deleted file mode 100644
index 7a5d25f2..00000000
--- a/apps/web/src/features/settings/components/crud/SettingsListEmpty.tsx
+++ /dev/null
@@ -1,44 +0,0 @@
-import type { LucideIcon } from 'lucide-react';
-import { Plus } from 'lucide-react';
-import { Button } from '@/components/ui/button';
-import { useSettingsCan } from '../../context/settingsPermission';
-
-// The first-run state for a settings list. Sits on a quiet muted panel with a min
-// height so an empty tab reads as a defined area, not a void. Shared by the settings
-// CRUD tabs.
-export function SettingsListEmpty({
- icon: Icon,
- title,
- description,
- addLabel,
- onAdd,
-}: {
- icon: LucideIcon;
- title: string;
- description: string;
- // The add action is optional: pages that expose it in the page header instead
- // omit it here, so the empty state stays a plain message.
- addLabel?: string;
- onAdd?: () => void;
-}) {
- const can = useSettingsCan();
- return (
- <div className="flex min-h-[320px] flex-col items-center justify-center gap-4 rounded-xl bg-muted/30 px-6 py-16 text-center">
- <div className="flex size-11 items-center justify-center rounded-xl bg-background text-muted-foreground shadow-sm">
- <Icon className="size-5" />
- </div>
- <div className="space-y-1">
- <p className="text-sm font-medium text-foreground">{title}</p>
- <p className="mx-auto max-w-xs text-xs leading-relaxed text-muted-foreground">
- {description}
- </p>
- </div>
- {onAdd && can('create') && (
- <Button size="sm" className="h-8 gap-1.5" onClick={onAdd}>
- <Plus className="size-3.5" />
- {addLabel}
- </Button>
- )}
- </div>
- );
-}
diff --git a/apps/web/src/features/settings/components/integrations/SettingsIntegrations.tsx b/apps/web/src/features/settings/components/integrations/SettingsIntegrations.tsx
index da89ea87..1f5a185c 100644
--- a/apps/web/src/features/settings/components/integrations/SettingsIntegrations.tsx
+++ b/apps/web/src/features/settings/components/integrations/SettingsIntegrations.tsx
@@ -1,5 +1,4 @@
import { useState } from 'react';
-import { KeyRound } from 'lucide-react';
import type { IntegrationCredential, ProjectDetail } from '@/lib/api';
import {
useCredentialsQuery,
@@ -7,8 +6,8 @@ import {
useDeleteCredential,
} from '@/services/integrations.service';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { useSettingsCan } from '../../context/settingsPermission';
import { CredentialDialog } from './CredentialDialog';
import { CredentialRow } from './CredentialRow';
@@ -34,10 +33,9 @@ export default function SettingsIntegrations({ project }: { project: ProjectDeta
return (
<>
{credentials.length === 0 ? (
- <SettingsListEmpty
- icon={KeyRound}
+ <EmptyState
title="No credentials yet"
- description="Add a credential for an AI provider or a tool integration so agents can use it."
+ description="Agents can't use an AI provider or a tool without one."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/issue-types/SettingsIssueTypes.tsx b/apps/web/src/features/settings/components/issue-types/SettingsIssueTypes.tsx
index 11bad56e..07e7a66e 100644
--- a/apps/web/src/features/settings/components/issue-types/SettingsIssueTypes.tsx
+++ b/apps/web/src/features/settings/components/issue-types/SettingsIssueTypes.tsx
@@ -2,7 +2,6 @@ import { useEffect, useState } from 'react';
import { Pencil, Trash2 } from 'lucide-react';
import { type IssueType, type ProjectDetail } from '@/lib/api';
import { DEFAULT_COLOR } from '@/utils/project';
-import { settingsSection } from '@/utils/settingsSections';
import { colorDot } from '@/components/common/fields/colorDot';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -15,10 +14,10 @@ import {
TableHeader,
TableRow,
} from '@/components/ui/table';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsColorField from '../crud/SettingsColorField';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
import { SettingsInlineForm } from '../crud/SettingsInlineForm';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { useSettingsCan } from '../../context/settingsPermission';
import {
useCreateIssueType,
@@ -26,8 +25,6 @@ import {
useUpdateIssueType,
} from '../../services/settings.service';
-const section = settingsSection('issue-types');
-
// The project's issue types. Adding is opened from the page header (the `adding`
// flag is lifted to the page); the add form itself is inline in this list.
export default function SettingsIssueTypes({
@@ -99,8 +96,7 @@ export default function SettingsIssueTypes({
if (showEmpty) {
return (
- <SettingsListEmpty
- icon={section.icon}
+ <EmptyState
title="No issue types yet"
description="Add the kinds of issues this project can hold, each with its own fields."
/>
diff --git a/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx b/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx
index 1a110142..2beb04ee 100644
--- a/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx
+++ b/apps/web/src/features/settings/components/schedules/SettingsSchedules.tsx
@@ -1,8 +1,9 @@
import { useEffect, useState } from 'react';
import Link from 'next/link';
-import { AlertCircle, Clock3 } from 'lucide-react';
import type { AgentSchedule, AgentScheduleInput, ProjectDetail } from '@/lib/api';
+import { aiAgentsPath } from '@/utils/paths';
import { Button } from '@/components/ui/button';
+import { EmptyState } from '@/components/common/page/EmptyState';
import {
useAgentSchedules,
useCreateAgentSchedule,
@@ -10,16 +11,13 @@ import {
useRunAgentSchedule,
useUpdateAgentSchedule,
} from '@/services/agentSchedules.service';
-import { settingsSection } from '@/utils/settingsSections';
import { useInternalAgents } from '../../hooks/useInternalAgents';
+import { useSettingsCan } from '../../context/settingsPermission';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { SettingsScheduleDialog } from './SettingsScheduleDialog';
import { SettingsScheduleRunsSheet } from './SettingsScheduleRunsSheet';
import { SettingsSchedulesTable } from './SettingsSchedulesTable';
-const section = settingsSection('schedules');
-
export default function SettingsSchedules({
project,
requestNew,
@@ -30,6 +28,7 @@ export default function SettingsSchedules({
onNewHandled: () => void;
}) {
const projectKey = project.project.key;
+ const can = useSettingsCan();
const schedulesQuery = useAgentSchedules(projectKey);
const agentsQuery = useInternalAgents(projectKey);
const schedules = schedulesQuery.data ?? [];
@@ -51,16 +50,10 @@ export default function SettingsSchedules({
if (agentsQuery.isError || schedulesQuery.isError) {
return (
- <div className="flex min-h-[320px] flex-col items-center justify-center gap-3 rounded-xl bg-muted/30 px-6 text-center">
- <div className="flex size-11 items-center justify-center rounded-xl bg-background text-muted-foreground shadow-sm">
- <AlertCircle className="size-5" />
- </div>
- <div>
- <p className="text-sm font-medium">Couldn&apos;t load schedules</p>
- <p className="mt-1 max-w-sm text-xs text-muted-foreground">
- Check your connection and try again.
- </p>
- </div>
+ <EmptyState
+ title="Couldn't load schedules"
+ description="Check your connection and try again."
+ >
<Button
size="sm"
variant="outline"
@@ -68,7 +61,7 @@ export default function SettingsSchedules({
>
Try again
</Button>
- </div>
+ </EmptyState>
);
}
@@ -85,20 +78,16 @@ export default function SettingsSchedules({
if (agents.length === 0) {
return (
- <div className="flex min-h-[320px] flex-col items-center justify-center gap-3 rounded-xl bg-muted/30 px-6 text-center">
- <div className="flex size-11 items-center justify-center rounded-xl bg-background text-muted-foreground shadow-sm">
- <Clock3 className="size-5" />
- </div>
- <div>
- <p className="text-sm font-medium">No agents to schedule</p>
- <p className="mt-1 max-w-sm text-xs text-muted-foreground">
- A schedule runs a task for an internal agent. Create one first, then come back here.
- </p>
- </div>
- <Button size="sm" className="h-8" asChild>
- <Link href={`/project/${projectKey}/ai-agents`}>Create an agent</Link>
- </Button>
- </div>
+ <EmptyState
+ title="No agents to schedule"
+ description="A schedule runs a task for one of your internal agents."
+ >
+ {can('edit') && (
+ <Button size="sm" asChild>
+ <Link href={aiAgentsPath(projectKey)}>Create an agent</Link>
+ </Button>
+ )}
+ </EmptyState>
);
}
@@ -119,10 +108,9 @@ export default function SettingsSchedules({
return (
<>
{schedules.length === 0 ? (
- <SettingsListEmpty
- icon={section.icon}
+ <EmptyState
title="No schedules yet"
- description="Run an agent task automatically on a recurring UTC schedule."
+ description="Pick an agent, a task, and how often it runs."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/features/settings/components/webhooks/SettingsWebhooks.tsx b/apps/web/src/features/settings/components/webhooks/SettingsWebhooks.tsx
index 1bf88cc9..4a81247d 100644
--- a/apps/web/src/features/settings/components/webhooks/SettingsWebhooks.tsx
+++ b/apps/web/src/features/settings/components/webhooks/SettingsWebhooks.tsx
@@ -6,15 +6,12 @@ import {
useUpdateWebhook,
useDeleteWebhook,
} from '@/services/webhooks.service';
-import { settingsSection } from '@/utils/settingsSections';
+import { EmptyState } from '@/components/common/page/EmptyState';
import SettingsConfirmDeleteDialog from '../crud/SettingsConfirmDeleteDialog';
-import { SettingsListEmpty } from '../crud/SettingsListEmpty';
import { SettingsWebhookDialog, type WebhookFormValue } from './SettingsWebhookDialog';
import { SettingsWebhooksTable } from './SettingsWebhooksTable';
import { SettingsWebhookDeliveriesSheet } from './SettingsWebhookDeliveriesSheet';
-const section = settingsSection('webhooks');
-
// Project settings tab for outgoing webhooks. Each webhook posts subscribed
// project events to its URL, signed with a per-webhook secret. Delivery is handled
// by the server; this tab manages the subscriptions.
@@ -61,10 +58,9 @@ export default function SettingsWebhooks({
return (
<>
{webhooks.length === 0 ? (
- <SettingsListEmpty
- icon={section.icon}
+ <EmptyState
title="No webhooks yet"
- description="Send project events to an external URL, signed with a per-webhook secret."
+ description="Set a payload URL and choose which events to send."
/>
) : (
<div className="space-y-4">
diff --git a/apps/web/src/utils/settingsSections.ts b/apps/web/src/utils/settingsSections.ts
index aa725277..99d85b91 100644
--- a/apps/web/src/utils/settingsSections.ts
+++ b/apps/web/src/utils/settingsSections.ts
@@ -100,8 +100,7 @@ export const SETTINGS_SECTIONS: SettingsSection[] = [
{
slug: 'actions',
label: 'Actions',
- description:
- 'One-click actions on an issue that apply field changes when its conditions match.',
+ description: 'Buttons on an issue that set fields in one click.',
icon: Zap,
resource: 'actions',
group: 'automation',
@@ -109,7 +108,7 @@ export const SETTINGS_SECTIONS: SettingsSection[] = [
{
slug: 'schedules',
label: 'Schedules',
- description: 'Run recurring agent tasks automatically. Schedule times use UTC.',
+ description: 'Run agent tasks on a recurring schedule.',
icon: Clock3,
resource: 'ai_agents',
group: 'ai-team',
@@ -130,8 +129,7 @@ export const SETTINGS_SECTIONS: SettingsSection[] = [
export const AI_AGENTS_SECTION: SettingsSection = {
slug: 'ai-agents',
label: 'Agents',
- description:
- 'Bot users you can delegate issues to, driven through the API or by the built-in runtime.',
+ description: 'Bot users you can delegate issues to.',
icon: Bot,
resource: 'ai_agents',
group: 'ai',
@@ -141,7 +139,7 @@ export const INTEGRATIONS_SECTION: SettingsSection = {
slug: 'integrations',
label: 'Integrations',
description:
- 'Credentials for the services agents use: AI provider keys and tool integrations (Jina, Firecrawl, Telegram). Stored encrypted and never shown again.',
+ 'Credentials your agents use to reach AI providers and tools. Stored encrypted and never shown again.',
icon: KeyRound,
resource: 'integrations',
group: 'ai',
@@ -150,8 +148,7 @@ export const INTEGRATIONS_SECTION: SettingsSection = {
export const AGENT_SKILLS_SECTION: SettingsSection = {
slug: 'agent-skills',
label: 'Skills',
- description:
- 'Reusable instructions given to internal agents, loaded on demand. Write markdown, upload a file, or import from GitHub.',
+ description: 'Reusable instructions internal agents load on demand.',
icon: BookText,
resource: 'agent_skills',
group: 'ai',
@@ -160,8 +157,7 @@ export const AGENT_SKILLS_SECTION: SettingsSection = {
export const AGENT_TOOLS_SECTION: SettingsSection = {
slug: 'agent-tools',
label: 'Tools',
- description:
- 'Tools agents can call, each connected to an integration credential. Configure a tool once, then enable it on an agent.',
+ description: 'Tools agents can call, each connected to an integration credential.',
icon: Wrench,
resource: 'agent_tools',
group: 'ai',