Skip to content

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

Merge branch 'main' into feat/import-data-in-onboarding-screen

erwanMarmelabe50865a73998
diff --cc src/components/atomic-crm/contacts/ContactList.test.tsx
index 31e80f70,3ad7f8d4..886ac2a6
--- a/src/components/atomic-crm/contacts/ContactList.test.tsx
+++ b/src/components/atomic-crm/contacts/ContactList.test.tsx
@@@ -129,18 -132,82 +132,95 @@@ describe("ContactList", () =>
await screen.getByRole("button", { name: /close/i }).click();
});
+ it("imports contacts from a dialog with no resource to pick", async () => {
+ const screen = await render(<DesktopEmpty />);
+
+ await screen.getByRole("button", { name: "Import CSV" }).click();
+
+ await expect
+ .element(screen.getByRole("heading", { name: "Import contacts" }))
+ .toBeVisible();
+ await expect
+ .element(screen.getByLabelText("Resource"))
+ .not.toBeInTheDocument();
+ });
++
+ describe("account manager filter", () => {
+ beforeAll(() => {
+ page.viewport(1600, 900);
+ });
+
+ it("restricts the list to the contacts of the account manager an admin picks", async () => {
+ const screen = await render(<AdminAccountManagerFilter />);
+
+ await expect.element(screen.getByText("Ada Lovelace")).toBeVisible();
+ await expect.element(screen.getByText("Grace Hopper")).toBeVisible();
+
+ await screen.getByRole("button", { name: "Marie Curie" }).click();
+
+ await expect.element(screen.getByText("Grace Hopper")).toBeVisible();
+ await expect
+ .element(screen.getByText("Ada Lovelace"))
+ .not.toBeInTheDocument();
+ });
+
+ it("brings every contact back when the admin untoggles the account manager", async () => {
+ const screen = await render(<AdminAccountManagerFilter />);
+
+ await screen.getByRole("button", { name: "Marie Curie" }).click();
+ await expect
+ .element(screen.getByText("Ada Lovelace"))
+ .not.toBeInTheDocument();
+
+ await screen.getByRole("button", { name: "Marie Curie" }).click();
+
+ await expect.element(screen.getByText("Ada Lovelace")).toBeVisible();
+ await expect.element(screen.getByText("Grace Hopper")).toBeVisible();
+ });
+
+ it("keeps the current user out of the account manager list, offering only Me", async () => {
+ const screen = await render(<AdminAccountManagerFilter />);
+
+ await expect
+ .element(screen.getByRole("button", { name: "Me" }))
+ .toBeVisible();
+ await expect
+ .element(screen.getByRole("button", { name: "Jane Doe" }))
+ .not.toBeInTheDocument();
+ });
+
+ it("offers no account manager list to a user who is not an admin", async () => {
+ const screen = await render(<NonAdminAccountManagerFilter />);
+
+ await expect
+ .element(screen.getByRole("button", { name: "Me" }))
+ .toBeVisible();
+ await expect
+ .element(screen.getByRole("button", { name: "Marie Curie" }))
+ .not.toBeInTheDocument();
+ });
+ });
+
+ describe("account manager filter on mobile", () => {
+ beforeAll(() => {
+ page.viewport(375, 667);
+ });
+
+ it("picks an account manager from inside the filter sheet", async () => {
+ const screen = await render(<AdminAccountManagerFilter />);
+
+ await expect.element(screen.getByText("Ada Lovelace")).toBeVisible();
+
+ await screen.getByRole("button", { name: "Add filter" }).click();
+ await screen.getByRole("button", { name: "Marie Curie" }).click();
+ await screen.getByRole("button", { name: "Confirm" }).click();
+
+ await expect.element(screen.getByText("Grace Hopper")).toBeVisible();
+ await expect
+ .element(screen.getByText("Ada Lovelace"))
+ .not.toBeInTheDocument();
+ });
+ });
});
const getSelectionCheckboxes = (container: HTMLElement) =>
diff --cc src/components/atomic-crm/deals/DealList.tsx
index 4b8182a0,61689245..3f6814c9
--- a/src/components/atomic-crm/deals/DealList.tsx
+++ b/src/components/atomic-crm/deals/DealList.tsx
@@@ -11,9 -16,9 +16,10 @@@ import { FilterButton } from "@/compone
import { SearchInput } from "@/components/admin/search-input";
import { SelectInput } from "@/components/admin/select-input";
+import { DataImportButton } from "../dataImport/DataImportButton";
import { useConfigurationContext } from "../root/ConfigurationContext";
import { TopToolbar } from "../layout/TopToolbar";
+ import { AccountManagerInput } from "../sales/AccountManagerInput";
import { DealArchivedList } from "./DealArchivedList";
import { DealCreate } from "./DealCreate";
import { DealEdit } from "./DealEdit";