Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(content): show loading without a spinning ring anywhere in Content (CE-026) (#1403)

Cihan940efff22df2
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx
index 59ebf0ce9..f5324e8d6 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/_webhook-settings.tsx
@@ -13,7 +13,8 @@ import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { Loader2, CheckCircle2, XCircle } from 'lucide-react';
+import { LoadingDots } from '@/components/ui/loading-dots';
+import { CheckCircle2, XCircle } from 'lucide-react';
import { getWebhookConfig, saveWebhookConfig, testWebhook } from '@/lib/actions/content';
import { toast } from 'sonner';
@@ -129,7 +130,7 @@ export function WebhookSettingsDialog({ open, onOpenChange, brandId }: WebhookSe
{loading ? (
<div className="flex justify-center py-8">
- <Loader2 className="h-6 w-6 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : (
<div className="space-y-4">
@@ -232,7 +233,7 @@ export function WebhookSettingsDialog({ open, onOpenChange, brandId }: WebhookSe
disabled={testing || !url.trim()}
className="gap-2"
>
- {testing && <Loader2 className="h-3.5 w-3.5 animate-spin" />}
+ {testing && <LoadingDots />}
{testing ? t('testing') : t('test')}
</Button>
<Button
@@ -241,7 +242,7 @@ export function WebhookSettingsDialog({ open, onOpenChange, brandId }: WebhookSe
disabled={saving || !url.trim()}
className="gap-2"
>
- {saving && <Loader2 className="h-3.5 w-3.5 animate-spin" />}
+ {saving && <LoadingDots />}
{saving ? t('saving') : t('save')}
</Button>
</div>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_add-source-dialog.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_add-source-dialog.tsx
index 3a156c4ee..528dc62ba 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_add-source-dialog.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_add-source-dialog.tsx
@@ -3,7 +3,6 @@
import { useEffect, useMemo, useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Loader2 } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
Combobox,
@@ -26,6 +25,7 @@ import {
} from '@/components/ui/dialog';
import { Input } from '@/components/ui/input';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
+import { LoadingDots } from '@/components/ui/loading-dots';
import {
addDraftSource,
getContentStartOptions,
@@ -206,7 +206,7 @@ export function AddSourceDialog({
>
{kind === 'prompt' && !prompts ? (
<span className="flex items-center gap-2 text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
{t('loading')}
</span>
) : (
@@ -244,7 +244,7 @@ export function AddSourceDialog({
{t('cancel')}
</Button>
<Button disabled={!ready || saving} onClick={() => void add()}>
- {saving && <Loader2 className="h-3.5 w-3.5 animate-spin" />}
+ {saving && <LoadingDots />}
{t('submit')}
</Button>
</DialogFooter>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx
index d5dc4406a..1ab194203 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_brief-tab.tsx
@@ -3,10 +3,11 @@
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Bot, Loader2, Pencil, Plus, Trash2 } from 'lucide-react';
+import { Bot, Pencil, Plus, Trash2 } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { saveDraftBrief } from '@/lib/actions/content-drafts';
import { MAX_BRIEF_SECTIONS, builtFromCount, type DraftBrief } from '@/lib/content/brief';
import type { DraftMethod } from '@/lib/content/drafts';
@@ -90,7 +91,7 @@ export function BriefTab({
if (state.status === 'loading') {
return (
<div className="flex justify-center py-8" aria-busy="true">
- <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ <LoadingDots className="text-muted-foreground" />
</div>
);
}
@@ -455,7 +456,7 @@ function BriefEditor({
</label>
<div className="flex gap-2">
<Button size="sm" disabled={saving} onClick={() => void save()}>
- {saving && <Loader2 className="h-3.5 w-3.5 animate-spin" />}
+ {saving && <LoadingDots />}
{t('save')}
</Button>
<Button size="sm" variant="outline" disabled={saving} onClick={onCancel}>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
index db5a978d7..3494ffd14 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
@@ -9,7 +9,7 @@ import StarterKit from '@tiptap/starter-kit';
import { TableKit } from '@tiptap/extension-table';
import Image from '@tiptap/extension-image';
import { CharacterCount, Placeholder } from '@tiptap/extensions';
-import { ArrowLeft, Bot, Check, Copy, Loader2, PanelRight, Target, X } from 'lucide-react';
+import { ArrowLeft, Bot, Check, Copy, PanelRight, Target, X } from 'lucide-react';
import { Link } from '@/i18n/navigation';
import { Button } from '@/components/ui/button';
import { buttonVariants } from '@/components/ui/button-variants';
@@ -21,6 +21,7 @@ import {
DialogHeader,
DialogTitle,
} from '@/components/ui/dialog';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { PLATFORM_LABELS } from '@/config/platform-labels';
import { DraftMethodBadge, DraftStatusBadge } from '@/components/content/draft-badges';
import {
@@ -1296,11 +1297,7 @@ export function DraftEditor({
}
onClick={markReady}
>
- {marking ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- !canMarkReady && <Check className="h-3.5 w-3.5" />
- )}
+ {marking ? <LoadingDots /> : !canMarkReady && <Check className="h-3.5 w-3.5" />}
{t('markReady')}
</Button>
<Button
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_history-menu.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_history-menu.tsx
index cd8fef428..fe68e8128 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_history-menu.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_history-menu.tsx
@@ -2,7 +2,7 @@
import { useState } from 'react';
import { useFormatter, useNow, useTranslations } from 'next-intl';
-import { History, Loader2, RotateCcw } from 'lucide-react';
+import { History, RotateCcw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
@@ -13,6 +13,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { getDraftVersions } from '@/lib/actions/content-drafts';
import { HISTORY_DAYS, type DraftVersion } from '@/lib/content/history';
@@ -85,7 +86,7 @@ export function HistoryMenu({
</div>
{versions === 'loading' ? (
<p className="flex items-center gap-2 px-1.5 py-2 text-xs text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
{t('loading')}
</p>
) : versions === 'failed' ? (
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_impact-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_impact-tab.tsx
index db9aacf49..9380c0b54 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_impact-tab.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_impact-tab.tsx
@@ -2,9 +2,10 @@
import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
-import { Check, ExternalLink, Loader2 } from 'lucide-react';
+import { Check, ExternalLink } from 'lucide-react';
import { Link } from '@/i18n/navigation';
import { Button } from '@/components/ui/button';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { getContentImpact, getContentResults } from '@/lib/actions/content-drafts';
import {
DEFAULT_IMPACT_PERIOD,
@@ -121,7 +122,7 @@ export function ImpactTab({
{!current ? (
<div className="flex justify-center py-8" aria-busy="true">
- <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ <LoadingDots className="text-muted-foreground" />
</div>
) : current.failed || !impact ? (
<p className="flex items-center gap-2 text-xs text-muted-foreground">
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_sources-tab.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_sources-tab.tsx
index 4d02d9c0d..5519244c6 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_sources-tab.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_sources-tab.tsx
@@ -11,9 +11,10 @@ import {
} from 'react';
import { useFormatter, useNow, useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Loader2, Plus, RefreshCw } from 'lucide-react';
+import { Plus, RefreshCw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { setDraftSourceIncluded } from '@/lib/actions/content-drafts';
import { platformNames } from '@/lib/content/impact';
import {
@@ -118,7 +119,7 @@ export function SourcesTab({
if (!read) {
return (
<div className="flex justify-center py-8" aria-busy="true">
- <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ <LoadingDots className="text-muted-foreground" />
</div>
);
}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_working-dots.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_working-dots.tsx
index b0b84824b..6594e9172 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_working-dots.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_working-dots.tsx
@@ -1,19 +1,10 @@
+import { LoadingDots } from '@/components/ui/loading-dots';
import { cn } from '@/lib/utils';
/**
- * The Content Agent at work (v1.1 CE-035): three dots that bounce in turn, in
- * the text's color — never a spinning ring. Still with reduced motion.
+ * The Content Agent at work (v1.1 CE-035): its dots, after "Content Agent is
+ * working" — never a spinning ring. Still with reduced motion.
*/
export function WorkingDots({ className }: { className?: string }) {
- return (
- <span aria-hidden className={cn('ml-1.5 inline-flex gap-[3px] align-middle', className)}>
- {[0, 1, 2].map((i) => (
- <span
- key={i}
- className="h-1 w-1 animate-agent-dot rounded-full bg-current opacity-25 motion-reduce:animate-none"
- style={{ animationDelay: `${i * 0.2}s` }}
- />
- ))}
- </span>
- );
+ return <LoadingDots className={cn('ml-1.5', className)} />;
}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.tsx
index 34948db29..3fa1e62df 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/page.tsx
@@ -3,10 +3,10 @@
import { useCallback, useEffect, useState } from 'react';
import { useParams } from 'next/navigation';
import { useTranslations } from 'next-intl';
-import { Loader2 } from 'lucide-react';
import { Link } from '@/i18n/navigation';
import { Button } from '@/components/ui/button';
import { buttonVariants } from '@/components/ui/button-variants';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { getContentDraft } from '@/lib/actions/content-drafts';
import { AGENT_POLL_MS, CONTENT_LIBRARY_PATH, type ContentDraft } from '@/lib/content/drafts';
import { useBrandStore } from '@/stores/use-brand-store';
@@ -92,7 +92,7 @@ export default function ContentEditorPage() {
<div className="-m-6 flex h-[calc(100vh-4rem)] flex-col md:h-screen">
{!current ? (
<div className="flex flex-1 items-center justify-center" aria-busy="true">
- <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : current.draft && writing ? (
<AgentWriting
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_library-export.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_library-export.tsx
index d40882a7f..d1473a31a 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/library/_library-export.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/library/_library-export.tsx
@@ -3,7 +3,7 @@
import { useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { ChevronDown, Download, FileSpreadsheet, FileText, FileType, Loader2 } from 'lucide-react';
+import { ChevronDown, Download, FileSpreadsheet, FileText, FileType } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
@@ -11,6 +11,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { BYTE_ORDER_MARK } from '@/lib/action-center/export';
import { assigneeLabel } from '@/lib/action-center/display';
import { getContentDraftPages, type DraftPage } from '@/lib/actions/content-drafts';
@@ -152,11 +153,7 @@ export function LibraryExportMenu({
disabled={disabled || exporting}
title={t('hint')}
>
- {exporting ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Download className="h-4 w-4" />
- )}
+ {exporting ? <LoadingDots /> : <Download className="h-4 w-4" />}
{t('button')}
<ChevronDown className="h-3.5 w-3.5 text-muted-foreground" />
</DropdownMenuTrigger>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx
index 7e1871aca..9617fc323 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/library/page.tsx
@@ -3,7 +3,7 @@
import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Loader2, Plus } from 'lucide-react';
+import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
import {
@@ -22,6 +22,7 @@ import {
SelectValue,
} from '@/components/ui/select';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { NewContentDialog } from '@/components/content/new-content-dialog';
import { useUserRole } from '@/hooks/use-user-role';
import {
@@ -274,7 +275,7 @@ export default function ContentLibraryPage() {
</div>
) : drafts === null ? (
<div className="flex items-center justify-center py-12" aria-busy="true">
- <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : listed.length === 0 && inTab.length > 0 ? (
<p className="px-6 py-12 text-center text-sm text-muted-foreground">
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx
index 52cfb02e2..62d69985f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx
@@ -51,7 +51,6 @@ import {
Check,
BarChart3,
Search,
- Loader2,
X,
Settings2,
Trash2,
@@ -115,6 +114,7 @@ import {
type NewOpportunitiesInput,
} from '@/components/content/new-opportunities-dialog';
import { Skeleton } from '@/components/ui/skeleton';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { PAGE_SIZE, TablePager, usePagination } from '@/components/table-pager';
import { toCsv } from '@/lib/csv';
import { readUrlChoice, writeUrlParams } from '@/lib/url-state';
@@ -872,7 +872,7 @@ export default function ContentPage() {
className="gap-2"
title={limitReached ? t('newLimitTooltip', { date: resetsOn }) : undefined}
>
- {generating ? <Loader2 className="h-4 w-4 animate-spin" /> : <Plus className="h-4 w-4" />}
+ {generating ? <LoadingDots /> : <Plus className="h-4 w-4" />}
{generating ? t('generating') : t('new')}
</Button>
);
@@ -1063,11 +1063,7 @@ export default function ContentPage() {
size="sm"
className="gap-2"
>
- {exporting ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Download className="h-4 w-4" />
- )}
+ {exporting ? <LoadingDots /> : <Download className="h-4 w-4" />}
{tCommon('exportCsv')}
</Button>
<Button
@@ -1084,7 +1080,7 @@ export default function ContentPage() {
{loading && opportunities.length === 0 ? (
<div className="flex items-center justify-center min-h-[300px]">
- <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : opportunities.length === 0 && !hasActiveFilters ? (
<Card>
@@ -1405,11 +1401,7 @@ export default function ContentPage() {
onClick={handleBulkSend}
disabled={bulkSending}
>
- {bulkSending ? (
- <Loader2 className="h-3 w-3 animate-spin" />
- ) : (
- <Send className="h-3 w-3" />
- )}
+ {bulkSending ? <LoadingDots /> : <Send className="h-3 w-3" />}
{t('bulk.sendAll')}
</Button>
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.tsx
index 8b7cf99cf..c2109a373 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/content/plan/page.tsx
@@ -3,9 +3,10 @@
import { useEffect, useMemo, useState } from 'react';
import { useFormatter, useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { Loader2, Plus } from 'lucide-react';
+import { Plus } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent } from '@/components/ui/card';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { NewContentDialog, type DialogPreset } from '@/components/content/new-content-dialog';
import {
getContentPlan,
@@ -365,7 +366,7 @@ export default function ContentPlanPage() {
{loading ? (
<div className="flex items-center justify-center py-16" aria-busy="true">
- <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : (
<>
@@ -418,7 +419,7 @@ export default function ContentPlanPage() {
</div>
) : !plan ? (
<div className="flex items-center justify-center py-12" aria-busy="true">
- <Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
) : rows.length === 0 ? (
<p className="px-6 py-12 text-center text-sm text-muted-foreground">
diff --git a/web/src/components/content/draft-badges.tsx b/web/src/components/content/draft-badges.tsx
index c2a39b349..7050e47e6 100644
--- a/web/src/components/content/draft-badges.tsx
+++ b/web/src/components/content/draft-badges.tsx
@@ -1,8 +1,8 @@
'use client';
import { useTranslations } from 'next-intl';
-import { Loader2 } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { cn } from '@/lib/utils';
import type { AgentState, DraftMethod, DraftStatus } from '@/lib/content/drafts';
@@ -61,7 +61,7 @@ export function AgentStateBadge({ state }: { state: Exclude<AgentState, null> })
: 'border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400'
}
>
- {state === 'writing' && <Loader2 aria-hidden className="h-3 w-3 animate-spin" />}
+ {state === 'writing' && <LoadingDots />}
{t(state)}
</Badge>
);
diff --git a/web/src/components/content/new-content-dialog.tsx b/web/src/components/content/new-content-dialog.tsx
index 818c32d63..5123e8578 100644
--- a/web/src/components/content/new-content-dialog.tsx
+++ b/web/src/components/content/new-content-dialog.tsx
@@ -3,7 +3,7 @@
import { useEffect, useRef, useState } from 'react';
import { useTranslations } from 'next-intl';
import { toast } from 'sonner';
-import { ArrowLeft, FileText, Loader2, X } from 'lucide-react';
+import { ArrowLeft, FileText, X } from 'lucide-react';
import { useRouter } from '@/i18n/navigation';
import { Button } from '@/components/ui/button';
import {
@@ -36,6 +36,7 @@ import {
} from '@/components/ui/select';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { Textarea } from '@/components/ui/textarea';
+import { LoadingDots } from '@/components/ui/loading-dots';
import {
createContentDraft,
getContentOverlap,
@@ -748,7 +749,7 @@ export function NewContentDialog({
{t('back')}
</Button>
<Button onClick={() => void openEditor()} disabled={opening}>
- {opening && <Loader2 className="h-4 w-4 animate-spin" />}
+ {opening && <LoadingDots />}
{t(
who === 'team'
? 'start.sendToTeam'
@@ -834,7 +835,7 @@ export function NewContentDialog({
</span>
) : (
<span className="flex items-center gap-2 text-muted-foreground">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
{t('loading')}
</span>
)}
@@ -945,7 +946,7 @@ export function NewContentDialog({
disabled={reading}
/>
<Button type="submit" variant="outline" disabled={reading || !pageUrl.trim()}>
- {reading && <Loader2 className="h-4 w-4 animate-spin" />}
+ {reading && <LoadingDots />}
{t(reading ? 'content.importing' : 'content.import')}
</Button>
</form>
@@ -992,7 +993,7 @@ export function NewContentDialog({
className="flex w-full flex-col items-center gap-1 rounded-lg border border-dashed px-3 py-6 text-center text-sm transition-colors hover:bg-muted/50"
>
{reading ? (
- <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+ <LoadingDots className="text-muted-foreground" />
) : (
<span className="font-medium">{t('content.choose')}</span>
)}
@@ -1165,7 +1166,7 @@ function OverlapCheck({
<Label>{t('label')}</Label>
{!read ? (
<p className="flex items-center gap-2 text-xs text-muted-foreground" aria-busy="true">
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
{t('checking')}
</p>
) : read.failed || !overlap ? (
diff --git a/web/src/components/content/new-opportunities-dialog.tsx b/web/src/components/content/new-opportunities-dialog.tsx
index 1dc67665f..bc8e76e88 100644
--- a/web/src/components/content/new-opportunities-dialog.tsx
+++ b/web/src/components/content/new-opportunities-dialog.tsx
@@ -2,7 +2,7 @@
import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
-import { Loader2, Minus, Plus, Sparkles } from 'lucide-react';
+import { Minus, Plus, Sparkles } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -31,6 +31,7 @@ import {
ComboboxValue,
} from '@/components/ui/combobox';
import { Textarea } from '@/components/ui/textarea';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { cn } from '@/lib/utils';
import { getTopics } from '@/lib/actions/topic';
import { getBrandPrompts } from '@/lib/actions/tracking';
@@ -277,11 +278,7 @@ function NewOpportunitiesForm({
{tCommon('cancel')}
</Button>
<Button onClick={submit} disabled={!canSubmit} className="gap-2">
- {submitting ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Sparkles className="h-4 w-4" />
- )}
+ {submitting ? <LoadingDots /> : <Sparkles className="h-4 w-4" />}
{t('generate', { count })}
</Button>
</DialogFooter>
diff --git a/web/src/components/content/opportunity-actions.tsx b/web/src/components/content/opportunity-actions.tsx
index 725167f50..16ec10db3 100644
--- a/web/src/components/content/opportunity-actions.tsx
+++ b/web/src/components/content/opportunity-actions.tsx
@@ -15,7 +15,6 @@ import {
FileText,
ListChecks,
ListPlus,
- Loader2,
MoreHorizontal,
RefreshCw,
RotateCcw,
@@ -34,6 +33,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { LoadingDots } from '@/components/ui/loading-dots';
/**
* The opportunity panel's actions (the user's spec): three in front, in this
@@ -116,11 +116,7 @@ export function OpportunityActions({
disabled={sendToActions.disabled}
className="gap-2"
>
- {sendToActions.sending ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Target className="h-4 w-4" />
- )}
+ {sendToActions.sending ? <LoadingDots /> : <Target className="h-4 w-4" />}
{t('sendToActions')}
</Button>
)
@@ -139,11 +135,7 @@ export function OpportunityActions({
title={brief.blockedReason ?? undefined}
className="gap-2"
>
- {brief.generating ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Sparkles className="h-4 w-4" />
- )}
+ {brief.generating ? <LoadingDots /> : <Sparkles className="h-4 w-4" />}
{brief.generating ? t('generatingBrief') : t('generateBrief')}
</Button>
)}
@@ -165,11 +157,7 @@ export function OpportunityActions({
onClick={content.onStart}
disabled={draftId === undefined}
>
- {draftId === undefined ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <FilePen className="h-4 w-4" />
- )}
+ {draftId === undefined ? <LoadingDots /> : <FilePen className="h-4 w-4" />}
{t('sendToEditor')}
</Button>
))}
@@ -212,7 +200,7 @@ export function OpportunityActions({
disabled={plan.prioritized === undefined}
>
{plan.prioritized === undefined ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
) : plan.prioritized ? (
<ListChecks className="h-3.5 w-3.5" />
) : (
@@ -228,11 +216,7 @@ export function OpportunityActions({
disabled={alternative.running}
title={t('alternative.hint')}
>
- {alternative.running ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <RefreshCw className="h-3.5 w-3.5" />
- )}
+ {alternative.running ? <LoadingDots /> : <RefreshCw className="h-3.5 w-3.5" />}
{alternative.running ? t('alternative.running') : t('alternative.button')}
</DropdownMenuItem>
)}
@@ -242,11 +226,7 @@ export function OpportunityActions({
onClick={workflow.onSend}
disabled={workflow.sending}
>
- {workflow.sending ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <Send className="h-3.5 w-3.5" />
- )}
+ {workflow.sending ? <LoadingDots /> : <Send className="h-3.5 w-3.5" />}
{workflow.sending
? t('sending')
: workflow.sentBefore
diff --git a/web/src/components/content/opportunity-angle-dialogs.tsx b/web/src/components/content/opportunity-angle-dialogs.tsx
index fee7e8c1a..ee1b82403 100644
--- a/web/src/components/content/opportunity-angle-dialogs.tsx
+++ b/web/src/components/content/opportunity-angle-dialogs.tsx
@@ -2,7 +2,7 @@
import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
-import { Loader2, RefreshCw } from 'lucide-react';
+import { RefreshCw } from 'lucide-react';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -13,6 +13,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
import { Textarea } from '@/components/ui/textarea';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { cn } from '@/lib/utils';
import { getContentUsage } from '@/lib/actions/content';
@@ -126,11 +127,7 @@ function AlternativeForm({
{tCommon('cancel')}
</Button>
<Button onClick={submit} disabled={submitting || noneLeft} className="gap-2">
- {submitting ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <RefreshCw className="h-4 w-4" />
- )}
+ {submitting ? <LoadingDots /> : <RefreshCw className="h-4 w-4" />}
{t('generate')}
</Button>
</DialogFooter>
diff --git a/web/src/components/content/opportunity-basket.tsx b/web/src/components/content/opportunity-basket.tsx
index 58bd0cd1f..79f10fb83 100644
--- a/web/src/components/content/opportunity-basket.tsx
+++ b/web/src/components/content/opportunity-basket.tsx
@@ -2,12 +2,13 @@
import { useEffect, useState } from 'react';
import { useTranslations } from 'next-intl';
-import { Boxes, ExternalLink, FileText, Gauge, Layers, Loader2, Search } from 'lucide-react';
+import { Boxes, ExternalLink, FileText, Gauge, Layers, Search } from 'lucide-react';
import { Link } from '@/i18n/navigation';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Skeleton } from '@/components/ui/skeleton';
+import { LoadingDots } from '@/components/ui/loading-dots';
import { useAssetTypeLabel } from '@/hooks/use-asset-type-label';
import { getOpportunityActions, type OpportunityActionResult } from '@/lib/actions/content';
import type {
@@ -298,11 +299,7 @@ export function AssetsCard({
disabled={sendingKey !== null && sendingKey !== undefined}
onClick={() => onSend(a.key)}
>
- {sendingKey === a.key ? (
- <Loader2 className="h-3 w-3 animate-spin" />
- ) : (
- t('sendAsset')
- )}
+ {sendingKey === a.key ? <LoadingDots /> : t('sendAsset')}
</Button>
)
)}
diff --git a/web/src/components/content/opportunity-detail.tsx b/web/src/components/content/opportunity-detail.tsx
index 3f0d10d1e..bceda434c 100644
--- a/web/src/components/content/opportunity-detail.tsx
+++ b/web/src/components/content/opportunity-detail.tsx
@@ -8,7 +8,6 @@ import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
ArrowLeft,
- Loader2,
TrendingUp,
Eye,
Users,
@@ -37,6 +36,7 @@ import {
} from '@/lib/actions/content';
import { EstimateBadge, EstimateRange } from '@/components/prompts/volume-estimate';
import { Skeleton } from '@/components/ui/skeleton';
+import { LoadingDots } from '@/components/ui/loading-dots';
import {
AlternativeDialog,
DismissReasonDialog,
@@ -418,7 +418,7 @@ export function OpportunityDetail({
if (loading) {
return (
<div className="flex items-center justify-center min-h-[400px]">
- <Loader2 className="h-8 w-8 animate-spin text-muted-foreground" />
+ <LoadingDots size="md" className="text-muted-foreground" />
</div>
);
}
@@ -859,11 +859,7 @@ export function OpportunityDetail({
disabled={generatingBrief}
className="gap-2"
>
- {generatingBrief ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Sparkles className="h-4 w-4" />
- )}
+ {generatingBrief ? <LoadingDots /> : <Sparkles className="h-4 w-4" />}
{generatingBrief ? 'Generating...' : 'Generate Content Brief'}
</Button>
{quotaLimited && (
diff --git a/web/src/components/content/opportunity-row-menu.tsx b/web/src/components/content/opportunity-row-menu.tsx
index 662537435..11e279821 100644
--- a/web/src/components/content/opportunity-row-menu.tsx
+++ b/web/src/components/content/opportunity-row-menu.tsx
@@ -7,7 +7,6 @@ import {
FileText,
ListChecks,
ListPlus,
- Loader2,
MoreHorizontal,
RotateCcw,
Send,
@@ -21,6 +20,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import { LoadingDots } from '@/components/ui/loading-dots';
/**
* An Opportunities list row's actions, in one "…" menu as the panel keeps
@@ -87,11 +87,7 @@ export function OpportunityRowMenu({
onClick={editor.onStart}
disabled={draftId === undefined}
>
- {draftId === undefined ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <FilePen className="h-3.5 w-3.5" />
- )}
+ {draftId === undefined ? <LoadingDots /> : <FilePen className="h-3.5 w-3.5" />}
{t('sendToEditor')}
</DropdownMenuItem>
)
@@ -103,7 +99,7 @@ export function OpportunityRowMenu({
disabled={plan.prioritized === undefined}
>
{plan.prioritized === undefined ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
+ <LoadingDots />
) : plan.prioritized ? (
<ListChecks className="h-3.5 w-3.5" />
) : (
@@ -114,11 +110,7 @@ export function OpportunityRowMenu({
)}
{workflow && (
<DropdownMenuItem className="gap-2" onClick={workflow.onSend} disabled={workflow.sending}>
- {workflow.sending ? (
- <Loader2 className="h-3.5 w-3.5 animate-spin" />
- ) : (
- <Send className="h-3.5 w-3.5" />
- )}
+ {workflow.sending ? <LoadingDots /> : <Send className="h-3.5 w-3.5" />}
{t('sendToWorkflow')}
</DropdownMenuItem>
)}
diff --git a/web/src/components/ui/loading-dots.test.tsx b/web/src/components/ui/loading-dots.test.tsx
new file mode 100644
index 000000000..0706d4041
--- /dev/null
+++ b/web/src/components/ui/loading-dots.test.tsx
@@ -0,0 +1,19 @@
+import { renderToStaticMarkup } from 'react-dom/server';
+import { describe, expect, it } from 'vitest';
+import { LoadingDots } from './loading-dots';
+
+/** The dots say nothing to a screen reader, and stay visible with reduced motion. */
+
+describe('LoadingDots', () => {
+ it('is hidden from screen readers and stays visible without motion', () => {
+ const html = renderToStaticMarkup(<LoadingDots />);
+ const root = new DOMParser().parseFromString(html, 'text/html').body.firstElementChild!;
+ expect(root.getAttribute('aria-hidden')).toBe('true');
+ const dots = [...root.children];
+ expect(dots).toHaveLength(3);
+ for (const dot of dots) {
+ expect(dot.className).toContain('motion-reduce:animate-none');
+ expect(dot.className).toContain('motion-reduce:opacity-60');
+ }
+ });
+});
diff --git a/web/src/components/ui/loading-dots.tsx b/web/src/components/ui/loading-dots.tsx
new file mode 100644
index 000000000..a3b18cf33
--- /dev/null
+++ b/web/src/components/ui/loading-dots.tsx
@@ -0,0 +1,38 @@
+import { cn } from '@/lib/utils';
+
+/**
+ * Something loading or at work, without a spinning ring (Content Editor
+ * brief: "no spinning ring anywhere"): three dots that bounce in turn, in the
+ * text's color. Still with reduced motion. `md` for a page or a panel
+ * loading, `sm` (the default) beside a button's label.
+ */
+export function LoadingDots({
+ size = 'sm',
+ className,
+}: {
+ size?: 'sm' | 'md';
+ className?: string;
+}) {
+ return (
+ <span
+ aria-hidden
+ className={cn(
+ 'inline-flex shrink-0 items-center align-middle',
+ size === 'md' ? 'gap-1' : 'gap-[3px]',
+ className,
+ )}
+ >
+ {[0, 1, 2].map((i) => (
+ <span
+ key={i}
+ className={cn(
+ // Still with reduced motion, at an opacity that stays visible on muted text.
+ 'animate-agent-dot rounded-full bg-current opacity-25 motion-reduce:animate-none motion-reduce:opacity-60',
+ size === 'md' ? 'h-1.5 w-1.5' : 'h-1 w-1',
+ )}
+ style={{ animationDelay: `${i * 0.2}s` }}
+ />
+ ))}
+ </span>
+ );
+}