From 8e0e82d573083dc59ccc50b239181ca72ea996ec Mon Sep 17 00:00:00 2001
From: iza <59828082+izadoesdev@users.noreply.github.com>
Date: Tue, 8 Sep 2026 20:08:36 +0300
Subject: [PATCH] fix(dashboard): match business context to organization
settings
---
.agents/skills/databuddy-internal/SKILL.md | 1 +
.../components/business-context-editor.tsx | 460 ++++++++++--------
.../components/business-context-settings.tsx | 142 +++---
.../regressions/business-context.spec.ts | 9 +-
4 files changed, 338 insertions(+), 274 deletions(-)
diff --git a/.agents/skills/databuddy-internal/SKILL.md b/.agents/skills/databuddy-internal/SKILL.md
index 0d63c6b03..f9ee0f53e 100644
--- a/.agents/skills/databuddy-internal/SKILL.md
+++ b/.agents/skills/databuddy-internal/SKILL.md
@@ -132,6 +132,7 @@ Read [codebase-map.md](./references/codebase-map.md) when you need deeper routin
### Dashboard work
- Start in `apps/dashboard`
+- Organization settings should match `organizations/components/general-settings.tsx`: the same `max-w-2xl` column, shared `Card` headers/content, compact fields, and `TopBar.Actions` for Save. Compare actual neighboring pages visually before claiming design consistency; shared inputs alone are not enough.
- The Feature Flags list is a dense data table; keep flag identity metadata clean and place activity telemetry in a dedicated labeled column with its accuracy caveat in the Activity header tooltip.
- Keep large page-owned settings sheets and dialogs in adjacent feature files; route components should own page data and layout rather than embedding unrelated form lifecycles.
- For dashboard navigation audits, check all route surfaces: `components/layout/navigation/navigation-config.tsx`, `components/ui/command-search.tsx`, and local `PageNavigation` layouts under `app/**/layout.tsx` before calling a page orphaned.
diff --git a/apps/dashboard/app/(main)/organizations/components/business-context-editor.tsx b/apps/dashboard/app/(main)/organizations/components/business-context-editor.tsx
index 18e9670b2..756341605 100644
--- a/apps/dashboard/app/(main)/organizations/components/business-context-editor.tsx
+++ b/apps/dashboard/app/(main)/organizations/components/business-context-editor.tsx
@@ -6,10 +6,17 @@ import {
type BusinessContextSettings,
businessContextIsGenerating,
} from "@databuddy/shared/organization-business-context";
-import { Button, Field, Textarea, dayjs } from "@databuddy/ui";
+import { Button, Card, Field, Textarea, dayjs } from "@databuddy/ui";
import { Dialog, DropdownMenu } from "@databuddy/ui/client";
-import { CaretDownIcon, WandSparkleIcon } from "@databuddy/ui/icons";
+import {
+ ArrowSquareOutIcon,
+ CaretDownIcon,
+ FileTextIcon,
+ FloppyDiskIcon,
+ WandSparkleIcon,
+} from "@databuddy/ui/icons";
import { useEffect, useRef, useState } from "react";
+import { TopBar } from "@/components/layout/top-bar";
interface EditableBrief {
content: string;
@@ -35,21 +42,40 @@ function Sources({ sources }: { sources: BusinessBrief["sources"] }) {
return null;
}
return (
-
- {generation.error ||
- "AI couldn't finish this draft. Try generating again, or keep editing."}
-
- )}
- {notice &&
{notice}
}
-
-
- Business brief
-
- {canEdit
- ? "Edit anything. Your saved brief stays in use until you save changes."
- : "This is the context your agent uses. Organization admins can update it."}
-
-
- {conflict && canEdit && (
-
-
- A newer brief was saved. Review it before saving your edits.
-
+ {dirty && (
- {dirty && (
+ )}
+
+ )}
+
+
+ Business context
+
+ What you do, who you serve, and what matters to your business
+
+
+
+ {canEdit && (
+
+ {generation.error ||
+ "AI couldn't finish this draft. Try generating again, or keep editing."}
+
+ )}
+ {notice &&
{notice}
}
+
+
+ Business brief
+
+ {canEdit
+ ? "Used by Databunny to interpret your analytics. Changes apply when saved."
+ : "Used by Databunny to interpret your analytics. Organization admins can update it."}
+
+
+ {conflict && canEdit && (
+
+
+ A newer brief was saved. Review it before saving your edits.
+