Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

add storied on ContactEdit

ThieryMichel31847c31b4d5
diff --git a/registry.json b/registry.json
index 1825eed7..46cadd18 100644
--- a/registry.json
+++ b/registry.json
@@ -709,6 +709,10 @@
"path": "src/components/atomic-crm/contacts/ContactEdit.tsx",
"type": "registry:component"
},
+ {
+ "path": "src/components/atomic-crm/contacts/ContactEdit.stories.tsx",
+ "type": "registry:component"
+ },
{
"path": "src/components/atomic-crm/contacts/ContactCreateSheet.tsx",
"type": "registry:component"
@@ -717,6 +721,10 @@
"path": "src/components/atomic-crm/contacts/ContactCreate.tsx",
"type": "registry:component"
},
+ {
+ "path": "src/components/atomic-crm/contacts/ContactCreate.stories.tsx",
+ "type": "registry:component"
+ },
{
"path": "src/components/atomic-crm/contacts/ContactBackgroundInfo.tsx",
"type": "registry:component"
diff --git a/src/components/atomic-crm/contacts/ContactCreate.stories.tsx b/src/components/atomic-crm/contacts/ContactCreate.stories.tsx
index 8b0fd2cb..4ae5e733 100644
--- a/src/components/atomic-crm/contacts/ContactCreate.stories.tsx
+++ b/src/components/atomic-crm/contacts/ContactCreate.stories.tsx
@@ -1,6 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import {
+ buildContact,
createCrmDb,
CrmStoryProvider,
} from "@/test/browser/atomic-crm/crmUiHarness";
@@ -22,7 +23,18 @@ export const ConcatCreateBasic: Story = {
<CrmStoryProvider
resource="contacts"
initialEntries={["/contacts/create"]}
- scenarioOptions={{ db: createCrmDb(), silent: false }}
+ scenarioOptions={{
+ db: createCrmDb({
+ contacts: [
+ buildContact({
+ id: 1,
+ email_jsonb: [],
+ phone_jsonb: [],
+ }),
+ ] as any,
+ }),
+ silent: false,
+ }}
>
<ContactCreate />
</CrmStoryProvider>
@@ -35,7 +47,15 @@ export const ConcatCreateBasicWithError: Story = {
resource="contacts"
initialEntries={["/contacts/create"]}
scenarioOptions={{
- db: createCrmDb(),
+ db: createCrmDb({
+ contacts: [
+ buildContact({
+ id: 1,
+ email_jsonb: [],
+ phone_jsonb: [],
+ }),
+ ] as any,
+ }),
creationError: "Simulated create error",
silent: false,
}}
diff --git a/src/components/atomic-crm/contacts/ContactEdit.stories.tsx b/src/components/atomic-crm/contacts/ContactEdit.stories.tsx
new file mode 100644
index 00000000..4344594b
--- /dev/null
+++ b/src/components/atomic-crm/contacts/ContactEdit.stories.tsx
@@ -0,0 +1,96 @@
+import type { Meta, StoryObj } from "@storybook/react-vite";
+
+import {
+ buildContact,
+ createCrmDb,
+ CrmStoryProvider,
+} from "@/test/browser/atomic-crm/crmUiHarness";
+import { ContactEdit } from "./ContactEdit";
+import { Route, Routes } from "react-router";
+
+const meta = {
+ title: "Atomic CRM/Contacts/Contact Edit",
+ parameters: {
+ layout: "fullscreen",
+ },
+} satisfies Meta;
+
+export default meta;
+
+type Story = StoryObj<typeof meta>;
+
+export const ConcatEditBasic: Story = {
+ render: () => (
+ <CrmStoryProvider
+ resource="contacts"
+ initialEntries={["/contacts/1"]}
+ scenarioOptions={{
+ db: createCrmDb({
+ contacts: [
+ buildContact({
+ id: 1,
+ email_jsonb: [],
+ phone_jsonb: [],
+ }),
+ ] as any,
+ }),
+ silent: false,
+ }}
+ >
+ <Routes>
+ <Route
+ path="/contacts/:id"
+ element={<ContactEdit mutationMode="pessimistic" />}
+ />
+ </Routes>
+ </CrmStoryProvider>
+ ),
+};
+export const ConcatEditWithError: Story = {
+ render: () => (
+ <CrmStoryProvider
+ resource="contacts"
+ initialEntries={["/contacts/1"]}
+ scenarioOptions={{
+ db: createCrmDb({
+ contacts: [
+ buildContact({
+ id: 1,
+ email_jsonb: [],
+ phone_jsonb: [],
+ }),
+ ] as any,
+ }),
+ updateError: "Simulated update error",
+ silent: false,
+ }}
+ >
+ <Routes>
+ <Route
+ path="/contacts/:id"
+ element={<ContactEdit mutationMode="pessimistic" />}
+ />
+ </Routes>
+ </CrmStoryProvider>
+ ),
+};
+
+export const ConcatEditNotFound: Story = {
+ render: () => (
+ <CrmStoryProvider
+ resource="contacts"
+ initialEntries={["/contacts/1"]}
+ scenarioOptions={{
+ db: createCrmDb(),
+ silent: false,
+ }}
+ >
+ <Routes>
+ <Route
+ path="/contacts/:id"
+ element={<ContactEdit mutationMode="pessimistic" />}
+ />
+ </Routes>
+ </CrmStoryProvider>
+ ),
+};
diff --git a/src/components/atomic-crm/tasks/__screenshots__/TaskCreateSheet.integration.test.tsx/TaskCreateSheet-integration-creates-a-task-for-a-selected-contact-and-updates-last-seen-1.png b/src/components/atomic-crm/tasks/__screenshots__/TaskCreateSheet.integration.test.tsx/TaskCreateSheet-integration-creates-a-task-for-a-selected-contact-and-updates-last-seen-1.png
deleted file mode 100644
index bef54772..00000000
Binary files a/src/components/atomic-crm/tasks/__screenshots__/TaskCreateSheet.integration.test.tsx/TaskCreateSheet-integration-creates-a-task-for-a-selected-contact-and-updates-last-seen-1.png and /dev/null differ