Skip to content

armgit / crm

Public Imported from GitHub
0

Comp AI CRM is an open source, CRM designed for AI agents. Agentic-first CRM.

TypeScript

initial commit

Lewis Carhartcba157ae944a
diff --git a/.gitignore b/.gitignore
index 96fab4fe..8e4168a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,6 @@ yarn-error.log*
# Misc
.DS_Store
*.pem
+
+# Agent worktrees
+.claude/worktrees/
diff --git a/apps/api/nest-cli.json b/apps/api/nest-cli.json
deleted file mode 100644
index 68d1974c..00000000
--- a/apps/api/nest-cli.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "$schema": "https://json.schemastore.org/nest-cli",
- "collection": "@nestjs/schematics",
- "sourceRoot": "src"
-}
diff --git a/apps/api/package.json b/apps/api/package.json
index f73cb5ee..ef04b458 100644
--- a/apps/api/package.json
+++ b/apps/api/package.json
@@ -44,8 +44,6 @@
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
- "@nestjs/cli": "^11.0.0",
- "@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^11.0.1",
"@types/bun": "^1.3.14",
"@types/express": "^5.0.0",
diff --git a/apps/api/src/activities/activities.contracts.ts b/apps/api/src/activities/activities.contracts.ts
index 10bba6ea..bbd8dae2 100644
--- a/apps/api/src/activities/activities.contracts.ts
+++ b/apps/api/src/activities/activities.contracts.ts
@@ -1,13 +1,9 @@
import { ActivityType } from "@crm/db";
import { z } from "zod";
-const typeEnum = z.enum(
- Object.values(ActivityType) as [ActivityType, ...ActivityType[]],
-);
-
/** Types a human can log. `STAGE_CHANGE` and `ENRICHMENT` are written by the
* system and the agent, and are not offered in the composer. */
-export const COMPOSABLE_TYPES = [
+const COMPOSABLE_TYPES = [
ActivityType.NOTE,
ActivityType.CALL,
ActivityType.EMAIL,
@@ -24,7 +20,7 @@ const composableEnum = z.enum(COMPOSABLE_TYPES);
* pins those at the top, and an entry that appears both pinned and in the
* history below it reads as two different things having happened.
*/
-export const TIMELINE_FILTERS = [
+const TIMELINE_FILTERS = [
"all",
"history",
"notes",
@@ -85,18 +81,6 @@ export const activityCreateInput = z
export type ActivityCreateInput = z.infer<typeof activityCreateInput>;
-export const activityUpdateInput = z.object({
- id: z.string(),
- subject: z.string().optional(),
- body: z.string().optional(),
- dueAt: z.string().nullable().optional(),
- occurredAt: z.string().nullable().optional(),
-});
-
-export type ActivityUpdateInput = z.infer<typeof activityUpdateInput>;
-
-export const activityIdInput = z.object({ id: z.string() });
-
export const completeInput = z.object({
id: z.string(),
/** `false` reopens a task that was ticked off by mistake. */
@@ -110,5 +94,3 @@ export const myTasksInput = z.object({
});
export type MyTasksInput = z.infer<typeof myTasksInput>;
-
-export { typeEnum as activityTypeEnum };
diff --git a/apps/api/src/activities/activities.router.ts b/apps/api/src/activities/activities.router.ts
index 36106c4b..d75f6218 100644
--- a/apps/api/src/activities/activities.router.ts
+++ b/apps/api/src/activities/activities.router.ts
@@ -12,8 +12,6 @@ import type { AuthedTrpcContext } from "../trpc/context.types";
import { AuthMiddleware } from "../trpc/middlewares/auth.middleware";
import {
activityCreateInput,
- activityIdInput,
- activityUpdateInput,
completeInput,
myTasksInput,
timelineCountsInput,
@@ -54,18 +52,8 @@ export class ActivitiesRouter {
return this.activities.create(input, ctx.user.id);
}
- @Mutation({ input: activityUpdateInput })
- async update(@Input() input: z.infer<typeof activityUpdateInput>) {
- return this.activities.update(input);
- }
-
@Mutation({ input: completeInput })
async complete(@Input() input: z.infer<typeof completeInput>) {
return this.activities.complete(input.id, input.completed);
}
-
- @Mutation({ input: activityIdInput })
- async remove(@Input("id") id: string) {
- return this.activities.remove(id);
- }
}
diff --git a/apps/api/src/activities/activities.service.ts b/apps/api/src/activities/activities.service.ts
index cc53d0de..22cfc406 100644
--- a/apps/api/src/activities/activities.service.ts
+++ b/apps/api/src/activities/activities.service.ts
@@ -1,9 +1,4 @@
-import {
- ActivityType,
- type Db,
- type Prisma,
- Prisma as PrismaNamespace,
-} from "@crm/db";
+import { ActivityType, type Db, type Prisma } from "@crm/db";
import {
BadRequestException,
Injectable,
@@ -14,7 +9,6 @@ import { blankToNull } from "../crm/values";
import { InjectDatabase } from "../database/database.constants";
import type {
ActivityCreateInput,
- ActivityUpdateInput,
MyTasksInput,
TimelineFilter,
TimelineInput,
@@ -144,28 +138,6 @@ export class ActivitiesService {
return serializeEntry(activity);
}
- async update(input: ActivityUpdateInput) {
- const data: Prisma.ActivityUpdateInput = {};
-
- if (input.subject !== undefined) data.subject = blankToNull(input.subject);
- if (input.body !== undefined) data.body = blankToNull(input.body);
- if (input.dueAt !== undefined) data.dueAt = parseDate(input.dueAt);
- if (input.occurredAt !== undefined) {
- data.occurredAt = parseDate(input.occurredAt);
- }
-
- try {
- const activity = await this.db.activity.update({
- where: { id: input.id },
- data,
- select: ENTRY_SELECT,
- });
- return serializeEntry(activity);
- } catch (error) {
- throw this.translate(error, input.id);
- }
- }
-
/** Ticks a task off, or puts it back. */
async complete(id: string, completed: boolean) {
const activity = await this.db.activity.findUnique({
@@ -190,15 +162,6 @@ export class ActivitiesService {
return serializeEntry(updated);
}
- async remove(id: string): Promise<{ id: string }> {
- try {
- await this.db.activity.delete({ where: { id } });
- } catch (error) {
- throw this.translate(error, id);
- }
- return { id };
- }
-
/** Open tasks assigned to whoever is asking. */
async myTasks(input: MyTasksInput, actingUserId: string) {
const now = new Date();
@@ -274,16 +237,6 @@ export class ActivitiesService {
return null;
}
-
- private translate(error: unknown, id: string): unknown {
- if (
- error instanceof PrismaNamespace.PrismaClientKnownRequestError &&
- error.code === "P2025"
- ) {
- return new NotFoundException(`No activity with id ${id}.`);
- }
- return error;
- }
}
function filterClause(filter: TimelineFilter): Prisma.ActivityWhereInput {
diff --git a/apps/api/src/app.module.ts b/apps/api/src/app.module.ts
index 9bf933a1..70b92541 100644
--- a/apps/api/src/app.module.ts
+++ b/apps/api/src/app.module.ts
@@ -12,7 +12,6 @@ import { DashboardModule } from "./dashboard/dashboard.module";
import { DatabaseModule } from "./database/database.module";
import { DealsModule } from "./deals/deals.module";
import { HealthModule } from "./health/health.module";
-import { ImportModule } from "./import/import.module";
import { LoggingModule } from "./logging/logging.module";
import { logAuthRoute } from "./logging/request-logger.middleware";
import { SearchModule } from "./search/search.module";
@@ -39,7 +38,6 @@ import { UsersModule } from "./users/users.module";
DealsModule,
ActivitiesModule,
DashboardModule,
- ImportModule,
SearchModule,
],
})
diff --git a/apps/api/src/companies/companies.contracts.ts b/apps/api/src/companies/companies.contracts.ts
index 9a09ae21..5ad00b5b 100644
--- a/apps/api/src/companies/companies.contracts.ts
+++ b/apps/api/src/companies/companies.contracts.ts
@@ -34,7 +34,7 @@ export type CompanyCreateInput = z.infer<typeof companyCreateInput>;
* editors on the detail page can send one field at a time. An empty string
* clears a value; `null` on `ownerId` unassigns.
*/
-export const companyUpdateInput = z.object({
+const companyUpdateInput = z.object({
name: z.string().trim().min(1).optional(),
domain: z.string().optional(),
website: z.string().optional(),
diff --git a/apps/api/src/companies/companies.router.ts b/apps/api/src/companies/companies.router.ts
index 838ea93e..1da3d274 100644
--- a/apps/api/src/companies/companies.router.ts
+++ b/apps/api/src/companies/companies.router.ts
@@ -53,11 +53,6 @@ export class CompaniesRouter {
return this.companies.update(input.id, input.data);
}
- @Mutation({ input: companyIdInput })
- async remove(@Input("id") id: string) {
- return this.companies.remove(id);
- }
-
/** Re-runs the brand lookup, ignoring Context.dev's cache. */
@Mutation({ input: companyIdInput })
async enrich(@Input("id") id: string) {
diff --git a/apps/api/src/companies/companies.service.ts b/apps/api/src/companies/companies.service.ts
index 1821d356..33b18612 100644
--- a/apps/api/src/companies/companies.service.ts
+++ b/apps/api/src/companies/companies.service.ts
@@ -385,16 +385,6 @@ export class CompaniesService {
return result;
}
- async remove(id: string): Promise<{ id: string }> {
- try {
- await this.db.company.delete({ where: { id } });
- } catch (error) {
- throw this.translate(error, id);
- }
- this.logger.log({ message: "Company deleted", companyId: id });
- return { id };
- }
-
/**
* Points a company at the person to call.
*
diff --git a/apps/api/src/contacts/contacts.contracts.ts b/apps/api/src/contacts/contacts.contracts.ts
index 4219aca6..098a484b 100644
--- a/apps/api/src/contacts/contacts.contracts.ts
+++ b/apps/api/src/contacts/contacts.contracts.ts
@@ -28,7 +28,7 @@ export const contactCreateInput = z.object({
export type ContactCreateInput = z.infer<typeof contactCreateInput>;
/** `undefined` leaves a field alone; `""` clears it. */
-export const contactUpdateInput = z.object({
+const contactUpdateInput = z.object({
firstName: z.string().trim().min(1).optional(),
lastName: z.string().optional(),
email: z.string().optional(),
diff --git a/apps/api/src/contacts/contacts.router.ts b/apps/api/src/contacts/contacts.router.ts
index b57d1853..79b1463a 100644
--- a/apps/api/src/contacts/contacts.router.ts
+++ b/apps/api/src/contacts/contacts.router.ts
@@ -36,9 +36,4 @@ export class ContactsRouter {
async update(@Input() input: z.infer<typeof contactUpdateArgs>) {
return this.contacts.update(input.id, input.data);
}
-
- @Mutation({ input: contactIdInput })
- async remove(@Input("id") id: string) {
- return this.contacts.remove(id);
- }
}
diff --git a/apps/api/src/contacts/contacts.service.ts b/apps/api/src/contacts/contacts.service.ts
index 6a0c4696..693e03b8 100644
--- a/apps/api/src/contacts/contacts.service.ts
+++ b/apps/api/src/contacts/contacts.service.ts
@@ -263,16 +263,6 @@ export class ContactsService {
}
}
- async remove(id: string): Promise<{ id: string }> {
- try {
- await this.db.contact.delete({ where: { id } });
- } catch (error) {
- throw this.translate(error, id);
- }
- this.logger.log({ message: "Contact deleted", contactId: id });
- return { id };
- }
-
/** `q` matches a name, an email address, or where they work. */
private searchFilter(q: string): Prisma.ContactWhereInput {
const term = q.trim();
diff --git a/apps/api/src/dashboard/dashboard.contracts.ts b/apps/api/src/dashboard/dashboard.contracts.ts
new file mode 100644
index 00000000..08706002
--- /dev/null
+++ b/apps/api/src/dashboard/dashboard.contracts.ts
@@ -0,0 +1,16 @@
+import { z } from "zod";
+
+/**
+ * Whose numbers the overview shows.
+ *
+ * `"me"` is the default because the page answers "how am I doing" first — a rep
+ * opening the app wants their own quarter, not the team's. `"everyone"` is the
+ * same page over every owner, which is what a founder or a manager wants.
+ */
+const DASHBOARD_SCOPES = ["me", "everyone"] as const;
+
+export const dashboardSummaryInput = z.object({
+ scope: z.enum(DASHBOARD_SCOPES).default("me"),
+});
+
+export type DashboardSummaryInput = z.infer<typeof dashboardSummaryInput>;
diff --git a/apps/api/src/dashboard/dashboard.router.ts b/apps/api/src/dashboard/dashboard.router.ts
index 856c485a..fb3648aa 100644
--- a/apps/api/src/dashboard/dashboard.router.ts
+++ b/apps/api/src/dashboard/dashboard.router.ts
@@ -1,7 +1,9 @@
import { Inject } from "@nestjs/common";
-import { Ctx, Query, Router, UseMiddlewares } from "nestjs-trpc";
+import { Ctx, Input, Query, Router, UseMiddlewares } from "nestjs-trpc";
+import type { z } from "zod";
import type { AuthedTrpcContext } from "../trpc/context.types";
import { AuthMiddleware } from "../trpc/middlewares/auth.middleware";
+import { dashboardSummaryInput } from "./dashboard.contracts";
import { DashboardService } from "./dashboard.service";
@Router({ alias: "dashboard" })
@@ -11,9 +13,16 @@ export class DashboardRouter {
@Inject(DashboardService) private readonly dashboard: DashboardService,
) {}
- /** Pipeline by stage, deals closing this month, my overdue tasks, recent activity. */
- @Query()
- async summary(@Ctx() ctx: AuthedTrpcContext) {
- return this.dashboard.summary(ctx.user.id);
+ /**
+ * Everything on the overview: closed-won and the rolling rates behind it, the
+ * open pipeline by stage, six months of won against created, what is due to
+ * close, the biggest open deals, overdue tasks and recent activity.
+ */
+ @Query({ input: dashboardSummaryInput })
+ async summary(
+ @Ctx() ctx: AuthedTrpcContext,
+ @Input() input: z.infer<typeof dashboardSummaryInput>,
+ ) {
+ return this.dashboard.summary(ctx.user.id, input);
}
}
diff --git a/apps/api/src/dashboard/dashboard.service.ts b/apps/api/src/dashboard/dashboard.service.ts
index f392aa8c..a94d478a 100644
--- a/apps/api/src/dashboard/dashboard.service.ts
+++ b/apps/api/src/dashboard/dashboard.service.ts
@@ -1,8 +1,9 @@
-import { ActivityType, type Db, type DealStage } from "@crm/db";
+import { ActivityType, type Db, DealStage } from "@crm/db";
import { Injectable } from "@nestjs/common";
import { toCents } from "../crm/values";
import { InjectDatabase } from "../database/database.constants";
import { OPEN_DEAL_STAGES } from "../deals/deal-stage";
+import type { DashboardSummaryInput } from "./dashboard.contracts";
const OWNER_SELECT = {
id: true,
@@ -11,42 +12,109 @@ const OWNER_SELECT = {
image: true,
} as const;
+/** Months in the trend chart, the current one included. */
+const TREND_MONTHS = 6;
+
+/**
+ * Window behind the rolling rates — win rate, average deal size, cycle time.
+ *
+ * A quarter is long enough that one good week does not swing it and short
+ * enough that it still describes how the rep is selling now.
+ */
+const RATE_WINDOW_DAYS = 90;
+
+const DAY_MS = 24 * 60 * 60 * 1000;
+
+/** "Feb". The chart has room for three letters, not "February". */
+const MONTH_LABEL = new Intl.DateTimeFormat("en-US", { month: "short" });
+
+/** Local month boundary, `offset` months from the one `from` falls in. */
+function monthStart(from: Date, offset: number): Date {
+ return new Date(from.getFullYear(), from.getMonth() + offset, 1);
+}
+
+/** Months since year zero — subtract two to get a bucket index. */
+function monthKey(date: Date): number {
+ return date.getFullYear() * 12 + date.getMonth();
+}
+
@Injectable()
export class DashboardService {
constructor(@InjectDatabase() private readonly db: Db) {}
/**
- * What a rep wants on opening the app: where the pipeline is, what closes
- * this month, what they are late on, and what just happened.
+ * How the rep is doing: what they have closed, what is still open, the rates
+ * that describe how they sell, and what needs attention today.
*
- * Everything is aggregated in Postgres. The alternative — fetching deals and
- * summing them here — is a page that gets slower every quarter.
+ * The open pipeline spans all history, so it is aggregated in Postgres — the
+ * alternative is a page that gets slower every quarter. Everything derived
+ * from closed and newly created deals comes off one bounded read of the last
+ * six months and is folded up here: that window does not grow with history,
+ * it is a single index scan instead of a dozen aggregates, and it keeps the
+ * KPI strip and the chart underneath it on exactly the same month boundaries
+ * rather than letting SQL's idea of a month drift from JavaScript's.
*/
- async summary(actingUserId: string) {
+ async summary(actingUserId: string, input: DashboardSummaryInput) {
+ const mine = input.scope === "me";
+ const owned = mine ? { ownerId: actingUserId } : {};
+
const now = new Date();
- const startOfMonth = new Date(now.getFullYear(), now.getMonth(), 1);
- const startOfNextMonth = new Date(now.getFullYear(), now.getMonth() + 1, 1);
+ const startOfMonth = monthStart(now, 0);
+ const startOfNextMonth = monthStart(now, 1);
+ const startOfPrevMonth = monthStart(now, -1);
+ const trendStart = monthStart(now, -(TREND_MONTHS - 1));
+ const rateStart = new Date(now.getTime() - RATE_WINDOW_DAYS * DAY_MS);
const [
- byStage,
- closingThisMonth,
+ openByStage,
+ recentDeals,
+ closingThisMonthTotals,
+ biggestOpen,
overdueTasks,
recentActivity,
- wonThisMonth,
] = await Promise.all([
this.db.deal.groupBy({
by: ["stage"],
- where: { stage: { in: [...OPEN_DEAL_STAGES] } },
+ where: { ...owned, stage: { in: [...OPEN_DEAL_STAGES] } },
_count: { _all: true },
_sum: { amount: true },
}),
+ // One read covers the trend chart, this month vs. last, and the
+ // 90-day rates. `amount` is the only wide column and there are four
+ // of them, so this stays cheap even for a busy team.
this.db.deal.findMany({
where: {
+ ...owned,
+ OR: [
+ { createdAt: { gte: trendStart } },
+ { closedAt: { gte: trendStart } },
+ ],
+ },
+ select: {
+ amount: true,
+ stage: true,
+ createdAt: true,
+ closedAt: true,
+ },
+ }),
+ // A count and a sum, not rows: the KPI strip quotes "due this month"
+ // as one figure, and no list on the page shows the deals behind it.
+ this.db.deal.aggregate({
+ where: {
+ ...owned,
stage: { in: [...OPEN_DEAL_STAGES] },
expectedCloseDate: { gte: startOfMonth, lt: startOfNextMonth },
},
- orderBy: [{ expectedCloseDate: "asc" }],
- take: 10,
+ _count: { _all: true },
+ _sum: { amount: true },
+ }),
+ this.db.deal.findMany({
+ where: { ...owned, stage: { in: [...OPEN_DEAL_STAGES] } },
+ orderBy: [
+ { amount: { sort: "desc", nulls: "last" } },
+ { expectedCloseDate: "asc" },
+ ],
+ take: 6,
select: {
id: true,
name: true,
@@ -54,10 +122,13 @@ export class DashboardService {
amount: true,
currency: true,
expectedCloseDate: true,
+ stageChangedAt: true,
company: { select: { id: true, name: true, iconUrl: true } },
owner: { select: OWNER_SELECT },
},
}),
+ // Always the acting user's, in either scope: nobody else's tasks are
+ // theirs to tick off.
this.db.activity.findMany({
where: {
type: ActivityType.TASK,
@@ -76,6 +147,7 @@ export class DashboardService {
},
}),
this.db.activity.findMany({
+ where: mine ? { createdById: actingUserId } : {},
orderBy: [{ createdAt: "desc" }],
take: 12,
select: {
@@ -90,18 +162,10 @@ export class DashboardService {
deal: { select: { id: true, name: true } },
},
}),
- this.db.deal.aggregate({
- where: {
- stage: "CLOSED_WON",
- closedAt: { gte: startOfMonth, lt: startOfNextMonth },
- },
- _count: { _all: true },
- _sum: { amount: true },
- }),
]);
const stages = OPEN_DEAL_STAGES.map((stage) => {
- const group = byStage.find((row) => row.stage === stage);
+ const group = openByStage.find((row) => row.stage === stage);
return {
stage: stage as DealStage,
count: group?._count._all ?? 0,
@@ -109,24 +173,90 @@ export class DashboardService {
};
});
+ const firstBucket = monthKey(trendStart);
+ const trend = Array.from({ length: TREND_MONTHS }, (_, index) => ({
+ month: MONTH_LABEL.format(monthStart(trendStart, index)),
+ won: 0,
+ created: 0,
+ }));
+
+ const wonThisMonth = { count: 0, valueCents: 0 };
+ const wonPrevMonth = { count: 0, valueCents: 0 };
+ let wins = 0;
+ let losses = 0;
+ let wonCents = 0;
+ let cycleDays = 0;
+
+ for (const deal of recentDeals) {
+ const cents = toCents(deal.amount) ?? 0;
+
+ // A deal closed inside the window but opened before it lands in no
+ // created bucket — the index is negative, and the lookup misses.
+ const created = trend[monthKey(deal.createdAt) - firstBucket];
+ if (created) created.created += cents;
+
+ const { closedAt, stage } = deal;
+ if (!closedAt) continue;
+ const won = stage === DealStage.CLOSED_WON;
+
+ if (won) {
+ const closed = trend[monthKey(closedAt) - firstBucket];
+ if (closed) closed.won += cents;
+
+ if (closedAt >= startOfMonth && closedAt < startOfNextMonth) {
+ wonThisMonth.count += 1;
+ wonThisMonth.valueCents += cents;
+ } else if (closedAt >= startOfPrevMonth && closedAt < startOfMonth) {
+ wonPrevMonth.count += 1;
+ wonPrevMonth.valueCents += cents;
+ }
+ }
+
+ if (closedAt < rateStart) continue;
+ if (won) {
+ wins += 1;
+ wonCents += cents;
+ cycleDays += (closedAt.getTime() - deal.createdAt.getTime()) / DAY_MS;
+ } else if (stage === DealStage.CLOSED_LOST) {
+ // Disqualified deals are deliberately neither: they never reached a
+ // decision, so counting them would turn the win rate into a
+ // measure of lead quality.
+ losses += 1;
+ }
+ }
+
+ const decided = wins + losses;
+
return {
+ scope: input.scope,
pipeline: {
stages,
- totalCents: stages.reduce(
- (total, stage) => total + stage.valueCents,
- 0,
- ),
- totalDeals: stages.reduce((total, stage) => total + stage.count, 0),
+ totalCents: stages.reduce((total, s) => total + s.valueCents, 0),
+ totalDeals: stages.reduce((total, s) => total + s.count, 0),
+ },
+ wonThisMonth,
+ wonPrevMonth,
+ /** Rolling rates over `windowDays`. `null` where nothing has closed. */
+ performance: {
+ windowDays: RATE_WINDOW_DAYS,
+ wins,
+ losses,
+ winRate: decided === 0 ? null : wins / decided,
+ avgDealCents: wins === 0 ? null : Math.round(wonCents / wins),
+ avgCycleDays: wins === 0 ? null : Math.round(cycleDays / wins),
},
- wonThisMonth: {
- count: wonThisMonth._count._all,
- valueCents: toCents(wonThisMonth._sum.amount) ?? 0,
+ /** Six months of closed-won value against new pipeline created. */
+ trend,
+ closingThisMonthTotal: {
+ count: closingThisMonthTotals._count._all,
+ valueCents: toCents(closingThisMonthTotals._sum.amount) ?? 0,
},
- closingThisMonth: closingThisMonth.map(
- ({ amount, expectedCloseDate, ...deal }) => ({
+ biggestOpen: biggestOpen.map(
+ ({ amount, expectedCloseDate, stageChangedAt, ...deal }) => ({
...deal,
amountCents: toCents(amount),
expectedCloseDate: expectedCloseDate?.toISOString() ?? null,
+ stageChangedAt: stageChangedAt.toISOString(),
}),
),
overdueTasks: overdueTasks.map(({ dueAt, ...task }) => ({
diff --git a/apps/api/src/deals/deal-stage.ts b/apps/api/src/deals/deal-stage.ts
index 9be10ca1..c755ff8e 100644
--- a/apps/api/src/deals/deal-stage.ts
+++ b/apps/api/src/deals/deal-stage.ts
@@ -33,7 +33,3 @@ const CLOSED = new Set<DealStage>(CLOSED_DEAL_STAGES);
export function isClosedStage(stage: DealStage): boolean {
return CLOSED.has(stage);
}
-
-export function isOpenStage(stage: DealStage): boolean {
- return !CLOSED.has(stage);
-}
diff --git a/apps/api/src/deals/deals.board.ts b/apps/api/src/deals/deals.board.ts
deleted file mode 100644
index fdb795d7..00000000
--- a/apps/api/src/deals/deals.board.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { z } from "zod";
-
-/**
- * The board shows the open pipeline only.
- *
- * A closed column would be an ever-growing list of things nobody is working,
- * and dragging a card into it needs a reason typed in — which is a dialog, not
- * a drop target. Closing happens from the row menu or the deal page.
- */
-export const boardInput = z.object({
- q: z.string().default(""),
- /** A user id, or `"all"`. */
- owner: z.string().default("all"),
- /** Cards per column. The count is always the true total. */
- limit: z.number().int().min(1).max(100).default(50),
-});
-
-export type BoardInput = z.infer<typeof boardInput>;
diff --git a/apps/api/src/deals/deals.contracts.ts b/apps/api/src/deals/deals.contracts.ts
index 14bc65b3..b1463fef 100644
--- a/apps/api/src/deals/deals.contracts.ts
+++ b/apps/api/src/deals/deals.contracts.ts
@@ -55,7 +55,7 @@ export type DealCreateInput = z.infer<typeof dealCreateInput>;
/** `undefined` leaves a field alone. Stage is not here — it goes through
* `setStage`, which also writes the timeline entry. */
-export const dealUpdateInput = z.object({
+const dealUpdateInput = z.object({
name: z.string().trim().min(1).optional(),
companyId: z.string().optional(),
ownerId: z.string().optional(),
@@ -81,15 +81,3 @@ export const setStageInput = z.object({
});
export type SetStageInput = z.infer<typeof setStageInput>;
-
-export const setContactsInput = z.object({
- dealId: z.string(),
- contacts: z.array(
- z.object({
- contactId: z.string(),
- role: z.string().trim().optional(),
- }),
- ),
-});
-
-export type SetContactsInput = z.infer<typeof setContactsInput>;
diff --git a/apps/api/src/deals/deals.router.ts b/apps/api/src/deals/deals.router.ts
index 20ecf83f..2f191026 100644
--- a/apps/api/src/deals/deals.router.ts
+++ b/apps/api/src/deals/deals.router.ts
@@ -10,13 +10,11 @@ import {
import type { z } from "zod";
import type { AuthedTrpcContext } from "../trpc/context.types";
import { AuthMiddleware } from "../trpc/middlewares/auth.middleware";
-import { boardInput } from "./deals.board";
import {
dealCreateInput,
dealIdInput,
dealListInput,
dealUpdateArgs,
- setContactsInput,
setStageInput,
} from "./deals.contracts";
import { DealsService } from "./deals.service";
@@ -31,12 +29,6 @@ export class DealsRouter {
return this.deals.list(input);
}
- /** The open pipeline as stage columns, for `?view=board`. */
- @Query({ input: boardInput })
- async board(@Input() input: z.infer<typeof boardInput>) {
- return this.deals.board(input);
- }
-
@Query({ input: dealIdInput })
async byId(@Input("id") id: string) {
return this.deals.byId(id);
@@ -60,14 +52,4 @@ export class DealsRouter {
) {
return this.deals.setStage(input, ctx.user.id);
}
-
- @Mutation({ input: setContactsInput })
- async setContacts(@Input() input: z.infer<typeof setContactsInput>) {
- return this.deals.setContacts(input);
- }
-
- @Mutation({ input: dealIdInput })
- async remove(@Input("id") id: string) {
- return this.deals.remove(id);
- }
}
diff --git a/apps/api/src/deals/deals.service.ts b/apps/api/src/deals/deals.service.ts
index 32b572ba..a0a0c353 100644
--- a/apps/api/src/deals/deals.service.ts
+++ b/apps/api/src/deals/deals.service.ts
@@ -27,13 +27,11 @@ import {
LOSING_DEAL_STAGES,
OPEN_DEAL_STAGES,
} from "./deal-stage";
-import type { BoardInput } from "./deals.board";
import type {
ClosingWindow,
DealCreateInput,
DealListInput,
DealUpdateInput,
- SetContactsInput,
SetStageInput,
} from "./deals.contracts";
import { CLOSING_WINDOWS } from "./deals.contracts";
@@ -132,73 +130,6 @@ export class DealsService {
} satisfies ListResult<unknown> & { openValueCents: number | null };
}
- /**
- * The pipeline as columns.
- *
- * One query, grouped in memory rather than four round trips: the open
- * pipeline is small by construction, and a board that issues a query per
- * column gets slower every time someone adds a stage.
- */
- async board(input: BoardInput) {
- const where: Prisma.DealWhereInput = {
- ...this.searchFilter(input.q),
- stage: { in: [...OPEN_DEAL_STAGES] },
- };
-
- if (input.owner !== FACET_ALL) {
- where.ownerId = input.owner;
- }
-
- const [deals, totals] = await Promise.all([
- this.db.deal.findMany({
- where,
- orderBy: [
- { stage: "asc" },
- { expectedCloseDate: "asc" },
- { name: "asc" },
- ],
- select: {
- id: true,
- name: true,
- stage: true,
- amount: true,
- currency: true,
- expectedCloseDate: true,
- company: { select: COMPANY_SELECT },
- owner: { select: OWNER_SELECT },
- },
- }),
- this.db.deal.groupBy({
- by: ["stage"],
- where,
- _count: { _all: true },
- _sum: { amount: true },
- }),
- ]);
-
- const columns = OPEN_DEAL_STAGES.map((stage) => {
- const group = totals.find((row) => row.stage === stage);
- const cards = deals
- .filter((deal) => deal.stage === stage)
- .slice(0, input.limit)
- .map(({ amount, expectedCloseDate, ...deal }) => ({
- ...deal,
- amountCents: toCents(amount),
- expectedCloseDate: expectedCloseDate?.toISOString() ?? null,
- }));
-
- return {
- stage,
- cards,
- /** The whole column, even when only `limit` cards are shown. */
- total: group?._count._all ?? 0,
- valueCents: toCents(group?._sum.amount ?? null) ?? 0,
- };
- });
-
- return { columns };
- }
-
async byId(id: string) {
const deal = await this.db.deal.findUnique({
where: { id },
@@ -375,55 +306,6 @@ export class DealsService {
return { ...updated, changed: true };
}
- /** Replaces the people on a deal wholesale — the UI edits the whole set. */
- async setContacts(input: SetContactsInput) {
- const deal = await this.db.deal.findUnique({
- where: { id: input.dealId },
- select: { companyId: true },
- });
-
- if (!deal) {
- throw new NotFoundException(`No deal with id ${input.dealId}.`);
- }
-
- const contactIds = [...new Set(input.contacts.map((c) => c.contactId))];
-
- if (contactIds.length > 0) {
- const belong = await this.db.contact.count({
- where: { id: { in: contactIds }, companyId: deal.companyId },
- });
- if (belong !== contactIds.length) {
- throw new BadRequestException(
- "Every contact on a deal has to work at the company the deal is with.",
- );
- }
- }
-
- await this.db.$transaction([
- this.db.dealContact.deleteMany({ where: { dealId: input.dealId } }),
- this.db.dealContact.createMany({
- data: input.contacts.map((contact) => ({
- dealId: input.dealId,
- contactId: contact.contactId,
- role: contact.role || null,
- })),
- skipDuplicates: true,
- }),
- ]);
-
- return { dealId: input.dealId, count: contactIds.length };
- }
-
- async remove(id: string): Promise<{ id: string }> {
- try {
- await this.db.deal.delete({ where: { id } });
- } catch (error) {
- throw this.translate(error, id);
- }
- this.logger.log({ message: "Deal deleted", dealId: id });
- return { id };
- }
-
private searchFilter(q: string): Prisma.DealWhereInput {
const term = q.trim();
if (!term) return {};
diff --git a/apps/api/src/enrichment/enrichment.service.ts b/apps/api/src/enrichment/enrichment.service.ts
index 568dfc05..ccba515f 100644
--- a/apps/api/src/enrichment/enrichment.service.ts
+++ b/apps/api/src/enrichment/enrichment.service.ts
@@ -69,19 +69,6 @@ export class EnrichmentService {
);
}
- /**
- * Warms Context.dev's cache for a batch of domains.
- *
- * Free, and the difference between a CSV import queueing a hundred cold
- * seven-second lookups and a hundred warm sub-second ones.
- */
- async warm(domains: string[]): Promise<void> {
- if (!this.context.enabled) return;
- await Promise.all(
- [...new Set(domains)].map((domain) => this.context.prefetch(domain)),
- );
- }
-
/** Whether the agent has an API key at all. */
get enabled(): boolean {
return this.context.enabled;
diff --git a/apps/api/src/generated/server.ts b/apps/api/src/generated/server.ts
index 5a6c2eac..d9eae44c 100644
--- a/apps/api/src/generated/server.ts
+++ b/apps/api/src/generated/server.ts
@@ -13,18 +13,16 @@ import { z } from "zod";
const t = initTRPC.create();
const publicProcedure = t.procedure;
-import { timelineInput, timelineCountsInput, myTasksInput, activityCreateInput, activityUpdateInput, completeInput, activityIdInput } from "../activities/activities.contracts";
+import { timelineInput, timelineCountsInput, myTasksInput, activityCreateInput, completeInput } from "../activities/activities.contracts";
import { companyListInput, companyIdInput, companyOptionsInput, companyCreateInput, companyUpdateArgs, setPrimaryContactInput } from "../companies/companies.contracts";
import { contactListInput, contactIdInput, contactCreateInput, contactUpdateArgs } from "../contacts/contacts.contracts";
-import { dealListInput, dealIdInput, dealCreateInput, dealUpdateArgs, setStageInput, setContactsInput } from "../deals/deals.contracts";
-import { boardInput } from "../deals/deals.board";
-import { importInput } from "../import/import.contracts";
+import { dashboardSummaryInput } from "../dashboard/dashboard.contracts";
+import { dealListInput, dealIdInput, dealCreateInput, dealUpdateArgs, setStageInput } from "../deals/deals.contracts";
import type { ActivitiesRouter } from "../activities/activities.router";
import type { CompaniesRouter } from "../companies/companies.router";
import type { ContactsRouter } from "../contacts/contacts.router";
import type { DashboardRouter } from "../dashboard/dashboard.router";
import type { DealsRouter } from "../deals/deals.router";
-import type { ImportRouter } from "../import/import.router";
import type { SearchRouter } from "../search/search.router";
import type { UsersRouter } from "../users/users.router";
@@ -42,15 +40,9 @@ const appRouter = t.router({
create: publicProcedure
.input(activityCreateInput)
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ActivitiesRouter["create"]>>),
- update: publicProcedure
- .input(activityUpdateInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ActivitiesRouter["update"]>>),
complete: publicProcedure
.input(completeInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ActivitiesRouter["complete"]>>),
- remove: publicProcedure
- .input(activityIdInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ActivitiesRouter["remove"]>>)
+ .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ActivitiesRouter["complete"]>>)
}),
companies: t.router({
list: publicProcedure
@@ -68,9 +60,6 @@ const appRouter = t.router({
update: publicProcedure
.input(companyUpdateArgs)
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<CompaniesRouter["update"]>>),
- remove: publicProcedure
- .input(companyIdInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<CompaniesRouter["remove"]>>),
enrich: publicProcedure
.input(companyIdInput)
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<CompaniesRouter["enrich"]>>),
@@ -93,22 +82,17 @@ const appRouter = t.router({
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ContactsRouter["create"]>>),
update: publicProcedure
.input(contactUpdateArgs)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ContactsRouter["update"]>>),
- remove: publicProcedure
- .input(contactIdInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ContactsRouter["remove"]>>)
+ .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ContactsRouter["update"]>>)
}),
dashboard: t.router({
summary: publicProcedure
+ .input(dashboardSummaryInput)
.query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DashboardRouter["summary"]>>)
}),
deals: t.router({
list: publicProcedure
.input(dealListInput)
.query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["list"]>>),
- board: publicProcedure
- .input(boardInput)
- .query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["board"]>>),
byId: publicProcedure
.input(dealIdInput)
.query(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["byId"]>>),
@@ -120,18 +104,7 @@ const appRouter = t.router({
.mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["update"]>>),
setStage: publicProcedure
.input(setStageInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["setStage"]>>),
- setContacts: publicProcedure
- .input(setContactsInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["setContacts"]>>),
- remove: publicProcedure
- .input(dealIdInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["remove"]>>)
- }),
- import: t.router({
- run: publicProcedure
- .input(importInput)
- .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<ImportRouter["run"]>>)
+ .mutation(async () => "PLACEHOLDER_DO_NOT_REMOVE" as unknown as Awaited<ReturnType<DealsRouter["setStage"]>>)
}),
search: t.router({
quick: publicProcedure
diff --git a/apps/api/src/import/csv.ts b/apps/api/src/import/csv.ts
deleted file mode 100644
index 915b8f66..00000000
--- a/apps/api/src/import/csv.ts
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * A CSV reader, rather than a dependency.
- *
- * HubSpot exports are RFC 4180: comma-separated, `"` quoting, `""` for a
- * literal quote, and newlines allowed inside quoted fields. That is the whole
- * grammar, and it is about forty lines — small enough that owning it beats
- * taking a parser we would then have to keep patched.
- */
-
-export type CsvRow = Record<string, string>;
-
-/**
- * A row plus the line it came from.
- *
- * The line number is the point of the import report — "fix row 214" is only
- * useful if 214 is what the spreadsheet shows. Blank rows are dropped from the
- * results but still consume a line number.
- */
-export type ParsedRow = { line: number; values: CsvRow };
-
-/** Splits a CSV document into rows of raw cells. */
-function parseRows(input: string): string[][] {
- const rows: string[][] = [];
- let row: string[] = [];
- let cell = "";
- let quoted = false;
-
- // Normalising line endings first means the state machine below only has to
- // think about `\n`.
- const text = input.replace(/\r\n?/g, "\n");
-
- for (let index = 0; index < text.length; index++) {
- const char = text[index];
-
- if (quoted) {
- if (char === '"') {
- if (text[index + 1] === '"') {
- cell += '"';
- index += 1;
- } else {
- quoted = false;
- }
- } else {
- cell += char;
- }
- continue;
- }
-
- if (char === '"') {
- quoted = true;
- } else if (char === ",") {
- row.push(cell);
- cell = "";
- } else if (char === "\n") {
- row.push(cell);
- rows.push(row);
- row = [];
- cell = "";
- } else {
- cell += char;
- }
- }
-
- // A file that does not end in a newline still has a last row.
- if (cell !== "" || row.length > 0) {
- row.push(cell);
- rows.push(row);
- }
-
- return rows;
-}
-
-/**
- * Parses a CSV into objects keyed by header.
- *
- * Headers are lower-cased and stripped of punctuation so "First Name",
- * "first_name" and "FIRST NAME" all land on `firstname` — HubSpot's column
- * names differ between export types and versions, and a rep should not have to
- * care which one they got.
- */
-export function parseCsv(input: string): ParsedRow[] {
- const all = parseRows(input);
-
- // The header is the first row with anything in it; anything above it is
- // blank padding, and it still counts towards the line numbers below.
- const headerIndex = all.findIndex((row) =>
- row.some((cell) => cell.trim() !== ""),
- );
- if (headerIndex === -1) return [];
-
- const keys = (all[headerIndex] ?? []).map(normalizeHeader);
- const parsed: ParsedRow[] = [];
-
- for (let index = headerIndex + 1; index < all.length; index++) {
- const row = all[index] ?? [];
- if (!row.some((cell) => cell.trim() !== "")) continue;
-
- const values: CsvRow = {};
- for (const [column, key] of keys.entries()) {
- if (!key) continue;
- const value = row[column]?.trim() ?? "";
- // A repeated header should not blank out the column that has data.
- if (value !== "" || !(key in values)) values[key] = value;
- }
-
- // 1-based, counting the header — what a spreadsheet shows in the gutter.
- parsed.push({ line: index + 1, values });
- }
-
- return parsed;
-}
-
-export function normalizeHeader(header: string): string {
- return header
- .trim()
- .toLowerCase()
- .replace(/[^a-z0-9]/g, "");
-}
-
-/** First non-empty value among the aliases a column might be called. */
-export function field(row: CsvRow, ...aliases: string[]): string | undefined {
- for (const alias of aliases) {
- const value = row[normalizeHeader(alias)];
- if (value) return value;
- }
- return undefined;
-}
-
-/**
- * HubSpot writes amounts as `1,234.50` or `$1,234.50`. Returns integer cents,
- * or `null` when the cell is empty or not a number.
- */
-export function parseAmountCents(value: string | undefined): number | null {
- if (!value) return null;
- const cleaned = value.replace(/[^0-9.-]/g, "");
- if (cleaned === "" || cleaned === "-") return null;
- const parsed = Number.parseFloat(cleaned);
- return Number.isFinite(parsed) ? Math.round(parsed * 100) : null;
-}
-
-/** A date cell, or `null` — an unparseable date is dropped, not guessed at. */
-export function parseCsvDate(value: string | undefined): Date | null {
- if (!value) return null;
- const parsed = new Date(value);
- return Number.isNaN(parsed.getTime()) ? null : parsed;
-}
diff --git a/apps/api/src/import/import.contracts.ts b/apps/api/src/import/import.contracts.ts
deleted file mode 100644
index 3c780449..00000000
--- a/apps/api/src/import/import.contracts.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import { z } from "zod";
-
-export const IMPORT_KINDS = ["companies", "contacts", "deals"] as const;
-
-export type ImportKind = (typeof IMPORT_KINDS)[number];
-
-export const importInput = z.object({
- kind: z.enum(IMPORT_KINDS),
- /** The file's contents. Imports are a few thousand rows, not a data lake. */
- csv: z.string().min(1, "That file is empty."),
- /**
- * A dry run reports what *would* happen and writes nothing.
- *
- * Defaults to `true`: an import that silently rewrites the CRM on the first
- * click is how a bad column mapping becomes a restore-from-backup.
- */
- dryRun: z.boolean().default(true),
- /** Owner for rows that do not name one. */
- defaultOwnerId: z.string().nullable().optional(),
-});
-
-export type ImportInput = z.infer<typeof importInput>;
-
-/** What one row would do, or did. */
-export type RowOutcome = "created" | "updated" | "skipped" | "failed";
-
-export type ImportRowReport = {
- /** 1-based, counting the header as row 1 — what a spreadsheet shows. */
- line: number;
- outcome: RowOutcome;
- /** The domain, email or deal name the row was matched on. */
- key: string | null;
- label: string | null;
- reason?: string;
-};
-
-export type ImportReport = {
- kind: ImportKind;
- dryRun: boolean;
- total: number;
- created: number;
- updated: number;
- skipped: number;
- failed: number;
- /** Every row, so a dry run can be read before committing to it. */
- rows: ImportRowReport[];
-};
diff --git a/apps/api/src/import/import.module.ts b/apps/api/src/import/import.module.ts
deleted file mode 100644
index 3f9c2f6a..00000000
--- a/apps/api/src/import/import.module.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { Module } from "@nestjs/common";
-import { EnrichmentModule } from "../enrichment/enrichment.module";
-import { TrpcModule } from "../trpc/trpc.module";
-import { ImportRouter } from "./import.router";
-import { ImportService } from "./import.service";
-
-@Module({
- imports: [TrpcModule, EnrichmentModule],
- providers: [ImportService, ImportRouter],
-})
-export class ImportModule {}
diff --git a/apps/api/src/import/import.router.ts b/apps/api/src/import/import.router.ts
deleted file mode 100644
index 93e4f75c..00000000
--- a/apps/api/src/import/import.router.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Inject } from "@nestjs/common";
-import { Input, Mutation, Router, UseMiddlewares } from "nestjs-trpc";
-import type { z } from "zod";
-import { AuthMiddleware } from "../trpc/middlewares/auth.middleware";
-import { importInput } from "./import.contracts";
-import { ImportService } from "./import.service";
-
-@Router({ alias: "import" })
-@UseMiddlewares(AuthMiddleware)
-export class ImportRouter {
- constructor(@Inject(ImportService) private readonly imports: ImportService) {}
-
- /**
- * A mutation even when `dryRun` is true.
- *
- * A dry run writes nothing, but it is a POST with a body the size of a
- * spreadsheet, and modelling it as a query would put the whole file in a URL
- * and in the query cache.
- */
- @Mutation({ input: importInput })
- async run(@Input() input: z.infer<typeof importInput>) {
- return this.imports.run(input);
- }
-}
diff --git a/apps/api/src/import/import.service.ts b/apps/api/src/import/import.service.ts
deleted file mode 100644
index 2a6de655..00000000
--- a/apps/api/src/import/import.service.ts
+++ /dev/null
@@ -1,506 +0,0 @@
-import { type Db, type DealStage, DealStage as Stage } from "@crm/db";
-import { Injectable, Logger } from "@nestjs/common";
-import { normalizeDomain } from "../companies/domain";
-import { blankToNull, fromCents } from "../crm/values";
-import { InjectDatabase } from "../database/database.constants";
-import { isClosedStage } from "../deals/deal-stage";
-import { EnrichmentService } from "../enrichment/enrichment.service";
-import {
- type CsvRow,
- field,
- type ParsedRow,
- parseAmountCents,
- parseCsv,
- parseCsvDate,
-} from "./csv";
-import type {
- ImportInput,
- ImportKind,
- ImportReport,
- ImportRowReport,
-} from "./import.contracts";
-
-/**
- * HubSpot's deal stage names, lower-cased, mapped onto ours.
- *
- * Anything unrecognised lands in `DEMO_BOOKED` rather than failing the row: a
- * deal in the wrong column is a two-second fix, a deal that did not import is
- * a deal nobody knows is missing.
- */
-const STAGE_ALIASES: Record<string, DealStage> = {
- "demo booked": Stage.DEMO_BOOKED,
- appointmentscheduled: Stage.DEMO_BOOKED,
- "appointment scheduled": Stage.DEMO_BOOKED,
- "qualified to buy": Stage.QUALIFIED_TO_BUY,
- qualifiedtobuy: Stage.QUALIFIED_TO_BUY,
- "unqualified to buy": Stage.UNQUALIFIED_TO_BUY,
- unqualified: Stage.UNQUALIFIED_TO_BUY,
- "decision maker bought in": Stage.DECISION_MAKER_BOUGHT_IN,
- decisionmakerboughtin: Stage.DECISION_MAKER_BOUGHT_IN,
- "contract sent": Stage.CONTRACT_SENT,
- contractsent: Stage.CONTRACT_SENT,
- "closed won": Stage.CLOSED_WON,
- closedwon: Stage.CLOSED_WON,
- "closed lost": Stage.CLOSED_LOST,
- closedlost: Stage.CLOSED_LOST,
-};
-
-/** Rows above this are refused rather than quietly truncated. */
-const MAX_ROWS = 5_000;
-
-@Injectable()
-export class ImportService {
- private readonly logger = new Logger(ImportService.name);
-
- constructor(
- @InjectDatabase() private readonly db: Db,
- private readonly enrichment: EnrichmentService,
- ) {}
-
- async run(input: ImportInput): Promise<ImportReport> {
- const rows = parseCsv(input.csv);
-
- if (rows.length > MAX_ROWS) {
- throw new Error(
- `That file has ${rows.length} rows; the limit is ${MAX_ROWS}. Split it and import in batches.`,
- );
- }
-
- const reports =
- input.kind === "companies"
- ? await this.importCompanies(rows, input)
- : input.kind === "contacts"
- ? await this.importContacts(rows, input)
- : await this.importDeals(rows, input);
-
- const report = summarise(input.kind, input.dryRun, reports);
-
- this.logger.log({
- message: input.dryRun ? "Import dry run" : "Import applied",
- kind: input.kind,
- total: report.total,
- created: report.created,
- updated: report.updated,
- skipped: report.skipped,
- failed: report.failed,
- });
-
- return report;
- }
-
- private async importCompanies(
- rows: ParsedRow[],
- input: ImportInput,
- ): Promise<ImportRowReport[]> {
- // Warm Context.dev's cache for the whole file before touching any of it.
- // Prefetch is free, and it turns a queue of cold 7-second lookups into
- // warm sub-second ones once the rows land.
- if (!input.dryRun) {
- await this.enrichment.warm(
- rows
- .map(({ values }) =>
- normalizeDomain(
- field(values, "domain", "Company Domain Name", "website"),
- ),
- )
- .filter((domain): domain is string => domain !== null),
- );
- }
-
- const reports: ImportRowReport[] = [];
-
- for (const { line, values: row } of rows) {
- const name = field(row, "name", "Company name");
- const domain = normalizeDomain(
- field(row, "domain", "Company Domain Name", "website"),
- );
-
- if (!name && !domain) {
- reports.push({
- line,
- outcome: "skipped",
- key: null,
- label: null,
- reason: "No name and no domain.",
- });
- continue;
- }
-
- // Domain is the dedupe key. Rows without one fall back to an exact,
- // case-insensitive name match — HubSpot company exports often have no
- // domain column, and without a fallback every re-import would duplicate
- // those rows. The match is exact on purpose: fuzzy company names merge
- // accounts that are not the same company.
- const existing = domain
- ? await this.db.company.findUnique({
- where: { domain },
- select: { id: true, name: true },
- })
- : name
- ? await this.db.company.findFirst({
- where: {
- name: { equals: name, mode: "insensitive" },
- domain: null,
- },
- select: { id: true, name: true },
- })
- : null;
-
- // Worth saying out loud: a name match is a weaker claim than a domain
- // match, and the reader of the report is the one who can judge it.
- const matchedByName = existing !== null && domain === null;
- const label = name ?? domain;
-
- if (input.dryRun) {
- reports.push({
- line,
- outcome: existing ? "updated" : "created",
- key: domain,
- label,
- reason: matchedByName
- ? "Matched on name — this row has no domain."
- : domain
- ? undefined
- : "No domain, so this company cannot be matched on re-import.",
- });
- continue;
- }
-
- try {
- if (existing) {
- // Only fills gaps, exactly like the agent: an import should not
- // undo edits someone made after the last one.
- await this.db.company.update({
- where: { id: existing.id },
- data: {
- phone:
- blankToNull(field(row, "phone", "Phone Number") ?? "") ??
- undefined,
- city: blankToNull(field(row, "city") ?? "") ?? undefined,
- country: blankToNull(field(row, "country") ?? "") ?? undefined,
- industry: blankToNull(field(row, "industry") ?? "") ?? undefined,
- },
- });
- reports.push({
- line,
- outcome: "updated",
- key: domain,
- label,
- reason: matchedByName
- ? "Matched on name — this row has no domain."
- : undefined,
- });
- continue;
- }
-
- const company = await this.db.company.create({
- data: {
- name: name ?? domain ?? "Unnamed",
- domain,
- website: domain ? `https://${domain}` : null,
- phone: blankToNull(field(row, "phone", "Phone Number") ?? ""),
- city: blankToNull(field(row, "city") ?? ""),
- country: blankToNull(field(row, "country") ?? ""),
- industry: blankToNull(field(row, "industry") ?? ""),
- ownerId: input.defaultOwnerId ?? null,
- },
- select: { id: true },
- });
-
- this.enrichment.enqueueCompany(company.id);
- reports.push({ line, outcome: "created", key: domain, label });
- } catch (error) {
- reports.push({
- line,
- outcome: "failed",
- key: domain,
- label,
- reason: describe(error),
- });
- }
- }
-
- return reports;
- }
-
- private async importContacts(
- rows: ParsedRow[],
- input: ImportInput,
- ): Promise<ImportRowReport[]> {
- const reports: ImportRowReport[] = [];
-
- for (const { line, values: row } of rows) {
- const email = blankToNull(
- (field(row, "email", "Email Address") ?? "").toLowerCase(),
- );
- const firstName = field(row, "firstname", "First Name");
- const lastName = field(row, "lastname", "Last Name");
- const label = [firstName, lastName].filter(Boolean).join(" ") || email;
-
- if (!firstName && !email) {
- reports.push({
- line,
- outcome: "skipped",
- key: null,
- label: null,
- reason: "No name and no email.",
- });
- continue;
- }
-
- // Dedupe on email, which is unique — this is what makes re-running an
- // import safe.
- const existing = email
- ? await this.db.contact.findUnique({
- where: { email },
- select: { id: true },
- })
- : null;
-
- if (input.dryRun) {
- reports.push({
- line,
- outcome: existing ? "updated" : "created",
- key: email,
- label,
- });
- continue;
- }
-
- try {
- const companyId = await this.resolveCompany(row, email);
-
- if (existing) {
- await this.db.contact.update({
- where: { id: existing.id },
- data: {
- phone:
- blankToNull(field(row, "phone", "Phone Number") ?? "") ??
- undefined,
- title:
- blankToNull(
- field(row, "jobtitle", "Job Title", "title") ?? "",
- ) ?? undefined,
- ...(companyId ? { companyId } : {}),
- },
- });
- reports.push({ line, outcome: "updated", key: email, label });
- continue;
- }
-
- await this.db.contact.create({
- data: {
- firstName: firstName ?? email ?? "Unnamed",
- lastName: blankToNull(lastName ?? ""),
- email,
- phone: blankToNull(field(row, "phone", "Phone Number") ?? ""),
- title: blankToNull(
- field(row, "jobtitle", "Job Title", "title") ?? "",
- ),
- companyId,
- ownerId: input.defaultOwnerId ?? null,
- },
- });
-
- reports.push({ line, outcome: "created", key: email, label });
- } catch (error) {
- reports.push({
- line,
- outcome: "failed",
- key: email,
- label,
- reason: describe(error),
- });
- }
- }
-
- return reports;
- }
-
- private async importDeals(
- rows: ParsedRow[],
- input: ImportInput,
- ): Promise<ImportRowReport[]> {
- const reports: ImportRowReport[] = [];
-
- // Deals need an owner — the column is required in our schema — so a file
- // with no owner and no default cannot be applied at all.
- const fallbackOwnerId =
- input.defaultOwnerId ??
- (await this.db.user.findFirst({ select: { id: true } }))?.id ??
- null;
-
- for (const { line, values: row } of rows) {
- const name = field(row, "dealname", "Deal Name", "name");
- const companyName = field(row, "company", "Associated Company");
- const domain = normalizeDomain(
- field(row, "domain", "Associated Company Domain", "website"),
- );
- const label = name ?? null;
-
- if (!name) {
- reports.push({
- line,
- outcome: "skipped",
- key: null,
- label: null,
- reason: "No deal name.",
- });
- continue;
- }
-
- const company = await this.findCompany(domain, companyName);
-
- if (!company) {
- reports.push({
- line,
- outcome: "skipped",
- key: domain ?? companyName ?? null,
- label,
- reason:
- "No matching company — import companies first, or add the domain column.",
- });
- continue;
- }
-
- if (!fallbackOwnerId) {
- reports.push({
- line,
- outcome: "skipped",
- key: name,
- label,
- reason: "Every deal needs an owner; pick a default.",
- });
- continue;
- }
-
- // Deals have no natural key, so "the same name at the same company" is
- // the closest thing to one. It is what makes a re-run update rather
- // than duplicate.
- const existing = await this.db.deal.findFirst({
- where: { name, companyId: company.id },
- select: { id: true },
- });
-
- if (input.dryRun) {
- reports.push({
- line,
- outcome: existing ? "updated" : "created",
- key: company.id,
- label,
- });
- continue;
- }
-
- try {
- const stage = resolveStage(
- field(row, "dealstage", "Deal Stage", "stage"),
- );
- const amountCents = parseAmountCents(field(row, "amount"));
- const closeDate = parseCsvDate(field(row, "closedate", "Close Date"));
- const closed = isClosedStage(stage);
-
- const data = {
- name,
- companyId: company.id,
- ownerId: fallbackOwnerId,
- stage,
- amount: fromCents(amountCents),
- expectedCloseDate: closeDate,
- closedAt: closed ? (closeDate ?? new Date()) : null,
- };
-
- if (existing) {
- await this.db.deal.update({ where: { id: existing.id }, data });
- reports.push({ line, outcome: "updated", key: company.id, label });
- } else {
- await this.db.deal.create({ data });
- reports.push({ line, outcome: "created", key: company.id, label });
- }
- } catch (error) {
- reports.push({
- line,
- outcome: "failed",
- key: company.id,
- label,
- reason: describe(error),
- });
- }
- }
-
- return reports;
- }
-
- /** The company a contact row belongs to: an explicit column, then the email. */
- private async resolveCompany(
- row: CsvRow,
- email: string | null,
- ): Promise<string | null> {
- const domain = normalizeDomain(
- field(row, "domain", "Associated Company Domain", "Company Domain Name"),
- );
- const companyName = field(row, "company", "Associated Company");
-
- const matched = await this.findCompany(domain, companyName);
- if (matched) return matched.id;
-
- // Falls back to the agent, which will find or create one from the work
- // address — the same path a hand-added contact takes.
- return email ? this.enrichment.companyForEmail(email) : null;
- }
-
- private async findCompany(domain: string | null, name: string | undefined) {
- if (domain) {
- const byDomain = await this.db.company.findUnique({
- where: { domain },
- select: { id: true },
- });
- if (byDomain) return byDomain;
- }
-
- if (name) {
- // Name matching is a fallback, and deliberately exact — fuzzy matching
- // on company names attaches deals to the wrong account.
- return this.db.company.findFirst({
- where: { name: { equals: name, mode: "insensitive" } },
- select: { id: true },
- });
- }
-
- return null;
- }
-}
-
-function resolveStage(value: string | undefined): DealStage {
- if (!value) return Stage.DEMO_BOOKED;
- const key = value.trim().toLowerCase();
- return (
- STAGE_ALIASES[key] ??
- STAGE_ALIASES[key.replace(/[^a-z]/g, "")] ??
- Stage.DEMO_BOOKED
- );
-}
-
-function summarise(
- kind: ImportKind,
- dryRun: boolean,
- rows: ImportRowReport[],
-): ImportReport {
- const count = (outcome: ImportRowReport["outcome"]) =>
- rows.filter((row) => row.outcome === outcome).length;
-
- return {
- kind,
- dryRun,
- total: rows.length,
- created: count("created"),
- updated: count("updated"),
- skipped: count("skipped"),
- failed: count("failed"),
- rows,
- };
-}
-
-function describe(error: unknown): string {
- return error instanceof Error ? error.message : String(error);
-}
diff --git a/apps/api/src/logging/context-logger.ts b/apps/api/src/logging/context-logger.ts
index 3c639518..8ebaff8b 100644
--- a/apps/api/src/logging/context-logger.ts
+++ b/apps/api/src/logging/context-logger.ts
@@ -22,7 +22,7 @@ const DEVELOPMENT_LEVELS: LogLevel[] = [
* JSON at `log` and above in production, colourised with `debug`/`verbose`
* locally. Read live, not captured at import, so tests can flip it.
*/
-export function consoleLoggerOptions(): ConsoleLoggerOptions {
+function consoleLoggerOptions(): ConsoleLoggerOptions {
const isProduction = process.env.NODE_ENV === "production";
return {
@@ -41,7 +41,7 @@ export function consoleLoggerOptions(): ConsoleLoggerOptions {
* argument. Fields are hoisted to the top level in JSON and rendered after the
* text in development.
*/
-export type StructuredMessage = { message: string } & Record<string, unknown>;
+type StructuredMessage = { message: string } & Record<string, unknown>;
/** What `ConsoleLogger` emits in JSON mode, plus our correlation fields. */
interface JsonLogRecord {
@@ -132,7 +132,7 @@ export class ContextLogger extends ConsoleLogger {
}
/** Enough of a UUID to eyeball-match lines in a local terminal. */
-export function shortId(requestId: string): string {
+function shortId(requestId: string): string {
return requestId.slice(0, 8);
}
diff --git a/apps/api/src/trpc/list-input.ts b/apps/api/src/trpc/list-input.ts
index 96cabcb3..1f16c6b2 100644
--- a/apps/api/src/trpc/list-input.ts
+++ b/apps/api/src/trpc/list-input.ts
@@ -18,7 +18,7 @@ export const listInput = z.object({
export type ListInput = z.infer<typeof listInput>;
/** Facet id → value → number of rows that would match. */
-export type FacetCounts = Record<string, Record<string, number>>;
+type FacetCounts = Record<string, Record<string, number>>;
export type ListResult<TRow> = {
rows: TRow[];
diff --git a/apps/api/test/csv.spec.ts b/apps/api/test/csv.spec.ts
deleted file mode 100644
index bde9c775..00000000
--- a/apps/api/test/csv.spec.ts
+++ /dev/null
@@ -1,107 +0,0 @@
-import { describe, expect, it } from "bun:test";
-import {
- field,
- parseAmountCents,
- parseCsv,
- parseCsvDate,
-} from "../src/import/csv";
-
-describe("parseCsv", () => {
- it("reads a plain file and reports the spreadsheet line", () => {
- expect(
- parseCsv("name,domain\nStripe,stripe.com\nLinear,linear.app"),
- ).toEqual([
- { line: 2, values: { name: "Stripe", domain: "stripe.com" } },
- { line: 3, values: { name: "Linear", domain: "linear.app" } },
- ]);
- });
-
- it("keeps line numbers honest when blank rows are skipped", () => {
- // A report that says "fix row 5" has to mean row 5 in the file, not the
- // fifth row that happened to have data in it.
- const rows = parseCsv("name\nStripe\n\n\nLinear\n");
-
- expect(rows.map((row) => [row.line, row.values.name])).toEqual([
- [2, "Stripe"],
- [5, "Linear"],
- ]);
- });
-
- it("normalises header spelling so any HubSpot export lands", () => {
- const [parsed] = parseCsv("First Name,Company Domain Name\nAda,stripe.com");
-
- expect(parsed?.values.firstname).toBe("Ada");
- expect(parsed?.values.companydomainname).toBe("stripe.com");
- });
-
- it("handles quoted fields, commas and escaped quotes", () => {
- const [parsed] = parseCsv(
- 'name,note\n"Acme, Inc.","They said ""maybe"" twice"',
- );
-
- expect(parsed?.values.name).toBe("Acme, Inc.");
- expect(parsed?.values.note).toBe('They said "maybe" twice');
- });
-
- it("keeps newlines inside a quoted field", () => {
- const [parsed] = parseCsv('name,note\nAcme,"line one\nline two"');
-
- expect(parsed?.values.note).toBe("line one\nline two");
- });
-
- it("copes with CRLF, a trailing newline and blank lines", () => {
- expect(
- parseCsv("name\r\nStripe\r\n\r\nLinear\r\n").map((row) => row.values),
- ).toEqual([{ name: "Stripe" }, { name: "Linear" }]);
- });
-
- it("returns nothing for an empty or header-only file", () => {
- expect(parseCsv("")).toEqual([]);
- expect(parseCsv("name,domain")).toEqual([]);
- });
-
- it("does not let a short row shift the columns", () => {
- const [parsed] = parseCsv("name,domain,phone\nStripe,stripe.com");
-
- expect(parsed?.values.name).toBe("Stripe");
- expect(parsed?.values.domain).toBe("stripe.com");
- expect(parsed?.values.phone).toBe("");
- });
-});
-
-describe("field", () => {
- it("takes the first alias that has a value", () => {
- const [parsed] = parseCsv("First Name,name\n,Stripe");
- if (!parsed) throw new Error("expected a row");
-
- expect(field(parsed.values, "firstname", "name")).toBe("Stripe");
- expect(field(parsed.values, "nothing", "here")).toBeUndefined();
- });
-});
-
-describe("parseAmountCents", () => {
- it("reads what HubSpot writes", () => {
- expect(parseAmountCents("1,234.50")).toBe(123450);
- expect(parseAmountCents("$1,234.50")).toBe(123450);
- expect(parseAmountCents("24000")).toBe(2400000);
- // Floats are rounded to cents rather than carried as fractions.
- expect(parseAmountCents("0.1")).toBe(10);
- });
-
- it("treats an empty or junk cell as no amount", () => {
- for (const value of ["", " ", "n/a", "-", undefined]) {
- expect(parseAmountCents(value)).toBeNull();
- }
- });
-});
-
-describe("parseCsvDate", () => {
- it("parses a date, and drops one it cannot", () => {
- expect(parseCsvDate("2026-12-31")?.toISOString()).toBe(
- "2026-12-31T00:00:00.000Z",
- );
- expect(parseCsvDate("not a date")).toBeNull();
- expect(parseCsvDate("")).toBeNull();
- expect(parseCsvDate(undefined)).toBeNull();
- });
-});
diff --git a/apps/app/app/(app)/companies/companies-table.tsx b/apps/app/app/(app)/companies/companies-table.tsx
index e447b063..8bd3e0e6 100644
--- a/apps/app/app/(app)/companies/companies-table.tsx
+++ b/apps/app/app/(app)/companies/companies-table.tsx
@@ -11,7 +11,9 @@ import { relativeTimeFromIso } from "@crm/ui/lib/format";
import { useQuery } from "@tanstack/react-query";
import {
ENRICHMENT_FACET_OPTIONS,
+ ENRICHMENT_POLL_MS,
EnrichmentIndicator,
+ isEnriching,
} from "@/components/crm/enrichment-status";
import { OwnerCell } from "@/components/crm/owner-cell";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
@@ -100,7 +102,7 @@ const COLUMNS: DataTableColumn<CompanyRow>[] = [
width: "w-[12%]",
hideBelow: "sm",
cell: (row) => (
- <span className="text-muted-foreground">
+ <span className="text-muted-foreground" suppressHydrationWarning>
{relativeTimeFromIso(row.lastActivityAt)}
</span>
),
@@ -128,6 +130,14 @@ export function CompaniesTable() {
// Keeps the previous page on screen while the next one loads, so paging
// and typing never blank the table.
placeholderData: (previous) => previous,
+ // A company added here is enriched in the background, and the agent
+ // filling in its logo and industry is not a client action anyone can
+ // invalidate on. Ask while any row on this page is still working — a new
+ // company's logo then lands in the table rather than waiting for a reload.
+ refetchInterval: (query) =>
+ query.state.data?.rows.some((row) => isEnriching(row.enrichmentStatus))
+ ? ENRICHMENT_POLL_MS
+ : false,
});
const users = useQuery(trpc.users.list.queryOptions());
diff --git a/apps/app/app/(app)/companies/create-company-sheet.tsx b/apps/app/app/(app)/companies/create-company-sheet.tsx
index 13037116..f9999692 100644
--- a/apps/app/app/(app)/companies/create-company-sheet.tsx
+++ b/apps/app/app/(app)/companies/create-company-sheet.tsx
@@ -28,11 +28,12 @@ import {
SheetTrigger,
} from "@crm/ui/components/sheet";
import { Spinner } from "@crm/ui/components/spinner";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { parseAsBoolean, useQueryState } from "nuqs";
import { useId, useState } from "react";
import { toast } from "sonner";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
const UNASSIGNED = "unassigned";
@@ -47,7 +48,7 @@ const UNASSIGNED = "unassigned";
export function CreateCompanySheet() {
const openRecord = useOpenRecord();
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
// Open state lives in the URL, like every other view state here: "add a
// company" is then a link you can send someone, and Back closes the sheet
@@ -68,9 +69,7 @@ export function CreateCompanySheet() {
const create = useMutation(
trpc.companies.create.mutationOptions({
onSuccess: async (company) => {
- await queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- });
+ await cache.company(company.id);
toast.success(`${company.name} added.`);
// `null` rather than `false` so the closed state leaves a clean URL.
await setOpen(null);
diff --git a/apps/app/app/(app)/companies/page.tsx b/apps/app/app/(app)/companies/page.tsx
index a3b6be50..6d75fa05 100644
--- a/apps/app/app/(app)/companies/page.tsx
+++ b/apps/app/app/(app)/companies/page.tsx
@@ -42,7 +42,7 @@ export default async function CompaniesPage({
void queryClient.prefetchQuery(trpc.users.list.queryOptions());
return (
- <PageShell>
+ <PageShell className="min-h-0">
<PageShellHeader>
<PageShellHeading>
<PageShellTitle>Companies</PageShellTitle>
@@ -55,7 +55,7 @@ export default async function CompaniesPage({
</PageShellActions>
</PageShellHeader>
- <PageShellContent>
+ <PageShellContent className="min-h-0">
<HydrateClient>
<CompaniesTable />
</HydrateClient>
diff --git a/apps/app/app/(app)/contacts/contacts-table.tsx b/apps/app/app/(app)/contacts/contacts-table.tsx
index 903ee04f..267996f5 100644
--- a/apps/app/app/(app)/contacts/contacts-table.tsx
+++ b/apps/app/app/(app)/contacts/contacts-table.tsx
@@ -9,6 +9,7 @@ import { EmptyCellValue } from "@crm/ui/components/empty-cell";
import { relativeTimeFromIso } from "@crm/ui/lib/format";
import { useQuery } from "@tanstack/react-query";
import { CompanyCell } from "@/components/crm/company-cell";
+import { contactName } from "@/components/crm/contact-name";
import { OwnerCell } from "@/components/crm/owner-cell";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
import { useTableQuery } from "@/components/data-table/use-table-query";
@@ -18,13 +19,6 @@ import { contactsSearchParams } from "./contacts-search-params";
type ContactRow = RouterOutputs["contacts"]["list"]["rows"][number];
-export function contactName(contact: {
- firstName: string;
- lastName: string | null;
-}): string {
- return [contact.firstName, contact.lastName].filter(Boolean).join(" ");
-}
-
const COLUMNS: DataTableColumn<ContactRow>[] = [
{
id: "name",
@@ -83,7 +77,7 @@ const COLUMNS: DataTableColumn<ContactRow>[] = [
width: "w-[12%]",
hideBelow: "sm",
cell: (row) => (
- <span className="text-muted-foreground">
+ <span className="text-muted-foreground" suppressHydrationWarning>
{relativeTimeFromIso(row.lastActivityAt)}
</span>
),
diff --git a/apps/app/app/(app)/contacts/create-contact-sheet.tsx b/apps/app/app/(app)/contacts/create-contact-sheet.tsx
index 8e117ef2..a8da8614 100644
--- a/apps/app/app/(app)/contacts/create-contact-sheet.tsx
+++ b/apps/app/app/(app)/contacts/create-contact-sheet.tsx
@@ -23,11 +23,12 @@ import {
SheetTrigger,
} from "@crm/ui/components/sheet";
import { Spinner } from "@crm/ui/components/spinner";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { parseAsBoolean, useQueryState } from "nuqs";
import { useId, useState } from "react";
import { toast } from "sonner";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
const NONE = "none";
@@ -40,7 +41,7 @@ export function CreateContactSheet({
}) {
const openRecord = useOpenRecord();
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
// URL state, like every other view state here — see CreateCompanySheet.
const [open, setOpen] = useQueryState(
@@ -65,18 +66,7 @@ export function CreateContactSheet({
const create = useMutation(
trpc.contacts.create.mutationOptions({
onSuccess: async (contact) => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.contacts.list.queryKey(),
- }),
- // The company's own page shows its contacts and their count.
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- ]);
+ await cache.contact(contact.id);
toast.success(
`${[contact.firstName, contact.lastName].filter(Boolean).join(" ")} added.`,
);
diff --git a/apps/app/app/(app)/contacts/page.tsx b/apps/app/app/(app)/contacts/page.tsx
index 5889bc30..60efc7d1 100644
--- a/apps/app/app/(app)/contacts/page.tsx
+++ b/apps/app/app/(app)/contacts/page.tsx
@@ -40,7 +40,7 @@ export default async function ContactsPage({
);
return (
- <PageShell>
+ <PageShell className="min-h-0">
<PageShellHeader>
<PageShellHeading>
<PageShellTitle>Contacts</PageShellTitle>
@@ -51,7 +51,7 @@ export default async function ContactsPage({
</PageShellActions>
</PageShellHeader>
- <PageShellContent>
+ <PageShellContent className="min-h-0">
<HydrateClient>
<ContactsTable />
</HydrateClient>
diff --git a/apps/app/app/(app)/dashboard-summary.tsx b/apps/app/app/(app)/dashboard-summary.tsx
index e8a7cc8c..8a853164 100644
--- a/apps/app/app/(app)/dashboard-summary.tsx
+++ b/apps/app/app/(app)/dashboard-summary.tsx
@@ -4,269 +4,369 @@ import { Button } from "@crm/ui/components/button";
import {
Card,
CardAction,
- CardContent,
+ CardDescription,
CardHeader,
+ CardPanel,
+ CardPanelEmpty,
CardTitle,
} from "@crm/ui/components/card";
+import { CardTableEmpty } from "@crm/ui/components/card-table";
import { Checkbox } from "@crm/ui/components/checkbox";
import { EmptyCellValue } from "@crm/ui/components/empty-cell";
-import { Separator } from "@crm/ui/components/separator";
+import {
+ SimpleTable,
+ type SimpleTableColumn,
+ SimpleTableRow,
+} from "@crm/ui/components/simple-table";
+import { Spinner } from "@crm/ui/components/spinner";
import { StatusIndicator } from "@crm/ui/components/status-indicator";
-import { formatMoney, relativeTimeFromIso } from "@crm/ui/lib/format";
+import { TableCell } from "@crm/ui/components/table";
import {
- useMutation,
- useQueryClient,
- useSuspenseQuery,
-} from "@tanstack/react-query";
+ formatCount,
+ formatMoneyCompact,
+ relativeTimeFromIso,
+} from "@crm/ui/lib/format";
+import { useMutation, useQuery } from "@tanstack/react-query";
import Link from "next/link";
+import { useQueryState } from "nuqs";
+import type { CSSProperties } from "react";
import { toast } from "sonner";
-import { dealStageLabel } from "@/components/crm/deal-stage";
-import { OwnerCell } from "@/components/crm/owner-cell";
+import {
+ DealStageIndicator,
+ dealStageColor,
+} from "@/components/crm/deal-stage";
import { RecordLink } from "@/components/crm/record-sheet/record-link";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
-import {
- ActivityIcon,
- activityLabel,
-} from "@/components/crm/timeline/activity-icon";
+import { activityLabel } from "@/components/crm/timeline/activity-icon";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
+import { overviewParsers } from "./overview-search-params";
+import { SalesDashboard } from "./sales-dashboard";
-const dateFormat = new Intl.DateTimeFormat(undefined, {
- month: "short",
- day: "numeric",
-});
+/**
+ * Cell padding, in one constant.
+ *
+ * `SimpleTable` sets its own header padding and leaves the body to the caller,
+ * so a table where one column forgot `py-2.5` is a row half a line taller than
+ * the ones around it — which is most of what made these lists look ragged.
+ */
+const CELL = "px-3 py-2.5 align-middle";
+/**
+ * Every list on the overview is a table: a header row naming the columns, rows
+ * divided by hairlines, and no icon in the leading cell. A glyph per row is
+ * what this page deliberately does not do.
+ *
+ * The two panels below the charts are framed and set to one height because
+ * their rows scroll; the activity log at the bottom is unframed and runs as
+ * long as it needs to, because nothing sits beside it to end level with.
+ */
export function DashboardSummary() {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const openRecord = useOpenRecord();
- const { data } = useSuspenseQuery(trpc.dashboard.summary.queryOptions());
+ // Read, not written, here: the toggle in the page header owns the setter, and
+ // both sides agree because the value lives in the URL rather than in a
+ // provider threaded between them.
+ const [scope] = useQueryState("scope", overviewParsers.scope);
+
+ const summaryQuery = useQuery({
+ ...trpc.dashboard.summary.queryOptions({ scope }),
+ // Switching scope keeps the previous numbers on screen while the new ones
+ // load, the same way the tables hold their rows while paging.
+ placeholderData: (previous) => previous,
+ });
const complete = useMutation(
trpc.activities.complete.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.dashboard.summary.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timeline.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.myTasks.queryKey(),
- }),
- ]);
- },
+ onSuccess: () => cache.activity(),
onError: (error) => toast.error(error.message),
}),
);
- const {
- pipeline,
- wonThisMonth,
- closingThisMonth,
- overdueTasks,
- recentActivity,
- } = data;
+ const summary = summaryQuery.data;
+
+ if (!summary) {
+ return (
+ <div className="flex flex-1 justify-center py-12">
+ <Spinner />
+ </div>
+ );
+ }
+
+ const { biggestOpen, overdueTasks, recentActivity } = summary;
+
+ const mine = scope === "me";
+ const largestOpenCents = biggestOpen[0]?.amountCents ?? 0;
+
+ const openColumns: SimpleTableColumn[] = [
+ { header: "Deal" },
+ { header: "Stage", width: "w-32", className: "hidden lg:table-cell" },
+ {
+ srLabel: "Share of the largest",
+ width: "w-24",
+ className: "hidden sm:table-cell",
+ },
+ { header: "Value", width: "w-20", align: "right" },
+ ];
+
+ const taskColumns: SimpleTableColumn[] = [
+ { srLabel: "Done", width: "w-8" },
+ { header: "Task" },
+ { header: "Overdue", width: "w-24", align: "right" },
+ ];
+
+ const activityColumns: SimpleTableColumn[] = [
+ { header: "Activity" },
+ { header: "Company", width: "w-44", className: "hidden md:table-cell" },
+ { header: "Deal", width: "w-48", className: "hidden lg:table-cell" },
+ { header: "Who", width: "w-32", className: "hidden md:table-cell" },
+ { header: "When", width: "w-20", align: "right" },
+ ];
return (
<div className="flex flex-col gap-6">
- <Card>
- <CardHeader>
- <CardTitle>Pipeline</CardTitle>
- <CardAction>
- <span className="text-muted-foreground text-xs">
- {pipeline.totalDeals} open ·{" "}
- <span className="tabular-nums">
- {formatMoney(pipeline.totalCents)}
- </span>
- </span>
- </CardAction>
- </CardHeader>
- <Separator />
- <CardContent>
- <div className="grid gap-3 @md/page-content:grid-cols-2 @3xl/page-content:grid-cols-4">
- {pipeline.stages.map((stage) => (
- <Link
- key={stage.stage}
- href={`/deals?stage=${stage.stage}`}
- className="flex flex-col gap-1 border p-3 hover:bg-muted/40"
- >
- <span className="text-muted-foreground text-xs">
- {dealStageLabel(stage.stage)}
- </span>
- <span className="font-medium text-xl tabular-nums">
- {formatMoney(stage.valueCents)}
- </span>
- <span className="text-muted-foreground text-xs tabular-nums">
- {stage.count} {stage.count === 1 ? "deal" : "deals"}
- </span>
- </Link>
- ))}
- </div>
- </CardContent>
- </Card>
+ <SalesDashboard summary={summary} />
+ {/*
+ * Two panels of one fixed height rather than four cards that each grew
+ * to fit their rows: the pair always ends level, and the activity list
+ * below them stays where a rep last saw it however many deals are open.
+ */}
<div className="grid gap-6 @3xl/page-content:grid-cols-2">
- <Card>
+ <Card className="min-w-0">
<CardHeader>
- <CardTitle>Closing this month</CardTitle>
+ <CardTitle>Deals in progress</CardTitle>
+ <CardDescription>
+ The largest open deals, and how long each has sat in its stage
+ </CardDescription>
<CardAction>
- <span className="text-muted-foreground text-xs">
- {wonThisMonth.count} won ·{" "}
- <span className="tabular-nums">
- {formatMoney(wonThisMonth.valueCents)}
- </span>
- </span>
+ <Button asChild variant="ghost" size="sm">
+ <Link href="/deals">Open deals</Link>
+ </Button>
</CardAction>
</CardHeader>
- <Separator />
- <CardContent>
- {closingThisMonth.length === 0 ? (
- <p className="py-6 text-center text-muted-foreground text-xs">
- Nothing is due to close this month.
- </p>
+ <CardPanel>
+ {biggestOpen.length === 0 ? (
+ <CardPanelEmpty>
+ Nothing open. Time to fill the pipeline.
+ </CardPanelEmpty>
) : (
- <ul className="divide-y">
- {closingThisMonth.map((deal) => (
- <li key={deal.id} className="flex items-center gap-3 py-2.5">
- <button
- type="button"
- onClick={() => openRecord({ kind: "deal", id: deal.id })}
- className="flex min-w-0 flex-1 flex-col text-left hover:underline"
- >
- <span className="truncate font-medium text-sm">
- {deal.name}
- </span>
- <span className="truncate text-muted-foreground text-xs">
- {deal.company.name} · {dealStageLabel(deal.stage)}
- </span>
- </button>
- <span className="shrink-0 text-muted-foreground text-xs">
- {deal.expectedCloseDate
- ? dateFormat.format(new Date(deal.expectedCloseDate))
- : null}
- </span>
- <span className="shrink-0 tabular-nums text-sm">
+ <SimpleTable variant="panel" surface="page" columns={openColumns}>
+ {biggestOpen.map((deal) => (
+ <SimpleTableRow
+ key={deal.id}
+ clickable
+ onClick={() => openRecord({ kind: "deal", id: deal.id })}
+ >
+ <TableCell className={CELL}>
+ <DealCell
+ name={deal.name}
+ company={deal.company.name}
+ // Rendered on the server and again in the browser,
+ // often a minute apart — the text is meant to drift.
+ meta={relativeTimeFromIso(deal.stageChangedAt)}
+ />
+ </TableCell>
+ <TableCell className={`${CELL} hidden lg:table-cell`}>
+ <DealStageIndicator stage={deal.stage} />
+ </TableCell>
+ <TableCell className={`${CELL} hidden sm:table-cell`}>
+ <ValueMeter
+ share={
+ largestOpenCents > 0
+ ? ((deal.amountCents ?? 0) / largestOpenCents) * 100
+ : 0
+ }
+ color={dealStageColor(deal.stage)}
+ />
+ </TableCell>
+ <TableCell className={`${CELL} text-right tabular-nums`}>
{deal.amountCents === null ? (
<EmptyCellValue />
) : (
- formatMoney(deal.amountCents, deal.currency)
+ formatMoneyCompact(deal.amountCents, deal.currency)
)}
- </span>
- <OwnerCell owner={deal.owner} />
- </li>
+ </TableCell>
+ </SimpleTableRow>
))}
- </ul>
+ </SimpleTable>
)}
- </CardContent>
+ </CardPanel>
</Card>
- <Card>
+ <Card className="min-w-0">
<CardHeader>
- <CardTitle>My overdue tasks</CardTitle>
- <CardAction>
- {overdueTasks.length > 0 ? (
- <StatusIndicator
- tone="error"
- className="text-xs"
- label={`${overdueTasks.length} overdue`}
- />
- ) : null}
- </CardAction>
+ <CardTitle>Overdue tasks</CardTitle>
+ <CardDescription>
+ {overdueTasks.length === 0
+ ? "Every task you have logged is either done or still to come"
+ : `${formatCount(overdueTasks.length, "task")} past due`}
+ </CardDescription>
</CardHeader>
- <Separator />
- <CardContent>
+ <CardPanel>
{overdueTasks.length === 0 ? (
- <p className="py-6 text-center text-muted-foreground text-xs">
- Nothing overdue. Good.
- </p>
+ <CardPanelEmpty>Nothing overdue. Good.</CardPanelEmpty>
) : (
- <ul className="divide-y">
+ <SimpleTable variant="panel" surface="page" columns={taskColumns}>
{overdueTasks.map((task) => (
- <li key={task.id} className="flex items-center gap-3 py-2.5">
- <Checkbox
- checked={false}
- disabled={complete.isPending}
- aria-label="Mark as done"
- onCheckedChange={() =>
- complete.mutate({ id: task.id, completed: true })
- }
- />
- <span className="flex min-w-0 flex-1 flex-col">
- <span className="truncate text-sm">{task.subject}</span>
- <span className="flex min-w-0 text-xs">
- {task.deal ? (
- <RecordLink kind="deal" id={task.deal.id}>
- {task.deal.name}
- </RecordLink>
- ) : task.company ? (
- <RecordLink kind="company" id={task.company.id}>
- {task.company.name}
- </RecordLink>
- ) : null}
+ <SimpleTableRow key={task.id}>
+ <TableCell className={CELL}>
+ <Checkbox
+ checked={false}
+ disabled={complete.isPending}
+ aria-label="Mark as done"
+ onCheckedChange={() =>
+ complete.mutate({ id: task.id, completed: true })
+ }
+ />
+ </TableCell>
+ <TableCell className={CELL}>
+ <span className="flex min-w-0 flex-col">
+ <span className="truncate">{task.subject}</span>
+ <span className="flex min-w-0 text-muted-foreground">
+ {task.deal ? (
+ <RecordLink kind="deal" id={task.deal.id}>
+ {task.deal.name}
+ </RecordLink>
+ ) : task.company ? (
+ <RecordLink kind="company" id={task.company.id}>
+ {task.company.name}
+ </RecordLink>
+ ) : null}
+ </span>
</span>
- </span>
- <StatusIndicator
- tone="error"
- className="shrink-0 text-xs"
- label={relativeTimeFromIso(task.dueAt)}
- />
- </li>
+ </TableCell>
+ <TableCell className={`${CELL} text-right`}>
+ <StatusIndicator
+ tone="error"
+ label={relativeTimeFromIso(task.dueAt)}
+ />
+ </TableCell>
+ </SimpleTableRow>
))}
- </ul>
+ </SimpleTable>
)}
- </CardContent>
+ </CardPanel>
</Card>
</div>
- <Card>
+ <Card className="min-w-0">
<CardHeader>
- <CardTitle>Recent activity</CardTitle>
+ <CardTitle>
+ {mine ? "Your recent activity" : "Recent activity"}
+ </CardTitle>
+ <CardDescription>
+ {mine
+ ? "Every note, task and stage change you have logged"
+ : "Every note, task and stage change across the workspace"}
+ </CardDescription>
<CardAction>
<Button asChild variant="ghost" size="sm">
<Link href="/companies">All companies</Link>
</Button>
</CardAction>
</CardHeader>
- <Separator />
- <CardContent>
- {recentActivity.length === 0 ? (
- <p className="py-6 text-center text-muted-foreground text-xs">
- Nothing has happened yet.
- </p>
- ) : (
- <ul className="divide-y">
- {recentActivity.map((entry) => (
- <li key={entry.id} className="flex items-start gap-3 py-2.5">
- <span className="mt-0.5 text-muted-foreground">
- <ActivityIcon type={entry.type} />
- </span>
- <span className="flex min-w-0 flex-1 flex-col">
- <span className="truncate text-sm">
- {entry.subject ?? activityLabel(entry.type)}
- </span>
- <span className="flex min-w-0 items-center gap-1 truncate text-muted-foreground text-xs">
- {entry.company ? (
- <RecordLink kind="company" id={entry.company.id}>
- {entry.company.name}
- </RecordLink>
- ) : null}
- <span className="truncate">
- {entry.deal ? ` · ${entry.deal.name}` : null}
- {` · ${entry.createdBy.name}`}
- </span>
- </span>
+ {recentActivity.length === 0 ? (
+ <CardTableEmpty>Nothing has happened yet.</CardTableEmpty>
+ ) : (
+ <SimpleTable columns={activityColumns}>
+ {recentActivity.map((entry) => (
+ <SimpleTableRow key={entry.id}>
+ <TableCell className={CELL}>
+ <span className="truncate">
+ {entry.subject ?? activityLabel(entry.type)}
</span>
- <span className="shrink-0 text-muted-foreground text-xs">
+ </TableCell>
+ <TableCell className={`${CELL} hidden md:table-cell`}>
+ {entry.company ? (
+ <RecordLink kind="company" id={entry.company.id}>
+ {entry.company.name}
+ </RecordLink>
+ ) : (
+ <EmptyCellValue />
+ )}
+ </TableCell>
+ <TableCell className={`${CELL} hidden lg:table-cell`}>
+ {entry.deal ? (
+ <RecordLink kind="deal" id={entry.deal.id}>
+ {entry.deal.name}
+ </RecordLink>
+ ) : (
+ <EmptyCellValue />
+ )}
+ </TableCell>
+ <TableCell
+ className={`${CELL} hidden truncate text-muted-foreground md:table-cell`}
+ >
+ {entry.createdBy.name}
+ </TableCell>
+ <TableCell
+ className={`${CELL} text-right text-muted-foreground`}
+ >
+ {/* Rendered on the server and again in the browser, often a
+ minute apart — the text is meant to drift. */}
+ <span suppressHydrationWarning>
{relativeTimeFromIso(entry.createdAt)}
</span>
- </li>
- ))}
- </ul>
- )}
- </CardContent>
+ </TableCell>
+ </SimpleTableRow>
+ ))}
+ </SimpleTable>
+ )}
</Card>
</div>
);
}
+
+/**
+ * A deal's name over the account it belongs to — two lines in one cell, so the
+ * table keeps four columns in a half-width panel instead of seven.
+ */
+function DealCell({
+ name,
+ company,
+ meta,
+}: {
+ name: string;
+ company: string;
+ meta?: string;
+}) {
+ return (
+ <span className="flex min-w-0 flex-col">
+ <span className="truncate font-medium">{name}</span>
+ <span className="truncate text-muted-foreground" suppressHydrationWarning>
+ {meta ? `${company} · ${meta}` : company}
+ </span>
+ </span>
+ );
+}
+
+/**
+ * A deal's or a rep's share of the biggest one on the list.
+ *
+ * The same bar the charts use, in plain HTML: `bloom-*` is a theme-independent
+ * utility in `globals.css` precisely so a meter beside a row matches the plot
+ * above it. Hidden below `sm`, where the number alone has to carry it.
+ */
+function ValueMeter({ share, color }: { share: number; color: string }) {
+ return (
+ <span
+ className="bloom-low flex h-1.5 w-full overflow-hidden bg-muted"
+ style={{ "--bloom-color": color } as CSSProperties}
+ >
+ <span
+ className="h-full w-(--share)"
+ style={
+ {
+ backgroundColor: color,
+ // Rounded: a bar 24px wide cannot render the difference, and the
+ // raw ratio puts fourteen decimal places in the markup.
+ "--share": `${Math.round(Math.max(Math.min(share, 100), 0))}%`,
+ } as CSSProperties
+ }
+ />
+ </span>
+ );
+}
diff --git a/apps/app/app/(app)/deals/create-deal-sheet.tsx b/apps/app/app/(app)/deals/create-deal-sheet.tsx
index 85229f9e..5a8f3878 100644
--- a/apps/app/app/(app)/deals/create-deal-sheet.tsx
+++ b/apps/app/app/(app)/deals/create-deal-sheet.tsx
@@ -28,12 +28,13 @@ import {
SheetTrigger,
} from "@crm/ui/components/sheet";
import { Spinner } from "@crm/ui/components/spinner";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { parseAsBoolean, useQueryState } from "nuqs";
import { useId, useState } from "react";
import { toast } from "sonner";
import { dealStageLabel, OPEN_STAGES } from "@/components/crm/deal-stage";
import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
const UNSET = "";
@@ -46,7 +47,7 @@ export function CreateDealSheet({
}) {
const openRecord = useOpenRecord();
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
// URL state, like every other view state here — see CreateCompanySheet.
const [open, setOpen] = useQueryState(
@@ -74,17 +75,7 @@ export function CreateDealSheet({
const create = useMutation(
trpc.deals.create.mutationOptions({
onSuccess: async (deal) => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- ]);
+ await cache.deal(deal.id);
toast.success(`${deal.name} added.`);
await setOpen(null);
setName("");
diff --git a/apps/app/app/(app)/deals/deals-board.tsx b/apps/app/app/(app)/deals/deals-board.tsx
deleted file mode 100644
index 05d214bf..00000000
--- a/apps/app/app/(app)/deals/deals-board.tsx
+++ /dev/null
@@ -1,222 +0,0 @@
-"use client";
-
-import type { DealStage } from "@crm/db/enums";
-import { EmptyCellValue } from "@crm/ui/components/empty-cell";
-import { EntityLogo } from "@crm/ui/components/entity-logo";
-import { Spinner } from "@crm/ui/components/spinner";
-import { formatMoney } from "@crm/ui/lib/format";
-import { cn } from "@crm/ui/lib/utils";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { parseAsString, useQueryState, useQueryStates } from "nuqs";
-import { useState } from "react";
-import { toast } from "sonner";
-import { dealStageLabel, LOSING_STAGES } from "@/components/crm/deal-stage";
-import { OwnerCell } from "@/components/crm/owner-cell";
-import { useOpenRecord } from "@/components/crm/record-sheet/record-stack";
-import { DealStageMenu } from "@/components/crm/stage-change";
-import { useTRPC } from "@/lib/trpc/client";
-import type { RouterOutputs } from "@/lib/trpc/types";
-
-type Column = RouterOutputs["deals"]["board"]["columns"][number];
-type Card = Column["cards"][number];
-
-const dateFormat = new Intl.DateTimeFormat(undefined, {
- month: "short",
- day: "numeric",
-});
-
-/**
- * The open pipeline, as columns you can drag between.
- *
- * Native HTML drag and drop rather than a library: the interaction is "pick up
- * one card, drop it on one column", and that is what the platform already does.
- * Dropping onto a losing stage opens the same reason dialog the table uses —
- * the API refuses those without one either way.
- */
-export function DealsBoard() {
- const openRecord = useOpenRecord();
- const trpc = useTRPC();
- const queryClient = useQueryClient();
-
- const [owner] = useQueryState("owner", parseAsString.withDefault("all"));
- const [q] = useQueryState("q", parseAsString.withDefault(""));
- const [, setCloseParams] = useQueryStates({
- closing: parseAsString,
- closingStage: parseAsString,
- });
-
- const [dragging, setDragging] = useState<string | null>(null);
- const [over, setOver] = useState<DealStage | null>(null);
-
- const board = useQuery({
- ...trpc.deals.board.queryOptions({ q, owner, limit: 50 }),
- placeholderData: (previous) => previous,
- });
-
- const setStage = useMutation(
- trpc.deals.setStage.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.deals.board.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- ]);
- },
- onError: (error) => toast.error(error.message),
- }),
- );
-
- const drop = (stage: DealStage) => {
- const id = dragging;
- setDragging(null);
- setOver(null);
- if (!id) return;
-
- if (LOSING_STAGES.includes(stage)) {
- void setCloseParams({ closing: id, closingStage: stage });
- return;
- }
- setStage.mutate({ id, stage });
- };
-
- if (board.isPending) {
- return (
- <div className="flex justify-center py-12">
- <Spinner />
- </div>
- );
- }
-
- return (
- <div className="flex min-h-0 flex-1 gap-3 overflow-x-auto pb-2">
- {(board.data?.columns ?? []).map((column) => (
- /*
- * A column is a drop target across its whole area, not just the
- * cards in it — an empty column has to be droppable too.
- */
- // biome-ignore lint/a11y/noStaticElementInteractions: a drop target is pointer-only by nature. Dragging is an enhancement, not the only route: every card carries the same stage menu the table rows use, which is keyboard-operable.
- <section
- key={column.stage}
- onDragOver={(event) => {
- event.preventDefault();
- setOver(column.stage);
- }}
- onDragLeave={() =>
- setOver((current) => (current === column.stage ? null : current))
- }
- onDrop={() => drop(column.stage)}
- className={cn(
- "flex w-72 shrink-0 flex-col border",
- over === column.stage && "bg-muted/50",
- )}
- >
- <header className="flex items-baseline justify-between gap-2 border-b px-3 py-2">
- <span className="truncate font-medium text-sm">
- {dealStageLabel(column.stage)}
- </span>
- <span className="shrink-0 text-muted-foreground text-xs tabular-nums">
- {column.total} · {formatMoney(column.valueCents)}
- </span>
- </header>
-
- <ul className="flex min-h-24 flex-1 flex-col gap-2 overflow-y-auto p-2">
- {column.cards.map((card) => (
- <BoardCard
- key={card.id}
- card={card}
- dragging={dragging === card.id}
- onDragStart={() => setDragging(card.id)}
- onDragEnd={() => setDragging(null)}
- onOpen={() => openRecord({ kind: "deal", id: card.id })}
- />
- ))}
-
- {column.cards.length < column.total ? (
- <li className="py-2 text-center text-muted-foreground text-xs">
- {column.total - column.cards.length} more — narrow the filters
- to see them
- </li>
- ) : null}
- </ul>
- </section>
- ))}
- </div>
- );
-}
-
-function BoardCard({
- card,
- dragging,
- onDragStart,
- onDragEnd,
- onOpen,
-}: {
- card: Card;
- dragging: boolean;
- onDragStart: () => void;
- onDragEnd: () => void;
- onOpen: () => void;
-}) {
- return (
- <li
- draggable
- onDragStart={onDragStart}
- onDragEnd={onDragEnd}
- className={cn(
- "flex cursor-grab flex-col gap-2 border bg-background p-2.5",
- dragging && "opacity-50",
- )}
- >
- {/*
- * The title is the clickable region rather than the whole card: the
- * footer holds a stage menu, and a button inside a button is neither
- * valid nor operable.
- */}
- <button
- type="button"
- onClick={onOpen}
- className="truncate text-left font-medium text-sm hover:underline"
- >
- {card.name}
- </button>
-
- <span className="flex min-w-0 items-center gap-2">
- <EntityLogo
- src={card.company.iconUrl}
- name={card.company.name}
- size="sm"
- />
- <span className="truncate text-muted-foreground text-xs">
- {card.company.name}
- </span>
- </span>
-
- <span className="flex items-center justify-between gap-2">
- <span className="tabular-nums text-sm">
- {card.amountCents === null ? (
- <EmptyCellValue />
- ) : (
- formatMoney(card.amountCents, card.currency)
- )}
- </span>
- <span className="flex items-center gap-2">
- {card.expectedCloseDate ? (
- <span className="text-muted-foreground text-xs">
- {dateFormat.format(new Date(card.expectedCloseDate))}
- </span>
- ) : null}
- <OwnerCell owner={card.owner} compact />
- </span>
- </span>
-
- {/* The keyboard route to the same move dragging performs. */}
- <DealStageMenu dealId={card.id} stage={card.stage} />
- </li>
- );
-}
diff --git a/apps/app/app/(app)/deals/deals-search-params.ts b/apps/app/app/(app)/deals/deals-search-params.ts
index ba26bcb4..964c4e3e 100644
--- a/apps/app/app/(app)/deals/deals-search-params.ts
+++ b/apps/app/app/(app)/deals/deals-search-params.ts
@@ -1,4 +1,3 @@
-import { parseAsStringLiteral } from "nuqs/server";
import { createListSearchParams } from "@/components/data-table/list-search-params";
export const dealsSearchParams = createListSearchParams({
@@ -8,14 +7,3 @@ export const dealsSearchParams = createListSearchParams({
tabId: "status",
facetIds: ["owner", "stage", "closing"] as const,
});
-
-/** `?view=board` swaps the table for the pipeline columns. */
-export const dealsViewParser = parseAsStringLiteral([
- "table",
- "board",
-] as const).withDefault("table");
-
-export const loadDealsView = (searchParams: Record<string, unknown>) =>
- dealsViewParser.parseServerSide(
- searchParams.view as string | string[] | undefined,
- );
diff --git a/apps/app/app/(app)/deals/deals-table.tsx b/apps/app/app/(app)/deals/deals-table.tsx
index 218516b0..d8ebf7d7 100644
--- a/apps/app/app/(app)/deals/deals-table.tsx
+++ b/apps/app/app/(app)/deals/deals-table.tsx
@@ -97,7 +97,7 @@ const COLUMNS: DataTableColumn<DealRow>[] = [
width: "w-[12%]",
hideBelow: "lg",
cell: (row) => (
- <span className="text-muted-foreground">
+ <span className="text-muted-foreground" suppressHydrationWarning>
{relativeTimeFromIso(row.lastActivityAt)}
</span>
),
diff --git a/apps/app/app/(app)/deals/deals-view.tsx b/apps/app/app/(app)/deals/deals-view.tsx
deleted file mode 100644
index 98e9c83a..00000000
--- a/apps/app/app/(app)/deals/deals-view.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-"use client";
-
-import ChartColumn from "@carbon/icons-react/es/ChartColumn";
-import ListChecked from "@carbon/icons-react/es/ListChecked";
-import { Icon } from "@crm/ui/components/icon";
-import { ToggleGroup, ToggleGroupItem } from "@crm/ui/components/toggle-group";
-import { useQueryState } from "nuqs";
-import { DealsBoard } from "./deals-board";
-import { dealsViewParser } from "./deals-search-params";
-import { DealsTable } from "./deals-table";
-
-/** Table or board, from `?view=` — so "the board, filtered to me" is a link. */
-export function DealsViewToggle() {
- const [view, setView] = useQueryState("view", dealsViewParser);
-
- return (
- <ToggleGroup
- type="single"
- value={view}
- onValueChange={(next) =>
- next && setView(next === "board" ? "board" : null)
- }
- variant="outline"
- size="sm"
- >
- <ToggleGroupItem value="table" aria-label="Table">
- <Icon icon={ListChecked} />
- Table
- </ToggleGroupItem>
- <ToggleGroupItem value="board" aria-label="Board">
- <Icon icon={ChartColumn} />
- Board
- </ToggleGroupItem>
- </ToggleGroup>
- );
-}
-
-export function DealsView() {
- const [view] = useQueryState("view", dealsViewParser);
-
- return view === "board" ? <DealsBoard /> : <DealsTable />;
-}
diff --git a/apps/app/app/(app)/deals/page.tsx b/apps/app/app/(app)/deals/page.tsx
index 997e01a1..3af54650 100644
--- a/apps/app/app/(app)/deals/page.tsx
+++ b/apps/app/app/(app)/deals/page.tsx
@@ -13,8 +13,8 @@ import { requireSession } from "@/lib/session";
import { HydrateClient } from "@/lib/trpc/hydrate";
import { getServerQueryClient, getServerTrpc } from "@/lib/trpc/server";
import { CreateDealSheet } from "./create-deal-sheet";
-import { dealsSearchParams, loadDealsView } from "./deals-search-params";
-import { DealsView, DealsViewToggle } from "./deals-view";
+import { dealsSearchParams } from "./deals-search-params";
+import { DealsTable } from "./deals-table";
export const metadata: Metadata = {
title: "Deals",
@@ -28,33 +28,22 @@ export default async function DealsPage({
await requireSession();
const values = await dealsSearchParams.load(searchParams);
- const view = loadDealsView(await searchParams);
const trpc = getServerTrpc();
const queryClient = getServerQueryClient();
// The rows are awaited so the first paint is the filtered, sorted, correct
// page rather than a spinner. The owner and company pickers behind the facet
// dropdowns are not — the table draws fine without them.
- // Only the view actually being shown is prefetched — the other one is a
- // second set of queries nobody asked for.
- await (view === "board"
- ? queryClient.prefetchQuery(
- trpc.deals.board.queryOptions({
- q: values.q.trim(),
- owner: values.owner,
- limit: 50,
- }),
- )
- : queryClient.prefetchQuery(
- trpc.deals.list.queryOptions(dealsSearchParams.toInput(values)),
- ));
+ await queryClient.prefetchQuery(
+ trpc.deals.list.queryOptions(dealsSearchParams.toInput(values)),
+ );
void queryClient.prefetchQuery(trpc.users.list.queryOptions());
void queryClient.prefetchQuery(
trpc.companies.options.queryOptions({ q: "" }),
);
return (
- <PageShell>
+ <PageShell className="min-h-0">
<PageShellHeader>
<PageShellHeading>
<PageShellTitle>Deals</PageShellTitle>
@@ -63,14 +52,13 @@ export default async function DealsPage({
</PageShellDescription>
</PageShellHeading>
<PageShellActions>
- <DealsViewToggle />
<CreateDealSheet />
</PageShellActions>
</PageShellHeader>
- <PageShellContent>
+ <PageShellContent className="min-h-0">
<HydrateClient>
- <DealsView />
+ <DealsTable />
</HydrateClient>
</PageShellContent>
</PageShell>
diff --git a/apps/app/app/(app)/import/import-panel.tsx b/apps/app/app/(app)/import/import-panel.tsx
deleted file mode 100644
index 68daf4ba..00000000
--- a/apps/app/app/(app)/import/import-panel.tsx
+++ /dev/null
@@ -1,279 +0,0 @@
-"use client";
-
-import Upload from "@carbon/icons-react/es/Upload";
-import { Button } from "@crm/ui/components/button";
-import {
- Card,
- CardAction,
- CardContent,
- CardHeader,
- CardTitle,
-} from "@crm/ui/components/card";
-import { Field, FieldDescription, FieldLabel } from "@crm/ui/components/field";
-import { Icon } from "@crm/ui/components/icon";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@crm/ui/components/select";
-import { Separator } from "@crm/ui/components/separator";
-import { SimpleTable, SimpleTableRow } from "@crm/ui/components/simple-table";
-import { Spinner } from "@crm/ui/components/spinner";
-import {
- StatusIndicator,
- type StatusTone,
-} from "@crm/ui/components/status-indicator";
-import { TableCell } from "@crm/ui/components/table";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { parseAsStringLiteral, useQueryState } from "nuqs";
-import { useId, useState } from "react";
-import { toast } from "sonner";
-import { useTRPC } from "@/lib/trpc/client";
-import type { RouterOutputs } from "@/lib/trpc/types";
-
-type Report = RouterOutputs["import"]["run"];
-type Outcome = Report["rows"][number]["outcome"];
-
-const KINDS = ["companies", "contacts", "deals"] as const;
-
-const KIND_HELP: Record<(typeof KINDS)[number], string> = {
- companies:
- "Matched on domain. Columns: Name, Company Domain Name, Phone, City, Country, Industry.",
- contacts:
- "Matched on email. Columns: First Name, Last Name, Email, Phone, Job Title, Associated Company.",
- deals:
- "Matched on deal name within a company. Columns: Deal Name, Associated Company, Deal Stage, Amount, Close Date. Import companies first.",
-};
-
-const OUTCOME_TONE: Record<Outcome, StatusTone> = {
- created: "success",
- updated: "info",
- skipped: "neutral",
- failed: "error",
-};
-
-const UNASSIGNED = "unassigned";
-
-/**
- * HubSpot CSV import.
- *
- * Always dry-runs first. The report is the whole point: a bad column mapping is
- * invisible until you can see that four hundred rows would be "skipped — no
- * name and no domain", and by then it has already run.
- */
-export function ImportPanel() {
- const trpc = useTRPC();
- const queryClient = useQueryClient();
-
- const [kind, setKind] = useQueryState(
- "kind",
- parseAsStringLiteral(KINDS).withDefault("companies"),
- );
- const [fileName, setFileName] = useState<string | null>(null);
- const [csv, setCsv] = useState("");
- const [ownerId, setOwnerId] = useState(UNASSIGNED);
- const [report, setReport] = useState<Report | null>(null);
-
- const fileId = useId();
-
- const users = useQuery(trpc.users.list.queryOptions());
-
- const run = useMutation(
- trpc.import.run.mutationOptions({
- onSuccess: async (result) => {
- setReport(result);
- if (result.dryRun) {
- toast.success("Dry run finished — nothing was written.");
- return;
- }
- // An applied import touches everything.
- await queryClient.invalidateQueries();
- toast.success(
- `Imported: ${result.created} created, ${result.updated} updated.`,
- );
- },
- onError: (error) => toast.error(error.message),
- }),
- );
-
- const submit = (dryRun: boolean) =>
- run.mutate({
- kind,
- csv,
- dryRun,
- defaultOwnerId: ownerId === UNASSIGNED ? null : ownerId,
- });
-
- const readFile = async (file: File) => {
- setFileName(file.name);
- setCsv(await file.text());
- // The old report describes the old file.
- setReport(null);
- };
-
- return (
- <div className="flex flex-col gap-6">
- <Card>
- <CardHeader>
- <CardTitle>File</CardTitle>
- </CardHeader>
- <Separator />
- <CardContent className="flex flex-col gap-4">
- <Field>
- <FieldLabel htmlFor="import-kind">What is in it</FieldLabel>
- <Select
- value={kind}
- onValueChange={(next) => {
- void setKind(next as (typeof KINDS)[number]);
- setReport(null);
- }}
- >
- <SelectTrigger id="import-kind">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="companies">Companies</SelectItem>
- <SelectItem value="contacts">Contacts</SelectItem>
- <SelectItem value="deals">Deals</SelectItem>
- </SelectContent>
- </Select>
- <FieldDescription>{KIND_HELP[kind]}</FieldDescription>
- </Field>
-
- <Field>
- <FieldLabel htmlFor={fileId}>CSV</FieldLabel>
- <input
- id={fileId}
- type="file"
- accept=".csv,text/csv"
- className="text-sm file:mr-3 file:border file:bg-muted file:px-3 file:py-1.5 file:text-xs"
- onChange={(event) => {
- const file = event.target.files?.[0];
- if (file) void readFile(file);
- }}
- />
- {fileName ? (
- <FieldDescription>
- {fileName} · {csv.length.toLocaleString()} characters
- </FieldDescription>
- ) : null}
- </Field>
-
- <Field>
- <FieldLabel htmlFor="import-owner">
- Owner for rows that do not name one
- </FieldLabel>
- <Select value={ownerId} onValueChange={setOwnerId}>
- <SelectTrigger id="import-owner">
- <SelectValue />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value={UNASSIGNED}>Unassigned</SelectItem>
- {(users.data ?? []).map((user) => (
- <SelectItem key={user.id} value={user.id}>
- {user.name}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- {kind === "deals" ? (
- <FieldDescription>
- Deals must have an owner, so this one is not optional for them.
- </FieldDescription>
- ) : null}
- </Field>
-
- <div className="flex flex-wrap items-center gap-2">
- <Button
- size="sm"
- disabled={run.isPending || csv === ""}
- onClick={() => submit(true)}
- >
- {run.isPending ? <Spinner /> : null}
- Dry run
- </Button>
- <Button
- variant="outline"
- size="sm"
- // Only enabled once a dry run of *this* file has been read.
- disabled={run.isPending || !report?.dryRun}
- onClick={() => submit(false)}
- >
- <Icon icon={Upload} data-icon="inline-start" />
- Apply {report ? `${report.created + report.updated} rows` : ""}
- </Button>
- </div>
- </CardContent>
- </Card>
-
- {report ? <ImportReportCard report={report} /> : null}
- </div>
- );
-}
-
-const REPORT_COLUMNS = [
- { header: "Row", width: "w-[10%]", align: "right" as const },
- { header: "Outcome", width: "w-[18%]" },
- { header: "Record", width: "w-[34%]" },
- { header: "Why", width: "w-[38%]" },
-];
-
-function ImportReportCard({ report }: { report: Report }) {
- // The ones that need a decision come first; a thousand clean "created" rows
- // are not what anyone is scanning for.
- const rows = [...report.rows].sort((a, b) => {
- const rank = (outcome: Outcome) =>
- outcome === "failed" ? 0 : outcome === "skipped" ? 1 : 2;
- return rank(a.outcome) - rank(b.outcome) || a.line - b.line;
- });
-
- return (
- <Card>
- <CardHeader>
- <CardTitle>{report.dryRun ? "Dry run" : "Imported"}</CardTitle>
- <CardAction>
- <span className="flex flex-wrap items-center gap-4 text-xs">
- <StatusIndicator
- tone="success"
- label={`${report.created} created`}
- />
- <StatusIndicator tone="info" label={`${report.updated} updated`} />
- {report.skipped > 0 ? (
- <StatusIndicator
- tone="neutral"
- label={`${report.skipped} skipped`}
- />
- ) : null}
- {report.failed > 0 ? (
- <StatusIndicator tone="error" label={`${report.failed} failed`} />
- ) : null}
- </span>
- </CardAction>
- </CardHeader>
-
- <SimpleTable columns={REPORT_COLUMNS}>
- {rows.map((row) => (
- <SimpleTableRow key={row.line}>
- <TableCell className="px-3 py-2 text-right tabular-nums text-muted-foreground">
- {row.line}
- </TableCell>
- <TableCell className="px-3 py-2 capitalize">
- <StatusIndicator
- tone={OUTCOME_TONE[row.outcome]}
- label={row.outcome}
- />
- </TableCell>
- <TableCell className="truncate px-3 py-2">
- {row.label ?? row.key ?? "—"}
- </TableCell>
- <TableCell className="truncate px-3 py-2 text-muted-foreground">
- {row.reason ?? ""}
- </TableCell>
- </SimpleTableRow>
- ))}
- </SimpleTable>
- </Card>
- );
-}
diff --git a/apps/app/app/(app)/import/page.tsx b/apps/app/app/(app)/import/page.tsx
deleted file mode 100644
index 2fff8a84..00000000
--- a/apps/app/app/(app)/import/page.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import type { Metadata } from "next";
-import {
- PageShell,
- PageShellContent,
- PageShellDescription,
- PageShellHeader,
- PageShellHeading,
- PageShellTitle,
-} from "@/components/page-shell";
-import { requireSession } from "@/lib/session";
-import { HydrateClient } from "@/lib/trpc/hydrate";
-import { getServerQueryClient, getServerTrpc } from "@/lib/trpc/server";
-import { ImportPanel } from "./import-panel";
-
-export const metadata: Metadata = {
- title: "Import",
-};
-
-export default async function ImportPage() {
- await requireSession();
-
- const trpc = getServerTrpc();
- const queryClient = getServerQueryClient();
- void queryClient.prefetchQuery(trpc.users.list.queryOptions());
-
- return (
- <PageShell>
- <PageShellHeader>
- <PageShellHeading>
- <PageShellTitle>Import from HubSpot</PageShellTitle>
- <PageShellDescription>
- Export a list from HubSpot and drop the CSV here. Companies match on
- domain and contacts on email, so re-running an import updates rather
- than duplicates.
- </PageShellDescription>
- </PageShellHeading>
- </PageShellHeader>
-
- <PageShellContent>
- <HydrateClient>
- <ImportPanel />
- </HydrateClient>
- </PageShellContent>
- </PageShell>
- );
-}
diff --git a/apps/app/app/(app)/overview-greeting.tsx b/apps/app/app/(app)/overview-greeting.tsx
index c6b62e05..7522bcd3 100644
--- a/apps/app/app/(app)/overview-greeting.tsx
+++ b/apps/app/app/(app)/overview-greeting.tsx
@@ -1,8 +1,10 @@
"use client";
import { useSuspenseQuery } from "@tanstack/react-query";
+import { useQueryState } from "nuqs";
import { PageShellDescription, PageShellTitle } from "@/components/page-shell";
import { useTRPC } from "@/lib/trpc/client";
+import { overviewParsers } from "./overview-search-params";
/**
* Reads the signed-in user from the API rather than the session cookie, so a
@@ -15,11 +17,16 @@ import { useTRPC } from "@/lib/trpc/client";
export function OverviewGreeting() {
const trpc = useTRPC();
const { data: me } = useSuspenseQuery(trpc.users.me.queryOptions());
+ const [scope] = useQueryState("scope", overviewParsers.scope);
return (
<>
<PageShellTitle>Welcome back, {me.name.split(" ")[0]}</PageShellTitle>
- <PageShellDescription>Welcome to the Comp AI CRM.</PageShellDescription>
+ <PageShellDescription>
+ {scope === "me"
+ ? "What you have closed, what is still in play, and what needs you today."
+ : "What the team has closed, what is still in play, and what needs you today."}
+ </PageShellDescription>
</>
);
}
diff --git a/apps/app/app/(app)/overview-scope.tsx b/apps/app/app/(app)/overview-scope.tsx
new file mode 100644
index 00000000..bf3ad621
--- /dev/null
+++ b/apps/app/app/(app)/overview-scope.tsx
@@ -0,0 +1,51 @@
+"use client";
+
+import { ToggleGroup, ToggleGroupItem } from "@crm/ui/components/toggle-group";
+import { useQueryState } from "nuqs";
+import {
+ OVERVIEW_SCOPES,
+ type OverviewScope,
+ overviewParsers,
+} from "./overview-search-params";
+
+const LABELS: Record<OverviewScope, string> = {
+ me: "Me",
+ everyone: "Everyone",
+};
+
+function isScope(value: string): value is OverviewScope {
+ return (OVERVIEW_SCOPES as readonly string[]).includes(value);
+}
+
+/**
+ * Whose numbers the overview shows.
+ *
+ * In the URL rather than in state: "how the team closed this quarter" is then a
+ * link someone can send, and the panel below reads the same key without either
+ * side owning the other.
+ */
+export function OverviewScopeToggle() {
+ const [scope, setScope] = useQueryState("scope", overviewParsers.scope);
+
+ return (
+ <ToggleGroup
+ type="single"
+ variant="outline"
+ size="sm"
+ spacing={0}
+ value={scope}
+ onValueChange={(next) => {
+ // Radix clears the value when the active item is pressed again, and a
+ // dashboard scoped to nobody is not a state worth having.
+ if (isScope(next)) void setScope(next);
+ }}
+ aria-label="Whose numbers to show"
+ >
+ {OVERVIEW_SCOPES.map((value) => (
+ <ToggleGroupItem key={value} value={value}>
+ {LABELS[value]}
+ </ToggleGroupItem>
+ ))}
+ </ToggleGroup>
+ );
+}
diff --git a/apps/app/app/(app)/overview-search-params.ts b/apps/app/app/(app)/overview-search-params.ts
new file mode 100644
index 00000000..dc51d69a
--- /dev/null
+++ b/apps/app/app/(app)/overview-search-params.ts
@@ -0,0 +1,23 @@
+import { createLoader, parseAsStringLiteral } from "nuqs/server";
+
+/**
+ * The overview URL. Shared by the page's server-side prefetch and the client
+ * panel, so the two cannot ask for different things — the same reason the list
+ * modules keep their parsers in one file.
+ *
+ * Imported from `nuqs/server`: parsers are plain data, and this module is pulled
+ * into both a server component and a client one.
+ */
+
+/** Kept in step with `DASHBOARD_SCOPES` in the API's dashboard contracts. */
+export const OVERVIEW_SCOPES = ["me", "everyone"] as const;
+
+export type OverviewScope = (typeof OVERVIEW_SCOPES)[number];
+
+export const overviewParsers = {
+ // A literal parser, not a plain string: `?scope=nonsense` then falls back to
+ // the default rather than reaching the API as an unhandled value.
+ scope: parseAsStringLiteral(OVERVIEW_SCOPES).withDefault("me"),
+};
+
+export const loadOverviewSearchParams = createLoader(overviewParsers);
diff --git a/apps/app/app/(app)/page.tsx b/apps/app/app/(app)/page.tsx
index e5b12dc9..6f4f9900 100644
--- a/apps/app/app/(app)/page.tsx
+++ b/apps/app/app/(app)/page.tsx
@@ -1,5 +1,7 @@
+import type { SearchParams } from "nuqs/server";
import {
PageShell,
+ PageShellActions,
PageShellContent,
PageShellHeader,
PageShellHeading,
@@ -9,17 +11,30 @@ import { HydrateClient } from "@/lib/trpc/hydrate";
import { getServerQueryClient, getServerTrpc } from "@/lib/trpc/server";
import { DashboardSummary } from "./dashboard-summary";
import { OverviewGreeting } from "./overview-greeting";
+import { OverviewScopeToggle } from "./overview-scope";
+import { loadOverviewSearchParams } from "./overview-search-params";
-export default async function OverviewPage() {
+export default async function OverviewPage({
+ searchParams,
+}: {
+ searchParams: Promise<SearchParams>;
+}) {
await requireSession();
+ // Parsed with the same parser the toggle uses, so the first paint is already
+ // scoped to whoever the URL says rather than to the default.
+ const { scope } = await loadOverviewSearchParams(searchParams);
+
const trpc = getServerTrpc();
const queryClient = getServerQueryClient();
- // The greeting is awaited — it is one line of text, and a skeleton that
- // flashes for the length of one API call is worse than rendering a beat
- // later. The summary streams in behind it.
- await queryClient.prefetchQuery(trpc.users.me.queryOptions());
- await queryClient.prefetchQuery(trpc.dashboard.summary.queryOptions());
+
+ // Both awaited: the greeting is one line of text and the dashboard is the
+ // whole page, so a skeleton that flashes for the length of one API call is
+ // worse than rendering a beat later.
+ await Promise.all([
+ queryClient.prefetchQuery(trpc.users.me.queryOptions()),
+ queryClient.prefetchQuery(trpc.dashboard.summary.queryOptions({ scope })),
+ ]);
return (
<PageShell>
@@ -29,6 +44,9 @@ export default async function OverviewPage() {
<OverviewGreeting />
</HydrateClient>
</PageShellHeading>
+ <PageShellActions>
+ <OverviewScopeToggle />
+ </PageShellActions>
</PageShellHeader>
<PageShellContent>
diff --git a/apps/app/app/(app)/sales-dashboard.tsx b/apps/app/app/(app)/sales-dashboard.tsx
new file mode 100644
index 00000000..0a7fa5a6
--- /dev/null
+++ b/apps/app/app/(app)/sales-dashboard.tsx
@@ -0,0 +1,242 @@
+"use client";
+
+import {
+ Card,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@crm/ui/components/card";
+import type { ChartConfig } from "@crm/ui/components/chart";
+import { DashboardRow, StatGroup } from "@crm/ui/components/dashboard";
+import { StatCard, type StatDelta } from "@crm/ui/components/stat-card";
+import {
+ formatCount,
+ formatMoney,
+ formatMoneyCompact,
+ formatPercent,
+} from "@crm/ui/lib/format";
+import Link from "next/link";
+import type { ReactNode } from "react";
+import { dealStageColor, dealStageLabel } from "@/components/crm/deal-stage";
+import { AreaTrend, DonutStat } from "@/components/dashboard-charts";
+import type { RouterOutputs } from "@/lib/trpc/types";
+
+type Summary = RouterOutputs["dashboard"]["summary"];
+
+/**
+ * Won is the outcome, created is the input that produces it six weeks later.
+ * `--success` for the first because a rep already reads green as "closed"; the
+ * chart ramp for the second because it is a leading indicator, not a verdict.
+ */
+const TREND_CONFIG: ChartConfig = {
+ won: { label: "Closed won", color: "var(--success)" },
+ created: { label: "New pipeline", color: "var(--chart-1)" },
+};
+
+/**
+ * Percentage change, or nothing.
+ *
+ * With no baseline there is no percentage to quote — "+100%" against a month
+ * where nothing closed is arithmetic, not information.
+ */
+function changeDelta(
+ current: number,
+ previous: number,
+ label: string,
+): StatDelta | undefined {
+ if (previous === 0) return undefined;
+ const change = Math.round(((current - previous) / previous) * 100);
+ return {
+ value: `${change >= 0 ? "+" : ""}${change}%`,
+ direction: change > 0 ? "up" : change < 0 ? "down" : "neutral",
+ label,
+ };
+}
+
+/**
+ * The KPI strip and the two charts behind it: six months of closed-won against
+ * new pipeline, and where the open pipeline currently sits.
+ */
+export function SalesDashboard({ summary }: { summary: Summary }) {
+ const {
+ pipeline,
+ wonThisMonth,
+ wonPrevMonth,
+ performance,
+ trend,
+ closingThisMonthTotal,
+ } = summary;
+
+ const hasTrend = trend.some((point) => point.won > 0 || point.created > 0);
+
+ const stageSlices = pipeline.stages
+ .map((stage) => ({
+ key: stage.stage,
+ label: dealStageLabel(stage.stage),
+ value: stage.valueCents,
+ color: dealStageColor(stage.stage),
+ count: stage.count,
+ }))
+ .filter((slice) => slice.value > 0);
+
+ return (
+ <div className="flex flex-col gap-6">
+ <StatGroup>
+ <StatCard
+ label="Closed won this month"
+ value={formatMoneyCompact(wonThisMonth.valueCents)}
+ delta={changeDelta(
+ wonThisMonth.valueCents,
+ wonPrevMonth.valueCents,
+ "vs. last month",
+ )}
+ description={`${formatCount(wonThisMonth.count, "deal")} · ${formatMoneyCompact(wonPrevMonth.valueCents)} last month`}
+ />
+ <StatCard
+ label="Open pipeline"
+ value={formatMoneyCompact(pipeline.totalCents)}
+ description={`${formatCount(pipeline.totalDeals, "deal")} in progress · ${formatMoneyCompact(closingThisMonthTotal.valueCents)} due this month`}
+ />
+ <StatCard
+ label={`Win rate (${performance.windowDays}d)`}
+ value={
+ performance.winRate === null
+ ? "—"
+ : formatPercent(performance.winRate)
+ }
+ description={
+ performance.wins + performance.losses === 0
+ ? "Nothing has closed yet"
+ : `${performance.wins} won · ${performance.losses} lost`
+ }
+ />
+ <StatCard
+ label={`Average deal (${performance.windowDays}d)`}
+ value={
+ performance.avgDealCents === null
+ ? "—"
+ : formatMoneyCompact(performance.avgDealCents)
+ }
+ description={
+ performance.avgCycleDays === null
+ ? "No wins to measure"
+ : `${performance.avgCycleDays}-day average cycle`
+ }
+ />
+ </StatGroup>
+
+ <DashboardRow split="hero">
+ <ChartPanel
+ title="Closed won vs. new pipeline"
+ description="Last six months, by the month a deal closed or was created"
+ >
+ {hasTrend ? (
+ <div className="flex flex-1 flex-col justify-center py-4">
+ <AreaTrend
+ data={trend}
+ config={TREND_CONFIG}
+ xKey="month"
+ height={196}
+ variant="gradient"
+ bloom="high"
+ showLegend
+ formatValue={(value) =>
+ formatMoney(typeof value === "number" ? value : Number(value))
+ }
+ />
+ </div>
+ ) : (
+ <EmptyChart label="No deals closed or created yet" />
+ )}
+ </ChartPanel>
+
+ <ChartPanel
+ title="Open pipeline by stage"
+ description="Where the value sits right now"
+ >
+ {stageSlices.length > 0 ? (
+ <div className="flex flex-1 flex-col justify-between gap-1 pt-4">
+ <DonutStat
+ data={stageSlices}
+ height={168}
+ centerValue={formatMoneyCompact(pipeline.totalCents)}
+ centerLabel="open"
+ formatValue={(value) =>
+ formatMoney(typeof value === "number" ? value : Number(value))
+ }
+ />
+ {/*
+ * A legend of links rather than `onSliceClick`: clicking a
+ * wedge is pointer-only, and "show me the contracts I have
+ * out" is the most likely thing a rep wants from this chart.
+ */}
+ <ul className="flex flex-col px-5 pb-1 md:px-6">
+ {stageSlices.map((slice) => (
+ <li key={slice.key} className="border-t first:border-t-0">
+ <Link
+ href={`/deals?stage=${slice.key}`}
+ className="flex items-center gap-2.5 py-2 text-xs hover:underline"
+ >
+ <span
+ aria-hidden
+ className="size-1.5 shrink-0"
+ style={{ backgroundColor: slice.color }}
+ />
+ <span className="min-w-0 flex-1 truncate">
+ {slice.label}
+ </span>
+ <span className="shrink-0 text-muted-foreground tabular-nums">
+ {slice.count}
+ </span>
+ <span className="w-14 shrink-0 text-right font-medium tabular-nums">
+ {formatMoneyCompact(slice.value)}
+ </span>
+ </Link>
+ </li>
+ ))}
+ </ul>
+ </div>
+ ) : (
+ <EmptyChart label="Nothing open" />
+ )}
+ </ChartPanel>
+ </DashboardRow>
+ </div>
+ );
+}
+
+/**
+ * A titled, framed plot, built from the same `Card` header the lists below the
+ * charts use so every section on the page shares one heading rhythm.
+ *
+ * The body keeps a border where a list does not: a chart floating against the
+ * page with no frame reads as unmoored, and `flex-1` makes both columns of a
+ * row end level however tall their plots are.
+ */
+function ChartPanel({
+ title,
+ description,
+ children,
+}: {
+ title: string;
+ description?: string;
+ children: ReactNode;
+}) {
+ return (
+ <Card className="min-w-0">
+ <CardHeader>
+ <CardTitle>{title}</CardTitle>
+ {description ? <CardDescription>{description}</CardDescription> : null}
+ </CardHeader>
+ <div className="flex flex-1 flex-col border">{children}</div>
+ </Card>
+ );
+}
+
+function EmptyChart({ label }: { label: string }) {
+ return (
+ <div className="flex flex-1 items-center justify-center px-5 py-10 text-muted-foreground text-sm md:px-6">
+ {label}
+ </div>
+ );
+}
diff --git a/apps/app/components/app-icon-rail.tsx b/apps/app/components/app-icon-rail.tsx
index bc47beaa..d0850f00 100644
--- a/apps/app/components/app-icon-rail.tsx
+++ b/apps/app/components/app-icon-rail.tsx
@@ -4,7 +4,6 @@ import Building from "@carbon/icons-react/es/Building";
import type { CarbonIconType } from "@carbon/icons-react/es/CarbonIcon";
import Dashboard from "@carbon/icons-react/es/Dashboard";
import Partnership from "@carbon/icons-react/es/Partnership";
-import Upload from "@carbon/icons-react/es/Upload";
import UserMultiple from "@carbon/icons-react/es/UserMultiple";
import { Button } from "@crm/ui/components/button";
import { Icon } from "@crm/ui/components/icon";
@@ -41,7 +40,6 @@ const ITEMS: RailItem[] = [
match: "prefix",
},
{ title: "Deals", href: "/deals", icon: Partnership, match: "prefix" },
- { title: "Import", href: "/import", icon: Upload, match: "prefix" },
];
function isActive(item: RailItem, pathname: string): boolean {
diff --git a/apps/app/components/crm/company-socials.tsx b/apps/app/components/crm/company-socials.tsx
index e401f6bc..5e17bbab 100644
--- a/apps/app/components/crm/company-socials.tsx
+++ b/apps/app/components/crm/company-socials.tsx
@@ -1,4 +1,3 @@
-import Launch from "@carbon/icons-react/es/Launch";
import LogoGithub from "@carbon/icons-react/es/LogoGithub";
import LogoLinkedin from "@carbon/icons-react/es/LogoLinkedin";
import LogoX from "@carbon/icons-react/es/LogoX";
@@ -7,61 +6,57 @@ import UserMultiple from "@carbon/icons-react/es/UserMultiple";
import { Button } from "@crm/ui/components/button";
import type { CarbonIcon } from "@crm/ui/components/icon";
import { Icon } from "@crm/ui/components/icon";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from "@crm/ui/components/tooltip";
-type Link = { label: string; href: string | null; icon: CarbonIcon };
+export type CompanyLinks = {
+ linkedinUrl: string | null;
+ twitterUrl: string | null;
+ githubUrl: string | null;
+ pricingUrl: string | null;
+ careersUrl: string | null;
+};
/**
- * Everywhere else this company exists, as found by the agent.
- *
- * Renders nothing until there is something to render — an empty row of
- * placeholder icons says "broken", not "not enriched yet".
+ * The website is not in this list — it is the domain in the sheet header,
+ * which is a link, because that is what a domain should be. What is left are
+ * the places the agent found this company that its name does not give you.
*/
-export function CompanySocials({
- company,
-}: {
- company: {
- website: string | null;
- linkedinUrl: string | null;
- twitterUrl: string | null;
- githubUrl: string | null;
- pricingUrl: string | null;
- careersUrl: string | null;
- };
-}) {
- const links: Link[] = [
- { label: "Website", href: company.website, icon: Launch },
- { label: "LinkedIn", href: company.linkedinUrl, icon: LogoLinkedin },
- { label: "X", href: company.twitterUrl, icon: LogoX },
- { label: "GitHub", href: company.githubUrl, icon: LogoGithub },
- { label: "Pricing", href: company.pricingUrl, icon: Money },
- { label: "Careers", href: company.careersUrl, icon: UserMultiple },
- ];
+const LINKS: { key: keyof CompanyLinks; label: string; icon: CarbonIcon }[] = [
+ { key: "linkedinUrl", label: "LinkedIn", icon: LogoLinkedin },
+ { key: "twitterUrl", label: "X", icon: LogoX },
+ { key: "githubUrl", label: "GitHub", icon: LogoGithub },
+ { key: "pricingUrl", label: "Pricing", icon: Money },
+ { key: "careersUrl", label: "Careers", icon: UserMultiple },
+];
- const present = links.filter(
- (link): link is Link & { href: string } => link.href !== null,
- );
+export function hasCompanyLinks(company: CompanyLinks): boolean {
+ return LINKS.some((link) => company[link.key] !== null);
+}
+
+/**
+ * Every link says where it goes.
+ *
+ * A bare row of glyphs works for LinkedIn and GitHub, whose marks people know,
+ * and fails for "pricing" and "careers", which have no mark — so the row comes
+ * out half legible and reads as clip art. Labels cost one line and remove the
+ * guessing.
+ */
+export function CompanySocials({ company }: { company: CompanyLinks }) {
+ const present = LINKS.flatMap((link) => {
+ const href = company[link.key];
+ return href ? [{ ...link, href }] : [];
+ });
if (present.length === 0) return null;
return (
- <div className="flex flex-wrap items-center gap-1">
+ <div className="flex flex-wrap items-center gap-2">
{present.map((link) => (
- <Tooltip key={link.label}>
- <TooltipTrigger asChild>
- <Button asChild variant="ghost" size="icon-sm">
- <a href={link.href} target="_blank" rel="noreferrer noopener">
- <Icon icon={link.icon} />
- <span className="sr-only">{link.label}</span>
- </a>
- </Button>
- </TooltipTrigger>
- <TooltipContent>{link.label}</TooltipContent>
- </Tooltip>
+ <Button key={link.key} asChild variant="outline" size="sm">
+ <a href={link.href} target="_blank" rel="noreferrer noopener">
+ <Icon icon={link.icon} data-icon="inline-start" />
+ {link.label}
+ </a>
+ </Button>
))}
</div>
);
diff --git a/apps/app/components/crm/contact-name.ts b/apps/app/components/crm/contact-name.ts
new file mode 100644
index 00000000..9e09acc0
--- /dev/null
+++ b/apps/app/components/crm/contact-name.ts
@@ -0,0 +1,13 @@
+/**
+ * A contact's display name.
+ *
+ * Only `firstName` is required, so the join has to survive a missing surname
+ * without leaving a trailing space behind — the table and the record sheet had
+ * a copy of this each, which is one copy too many for a rule this small.
+ */
+export function contactName(contact: {
+ firstName: string;
+ lastName: string | null;
+}): string {
+ return [contact.firstName, contact.lastName].filter(Boolean).join(" ");
+}
diff --git a/apps/app/components/crm/deal-stage.tsx b/apps/app/components/crm/deal-stage.tsx
index b91354d5..0b38d8f9 100644
--- a/apps/app/components/crm/deal-stage.tsx
+++ b/apps/app/components/crm/deal-stage.tsx
@@ -38,8 +38,10 @@ const PRESENTATION: Record<DealStage, { label: string; tone: StatusTone }> = {
/** Stages a deal can still be won from — the pipeline. */
export const OPEN_STAGES = ORDER.slice(0, 4) as readonly DealStage[];
-/** Stages a deal is finished in. */
-export const CLOSED_STAGES = ORDER.slice(4) as readonly DealStage[];
+/** Won, lost or disqualified — a deal that is no longer in the pipeline. */
+export function isClosedStage(stage: DealStage): boolean {
+ return !OPEN_STAGES.includes(stage);
+}
/** The two the API refuses without a `closedReason`. */
export const LOSING_STAGES: readonly DealStage[] = [
@@ -52,6 +54,24 @@ export const DEAL_STAGE_OPTIONS = ORDER.map((value) => ({
label: PRESENTATION[value].label,
}));
+/**
+ * The chart ramp in pipeline order, so a stage is the same colour in the
+ * overview's donut, its legend and every meter beside a deal.
+ *
+ * Only the open stages get one: a closed deal is not part of a breakdown of
+ * where the pipeline sits, and `StatusTone` already colours won and lost.
+ */
+const OPEN_STAGE_COLORS = [
+ "var(--chart-1)",
+ "var(--chart-2)",
+ "var(--chart-3)",
+ "var(--chart-4)",
+] as const;
+
+export function dealStageColor(stage: DealStage): string {
+ return OPEN_STAGE_COLORS[OPEN_STAGES.indexOf(stage)] ?? "var(--chart-5)";
+}
+
export function dealStageLabel(stage: DealStage): string {
return PRESENTATION[stage].label;
}
diff --git a/apps/app/components/crm/enrichment-actions.tsx b/apps/app/components/crm/enrichment-actions.tsx
index 22894be9..5f808b91 100644
--- a/apps/app/components/crm/enrichment-actions.tsx
+++ b/apps/app/components/crm/enrichment-actions.tsx
@@ -5,8 +5,9 @@ import Renew from "@carbon/icons-react/es/Renew";
import { Button } from "@crm/ui/components/button";
import { Icon } from "@crm/ui/components/icon";
import { Spinner } from "@crm/ui/components/spinner";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
/**
@@ -24,22 +25,12 @@ export function EnrichmentActions({
hasDomain: boolean;
}) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
-
- const invalidateCompany = () =>
- Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey({ id: companyId }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- ]);
+ const cache = useCrmCache();
const enrich = useMutation(
trpc.companies.enrich.mutationOptions({
onSuccess: async (result) => {
- await invalidateCompany();
+ await cache.company(companyId);
toast.success(
result.queued
? "Looking it up — this page will update when it finishes."
@@ -53,20 +44,16 @@ export function EnrichmentActions({
const research = useMutation(
trpc.companies.research.mutationOptions({
onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timeline.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timelineCounts.queryKey(),
- }),
- ]);
+ await cache.activity();
toast.success("Brief added to the timeline.");
},
onError: (error) => toast.error(error.message),
}),
);
+ // These sit in the sheet header, which on a phone is a full-width drawer
+ // with a logo and a name already in it. The labels drop below `sm` so the
+ // record's name keeps the room rather than two buttons about the agent.
return (
<>
<Button
@@ -82,7 +69,7 @@ export function EnrichmentActions({
) : (
<Icon icon={Renew} data-icon="inline-start" />
)}
- Re-enrich
+ <span className="hidden sm:inline">Re-enrich</span>
</Button>
<Button
@@ -96,7 +83,7 @@ export function EnrichmentActions({
) : (
<Icon icon={MagicWand} data-icon="inline-start" />
)}
- Research
+ <span className="hidden sm:inline">Research</span>
</Button>
</>
);
diff --git a/apps/app/components/crm/enrichment-status.tsx b/apps/app/components/crm/enrichment-status.tsx
index 1e809c95..abcddaf7 100644
--- a/apps/app/components/crm/enrichment-status.tsx
+++ b/apps/app/components/crm/enrichment-status.tsx
@@ -45,6 +45,21 @@ export function EnrichmentIndicator({
);
}
+/**
+ * Still going to change on its own.
+ *
+ * Enrichment is background work with no client action behind it, so there is
+ * nothing to invalidate — the only way to notice it finished is to ask. Anything
+ * rendering an enriched field (a logo, an industry) polls on this while it is
+ * true and stops the moment it settles.
+ */
+export function isEnriching(status: EnrichmentStatus): boolean {
+ return status === "PENDING" || status === "RUNNING";
+}
+
+/** How often to ask, in ms, while the agent is still working. */
+export const ENRICHMENT_POLL_MS = 3_000;
+
/** Statuses in the order the facet dropdown should list them. */
export const ENRICHMENT_FACET_OPTIONS = (
Object.keys(PRESENTATION) as EnrichmentStatus[]
diff --git a/apps/app/components/crm/inline-field.tsx b/apps/app/components/crm/inline-field.tsx
index d9a1df4c..eab65606 100644
--- a/apps/app/components/crm/inline-field.tsx
+++ b/apps/app/components/crm/inline-field.tsx
@@ -13,13 +13,39 @@ import {
import { Spinner } from "@crm/ui/components/spinner";
import { useId, useState } from "react";
+/** Label column, so every property in the sheet lines up on one edge. */
+const ROW = "grid grid-cols-[6.5rem_minmax(0,1fr)] items-center gap-2 py-0.5";
+const LABEL = "truncate text-muted-foreground text-xs";
/**
- * A property that turns into an input when you click it.
+ * Values look like text until you point at one.
*
- * The detail page is where reps live, and a card of read-only values with an
- * "Edit" mode over the whole thing means five clicks to fix one typo. Each
- * field saves on Enter or blur and reverts on Escape.
+ * A row of boxed inputs shouts "form" at someone who came here to read a
+ * record; a row of plain text gives no hint that a typo is one click from
+ * fixed. The hover outline is the whole affordance, and it is the same on a
+ * typed field and a chosen one so nothing looks more editable than the rest.
*/
+const CONTROL =
+ "h-8 w-full justify-start px-2 font-normal hover:border-input hover:bg-muted/40 border border-transparent";
+
+/**
+ * Which property a record's shared update mutation is currently writing.
+ *
+ * One `update` serves every row in a sheet, so its `isPending` says only that
+ * *something* is saving. Handing that to each row puts a spinner on all seven
+ * of them the moment you correct one — the whole form flashes for a write to a
+ * single field. The variables of the write name the field, so the spinner can
+ * land on the row that was actually edited and nowhere else.
+ */
+export function savingField(update: {
+ isPending: boolean;
+ variables?: { data?: object } | undefined;
+}): (field: string) => boolean {
+ const fields = update.isPending
+ ? Object.keys(update.variables?.data ?? {})
+ : [];
+ return (field) => fields.includes(field);
+}
+
export function InlineField({
label,
value,
@@ -47,9 +73,15 @@ export function InlineField({
if (draft.trim() !== (value ?? "")) onSave(draft.trim());
};
+ // Mid-write, the row reads back what was typed rather than what the record
+ // still says. The input closes on commit but the new value only arrives with
+ // the refetch, so reading `value` here would show the old one for the length
+ // of a round trip — which looks like the edit was thrown away.
+ const shown = saving ? draft.trim() : (value ?? "");
+
return (
- <div className="grid grid-cols-[minmax(0,9rem)_minmax(0,1fr)] items-center gap-3 py-1.5">
- <label htmlFor={id} className="truncate text-muted-foreground text-xs">
+ <div className={ROW}>
+ <label htmlFor={id} className={LABEL}>
{label}
</label>
@@ -79,17 +111,17 @@ export function InlineField({
<Button
variant="ghost"
size="sm"
- className="h-8 justify-start font-normal"
+ className={CONTROL}
onClick={() => {
setDraft(value ?? "");
setEditing(true);
}}
>
{saving ? <Spinner /> : null}
- {value ? (
- <span className="truncate">{render ? render(value) : value}</span>
+ {shown ? (
+ <span className="truncate">{render ? render(shown) : shown}</span>
) : (
- <span className="text-muted-foreground">
+ <span className="truncate text-muted-foreground">
{placeholder ?? <EmptyCellValue />}
</span>
)}
@@ -116,12 +148,14 @@ export function InlineSelectField({
const id = useId();
return (
- <div className="grid grid-cols-[minmax(0,9rem)_minmax(0,1fr)] items-center gap-3 py-1.5">
- <label htmlFor={id} className="truncate text-muted-foreground text-xs">
+ <div className={ROW}>
+ <label htmlFor={id} className={LABEL}>
{label}
</label>
<Select value={value} onValueChange={onSave}>
- <SelectTrigger id={id} size="sm">
+ {/* `default` size, matching the text rows' 32px — a select that is a
+ pixel shorter than the field above it makes the column look bent. */}
+ <SelectTrigger id={id} variant="ghost" className="w-full">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>
diff --git a/apps/app/components/crm/record-sheet/company-sheet.tsx b/apps/app/components/crm/record-sheet/company-sheet.tsx
index 9f13b267..13be66b9 100644
--- a/apps/app/components/crm/record-sheet/company-sheet.tsx
+++ b/apps/app/components/crm/record-sheet/company-sheet.tsx
@@ -1,8 +1,10 @@
"use client";
-import Launch from "@carbon/icons-react/es/Launch";
+import Add from "@carbon/icons-react/es/Add";
+import Partnership from "@carbon/icons-react/es/Partnership";
import Star from "@carbon/icons-react/es/Star";
import StarFilled from "@carbon/icons-react/es/StarFilled";
+import UserMultiple from "@carbon/icons-react/es/UserMultiple";
import { Button } from "@crm/ui/components/button";
import { EmptyCellValue } from "@crm/ui/components/empty-cell";
import { EntityLogo } from "@crm/ui/components/entity-logo";
@@ -15,36 +17,55 @@ import {
TooltipTrigger,
} from "@crm/ui/components/tooltip";
import { formatMoney } from "@crm/ui/lib/format";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { useState } from "react";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { CompanySocials } from "@/components/crm/company-socials";
+import {
+ CompanySocials,
+ hasCompanyLinks,
+} from "@/components/crm/company-socials";
import { OPEN_STAGES } from "@/components/crm/deal-stage";
import { EnrichmentActions } from "@/components/crm/enrichment-actions";
-import { EnrichmentIndicator } from "@/components/crm/enrichment-status";
-import { InlineField, InlineSelectField } from "@/components/crm/inline-field";
+import {
+ ENRICHMENT_POLL_MS,
+ EnrichmentIndicator,
+ isEnriching,
+} from "@/components/crm/enrichment-status";
+import {
+ InlineField,
+ InlineSelectField,
+ savingField,
+} from "@/components/crm/inline-field";
import { OwnerCell } from "@/components/crm/owner-cell";
import { DealStageMenu } from "@/components/crm/stage-change";
import { Timeline } from "@/components/crm/timeline/timeline";
import {
DetailSheetBody,
DetailSheetEmpty,
+ DetailSheetProperties,
DetailSheetSection,
DetailSheetStat,
DetailSheetStats,
type DetailSheetTab,
} from "@/components/detail-sheet";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@/lib/trpc/types";
-import { DealAmount, RecordSheetFrame } from "./record-parts";
-import { useOpenRecord } from "./record-stack";
+import { QuickAddContact, QuickAddDeal } from "./quick-add";
+import {
+ DealAmount,
+ DomainLink,
+ MetaLine,
+ RecordSheetFrame,
+} from "./record-parts";
+import { useOpenRecord, useRecordSheetView } from "./record-stack";
type Company = RouterOutputs["companies"]["byId"];
+type CompanyDeal = Company["deals"][number];
const UNASSIGNED = "unassigned";
const CONTACT_COLUMNS = [
- { srLabel: "Primary", width: "w-10", className: "pl-4" },
+ { srLabel: "Primary", width: "w-10", className: "pl-5" },
{ header: "Name", width: "w-[28%]" },
{ header: "Title", width: "w-[24%]" },
{ header: "Email", width: "w-[26%]" },
@@ -52,7 +73,7 @@ const CONTACT_COLUMNS = [
];
const DEAL_COLUMNS = [
- { header: "Deal", width: "w-[32%]", className: "pl-4" },
+ { header: "Deal", width: "w-[32%]", className: "pl-5" },
{ header: "Stage", width: "w-[24%]" },
{ header: "Amount", width: "w-[16%]", align: "right" as const },
{ header: "Close date", width: "w-[14%]" },
@@ -65,6 +86,52 @@ const dateFormat = new Intl.DateTimeFormat(undefined, {
year: "numeric",
});
+const shortDateFormat = new Intl.DateTimeFormat(undefined, {
+ month: "short",
+ day: "numeric",
+});
+
+/** The soonest a deal here could land, which is the number reps forecast on. */
+function nextClose(deals: CompanyDeal[]): string | null {
+ const dates = deals
+ .map((deal) => deal.expectedCloseDate)
+ .filter((date): date is string => date !== null)
+ .sort();
+ return dates[0] ?? null;
+}
+
+/**
+ * The last row of a list: "add another one".
+ *
+ * Part of the table rather than a button floating above it, so the affordance
+ * is where you finish reading and does not need its own band of chrome.
+ */
+function AddRow({
+ label,
+ columns,
+ onClick,
+}: {
+ label: string;
+ columns: number;
+ onClick: () => void;
+}) {
+ return (
+ <SimpleTableRow>
+ <TableCell colSpan={columns} className="p-0">
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={onClick}
+ className="h-9 w-full justify-start px-5 font-normal text-muted-foreground"
+ >
+ <Icon icon={Add} data-icon="inline-start" />
+ {label}
+ </Button>
+ </TableCell>
+ </SimpleTableRow>
+ );
+}
+
/**
* A company, everything attached to it, and the agent's work on it.
*
@@ -72,24 +139,22 @@ const dateFormat = new Intl.DateTimeFormat(undefined, {
* client action behind it, so there is nothing to invalidate — the only way to
* notice it finished is to ask. The interval stops the moment it settles.
*/
-export function CompanySheet({
- companyId,
- open,
- onOpenChange,
-}: {
- companyId: string;
- open: boolean;
- onOpenChange: (open: boolean) => void;
-}) {
+export function CompanySheet({ companyId }: { companyId: string }) {
const trpc = useTRPC();
- const [tab, setTab] = useState("overview");
+ // Tab and quick-add form both live in `?tab=` / `?add=`, so a half-typed
+ // contact survives a refresh and lands on the panel it was typed into.
+ const {
+ tab,
+ setTab,
+ form: adding,
+ setForm: setAdding,
+ } = useRecordSheetView("overview");
const query = useQuery({
...trpc.companies.byId.queryOptions({ id: companyId }),
- enabled: open,
refetchInterval: (current) => {
const status = current.state.data?.enrichmentStatus;
- return status === "PENDING" || status === "RUNNING" ? 3_000 : false;
+ return status && isEnriching(status) ? ENRICHMENT_POLL_MS : false;
},
});
@@ -99,7 +164,7 @@ export function CompanySheet({
? [company.city, company.stateCode, company.country]
.filter(Boolean)
.join(", ")
- : "";
+ : null;
const openDeals =
company?.deals.filter((deal) => OPEN_STAGES.includes(deal.stage)) ?? [];
@@ -107,6 +172,7 @@ export function CompanySheet({
(total, deal) => total + (deal.amountCents ?? 0),
0,
);
+ const closing = nextClose(openDeals);
const tabs: DetailSheetTab[] = company
? [
@@ -119,13 +185,27 @@ export function CompanySheet({
value: "contacts",
label: "Contacts",
count: company.contacts.length,
- content: <CompanyContacts company={company} />,
+ content: (
+ <CompanyContacts
+ company={company}
+ adding={adding === "contact"}
+ onAdd={() => setAdding("contact")}
+ onDone={() => setAdding(null)}
+ />
+ ),
},
{
value: "deals",
label: "Deals",
count: company.deals.length,
- content: <CompanyDeals company={company} />,
+ content: (
+ <CompanyDeals
+ company={company}
+ adding={adding === "deal"}
+ onAdd={() => setAdding("deal")}
+ onDone={() => setAdding(null)}
+ />
+ ),
},
{
value: "activity",
@@ -137,70 +217,64 @@ export function CompanySheet({
return (
<RecordSheetFrame
- open={open}
- onOpenChange={onOpenChange}
loading={query.isPending}
error={query.error?.message ?? null}
title={company?.name ?? "Company"}
description={
- company
- ? [company.domain, location, company.industry]
- .filter(Boolean)
- .join(" · ") ||
- "No domain yet — add one and the agent will fill in the rest."
- : undefined
- }
- media={
- <EntityLogo
- src={company?.iconUrl ?? company?.logoUrl}
- name={company?.name ?? "?"}
- size="xl"
- />
- }
- eyebrow={
company ? (
+ <MetaLine
+ lead={
+ <DomainLink domain={company.domain} website={company.website} />
+ }
+ parts={[location, company.industry]}
+ />
+ ) : undefined
+ }
+ // Only when there is something to say. "Enriched" is the resting state
+ // of every company in here, and a row that says so on all of them is a
+ // row nobody reads — which means nobody reads it when it says "failed"
+ // either.
+ note={
+ company && company.enrichmentStatus !== "COMPLETE" ? (
<EnrichmentIndicator
status={company.enrichmentStatus}
title={company.enrichmentError}
/>
) : null
}
+ media={
+ <EntityLogo
+ src={company?.iconUrl ?? company?.logoUrl}
+ name={company?.name ?? "?"}
+ size="lg"
+ />
+ }
actions={
company ? (
- <>
- {company.website ? (
- <Button asChild variant="outline" size="sm">
- <a
- href={company.website}
- target="_blank"
- rel="noreferrer noopener"
- >
- <Icon icon={Launch} data-icon="inline-start" />
- Visit site
- </a>
- </Button>
- ) : null}
- <EnrichmentActions
- companyId={company.id}
- hasDomain={company.domain !== null}
- />
- </>
+ <EnrichmentActions
+ companyId={company.id}
+ hasDomain={company.domain !== null}
+ />
) : null
}
stats={
company ? (
<DetailSheetStats>
- <DetailSheetStat label="Contacts">
- <span className="tabular-nums">{company.contacts.length}</span>
- </DetailSheetStat>
- <DetailSheetStat label="Open deals">
- <span className="tabular-nums">{openDeals.length}</span>
- </DetailSheetStat>
<DetailSheetStat label="Open pipeline">
<span className="tabular-nums">
{formatMoney(openValueCents)}
</span>
</DetailSheetStat>
+ <DetailSheetStat label="Open deals">
+ <span className="tabular-nums">{openDeals.length}</span>
+ </DetailSheetStat>
+ <DetailSheetStat label="Next close">
+ {closing ? (
+ shortDateFormat.format(new Date(closing))
+ ) : (
+ <EmptyCellValue />
+ )}
+ </DetailSheetStat>
<DetailSheetStat label="Owner">
<OwnerCell owner={company.owner} />
</DetailSheetStat>
@@ -216,22 +290,15 @@ export function CompanySheet({
function CompanyOverview({ company }: { company: Company }) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const users = useQuery(trpc.users.list.queryOptions());
const update = useMutation(
trpc.companies.update.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey({ id: company.id }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- ]);
- },
+ // `settle: "record"` — the row's spinner should last until the new value
+ // is under it, not until the table behind the sheet has caught up too.
+ onSuccess: () => cache.company(company.id, { settle: "record" }),
onError: (error) => toast.error(error.message),
}),
);
@@ -239,6 +306,8 @@ function CompanyOverview({ company }: { company: Company }) {
const save = (data: Record<string, string | null>) =>
update.mutate({ id: company.id, data });
+ const isSaving = savingField(update);
+
return (
<DetailSheetBody>
{/*
@@ -247,11 +316,11 @@ function CompanyOverview({ company }: { company: Company }) {
* someone to retype them is a text box inviting someone to fight it.
*/}
<DetailSheetSection title="Details">
- <div className="grid gap-x-8 sm:grid-cols-2">
+ <DetailSheetProperties>
<InlineField
label="Name"
value={company.name}
- saving={update.isPending}
+ saving={isSaving("name")}
onSave={(name) => name && save({ name })}
/>
<InlineField
@@ -259,7 +328,7 @@ function CompanyOverview({ company }: { company: Company }) {
value={company.domain}
type="url"
placeholder="stripe.com"
- saving={update.isPending}
+ saving={isSaving("domain")}
onSave={(domain) => save({ domain })}
/>
<InlineField
@@ -267,33 +336,33 @@ function CompanyOverview({ company }: { company: Company }) {
value={company.website}
type="url"
placeholder="https://stripe.com"
- saving={update.isPending}
+ saving={isSaving("website")}
onSave={(website) => save({ website })}
/>
<InlineField
label="Phone"
value={company.phone}
type="tel"
- saving={update.isPending}
+ saving={isSaving("phone")}
onSave={(phone) => save({ phone })}
/>
<InlineField
label="Email"
value={company.email}
type="email"
- saving={update.isPending}
+ saving={isSaving("email")}
onSave={(email) => save({ email })}
/>
<InlineField
label="City"
value={company.city}
- saving={update.isPending}
+ saving={isSaving("city")}
onSave={(city) => save({ city })}
/>
<InlineField
label="Country"
value={company.country}
- saving={update.isPending}
+ saving={isSaving("country")}
onSave={(country) => save({ country })}
/>
<InlineSelectField
@@ -310,7 +379,7 @@ function CompanyOverview({ company }: { company: Company }) {
save({ ownerId: ownerId === UNASSIGNED ? null : ownerId })
}
/>
- </div>
+ </DetailSheetProperties>
</DetailSheetSection>
{company.description ? (
@@ -321,151 +390,219 @@ function CompanyOverview({ company }: { company: Company }) {
</DetailSheetSection>
) : null}
- <CompanyLinks company={company} />
+ {hasCompanyLinks(company) ? (
+ <DetailSheetSection title="Links">
+ <CompanySocials company={company} />
+ </DetailSheetSection>
+ ) : null}
</DetailSheetBody>
);
}
-/**
- * Renders nothing until the agent has found somewhere to link to — a heading
- * over an empty row of icons says "broken", not "not enriched yet".
- */
-function CompanyLinks({ company }: { company: Company }) {
- const hasAny = [
- company.website,
- company.linkedinUrl,
- company.twitterUrl,
- company.githubUrl,
- company.pricingUrl,
- company.careersUrl,
- ].some(Boolean);
-
- if (!hasAny) return null;
-
- return (
- <DetailSheetSection title="Links">
- <CompanySocials company={company} />
- </DetailSheetSection>
- );
-}
-
-function CompanyContacts({ company }: { company: Company }) {
+function CompanyContacts({
+ company,
+ adding,
+ onAdd,
+ onDone,
+}: {
+ company: Company;
+ adding: boolean;
+ onAdd: () => void;
+ onDone: () => void;
+}) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const openRecord = useOpenRecord();
const setPrimary = useMutation(
trpc.companies.setPrimaryContact.mutationOptions({
- onSuccess: async () => {
- await queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey({ id: company.id }),
- });
- },
+ onSuccess: () => cache.company(company.id),
onError: (error) => toast.error(error.message),
}),
);
+ const form = adding ? (
+ <QuickAddContact
+ companyId={company.id}
+ ownerId={company.owner?.id ?? null}
+ onDone={onDone}
+ />
+ ) : null;
+
if (company.contacts.length === 0) {
- return <DetailSheetEmpty>Nobody here yet.</DetailSheetEmpty>;
+ return (
+ <>
+ {form}
+ {adding ? null : (
+ <DetailSheetEmpty
+ icon={UserMultiple}
+ title="No contacts yet"
+ description={`Everyone you talk to at ${company.name} lives here — add the first person and their calls, emails and notes hang off them.`}
+ action={
+ <Button variant="outline" size="sm" onClick={onAdd}>
+ <Icon icon={Add} data-icon="inline-start" />
+ Add contact
+ </Button>
+ }
+ />
+ )}
+ </>
+ );
}
return (
- <SimpleTable variant="panel" columns={CONTACT_COLUMNS}>
- {company.contacts.map((contact) => {
- const isPrimary = contact.id === company.primaryContactId;
- return (
+ <>
+ {form}
+ <SimpleTable variant="panel" columns={CONTACT_COLUMNS}>
+ {company.contacts.map((contact) => {
+ const isPrimary = contact.id === company.primaryContactId;
+ return (
+ <SimpleTableRow
+ key={contact.id}
+ clickable
+ onClick={() => openRecord({ kind: "contact", id: contact.id })}
+ >
+ <TableCell className="w-10 py-2.5 pl-5">
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ aria-pressed={isPrimary}
+ disabled={isPrimary || setPrimary.isPending}
+ // Without this the row's own handler fires too and opens
+ // the contact over the change just made.
+ onClick={(event) => {
+ event.stopPropagation();
+ setPrimary.mutate({
+ companyId: company.id,
+ contactId: contact.id,
+ });
+ }}
+ >
+ <Icon icon={isPrimary ? StarFilled : Star} />
+ <span className="sr-only">
+ {isPrimary ? "Primary contact" : "Make primary"}
+ </span>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>
+ {isPrimary ? "Primary contact" : "Make primary"}
+ </TooltipContent>
+ </Tooltip>
+ </TableCell>
+ <TableCell className="truncate px-3 py-2.5 font-medium">
+ {[contact.firstName, contact.lastName]
+ .filter(Boolean)
+ .join(" ")}
+ </TableCell>
+ <TableCell className="truncate px-3 py-2.5">
+ {contact.title ?? <EmptyCellValue />}
+ </TableCell>
+ <TableCell className="truncate px-3 py-2.5 text-muted-foreground">
+ {contact.email ?? <EmptyCellValue />}
+ </TableCell>
+ <TableCell className="px-3 py-2.5">
+ <OwnerCell owner={contact.owner} />
+ </TableCell>
+ </SimpleTableRow>
+ );
+ })}
+
+ <AddRow
+ label="Add contact"
+ columns={CONTACT_COLUMNS.length}
+ onClick={onAdd}
+ />
+ </SimpleTable>
+ </>
+ );
+}
+
+function CompanyDeals({
+ company,
+ adding,
+ onAdd,
+ onDone,
+}: {
+ company: Company;
+ adding: boolean;
+ onAdd: () => void;
+ onDone: () => void;
+}) {
+ const openRecord = useOpenRecord();
+
+ const form = adding ? (
+ <QuickAddDeal
+ companyId={company.id}
+ companyName={company.name}
+ ownerId={company.owner?.id ?? null}
+ onDone={onDone}
+ />
+ ) : null;
+
+ if (company.deals.length === 0) {
+ return (
+ <>
+ {form}
+ {adding ? null : (
+ <DetailSheetEmpty
+ icon={Partnership}
+ title="No deals yet"
+ description={`Nothing is being sold to ${company.name} right now. Open one and it joins the pipeline and the forecast.`}
+ action={
+ <Button variant="outline" size="sm" onClick={onAdd}>
+ <Icon icon={Add} data-icon="inline-start" />
+ New deal
+ </Button>
+ }
+ />
+ )}
+ </>
+ );
+ }
+
+ return (
+ <>
+ {form}
+ <SimpleTable variant="panel" columns={DEAL_COLUMNS}>
+ {company.deals.map((deal) => (
<SimpleTableRow
- key={contact.id}
+ key={deal.id}
clickable
- onClick={() => openRecord({ kind: "contact", id: contact.id })}
+ onClick={() => openRecord({ kind: "deal", id: deal.id })}
>
- <TableCell className="w-10 py-2.5 pl-4">
- <Tooltip>
- <TooltipTrigger asChild>
- <Button
- variant="ghost"
- size="icon-xs"
- aria-pressed={isPrimary}
- disabled={isPrimary || setPrimary.isPending}
- // Without this the row's own handler fires too and opens
- // the contact over the change just made.
- onClick={(event) => {
- event.stopPropagation();
- setPrimary.mutate({
- companyId: company.id,
- contactId: contact.id,
- });
- }}
- >
- <Icon icon={isPrimary ? StarFilled : Star} />
- <span className="sr-only">
- {isPrimary ? "Primary contact" : "Make primary"}
- </span>
- </Button>
- </TooltipTrigger>
- <TooltipContent>
- {isPrimary ? "Primary contact" : "Make primary"}
- </TooltipContent>
- </Tooltip>
+ <TableCell className="truncate py-2.5 pr-3 pl-5 font-medium">
+ {deal.name}
</TableCell>
- <TableCell className="truncate px-3 py-2.5 font-medium">
- {[contact.firstName, contact.lastName].filter(Boolean).join(" ")}
+ <TableCell className="px-3 py-2.5">
+ <DealStageMenu dealId={deal.id} stage={deal.stage} />
</TableCell>
- <TableCell className="truncate px-3 py-2.5">
- {contact.title ?? <EmptyCellValue />}
+ <TableCell className="px-3 py-2.5 text-right">
+ <DealAmount
+ amountCents={deal.amountCents}
+ currency={deal.currency}
+ />
</TableCell>
- <TableCell className="truncate px-3 py-2.5 text-muted-foreground">
- {contact.email ?? <EmptyCellValue />}
+ <TableCell className="px-3 py-2.5 text-muted-foreground">
+ {deal.expectedCloseDate ? (
+ dateFormat.format(new Date(deal.expectedCloseDate))
+ ) : (
+ <EmptyCellValue />
+ )}
</TableCell>
<TableCell className="px-3 py-2.5">
- <OwnerCell owner={contact.owner} />
+ <OwnerCell owner={deal.owner} />
</TableCell>
</SimpleTableRow>
- );
- })}
- </SimpleTable>
- );
-}
-
-function CompanyDeals({ company }: { company: Company }) {
- const openRecord = useOpenRecord();
-
- if (company.deals.length === 0) {
- return <DetailSheetEmpty>No deals yet.</DetailSheetEmpty>;
- }
+ ))}
- return (
- <SimpleTable variant="panel" columns={DEAL_COLUMNS}>
- {company.deals.map((deal) => (
- <SimpleTableRow
- key={deal.id}
- clickable
- onClick={() => openRecord({ kind: "deal", id: deal.id })}
- >
- <TableCell className="truncate py-2.5 pr-3 pl-4 font-medium">
- {deal.name}
- </TableCell>
- <TableCell className="px-3 py-2.5">
- <DealStageMenu dealId={deal.id} stage={deal.stage} />
- </TableCell>
- <TableCell className="px-3 py-2.5 text-right">
- <DealAmount
- amountCents={deal.amountCents}
- currency={deal.currency}
- />
- </TableCell>
- <TableCell className="px-3 py-2.5 text-muted-foreground">
- {deal.expectedCloseDate ? (
- dateFormat.format(new Date(deal.expectedCloseDate))
- ) : (
- <EmptyCellValue />
- )}
- </TableCell>
- <TableCell className="px-3 py-2.5">
- <OwnerCell owner={deal.owner} />
- </TableCell>
- </SimpleTableRow>
- ))}
- </SimpleTable>
+ <AddRow
+ label="New deal"
+ columns={DEAL_COLUMNS.length}
+ onClick={onAdd}
+ />
+ </SimpleTable>
+ </>
);
}
diff --git a/apps/app/components/crm/record-sheet/contact-sheet.tsx b/apps/app/components/crm/record-sheet/contact-sheet.tsx
index e812cffd..7d66a603 100644
--- a/apps/app/components/crm/record-sheet/contact-sheet.tsx
+++ b/apps/app/components/crm/record-sheet/contact-sheet.tsx
@@ -1,6 +1,7 @@
"use client";
import Email from "@carbon/icons-react/es/Email";
+import Partnership from "@carbon/icons-react/es/Partnership";
import Star from "@carbon/icons-react/es/Star";
import { Button } from "@crm/ui/components/button";
import { EmptyCellValue } from "@crm/ui/components/empty-cell";
@@ -9,91 +10,63 @@ import { Icon } from "@crm/ui/components/icon";
import { SimpleTable, SimpleTableRow } from "@crm/ui/components/simple-table";
import { StatusIndicator } from "@crm/ui/components/status-indicator";
import { TableCell } from "@crm/ui/components/table";
-import { formatMoney, initialsFromName } from "@crm/ui/lib/format";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { useState } from "react";
+import { initialsFromName } from "@crm/ui/lib/format";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { OPEN_STAGES } from "@/components/crm/deal-stage";
-import { InlineField, InlineSelectField } from "@/components/crm/inline-field";
+import { contactName } from "@/components/crm/contact-name";
+import {
+ InlineField,
+ InlineSelectField,
+ savingField,
+} from "@/components/crm/inline-field";
import { OwnerCell } from "@/components/crm/owner-cell";
import { DealStageMenu } from "@/components/crm/stage-change";
import { Timeline } from "@/components/crm/timeline/timeline";
import {
DetailSheetBody,
DetailSheetEmpty,
+ DetailSheetProperties,
DetailSheetSection,
DetailSheetStat,
DetailSheetStats,
type DetailSheetTab,
} from "@/components/detail-sheet";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@/lib/trpc/types";
-import { DealAmount, RecordSheetFrame } from "./record-parts";
-import { useOpenRecord } from "./record-stack";
+import { DealAmount, MetaLine, RecordSheetFrame } from "./record-parts";
+import { useOpenRecord, useRecordSheetView } from "./record-stack";
type Contact = RouterOutputs["contacts"]["byId"];
const NONE = "none";
const DEAL_COLUMNS = [
- { header: "Deal", width: "w-[32%]", className: "pl-4" },
+ { header: "Deal", width: "w-[32%]", className: "pl-5" },
{ header: "Role", width: "w-[16%]" },
{ header: "Stage", width: "w-[22%]" },
{ header: "Amount", width: "w-[16%]", align: "right" as const },
{ header: "Owner", width: "w-[14%]" },
];
-function contactName(contact: {
- firstName: string;
- lastName: string | null;
-}): string {
- return [contact.firstName, contact.lastName].filter(Boolean).join(" ");
-}
-
-export function ContactSheet({
- contactId,
- open,
- onOpenChange,
-}: {
- contactId: string;
- open: boolean;
- onOpenChange: (open: boolean) => void;
-}) {
+export function ContactSheet({ contactId }: { contactId: string }) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
- const [tab, setTab] = useState("overview");
-
- const query = useQuery({
- ...trpc.contacts.byId.queryOptions({ id: contactId }),
- enabled: open,
- });
+ const cache = useCrmCache();
+ const { tab, setTab } = useRecordSheetView("overview");
+ const query = useQuery(trpc.contacts.byId.queryOptions({ id: contactId }));
const contact = query.data;
const setPrimary = useMutation(
trpc.companies.setPrimaryContact.mutationOptions({
onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.contacts.byId.queryKey({ id: contactId }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- ]);
+ await cache.contact(contactId);
toast.success("Primary contact updated.");
},
onError: (error) => toast.error(error.message),
}),
);
- const openDeals =
- contact?.deals.filter((deal) => OPEN_STAGES.includes(deal.stage)) ?? [];
- const openValueCents = openDeals.reduce(
- (total, deal) => total + (deal.amountCents ?? 0),
- 0,
- );
-
const tabs: DetailSheetTab[] = contact
? [
{
@@ -117,30 +90,29 @@ export function ContactSheet({
return (
<RecordSheetFrame
- open={open}
- onOpenChange={onOpenChange}
loading={query.isPending}
error={query.error?.message ?? null}
title={contact ? contactName(contact) : "Contact"}
description={
- contact
- ? [contact.title, contact.company?.name]
- .filter(Boolean)
- .join(" · ") || "No title or company yet."
- : undefined
+ contact ? (
+ <MetaLine parts={[contact.title, contact.company?.name]} />
+ ) : undefined
}
- // A person, so initials rather than a logo — there is no avatar in the
- // directory and a broken image placeholder is worse than two letters.
+ note={
+ contact?.isPrimaryContact ? (
+ <StatusIndicator
+ tone="success"
+ label={`Primary contact at ${contact.company?.name ?? "this company"}`}
+ />
+ ) : null
+ }
+ // A person, so initials rather than a logo — there are no avatars in
+ // the CRM and a broken image placeholder is worse than two letters.
media={
- <span className="inline-flex size-14 shrink-0 items-center justify-center border bg-muted font-medium text-lg text-muted-foreground uppercase">
+ <span className="inline-flex size-10 shrink-0 items-center justify-center border bg-muted font-medium text-muted-foreground text-sm uppercase">
{contact ? initialsFromName(contactName(contact)) : "?"}
</span>
}
- eyebrow={
- contact?.isPrimaryContact ? (
- <StatusIndicator tone="success" label="Primary contact" />
- ) : null
- }
actions={
contact ? (
<>
@@ -148,7 +120,7 @@ export function ContactSheet({
<Button asChild variant="outline" size="sm">
<a href={`mailto:${contact.email}`}>
<Icon icon={Email} data-icon="inline-start" />
- Email
+ <span className="hidden sm:inline">Email</span>
</a>
</Button>
) : null}
@@ -167,12 +139,14 @@ export function ContactSheet({
}
>
<Icon icon={Star} data-icon="inline-start" />
- Make primary
+ <span className="hidden sm:inline">Make primary</span>
</Button>
) : null}
</>
) : null
}
+ // How to reach this person, which is what anyone opening a contact
+ // wants — the deal count is already on the tab beside it.
stats={
contact ? (
<DetailSheetStats>
@@ -183,13 +157,29 @@ export function ContactSheet({
<EmptyCellValue />
)}
</DetailSheetStat>
- <DetailSheetStat label="Deals">
- <span className="tabular-nums">{contact.deals.length}</span>
+ <DetailSheetStat label="Email">
+ {contact.email ? (
+ <a
+ href={`mailto:${contact.email}`}
+ className="underline-offset-2 hover:underline"
+ >
+ {contact.email}
+ </a>
+ ) : (
+ <EmptyCellValue />
+ )}
</DetailSheetStat>
- <DetailSheetStat label="Open pipeline">
- <span className="tabular-nums">
- {formatMoney(openValueCents)}
- </span>
+ <DetailSheetStat label="Phone">
+ {contact.phone ? (
+ <a
+ href={`tel:${contact.phone}`}
+ className="underline-offset-2 hover:underline"
+ >
+ {contact.phone}
+ </a>
+ ) : (
+ <EmptyCellValue />
+ )}
</DetailSheetStat>
<DetailSheetStat label="Owner">
<OwnerCell owner={contact.owner} />
@@ -215,7 +205,7 @@ function CompanyStat({
<button
type="button"
onClick={() => openRecord({ kind: "company", id: company.id })}
- className="flex min-w-0 items-center gap-2 hover:underline"
+ className="flex min-w-0 items-center gap-2 underline-offset-2 hover:underline"
>
<EntityLogo src={company.iconUrl} name={company.name} size="xs" />
<span className="truncate">{company.name}</span>
@@ -225,27 +215,17 @@ function CompanyStat({
function ContactOverview({ contact }: { contact: Contact }) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const users = useQuery(trpc.users.list.queryOptions());
const companies = useQuery(trpc.companies.options.queryOptions({ q: "" }));
const update = useMutation(
trpc.contacts.update.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.contacts.byId.queryKey({ id: contact.id }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.contacts.list.queryKey(),
- }),
- // Moving someone between companies changes both companies' records.
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- ]);
- },
+ // `settle: "record"` — the row's spinner should last until the new value
+ // is under it, not until the list behind the sheet and every cached
+ // company have caught up too.
+ onSuccess: () => cache.contact(contact.id, { settle: "record" }),
onError: (error) => toast.error(error.message),
}),
);
@@ -253,53 +233,50 @@ function ContactOverview({ contact }: { contact: Contact }) {
const save = (data: Record<string, string | null>) =>
update.mutate({ id: contact.id, data });
+ const isSaving = savingField(update);
+
return (
<DetailSheetBody>
<DetailSheetSection title="Details">
- <div className="grid gap-x-8 sm:grid-cols-2">
+ <DetailSheetProperties>
<InlineField
label="First name"
value={contact.firstName}
- saving={update.isPending}
+ saving={isSaving("firstName")}
onSave={(firstName) => firstName && save({ firstName })}
/>
<InlineField
label="Last name"
value={contact.lastName}
- saving={update.isPending}
+ saving={isSaving("lastName")}
onSave={(lastName) => save({ lastName })}
/>
<InlineField
label="Title"
value={contact.title}
placeholder="Head of Security"
- saving={update.isPending}
+ saving={isSaving("title")}
onSave={(title) => save({ title })}
/>
<InlineField
label="Email"
value={contact.email}
type="email"
- saving={update.isPending}
+ saving={isSaving("email")}
onSave={(email) => save({ email })}
- render={(email) => (
- <a href={`mailto:${email}`} className="hover:underline">
- {email}
- </a>
- )}
/>
<InlineField
label="Phone"
value={contact.phone}
type="tel"
- saving={update.isPending}
+ saving={isSaving("phone")}
onSave={(phone) => save({ phone })}
/>
<InlineField
label="LinkedIn"
value={contact.linkedinUrl}
type="url"
- saving={update.isPending}
+ saving={isSaving("linkedinUrl")}
onSave={(linkedinUrl) => save({ linkedinUrl })}
/>
<InlineSelectField
@@ -330,7 +307,7 @@ function ContactOverview({ contact }: { contact: Contact }) {
save({ ownerId: ownerId === NONE ? null : ownerId })
}
/>
- </div>
+ </DetailSheetProperties>
</DetailSheetSection>
</DetailSheetBody>
);
@@ -340,7 +317,13 @@ function ContactDeals({ contact }: { contact: Contact }) {
const openRecord = useOpenRecord();
if (contact.deals.length === 0) {
- return <DetailSheetEmpty>Not on any deals yet.</DetailSheetEmpty>;
+ return (
+ <DetailSheetEmpty
+ icon={Partnership}
+ title="Not on any deals"
+ description={`${contactName(contact)} is not attached to anything being sold yet. Deals are opened on the company, then people are added to them.`}
+ />
+ );
}
return (
@@ -351,7 +334,7 @@ function ContactDeals({ contact }: { contact: Contact }) {
clickable
onClick={() => openRecord({ kind: "deal", id: deal.id })}
>
- <TableCell className="truncate py-2.5 pr-3 pl-4 font-medium">
+ <TableCell className="truncate py-2.5 pr-3 pl-5 font-medium">
{deal.name}
</TableCell>
<TableCell className="truncate px-3 py-2.5 text-muted-foreground">
diff --git a/apps/app/components/crm/record-sheet/deal-sheet.tsx b/apps/app/components/crm/record-sheet/deal-sheet.tsx
index a9c179cf..88b12143 100644
--- a/apps/app/components/crm/record-sheet/deal-sheet.tsx
+++ b/apps/app/components/crm/record-sheet/deal-sheet.tsx
@@ -1,36 +1,42 @@
"use client";
+import UserMultiple from "@carbon/icons-react/es/UserMultiple";
import { Alert, AlertDescription, AlertTitle } from "@crm/ui/components/alert";
import { EmptyCellValue } from "@crm/ui/components/empty-cell";
import { EntityLogo } from "@crm/ui/components/entity-logo";
import { SimpleTable, SimpleTableRow } from "@crm/ui/components/simple-table";
import { TableCell } from "@crm/ui/components/table";
import { formatMoney, relativeTimeFromIso } from "@crm/ui/lib/format";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
-import { useState } from "react";
+import { useMutation, useQuery } from "@tanstack/react-query";
import { toast } from "sonner";
-import { DealStageIndicator } from "@/components/crm/deal-stage";
-import { InlineField, InlineSelectField } from "@/components/crm/inline-field";
+import {
+ InlineField,
+ InlineSelectField,
+ savingField,
+} from "@/components/crm/inline-field";
import { OwnerCell } from "@/components/crm/owner-cell";
+import { DealStageMenu } from "@/components/crm/stage-change";
import { StageStepper } from "@/components/crm/stage-stepper";
import { Timeline } from "@/components/crm/timeline/timeline";
import {
DetailSheetBody,
DetailSheetEmpty,
+ DetailSheetProperties,
DetailSheetSection,
DetailSheetStat,
DetailSheetStats,
type DetailSheetTab,
} from "@/components/detail-sheet";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@/lib/trpc/types";
import { RecordSheetFrame } from "./record-parts";
-import { useOpenRecord } from "./record-stack";
+import { useOpenRecord, useRecordSheetView } from "./record-stack";
type Deal = RouterOutputs["deals"]["byId"];
const CONTACT_COLUMNS = [
- { header: "Name", width: "w-[30%]", className: "pl-4" },
+ { header: "Name", width: "w-[30%]", className: "pl-5" },
{ header: "Role", width: "w-[20%]" },
{ header: "Title", width: "w-[25%]" },
{ header: "Email", width: "w-[25%]" },
@@ -47,24 +53,26 @@ function toDateInput(iso: string | null): string | null {
return iso ? (iso.slice(0, 10) ?? null) : null;
}
-export function DealSheet({
- dealId,
- open,
- onOpenChange,
-}: {
- dealId: string;
- open: boolean;
- onOpenChange: (open: boolean) => void;
-}) {
+/**
+ * A close date is a day on a calendar, not an instant.
+ *
+ * `new Date("2026-07-16")` is midnight UTC, which is the 15th anywhere west of
+ * it — so the field read "Jul 15" while the stats strip two inches above it,
+ * formatting the full timestamp, read "Jul 16". Split the parts and build a
+ * local date so both agree.
+ */
+function formatDay(value: string): string {
+ const [year, month, day] = value.split("-").map(Number);
+ if (!year || !month || !day) return value;
+ return dateFormat.format(new Date(year, month - 1, day));
+}
+
+export function DealSheet({ dealId }: { dealId: string }) {
const trpc = useTRPC();
const openRecord = useOpenRecord();
- const [tab, setTab] = useState("overview");
-
- const query = useQuery({
- ...trpc.deals.byId.queryOptions({ id: dealId }),
- enabled: open,
- });
+ const { tab, setTab } = useRecordSheetView("overview");
+ const query = useQuery(trpc.deals.byId.queryOptions({ id: dealId }));
const deal = query.data;
const tabs: DetailSheetTab[] = deal
@@ -90,17 +98,17 @@ export function DealSheet({
return (
<RecordSheetFrame
- open={open}
- onOpenChange={onOpenChange}
loading={query.isPending}
error={query.error?.message ?? null}
title={deal?.name ?? "Deal"}
+ // A deal is always somebody's deal, so the company is the subtitle and
+ // it opens rather than just naming itself.
description={
deal ? (
<button
type="button"
onClick={() => openRecord({ kind: "company", id: deal.company.id })}
- className="hover:underline"
+ className="text-foreground underline-offset-2 hover:underline"
>
{deal.company.name}
</button>
@@ -111,18 +119,21 @@ export function DealSheet({
<EntityLogo
src={deal.company.iconUrl}
name={deal.company.name}
- size="xl"
+ size="lg"
/>
) : null
}
- eyebrow={
+ // A deal's stage is the state it is in and the thing you change about
+ // it, so it is one control in the header — the same picker the deals
+ // table puts in every row — rather than a read-only cell in the stats
+ // strip plus a row of buttons further down the panel.
+ actions={
deal ? (
- <>
- <DealStageIndicator stage={deal.stage} />
- <span className="text-muted-foreground">
- changed {relativeTimeFromIso(deal.stageChangedAt)}
- </span>
- </>
+ <DealStageMenu
+ dealId={deal.id}
+ stage={deal.stage}
+ variant="control"
+ />
) : null
}
stats={
@@ -144,8 +155,10 @@ export function DealSheet({
<EmptyCellValue />
)}
</DetailSheetStat>
- <DetailSheetStat label="Contacts">
- <span className="tabular-nums">{deal.contacts.length}</span>
+ {/* How long it has sat where it is — the staleness read that
+ used to be a line of small print under the title. */}
+ <DetailSheetStat label="In stage">
+ {relativeTimeFromIso(deal.stageChangedAt)}
</DetailSheetStat>
<DetailSheetStat label="Owner">
<OwnerCell owner={deal.owner} />
@@ -162,26 +175,17 @@ export function DealSheet({
function DealOverview({ deal }: { deal: Deal }) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const users = useQuery(trpc.users.list.queryOptions());
const companies = useQuery(trpc.companies.options.queryOptions({ q: "" }));
const update = useMutation(
trpc.deals.update.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.deals.byId.queryKey({ id: deal.id }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- ]);
- },
+ // `settle: "record"` — the row's spinner should last until the new value
+ // is under it, not until the board behind the sheet and every cached
+ // company have caught up too.
+ onSuccess: () => cache.deal(deal.id, { settle: "record" }),
onError: (error) => toast.error(error.message),
}),
);
@@ -189,10 +193,13 @@ function DealOverview({ deal }: { deal: Deal }) {
const save = (data: Parameters<typeof update.mutate>[0]["data"]) =>
update.mutate({ id: deal.id, data });
+ const isSaving = savingField(update);
+
return (
<DetailSheetBody>
- {/* Moving a deal along is the most common thing anyone does here, so it
- * is the first thing in the sheet rather than a field in a list. */}
+ {/* Where the deal is, as a picture. Setting the stage — including
+ * closing it — is the control in the header; this is the one-click
+ * nudge to the next step. */}
<DetailSheetSection title="Stage">
<StageStepper dealId={deal.id} stage={deal.stage} />
</DetailSheetSection>
@@ -211,11 +218,11 @@ function DealOverview({ deal }: { deal: Deal }) {
) : null}
<DetailSheetSection title="Details">
- <div className="grid gap-x-8 sm:grid-cols-2">
+ <DetailSheetProperties>
<InlineField
label="Name"
value={deal.name}
- saving={update.isPending}
+ saving={isSaving("name")}
onSave={(name) => name && save({ name })}
/>
<InlineField
@@ -225,7 +232,7 @@ function DealOverview({ deal }: { deal: Deal }) {
deal.amountCents === null ? null : String(deal.amountCents / 100)
}
placeholder="24000"
- saving={update.isPending}
+ saving={isSaving("amountCents")}
onSave={(next) => {
if (next === "") return save({ amountCents: null });
const parsed = Number.parseFloat(next);
@@ -242,7 +249,7 @@ function DealOverview({ deal }: { deal: Deal }) {
<InlineField
label="Currency"
value={deal.currency}
- saving={update.isPending}
+ saving={isSaving("currency")}
onSave={(currency) => {
if (currency.length !== 3) {
toast.error("Use a three-letter currency code, like USD.");
@@ -253,10 +260,14 @@ function DealOverview({ deal }: { deal: Deal }) {
/>
<InlineField
label="Close date"
+ // Edited as `2026-12-31`, which is what a date input speaks, and
+ // read as "Jul 16, 2026", which is what the stats strip two
+ // inches above it says.
value={toDateInput(deal.expectedCloseDate)}
placeholder="2026-12-31"
- saving={update.isPending}
+ saving={isSaving("expectedCloseDate")}
onSave={(next) => save({ expectedCloseDate: next || null })}
+ render={formatDay}
/>
<InlineSelectField
label="Company"
@@ -276,7 +287,7 @@ function DealOverview({ deal }: { deal: Deal }) {
}))}
onSave={(ownerId) => save({ ownerId })}
/>
- </div>
+ </DetailSheetProperties>
</DetailSheetSection>
</DetailSheetBody>
);
@@ -287,9 +298,11 @@ function DealContacts({ deal }: { deal: Deal }) {
if (deal.contacts.length === 0) {
return (
- <DetailSheetEmpty>
- Nobody from {deal.company.name} is on this deal yet.
- </DetailSheetEmpty>
+ <DetailSheetEmpty
+ icon={UserMultiple}
+ title="No contacts on this deal"
+ description={`Nobody from ${deal.company.name} is attached yet. Add people to the company, then bring them onto the deal.`}
+ />
);
}
@@ -301,7 +314,7 @@ function DealContacts({ deal }: { deal: Deal }) {
clickable
onClick={() => openRecord({ kind: "contact", id: contact.id })}
>
- <TableCell className="truncate py-2.5 pr-3 pl-4 font-medium">
+ <TableCell className="truncate py-2.5 pr-3 pl-5 font-medium">
{[contact.firstName, contact.lastName].filter(Boolean).join(" ")}
</TableCell>
<TableCell className="truncate px-3 py-2.5">
diff --git a/apps/app/components/crm/record-sheet/quick-add.tsx b/apps/app/components/crm/record-sheet/quick-add.tsx
new file mode 100644
index 00000000..cf14fee8
--- /dev/null
+++ b/apps/app/components/crm/record-sheet/quick-add.tsx
@@ -0,0 +1,265 @@
+"use client";
+
+import { Button } from "@crm/ui/components/button";
+import { Field, FieldLabel } from "@crm/ui/components/field";
+import { Input } from "@crm/ui/components/input";
+import { Spinner } from "@crm/ui/components/spinner";
+import { useMutation, useQuery } from "@tanstack/react-query";
+import { useId, useState } from "react";
+import { toast } from "sonner";
+import { useCrmCache } from "@/lib/trpc/cache";
+import { useTRPC } from "@/lib/trpc/client";
+
+/**
+ * Adding a person or a deal without leaving the company you are looking at.
+ *
+ * An inline panel rather than a dialog over the sheet: you are already two
+ * layers deep, a third one that has to be dismissed before you can see whether
+ * the row landed is a layer too many. It also means adding three people in a
+ * row is three forms, not three round trips through a modal.
+ *
+ * Only the fields you would actually have to hand go here. Everything else is
+ * one click away on the record it just created.
+ */
+function QuickAddForm({
+ submitLabel,
+ pending,
+ ready,
+ onSubmit,
+ onCancel,
+ children,
+}: {
+ submitLabel: string;
+ pending: boolean;
+ ready: boolean;
+ onSubmit: () => void;
+ onCancel: () => void;
+ children: React.ReactNode;
+}) {
+ return (
+ <form
+ className="flex shrink-0 flex-col gap-4 border-b px-5 py-4"
+ onSubmit={(event) => {
+ event.preventDefault();
+ onSubmit();
+ }}
+ >
+ <div className="grid gap-4 sm:grid-cols-2">{children}</div>
+ <div className="flex items-center justify-end gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ disabled={pending}
+ onClick={onCancel}
+ >
+ Cancel
+ </Button>
+ <Button type="submit" size="sm" disabled={pending || !ready}>
+ {pending ? <Spinner /> : null}
+ {submitLabel}
+ </Button>
+ </div>
+ </form>
+ );
+}
+
+export function QuickAddContact({
+ companyId,
+ ownerId,
+ onDone,
+}: {
+ companyId: string;
+ /** Whoever owns the company — the person adding them almost never differs. */
+ ownerId: string | null;
+ onDone: () => void;
+}) {
+ const trpc = useTRPC();
+ const cache = useCrmCache();
+
+ const [firstName, setFirstName] = useState("");
+ const [lastName, setLastName] = useState("");
+ const [email, setEmail] = useState("");
+ const [title, setTitle] = useState("");
+
+ const firstNameId = useId();
+ const lastNameId = useId();
+ const emailId = useId();
+ const titleId = useId();
+
+ const create = useMutation(
+ trpc.contacts.create.mutationOptions({
+ onSuccess: async (contact) => {
+ await cache.contact(contact.id);
+ toast.success(`${contact.firstName} added.`);
+ onDone();
+ },
+ onError: (error) => toast.error(error.message),
+ }),
+ );
+
+ return (
+ <QuickAddForm
+ submitLabel="Add contact"
+ pending={create.isPending}
+ ready={firstName.trim() !== ""}
+ onCancel={onDone}
+ onSubmit={() =>
+ create.mutate({
+ firstName,
+ lastName: lastName || undefined,
+ email: email || undefined,
+ title: title || undefined,
+ companyId,
+ ownerId,
+ })
+ }
+ >
+ <Field>
+ <FieldLabel htmlFor={firstNameId}>First name</FieldLabel>
+ <Input
+ id={firstNameId}
+ autoFocus
+ value={firstName}
+ onChange={(event) => setFirstName(event.target.value)}
+ autoComplete="off"
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor={lastNameId}>Last name</FieldLabel>
+ <Input
+ id={lastNameId}
+ value={lastName}
+ onChange={(event) => setLastName(event.target.value)}
+ autoComplete="off"
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor={emailId}>Email</FieldLabel>
+ <Input
+ id={emailId}
+ type="email"
+ value={email}
+ onChange={(event) => setEmail(event.target.value)}
+ autoComplete="off"
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor={titleId}>Title</FieldLabel>
+ <Input
+ id={titleId}
+ value={title}
+ onChange={(event) => setTitle(event.target.value)}
+ placeholder="Head of Security"
+ autoComplete="off"
+ />
+ </Field>
+ </QuickAddForm>
+ );
+}
+
+export function QuickAddDeal({
+ companyId,
+ companyName,
+ ownerId,
+ onDone,
+}: {
+ companyId: string;
+ companyName: string;
+ /** The company's owner; falls back to whoever is signed in. */
+ ownerId: string | null;
+ onDone: () => void;
+}) {
+ const trpc = useTRPC();
+ const cache = useCrmCache();
+
+ const [name, setName] = useState("");
+ const [amount, setAmount] = useState("");
+ const [closeDate, setCloseDate] = useState("");
+
+ const nameId = useId();
+ const amountId = useId();
+ const closeId = useId();
+
+ // The API refuses a deal without an owner, and asking who owns a deal on
+ // the company you already own is a question with one answer.
+ const me = useQuery(trpc.users.me.queryOptions());
+ const owner = ownerId ?? me.data?.id ?? null;
+
+ const create = useMutation(
+ trpc.deals.create.mutationOptions({
+ onSuccess: async (deal) => {
+ await cache.deal(deal.id);
+ toast.success(`${deal.name} created.`);
+ onDone();
+ },
+ onError: (error) => toast.error(error.message),
+ }),
+ );
+
+ const submit = () => {
+ if (!owner) {
+ toast.error("Could not work out who should own this deal.");
+ return;
+ }
+
+ let amountCents: number | null = null;
+ if (amount.trim() !== "") {
+ const parsed = Number.parseFloat(amount);
+ if (!Number.isFinite(parsed) || parsed < 0) {
+ toast.error("Amount has to be a number.");
+ return;
+ }
+ amountCents = Math.round(parsed * 100);
+ }
+
+ create.mutate({
+ name,
+ companyId,
+ ownerId: owner,
+ amountCents,
+ expectedCloseDate: closeDate || null,
+ });
+ };
+
+ return (
+ <QuickAddForm
+ submitLabel="Create deal"
+ pending={create.isPending}
+ ready={name.trim() !== ""}
+ onCancel={onDone}
+ onSubmit={submit}
+ >
+ <Field className="sm:col-span-2">
+ <FieldLabel htmlFor={nameId}>Name</FieldLabel>
+ <Input
+ id={nameId}
+ autoFocus
+ value={name}
+ onChange={(event) => setName(event.target.value)}
+ placeholder={`${companyName} — Comp AI`}
+ autoComplete="off"
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor={amountId}>Amount</FieldLabel>
+ <Input
+ id={amountId}
+ value={amount}
+ onChange={(event) => setAmount(event.target.value)}
+ placeholder="24000"
+ autoComplete="off"
+ />
+ </Field>
+ <Field>
+ <FieldLabel htmlFor={closeId}>Expected close</FieldLabel>
+ <Input
+ id={closeId}
+ type="date"
+ value={closeDate}
+ onChange={(event) => setCloseDate(event.target.value)}
+ />
+ </Field>
+ </QuickAddForm>
+ );
+}
diff --git a/apps/app/components/crm/record-sheet/record-link.tsx b/apps/app/components/crm/record-sheet/record-link.tsx
index af026011..7c0d5a24 100644
--- a/apps/app/components/crm/record-sheet/record-link.tsx
+++ b/apps/app/components/crm/record-sheet/record-link.tsx
@@ -1,11 +1,8 @@
"use client";
-import ArrowLeft from "@carbon/icons-react/es/ArrowLeft";
-import { Button } from "@crm/ui/components/button";
-import { Icon } from "@crm/ui/components/icon";
import { cn } from "@crm/ui/lib/utils";
import type { ReactNode } from "react";
-import { type RecordKind, useOpenRecord, useRecordStack } from "./record-stack";
+import { type RecordKind, useOpenRecord } from "./record-stack";
/**
* A cross-reference to another record.
@@ -45,22 +42,3 @@ export function RecordLink({
</button>
);
}
-
-/**
- * Back to the record you opened this one from.
- *
- * Only appears once there is somewhere to go back to — on the first record in
- * a trail the close button beside it already does the same job.
- */
-export function RecordBack() {
- const { stack, close } = useRecordStack();
-
- if (stack.length < 2) return null;
-
- return (
- <Button variant="ghost" size="sm" onClick={close}>
- <Icon icon={ArrowLeft} data-icon="inline-start" />
- Back
- </Button>
- );
-}
diff --git a/apps/app/components/crm/record-sheet/record-parts.tsx b/apps/app/components/crm/record-sheet/record-parts.tsx
index f6b3bb0e..c7d4a680 100644
--- a/apps/app/components/crm/record-sheet/record-parts.tsx
+++ b/apps/app/components/crm/record-sheet/record-parts.tsx
@@ -5,72 +5,65 @@ import { Spinner } from "@crm/ui/components/spinner";
import { formatMoney } from "@crm/ui/lib/format";
import type { ReactNode } from "react";
import {
- DetailSheet,
DetailSheetHeader,
type DetailSheetTab,
DetailSheetTabs,
} from "@/components/detail-sheet";
-import { RecordBack } from "./record-link";
import { useRecordStack } from "./record-stack";
/**
* The frame every record sheet is poured into.
*
+ * The contents of the panel, not the panel: the one dialog every record is
+ * shown in belongs to `RecordSheetHost`, so stepping sideways from a company
+ * to one of its deals swaps what is in here without rebuilding the panel
+ * around it.
+ *
* The header renders before the record has loaded — a sheet has to have a
* title from the first frame or the dialog is unlabelled, and a panel that
* pops into existence a beat after the click reads as a bug rather than as
* loading.
*/
export function RecordSheetFrame({
- open,
- onOpenChange,
loading,
error,
title,
description,
+ note,
media,
- eyebrow,
actions,
stats,
tabs,
tab,
onTabChange,
}: {
- open: boolean;
- onOpenChange: (open: boolean) => void;
loading: boolean;
error: string | null;
title: string;
description?: ReactNode;
+ note?: ReactNode;
media?: ReactNode;
- eyebrow?: ReactNode;
actions?: ReactNode;
stats?: ReactNode;
tabs: DetailSheetTab[];
tab: string;
onTabChange: (tab: string) => void;
}) {
- // The eyebrow row is skipped rather than rendered empty: `space-y` would
- // still put a gap under a zero-height div, leaving the header top-heavy on
- // the records that have nothing to say up there.
- const { stack } = useRecordStack();
- const nested = stack.length > 1;
+ // Back and close read from the same stack, so the frame does not need them
+ // passed down: Back appears when there is a record underneath, and closing
+ // leaves the trail.
+ const { stack, close, closeAll } = useRecordStack();
return (
- <DetailSheet open={open} onOpenChange={onOpenChange}>
+ <>
<DetailSheetHeader
- eyebrow={
- nested || eyebrow ? (
- <>
- <RecordBack />
- {eyebrow}
- </>
- ) : null
- }
media={media}
title={title}
description={description}
+ note={note}
actions={actions}
+ onBack={stack.length > 1 ? close : undefined}
+ onClose={closeAll}
/>
{loading ? (
@@ -92,7 +85,7 @@ export function RecordSheetFrame({
/>
</>
)}
- </DetailSheet>
+ </>
);
}
@@ -109,3 +102,55 @@ export function DealAmount({
<span className="tabular-nums">{formatMoney(amountCents, currency)}</span>
);
}
+
+/**
+ * A record's meta line: `attio.com · London · Software`, with the first part
+ * optionally a link. Assembled here so a company, a contact and a deal all
+ * separate their facts the same way.
+ */
+export function MetaLine({
+ lead,
+ parts,
+}: {
+ lead?: ReactNode;
+ parts: (string | null | undefined)[];
+}) {
+ const rest = parts.filter((part): part is string => Boolean(part));
+
+ return (
+ <>
+ {lead}
+ {rest.map((part, index) => (
+ <span key={part}>
+ {index === 0 && !lead ? null : " · "}
+ {part}
+ </span>
+ ))}
+ </>
+ );
+}
+
+/** The domain, as a link, which is what a domain is. */
+export function DomainLink({
+ domain,
+ website,
+}: {
+ domain: string | null;
+ website: string | null;
+}) {
+ const href = website ?? (domain ? `https://${domain}` : null);
+ const label = domain ?? website;
+ if (!href || !label) return null;
+
+ return (
+ <a
+ href={href}
+ target="_blank"
+ rel="noreferrer noopener"
+ onClick={(event) => event.stopPropagation()}
+ className="text-foreground underline-offset-2 hover:underline"
+ >
+ {label}
+ </a>
+ );
+}
diff --git a/apps/app/components/crm/record-sheet/record-sheet-host.tsx b/apps/app/components/crm/record-sheet/record-sheet-host.tsx
index 22f3df01..ee947c81 100644
--- a/apps/app/components/crm/record-sheet/record-sheet-host.tsx
+++ b/apps/app/components/crm/record-sheet/record-sheet-host.tsx
@@ -2,6 +2,7 @@
import { useState } from "react";
import { CloseReasonDialog } from "@/components/crm/stage-change";
+import { DetailSheet } from "@/components/detail-sheet";
import { CompanySheet } from "./company-sheet";
import { ContactSheet } from "./contact-sheet";
import { DealSheet } from "./deal-sheet";
@@ -11,12 +12,12 @@ import { type RecordRef, recordKey, useRecordStack } from "./record-stack";
* The one place a company, contact or deal is rendered.
*
* Mounted in the app shell rather than per page, so opening a contact from a
- * deal on the deals board works the same as opening one from the contacts
+ * deal on the deals table works the same as opening one from the contacts
* table — and so no list has to carry a copy of every sheet a row might lead
* to.
*/
export function RecordSheetHost() {
- const { top, closeAll } = useRecordStack();
+ const { stack, top, closeAll } = useRecordStack();
// The record that was last open, kept a beat longer than the URL says.
// Unmounting the instant `?record=` clears would cut the close animation
@@ -26,44 +27,48 @@ export function RecordSheetHost() {
setShown(top);
}
- const open = top !== null;
- // Escape, the X and the backdrop all mean "I am done here", so they leave
- // the trail rather than stepping up one record at a time — going up is what
- // the Back button in the header is for.
- const onOpenChange = (next: boolean) => {
- if (!next) closeAll();
- };
-
return (
<>
- {shown?.kind === "company" ? (
- <CompanySheet
- // A new company reuses the sheet, so remount to reset the tab and
- // drop the last record's scroll position.
- key={shown.id}
- companyId={shown.id}
- open={open}
- onOpenChange={onOpenChange}
- />
- ) : null}
+ {/*
+ * One dialog for every record, out here rather than inside each sheet.
+ * Stepping sideways — a company to one of its deals to somebody on that
+ * deal — then only swaps the contents, and the panel, its backdrop and
+ * the body scroll lock stay exactly where they are.
+ *
+ * A dialog per record would instead be torn out and rebuilt on that
+ * move, because the sheet being unmounted is a different component from
+ * the one taking its place. Radix only animates the `open` prop
+ * changing, so the old panel disappears without sliding out, the new
+ * one replays its slide-in from the right, and the list behind the
+ * translucent backdrop jumps by the width of the scrollbar as the
+ * scroll lock is released and immediately re-applied. That is the
+ * flicker, and it is not the record loading — it happens between two
+ * records already in cache.
+ */}
+ <DetailSheet
+ open={stack.length > 0}
+ onOpenChange={(next) => {
+ if (!next) closeAll();
+ }}
+ >
+ {/*
+ * Keyed by record so moving to another one starts fresh: a sheet on
+ * Overview, scrolled to the top, rather than inheriting where you
+ * happened to be in the last one. Inside the dialog, so that reset
+ * costs the contents and not the panel around them.
+ */}
+ {shown?.kind === "company" ? (
+ <CompanySheet key={recordKey(shown)} companyId={shown.id} />
+ ) : null}
- {shown?.kind === "contact" ? (
- <ContactSheet
- key={shown.id}
- contactId={shown.id}
- open={open}
- onOpenChange={onOpenChange}
- />
- ) : null}
+ {shown?.kind === "contact" ? (
+ <ContactSheet key={recordKey(shown)} contactId={shown.id} />
+ ) : null}
- {shown?.kind === "deal" ? (
- <DealSheet
- key={shown.id}
- dealId={shown.id}
- open={open}
- onOpenChange={onOpenChange}
- />
- ) : null}
+ {shown?.kind === "deal" ? (
+ <DealSheet key={recordKey(shown)} dealId={shown.id} />
+ ) : null}
+ </DetailSheet>
{/*
* "Why did we lose it?" is asked from a table row, a board card and a
diff --git a/apps/app/components/crm/record-sheet/record-stack.ts b/apps/app/components/crm/record-sheet/record-stack.ts
index 7f43b978..a46c1398 100644
--- a/apps/app/components/crm/record-sheet/record-stack.ts
+++ b/apps/app/components/crm/record-sheet/record-stack.ts
@@ -1,22 +1,52 @@
"use client";
-import { parseAsArrayOf, parseAsString, useQueryState } from "nuqs";
+import {
+ parseAsArrayOf,
+ parseAsString,
+ parseAsStringLiteral,
+ useQueryStates,
+} from "nuqs";
import { useCallback, useMemo } from "react";
-export const RECORD_KINDS = ["company", "contact", "deal"] as const;
+const RECORD_KINDS = ["company", "contact", "deal"] as const;
export type RecordKind = (typeof RECORD_KINDS)[number];
export type RecordRef = { kind: RecordKind; id: string };
+/** The quick-add forms a record sheet can have open inside it. */
+const RECORD_FORMS = ["contact", "deal"] as const;
+
+export type RecordForm = (typeof RECORD_FORMS)[number];
+
+/** The panel a quick-add form belongs to. */
+const FORM_TAB: Record<RecordForm, string> = {
+ contact: "contacts",
+ deal: "deals",
+};
+
/**
- * Which records are open, innermost last.
+ * Everything about what the sheet is showing: which records are open
+ * (innermost last), which tab of the innermost one, and which quick-add form
+ * inside that.
*
* A stack rather than a single id because the interesting move is sideways:
* from a company to one of its deals to somebody on that deal. Closing the
* deal should put you back on the company you came from, not on the table.
+ *
+ * All three ride in one hook so a write to any of them can clear the others.
+ * Moving to another record has to reset the tab and drop a half-typed form —
+ * otherwise they reappear, out of context, on whatever you opened next.
+ *
+ * `tab` and `add` replace rather than push: flicking through tabs is reading,
+ * not navigating, and a Back button that walks you through four panels before
+ * it closes the sheet is a Back button nobody presses twice.
*/
-const stackParser = parseAsArrayOf(parseAsString, ",").withDefault([]);
+const params = {
+ record: parseAsArrayOf(parseAsString, ",").withDefault([]),
+ tab: parseAsString,
+ add: parseAsStringLiteral(RECORD_FORMS),
+};
export function recordKey(ref: RecordRef): string {
return `${ref.kind}:${ref.id}`;
@@ -32,19 +62,26 @@ function parseRef(raw: string): RecordRef | null {
}
export function useRecordStack() {
- const [raw, setRaw] = useQueryState("record", stackParser);
+ const [{ record }, setParams] = useQueryStates(params);
const stack = useMemo(
- () => raw.map(parseRef).filter((ref): ref is RecordRef => ref !== null),
- [raw],
+ () => record.map(parseRef).filter((ref): ref is RecordRef => ref !== null),
+ [record],
);
const write = useCallback(
(next: RecordRef[], history: "push" | "replace") => {
- // `null` clears the param rather than leaving `?record=` behind.
- void setRaw(next.length === 0 ? null : next.map(recordKey), { history });
+ void setParams(
+ // `null` clears each param rather than leaving `?record=` behind.
+ {
+ record: next.length === 0 ? null : next.map(recordKey),
+ tab: null,
+ add: null,
+ },
+ { history },
+ );
},
- [setRaw],
+ [setParams],
);
/**
@@ -91,3 +128,37 @@ export function useRecordStack() {
export function useOpenRecord() {
return useRecordStack().open;
}
+
+/**
+ * What the open record sheet is showing — the tab, and the quick-add form
+ * inside it.
+ *
+ * In the URL rather than component state, like every other view state here:
+ * "the Attio deal, on Activity" is then a link you can send someone, and a
+ * half-finished "add a contact" survives a refresh instead of being silently
+ * discarded.
+ */
+export function useRecordSheetView(fallbackTab: string) {
+ const [{ tab, add }, setParams] = useQueryStates(params);
+
+ // A form open in a panel implies the panel: landing on `?add=contact`
+ // should show the contacts tab, not leave the form mounted out of sight
+ // behind whichever tab happened to be the default.
+ const active = add ? FORM_TAB[add] : (tab ?? fallbackTab);
+
+ const setTab = useCallback(
+ (next: string) => {
+ // Leaving the panel abandons the form that lived in it, and the
+ // default tab is the absence of the param rather than a value.
+ void setParams({ tab: next === fallbackTab ? null : next, add: null });
+ },
+ [setParams, fallbackTab],
+ );
+
+ const setForm = useCallback(
+ (next: RecordForm | null) => void setParams({ add: next }),
+ [setParams],
+ );
+
+ return { tab: active, setTab, form: add, setForm };
+}
diff --git a/apps/app/components/crm/stage-change.tsx b/apps/app/components/crm/stage-change.tsx
index eb319a99..43818b25 100644
--- a/apps/app/components/crm/stage-change.tsx
+++ b/apps/app/components/crm/stage-change.tsx
@@ -1,5 +1,6 @@
"use client";
+import ChevronDown from "@carbon/icons-react/es/ChevronDown";
import type { DealStage } from "@crm/db/enums";
import { Button } from "@crm/ui/components/button";
import {
@@ -18,12 +19,14 @@ import {
DropdownMenuTrigger,
} from "@crm/ui/components/dropdown-menu";
import { Field, FieldLabel } from "@crm/ui/components/field";
+import { Icon } from "@crm/ui/components/icon";
import { Spinner } from "@crm/ui/components/spinner";
import { Textarea } from "@crm/ui/components/textarea";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useMutation } from "@tanstack/react-query";
import { parseAsString, useQueryStates } from "nuqs";
import { useId, useState } from "react";
import { toast } from "sonner";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import {
DEAL_STAGE_OPTIONS,
@@ -46,28 +49,12 @@ const closeReasonParams = {
/** Invalidates everywhere a stage is visible. */
function useStageMutation(onDone?: () => void) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
return useMutation(
trpc.deals.setStage.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.deals.byId.queryKey(),
- }),
- // A stage change writes a STAGE_CHANGE activity stamped with the
- // company, so the company page's timeline and last-activity change
- // too.
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- ]);
+ onSuccess: async (_, variables) => {
+ await cache.deal(variables.id);
onDone?.();
},
onError: (error) => toast.error(error.message),
@@ -76,7 +63,12 @@ function useStageMutation(onDone?: () => void) {
}
/**
- * The stage picker that appears on a deal row and on the deal page.
+ * The one place a deal's stage is set — a table cell, a board card, or the
+ * header of the deal's own sheet.
+ *
+ * `inline` is for a cell in a list, where a bordered control in every row
+ * would out-shout the rows. `control` is for a sheet header, where it sits
+ * beside real buttons and has to look like one.
*
* Losing stages divert through `CloseReasonDialog`: the API refuses them
* without a reason, so asking here is friendlier than a toast full of the
@@ -85,9 +77,11 @@ function useStageMutation(onDone?: () => void) {
export function DealStageMenu({
dealId,
stage,
+ variant = "inline",
}: {
dealId: string;
stage: DealStage;
+ variant?: "inline" | "control";
}) {
const [, setCloseParams] = useQueryStates(closeReasonParams);
const setStage = useStageMutation();
@@ -96,17 +90,32 @@ export function DealStageMenu({
<DropdownMenu>
<DropdownMenuTrigger asChild>
{/* The row underneath opens a record on click; this control does not. */}
- <button
- type="button"
- onClick={(event) => event.stopPropagation()}
- disabled={setStage.isPending}
- className="flex min-w-0 items-center text-left hover:text-foreground disabled:opacity-50"
- >
- <DealStageIndicator stage={stage} />
- </button>
+ {variant === "control" ? (
+ <Button
+ variant="outline"
+ size="sm"
+ disabled={setStage.isPending}
+ onClick={(event) => event.stopPropagation()}
+ >
+ <DealStageIndicator stage={stage} className="text-foreground" />
+ <Icon icon={ChevronDown} className="text-muted-foreground" />
+ </Button>
+ ) : (
+ <button
+ type="button"
+ onClick={(event) => event.stopPropagation()}
+ disabled={setStage.isPending}
+ className="flex min-w-0 items-center text-left hover:text-foreground disabled:opacity-50"
+ >
+ <DealStageIndicator stage={stage} />
+ </button>
+ )}
</DropdownMenuTrigger>
<DropdownMenuContent
- align="start"
+ // The header control sits at the right edge of the sheet, so its menu
+ // hangs from that edge rather than being pushed back by collision
+ // detection a beat after it opens.
+ align={variant === "control" ? "end" : "start"}
className="min-w-52"
onClick={(event) => event.stopPropagation()}
>
diff --git a/apps/app/components/crm/stage-stepper.tsx b/apps/app/components/crm/stage-stepper.tsx
index 7677a71c..4fc5ebae 100644
--- a/apps/app/components/crm/stage-stepper.tsx
+++ b/apps/app/components/crm/stage-stepper.tsx
@@ -1,25 +1,35 @@
"use client";
-import type { DealStage } from "@crm/db/enums";
-import { Button } from "@crm/ui/components/button";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
-import { parseAsString, useQueryStates } from "nuqs";
+import { DealStage } from "@crm/db/enums";
+import { cn } from "@crm/ui/lib/utils";
+import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";
import {
- CLOSED_STAGES,
DealStageIndicator,
dealStageLabel,
- LOSING_STAGES,
+ isClosedStage,
OPEN_STAGES,
} from "@/components/crm/deal-stage";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
/**
- * The open pipeline as a row of steps, with the closing outcomes beside it.
+ * Won is the end of the pipeline, so it is the last step on the rail.
*
- * Only the four open stages are steps: `CLOSED_WON`, `CLOSED_LOST` and
- * `UNQUALIFIED_TO_BUY` are outcomes, and drawing them as "further along the
- * line" would say a lost deal is progress.
+ * Lost and unqualified are not — they are exits, they can happen from any
+ * step, and the API refuses them without a reason. Those stay in the stage
+ * control in the header, which knows to ask why.
+ */
+const RAIL = [...OPEN_STAGES, DealStage.CLOSED_WON] as readonly DealStage[];
+
+/**
+ * How far along the deal is, as a rail of segments.
+ *
+ * Mostly the picture, not the picker — jumping backwards, reopening and
+ * closing-as-lost live in the stage control in the sheet header, next to the
+ * record's name where the other sheets keep their state. What is here is the
+ * move a rep makes constantly: nudging a deal to the next step, in one click,
+ * all the way through to won.
*/
export function StageStepper({
dealId,
@@ -29,90 +39,71 @@ export function StageStepper({
stage: DealStage;
}) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
- const [, setCloseParams] = useQueryStates({
- closing: parseAsString,
- closingStage: parseAsString,
- });
+ const cache = useCrmCache();
const setStage = useMutation(
trpc.deals.setStage.mutationOptions({
onSuccess: async (result) => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.deals.byId.queryKey({ id: dealId }),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.companies.byId.queryKey(),
- }),
- ]);
+ await cache.deal(dealId);
if (result.changed) toast.success("Stage updated.");
},
onError: (error) => toast.error(error.message),
}),
);
- const currentIndex = OPEN_STAGES.indexOf(stage);
- const isClosed = CLOSED_STAGES.includes(stage);
-
- const move = (next: DealStage) => {
- if (LOSING_STAGES.includes(next)) {
- void setCloseParams({ closing: dealId, closingStage: next });
- return;
- }
- setStage.mutate({ id: dealId, stage: next });
- };
+ // A deal that was lost or disqualified never reached won, so the rail shows
+ // its four open steps unlit and hands the last segment to the outcome.
+ const exited = isClosedStage(stage) && stage !== DealStage.CLOSED_WON;
+ const steps = exited ? OPEN_STAGES : RAIL;
+ const currentIndex = steps.indexOf(stage);
return (
- <div className="flex flex-col gap-3">
- <div className="flex flex-wrap items-center gap-1">
- {OPEN_STAGES.map((option, index) => {
- const reached = !isClosed && index <= currentIndex;
- return (
- <Button
- key={option}
- variant={reached ? "secondary" : "ghost"}
- size="sm"
- aria-current={option === stage ? "step" : undefined}
+ <ol className="flex w-full gap-1">
+ {steps.map((option, index) => {
+ const reached = !exited && index <= currentIndex;
+ const current = !exited && option === stage;
+ return (
+ <li key={option} className="flex min-w-0 flex-1">
+ <button
+ type="button"
+ aria-current={current ? "step" : undefined}
disabled={setStage.isPending}
- onClick={() => move(option)}
+ onClick={() => setStage.mutate({ id: dealId, stage: option })}
+ className={cn(
+ "min-w-0 flex-1 border-t-2 pt-2 text-left text-xs transition-colors disabled:pointer-events-none disabled:opacity-50",
+ reached
+ ? "border-foreground text-foreground"
+ : "border-border text-muted-foreground hover:border-muted-foreground hover:text-foreground",
+ current && "font-medium",
+ )}
>
- {dealStageLabel(option)}
- </Button>
- );
- })}
- </div>
+ <span className="block truncate">
+ {/* The last segment is the outcome slot: the win the deal is
+ heading for while it is open, and the actual result once
+ it is not. */}
+ {current && option === DealStage.CLOSED_WON ? (
+ <DealStageIndicator stage={stage} className="text-xs" />
+ ) : (
+ dealStageLabel(option)
+ )}
+ </span>
+ </button>
+ </li>
+ );
+ })}
- <div className="flex flex-wrap items-center gap-2">
- {isClosed ? (
- <>
- <DealStageIndicator stage={stage} className="text-sm" />
- <Button
- variant="outline"
- size="sm"
- disabled={setStage.isPending}
- onClick={() => move("DEMO_BOOKED")}
- >
- Reopen
- </Button>
- </>
- ) : (
- CLOSED_STAGES.map((option) => (
- <Button
- key={option}
- variant="outline"
- size="sm"
- disabled={setStage.isPending}
- onClick={() => move(option)}
- >
- {dealStageLabel(option)}
- </Button>
- ))
- )}
- </div>
- </div>
+ {/*
+ * Lost or disqualified, as the final segment. Not a button: coming back
+ * into the pipeline means choosing a step, which the four to its left
+ * already do, and a rail whose end undoes itself on click is a trap.
+ */}
+ {exited ? (
+ <li className="flex min-w-0 flex-1">
+ <div className="min-w-0 flex-1 border-foreground border-t-2 pt-2">
+ <DealStageIndicator stage={stage} className="text-xs" />
+ </div>
+ </li>
+ ) : null}
+ </ol>
);
}
diff --git a/apps/app/components/crm/timeline/activity-composer.tsx b/apps/app/components/crm/timeline/activity-composer.tsx
index 4265b9e0..bf5ed61b 100644
--- a/apps/app/components/crm/timeline/activity-composer.tsx
+++ b/apps/app/components/crm/timeline/activity-composer.tsx
@@ -5,9 +5,10 @@ import { Input } from "@crm/ui/components/input";
import { Spinner } from "@crm/ui/components/spinner";
import { Textarea } from "@crm/ui/components/textarea";
import { ToggleGroup, ToggleGroupItem } from "@crm/ui/components/toggle-group";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useMutation } from "@tanstack/react-query";
import { useId, useState } from "react";
import { toast } from "sonner";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import { ActivityIcon, activityLabel } from "./activity-icon";
import type { TimelineAnchor } from "./timeline";
@@ -18,10 +19,19 @@ const TYPES = ["NOTE", "CALL", "EMAIL", "MEETING", "TASK"] as const;
type ComposableType = (typeof TYPES)[number];
+/**
+ * Logging what just happened, without burying what already did.
+ *
+ * Collapsed to a single line until you click it. Expanded, it was taller than
+ * the first three entries of the timeline put together, so opening a company
+ * showed you a form where you expected its history — and the history is what
+ * people come here to read. Writing is one click away; reading is none.
+ */
export function ActivityComposer({ anchor }: { anchor: TimelineAnchor }) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
+ const [open, setOpen] = useState(false);
const [type, setType] = useState<ComposableType>("NOTE");
const [subject, setSubject] = useState("");
const [body, setBody] = useState("");
@@ -36,33 +46,11 @@ export function ActivityComposer({ anchor }: { anchor: TimelineAnchor }) {
const create = useMutation(
trpc.activities.create.mutationOptions({
onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timeline.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timelineCounts.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.myTasks.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.dashboard.summary.queryKey(),
- }),
- // "Last activity" columns move whenever anything is logged.
- queryClient.invalidateQueries({
- queryKey: trpc.companies.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.contacts.list.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.deals.list.queryKey(),
- }),
- ]);
+ await cache.activity();
setSubject("");
setBody("");
setDueAt("");
+ setOpen(false);
},
onError: (error) => toast.error(error.message),
}),
@@ -70,9 +58,28 @@ export function ActivityComposer({ anchor }: { anchor: TimelineAnchor }) {
const ready = isTask ? subject.trim() !== "" : body.trim() !== "";
+ const dismiss = () => {
+ setSubject("");
+ setBody("");
+ setDueAt("");
+ setOpen(false);
+ };
+
+ if (!open) {
+ return (
+ <button
+ type="button"
+ onClick={() => setOpen(true)}
+ className="flex h-9 w-full items-center border bg-transparent px-3 text-left text-muted-foreground text-sm hover:border-ring hover:bg-muted/30"
+ >
+ Log a note, call, email, meeting or task…
+ </button>
+ );
+ }
+
return (
<form
- className="flex flex-col gap-3 border-b pb-4"
+ className="flex flex-col gap-3"
onSubmit={(event) => {
event.preventDefault();
create.mutate({
@@ -159,6 +166,15 @@ export function ActivityComposer({ anchor }: { anchor: TimelineAnchor }) {
)}
<div className="flex items-center justify-end gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ disabled={create.isPending}
+ onClick={dismiss}
+ >
+ Cancel
+ </Button>
<Button type="submit" size="sm" disabled={create.isPending || !ready}>
{create.isPending ? <Spinner /> : null}
{isTask ? "Add task" : `Log ${activityLabel(type).toLowerCase()}`}
diff --git a/apps/app/components/crm/timeline/activity-icon.tsx b/apps/app/components/crm/timeline/activity-icon.tsx
index 1b16e526..98885762 100644
--- a/apps/app/components/crm/timeline/activity-icon.tsx
+++ b/apps/app/components/crm/timeline/activity-icon.tsx
@@ -24,10 +24,6 @@ export function activityLabel(type: ActivityType): string {
return PRESENTATION[type].label;
}
-export function activityIcon(type: ActivityType): CarbonIcon {
- return PRESENTATION[type].icon;
-}
-
export function ActivityIcon({ type }: { type: ActivityType }) {
return <Icon icon={PRESENTATION[type].icon} />;
}
diff --git a/apps/app/components/crm/timeline/timeline-entry.tsx b/apps/app/components/crm/timeline/timeline-entry.tsx
index e1a7ba40..ffa599db 100644
--- a/apps/app/components/crm/timeline/timeline-entry.tsx
+++ b/apps/app/components/crm/timeline/timeline-entry.tsx
@@ -3,10 +3,11 @@
import { Checkbox } from "@crm/ui/components/checkbox";
import { StatusIndicator } from "@crm/ui/components/status-indicator";
import { relativeTimeFromIso } from "@crm/ui/lib/format";
-import { useMutation, useQueryClient } from "@tanstack/react-query";
+import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";
import { dealStageLabel } from "@/components/crm/deal-stage";
import { RecordLink } from "@/components/crm/record-sheet/record-link";
+import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";
import type { RouterOutputs } from "@/lib/trpc/types";
import { ActivityIcon, activityLabel } from "./activity-icon";
@@ -35,26 +36,11 @@ export function TimelineEntry({
showContext?: boolean;
}) {
const trpc = useTRPC();
- const queryClient = useQueryClient();
+ const cache = useCrmCache();
const complete = useMutation(
trpc.activities.complete.mutationOptions({
- onSuccess: async () => {
- await Promise.all([
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timeline.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.timelineCounts.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.activities.myTasks.queryKey(),
- }),
- queryClient.invalidateQueries({
- queryKey: trpc.dashboard.summary.queryKey(),
- }),
- ]);
- },
+ onSuccess: () => cache.activity(),
onError: (error) => toast.error(error.message),
}),
);
diff --git a/apps/app/components/crm/timeline/timeline.tsx b/apps/app/components/crm/timeline/timeline.tsx
index 03052615..af7b3572 100644
--- a/apps/app/components/crm/timeline/timeline.tsx
+++ b/apps/app/components/crm/timeline/timeline.tsx
@@ -94,11 +94,11 @@ export function Timeline({ anchor }: { anchor: TimelineAnchor }) {
return (
<div className="flex min-h-0 flex-1 flex-col">
- <div className="shrink-0 border-b p-5">
+ {/* One band of controls, then history. Two stacked bordered bands push
+ the first entry off the fold on a laptop. */}
+ <div className="flex shrink-0 flex-col gap-3 border-b px-5 py-3">
<ActivityComposer anchor={anchor} />
- </div>
- <div className="flex shrink-0 items-center border-b px-5 py-2">
<ToggleGroup
type="single"
value={tab}
diff --git a/apps/app/components/dashboard-charts.tsx b/apps/app/components/dashboard-charts.tsx
new file mode 100644
index 00000000..797bc347
--- /dev/null
+++ b/apps/app/components/dashboard-charts.tsx
@@ -0,0 +1,28 @@
+"use client";
+
+import { Spinner } from "@crm/ui/components/spinner";
+import dynamic from "next/dynamic";
+
+/**
+ * Recharts measures the DOM to lay a chart out, so there is nothing useful to
+ * render on the server — an SSR pass emits a zero-width plot that the browser
+ * immediately throws away. Loading the charts on the client only also keeps
+ * recharts out of the shell bundle every other page pays for.
+ */
+const load = () => import("@crm/ui/components/dashboard-chart");
+
+const loading = () => (
+ <div className="flex h-[200px] items-center justify-center">
+ <Spinner />
+ </div>
+);
+
+export const AreaTrend = dynamic(() => load().then((m) => m.AreaTrend), {
+ ssr: false,
+ loading,
+});
+
+export const DonutStat = dynamic(() => load().then((m) => m.DonutStat), {
+ ssr: false,
+ loading,
+});
diff --git a/apps/app/components/data-table/list-search-params.ts b/apps/app/components/data-table/list-search-params.ts
index 9ac2e37c..e439639e 100644
--- a/apps/app/components/data-table/list-search-params.ts
+++ b/apps/app/components/data-table/list-search-params.ts
@@ -31,7 +31,7 @@ type StringParser = ParserBuilder<string> & { defaultValue: string };
* signature here would collide with `page: number` and make every setter
* untypeable.
*/
-export type ListParsers<TKey extends string> = {
+type ListParsers<TKey extends string> = {
q: StringParser;
sort: StringParser;
dir: ParserBuilder<SortDirection> & { defaultValue: SortDirection };
diff --git a/apps/app/components/detail-sheet.tsx b/apps/app/components/detail-sheet.tsx
index 5ea007ba..6690647b 100644
--- a/apps/app/components/detail-sheet.tsx
+++ b/apps/app/components/detail-sheet.tsx
@@ -1,5 +1,19 @@
"use client";
+import ArrowLeft from "@carbon/icons-react/es/ArrowLeft";
+import Close from "@carbon/icons-react/es/Close";
+import { Button } from "@crm/ui/components/button";
+import {
+ Empty,
+ EmptyContent,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+} from "@crm/ui/components/empty";
+import type { CarbonIcon } from "@crm/ui/components/icon";
+import { Icon } from "@crm/ui/components/icon";
+import { Separator } from "@crm/ui/components/separator";
import type { SheetSize } from "@crm/ui/components/sheet";
import {
Tabs,
@@ -7,8 +21,13 @@ import {
TabsList,
TabsTrigger,
} from "@crm/ui/components/tabs";
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from "@crm/ui/components/tooltip";
import { cn } from "@crm/ui/lib/utils";
-import type { ReactNode } from "react";
+import { type ReactNode, useRef } from "react";
import {
Sheet,
SheetContent,
@@ -17,14 +36,29 @@ import {
SheetTitle,
} from "@/components/responsive-sheet";
+/** One gutter for the whole panel, so every band lines up down the left edge. */
+const GUTTER = "px-5";
+
+/**
+ * Section headings are eyebrows, not titles.
+ *
+ * The only title in a record sheet is the record's name. "Details" and "About"
+ * are labels on a filing cabinet — they need to be findable when you scan for
+ * them and invisible when you are not.
+ */
+const SECTION_TITLE =
+ "font-medium text-muted-foreground text-xs uppercase tracking-wider";
+
/**
* The chrome every record sheet is built from.
*
* One shape for all of them — header, a strip of numbers, tabs, a scrolling
* body — so a rep who has opened a company knows where everything is on a deal
- * without looking. The parts are separate components rather than props on one
- * because the tabs' contents differ per record and a `renderX` prop for each
- * would be worse than composing them.
+ * without looking.
+ *
+ * `showCloseButton={false}`: the close control is part of the header's action
+ * group instead of floating over the top-right corner, which is the only way
+ * a record's own buttons can sit up there without being crowded by it.
*/
export function DetailSheet({
open,
@@ -39,11 +73,24 @@ export function DetailSheet({
className?: string;
children: ReactNode;
}) {
+ const content = useRef<HTMLDivElement>(null);
+
return (
<Sheet open={open} onOpenChange={onOpenChange}>
<SheetContent
+ ref={content}
side="right"
size={size}
+ showCloseButton={false}
+ // Opening a record is a read, not a form. Left alone, Radix puts
+ // focus on the first control in the panel, so the sheet arrives with
+ // a focus ring already drawn on a button nobody pressed. Focusing the
+ // panel itself keeps assistive tech inside the dialog and announces
+ // the record's name, without anything looking pre-clicked.
+ onOpenAutoFocus={(event) => {
+ event.preventDefault();
+ content.current?.focus();
+ }}
className={cn("flex flex-col gap-0 p-0", className)}
>
{children}
@@ -53,36 +100,43 @@ export function DetailSheet({
}
export function DetailSheetHeader({
- eyebrow,
+ media,
title,
description,
- media,
+ note,
actions,
- className,
- children,
+ onBack,
+ onClose,
}: {
- eyebrow?: ReactNode;
+ media?: ReactNode;
title: ReactNode;
+ /** The one line that says what this is — domain, company, location. */
description?: ReactNode;
- media?: ReactNode;
- /** Buttons, wrapped so the close control never lands on top of them. */
+ /** Only when there is something to say: an agent running, a failure. */
+ note?: ReactNode;
actions?: ReactNode;
- className?: string;
- children?: ReactNode;
+ /** Up one record, when this was opened from another one. */
+ onBack?: () => void;
+ onClose: () => void;
}) {
return (
- <SheetHeader
- className={cn("gap-0 space-y-3 border-b p-5 pr-14", className)}
- >
- {eyebrow ? (
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs">
- {eyebrow}
- </div>
- ) : null}
+ <SheetHeader className={cn("gap-0 border-b py-4", GUTTER)}>
+ <div className="flex items-start gap-3">
+ {onBack ? (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button variant="ghost" size="icon-sm" onClick={onBack}>
+ <Icon icon={ArrowLeft} />
+ <span className="sr-only">Back</span>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>Back</TooltipContent>
+ </Tooltip>
+ ) : null}
- <div className="flex items-start gap-4">
{media}
- <div className="min-w-0 flex-1 space-y-1">
+
+ <div className="min-w-0 flex-1 space-y-1 pt-0.5">
<SheetTitle size="lg" className="wrap-anywhere">
{title}
</SheetTitle>
@@ -91,49 +145,52 @@ export function DetailSheetHeader({
{description}
</SheetDescription>
) : null}
+ {note ? (
+ <div className="flex flex-wrap items-center gap-x-3 gap-y-1 pt-0.5 text-xs">
+ {note}
+ </div>
+ ) : null}
</div>
- </div>
-
- {actions ? (
- <div className="flex flex-wrap items-center gap-2">{actions}</div>
- ) : null}
- {children}
+ {/*
+ * Actions and close travel together, so the record's own buttons can
+ * never end up underneath the close control.
+ */}
+ <div className="flex shrink-0 items-center gap-1">
+ {actions}
+ {actions ? (
+ <Separator orientation="vertical" className="mx-1 h-5" />
+ ) : null}
+ <Button variant="ghost" size="icon-sm" onClick={onClose}>
+ <Icon icon={Close} />
+ <span className="sr-only">Close</span>
+ </Button>
+ </div>
+ </div>
</SheetHeader>
);
}
-/** A row of the four or five numbers you would otherwise go hunting for. */
-export function DetailSheetStats({
- className,
- children,
-}: {
- className?: string;
- children: ReactNode;
-}) {
- return (
- <dl className={cn("flex shrink-0 divide-x border-b", className)}>
- {children}
- </dl>
- );
+/**
+ * The numbers you would otherwise open a tab to find.
+ *
+ * Deliberately not the counts already printed on the tabs beside them — a
+ * strip that repeats "Contacts 3" under a tab reading "Contacts 3" is a band
+ * of furniture, not information.
+ */
+export function DetailSheetStats({ children }: { children: ReactNode }) {
+ return <dl className="flex shrink-0 divide-x border-b">{children}</dl>;
}
export function DetailSheetStat({
label,
- className,
children,
}: {
label: ReactNode;
- className?: string;
children: ReactNode;
}) {
return (
- <div
- className={cn(
- "flex min-w-0 flex-1 flex-col gap-1.5 px-5 py-3",
- className,
- )}
- >
+ <div className={cn("flex min-w-0 flex-1 flex-col gap-1 py-2.5", GUTTER)}>
<dt className="truncate text-muted-foreground text-xs">{label}</dt>
<dd className="min-w-0 truncate text-sm">{children}</dd>
</div>
@@ -160,28 +217,33 @@ export function DetailSheetTabs({
tabs,
value,
onValueChange,
- className,
}: {
tabs: DetailSheetTab[];
value: string;
onValueChange: (value: string) => void;
- className?: string;
}) {
return (
<Tabs
value={value}
onValueChange={onValueChange}
- className={cn("flex min-h-0 flex-1 flex-col gap-0", className)}
+ className="flex min-h-0 flex-1 flex-col gap-0"
>
+ {/*
+ * Tabs only. A panel's actions live in the panel — a button bolted to
+ * the right of the tab strip reads as part of the navigation, and the
+ * one thing it is not is somewhere you can go.
+ */}
<TabsList
variant="line"
- className="w-full shrink-0 justify-start gap-4 border-b px-5"
+ className={cn("w-full shrink-0 justify-start gap-6 border-b", GUTTER)}
>
{tabs.map((tab) => (
<TabsTrigger key={tab.value} value={tab.value}>
{tab.label}
{tab.count ? (
- <span className="tabular-nums opacity-60">{tab.count}</span>
+ <span className="text-muted-foreground tabular-nums">
+ {tab.count}
+ </span>
) : null}
</TabsTrigger>
))}
@@ -207,17 +269,9 @@ export function DetailSheetTabs({
}
/** The scroll container for a tab made of sections rather than one table. */
-export function DetailSheetBody({
- className,
- children,
-}: {
- className?: string;
- children: ReactNode;
-}) {
+export function DetailSheetBody({ children }: { children: ReactNode }) {
return (
- <div
- className={cn("flex min-h-0 flex-1 flex-col overflow-y-auto", className)}
- >
+ <div className="flex min-h-0 flex-1 flex-col overflow-y-auto">
{children}
</div>
);
@@ -236,15 +290,15 @@ export function DetailSheetSection({
}) {
return (
<section
- className={cn("space-y-3 border-b p-5 last:border-b-0", className)}
+ className={cn(
+ "space-y-3 border-b py-4 last:border-b-0",
+ GUTTER,
+ className,
+ )}
>
{title || action ? (
- <div className="flex items-center justify-between gap-3">
- {title ? (
- <h3 className="font-medium text-foreground text-sm">{title}</h3>
- ) : (
- <span />
- )}
+ <div className="flex h-6 items-center justify-between gap-3">
+ {title ? <h3 className={SECTION_TITLE}>{title}</h3> : <span />}
{action}
</div>
) : null}
@@ -253,11 +307,44 @@ export function DetailSheetSection({
);
}
-/** Nothing here yet, said once, the same way everywhere. */
-export function DetailSheetEmpty({ children }: { children: ReactNode }) {
+/**
+ * Two columns of editable properties on a wide panel, one on a narrow one.
+ *
+ * Paired rather than a single list because a company has eight of these and a
+ * single column turns the first screen of the sheet into a ladder you scroll.
+ */
+export function DetailSheetProperties({ children }: { children: ReactNode }) {
+ return <div className="grid gap-x-8 sm:grid-cols-2">{children}</div>;
+}
+
+/**
+ * Nothing here yet, said once, the same way everywhere.
+ *
+ * A real empty state rather than a line of grey text: an empty panel is the
+ * most common thing a rep sees on a company they just added, so it is the one
+ * place the app has to say what this list is for and how to start it.
+ */
+export function DetailSheetEmpty({
+ icon,
+ title,
+ description,
+ action,
+}: {
+ icon: CarbonIcon;
+ title: string;
+ description: string;
+ action?: ReactNode;
+}) {
return (
- <p className="px-5 py-10 text-center text-muted-foreground text-xs">
- {children}
- </p>
+ <Empty className="flex-1">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <Icon icon={icon} />
+ </EmptyMedia>
+ <EmptyTitle>{title}</EmptyTitle>
+ <EmptyDescription>{description}</EmptyDescription>
+ </EmptyHeader>
+ {action ? <EmptyContent>{action}</EmptyContent> : null}
+ </Empty>
);
}
diff --git a/apps/app/components/responsive-sheet.tsx b/apps/app/components/responsive-sheet.tsx
index 3626c6fc..6c0ce88e 100644
--- a/apps/app/components/responsive-sheet.tsx
+++ b/apps/app/components/responsive-sheet.tsx
@@ -2,24 +2,18 @@
import {
Drawer,
- DrawerClose,
DrawerContent,
DrawerDescription,
- DrawerFooter,
DrawerHeader,
DrawerTitle,
- DrawerTrigger,
} from "@crm/ui/components/drawer";
import {
type SheetSize,
Sheet as UISheet,
- SheetClose as UISheetClose,
SheetContent as UISheetContent,
SheetDescription as UISheetDescription,
- SheetFooter as UISheetFooter,
SheetHeader as UISheetHeader,
SheetTitle as UISheetTitle,
- SheetTrigger as UISheetTrigger,
} from "@crm/ui/components/sheet";
import { useIsMobile } from "@crm/ui/hooks/use-mobile";
import { cn } from "@crm/ui/lib/utils";
@@ -58,26 +52,6 @@ function Sheet({ children, ...props }: RootProps) {
);
}
-function SheetTrigger(
- props: React.ComponentProps<"button"> & { asChild?: boolean },
-) {
- return useResponsive() ? (
- <DrawerTrigger {...props} />
- ) : (
- <UISheetTrigger {...props} />
- );
-}
-
-function SheetClose(
- props: React.ComponentProps<"button"> & { asChild?: boolean },
-) {
- return useResponsive() ? (
- <DrawerClose {...props} />
- ) : (
- <UISheetClose {...props} />
- );
-}
-
function SheetContent({
children,
side,
@@ -89,6 +63,8 @@ function SheetContent({
side?: "top" | "right" | "bottom" | "left";
size?: SheetSize;
showCloseButton?: boolean;
+ /** Radix's "where does focus land" hook — both branches forward it. */
+ onOpenAutoFocus?: (event: Event) => void;
}) {
if (useResponsive()) {
// A bottom drawer is otherwise content-height, so a short body (or a tab
@@ -128,14 +104,6 @@ function SheetHeader(props: React.ComponentProps<"div">) {
);
}
-function SheetFooter(props: React.ComponentProps<"div">) {
- return useResponsive() ? (
- <DrawerFooter {...props} />
- ) : (
- <UISheetFooter {...props} />
- );
-}
-
function SheetTitle(props: {
className?: string;
size?: "default" | "lg";
@@ -159,13 +127,4 @@ function SheetDescription(props: {
);
}
-export {
- Sheet,
- SheetClose,
- SheetContent,
- SheetDescription,
- SheetFooter,
- SheetHeader,
- SheetTitle,
- SheetTrigger,
-};
+export { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle };
diff --git a/apps/app/lib/trpc/cache.ts b/apps/app/lib/trpc/cache.ts
new file mode 100644
index 00000000..7f2bca3a
--- /dev/null
+++ b/apps/app/lib/trpc/cache.ts
@@ -0,0 +1,168 @@
+"use client";
+
+import { type QueryKey, useQueryClient } from "@tanstack/react-query";
+import { useTRPC } from "./client";
+
+/**
+ * What a write invalidates, in one place.
+ *
+ * Every mutation used to list its own keys in `onSuccess`, and the lists drifted
+ * apart: a stage change wrote a `STAGE_CHANGE` activity without invalidating the
+ * timeline it landed on, creating a deal from the deals page never refreshed the
+ * list, and nothing at all invalidated the overview — so a rep could close a
+ * deal and watch their own numbers not move. The fan-out belongs to the shape of
+ * the data, not to the button that happened to trigger it, so it lives here and
+ * each call site says only *what changed*.
+ *
+ * Per the API rules: freshness is TanStack Query's job, invalidated from the
+ * mutation's `onSuccess` with the narrowest key that covers what changed. What
+ * counts as "narrowest" is per-entity, which is exactly what these functions
+ * encode.
+ */
+
+type Settle = "all" | "record";
+
+type Options = {
+ /**
+ * Which refetches to wait for.
+ *
+ * `"all"` (the default) keeps the caller pending until every affected view is
+ * fresh — right when the point of the action *is* the view changing, like a
+ * row leaving the filtered list once its stage no longer matches.
+ *
+ * `"record"` waits only for the changed record's own query and lets the rest
+ * refetch behind it, so an inline editor's spinner clears as soon as the value
+ * under it is right rather than when the table behind the sheet has caught up.
+ */
+ settle?: Settle;
+};
+
+export type CrmCache = {
+ /** A company's name, logo, industry, owner, primary contact or enrichment. */
+ company(id?: string, options?: Options): Promise<void>;
+ /** A contact's name, title, email or which company they belong to. */
+ contact(id?: string, options?: Options): Promise<void>;
+ /** A deal's stage, amount, close date or owner — and so every sales number. */
+ deal(id?: string, options?: Options): Promise<void>;
+ /** A note, a task, or a task being ticked off. */
+ activity(options?: Options): Promise<void>;
+ /** An import writes across every table, so nothing is assumed to survive. */
+ everything(): Promise<void>;
+};
+
+export function useCrmCache(): CrmCache {
+ const trpc = useTRPC();
+ const queryClient = useQueryClient();
+
+ const run = (
+ record: QueryKey[],
+ rest: QueryKey[],
+ { settle = "all" }: Options = {},
+ ): Promise<void> => {
+ const awaited = settle === "all" ? [...record, ...rest] : record;
+ const behind = settle === "all" ? [] : rest;
+
+ for (const queryKey of behind) {
+ void queryClient.invalidateQueries({ queryKey });
+ }
+
+ return Promise.all(
+ awaited.map((queryKey) => queryClient.invalidateQueries({ queryKey })),
+ ).then(() => undefined);
+ };
+
+ /**
+ * The timeline history is an infinite query, so `pathKey()` — tRPC stamps the
+ * query type into `queryKey()`, and `{ type: "query" }` cannot partially match
+ * the `{ type: "infinite" }` the history is cached under. Getting this wrong
+ * is silent: it reports success, refetches the sibling non-infinite queries,
+ * and leaves the history stale until a reload.
+ */
+ const activityKeys = () => [
+ trpc.activities.timeline.pathKey(),
+ trpc.activities.timelineCounts.queryKey(),
+ trpc.activities.myTasks.queryKey(),
+ ];
+
+ /** Where a record's name and logo are rendered other than on itself. */
+ const listKeys = () => [
+ trpc.companies.list.queryKey(),
+ trpc.contacts.list.queryKey(),
+ trpc.deals.list.queryKey(),
+ // The ⌘K switcher searches names and domains, so a rename it cannot see
+ // is a record the rep cannot find.
+ trpc.search.quick.queryKey(),
+ ];
+
+ return {
+ company: (id, options) =>
+ run(
+ [
+ id
+ ? trpc.companies.byId.queryKey({ id })
+ : trpc.companies.byId.queryKey(),
+ ],
+ [
+ ...listKeys(),
+ // A company's name and logo ride along on every contact and deal.
+ trpc.contacts.byId.queryKey(),
+ trpc.deals.byId.queryKey(),
+ trpc.dashboard.summary.queryKey(),
+ ],
+ options,
+ ),
+
+ contact: (id, options) =>
+ run(
+ [
+ id
+ ? trpc.contacts.byId.queryKey({ id })
+ : trpc.contacts.byId.queryKey(),
+ ],
+ [
+ ...listKeys(),
+ // Contact count and primary contact live on the company; a contact
+ // can also be on a deal. Moving someone between companies changes
+ // both, so the whole path is invalidated rather than one id.
+ trpc.companies.byId.queryKey(),
+ trpc.deals.byId.queryKey(),
+ ],
+ options,
+ ),
+
+ deal: (id, options) =>
+ run(
+ [id ? trpc.deals.byId.queryKey({ id }) : trpc.deals.byId.queryKey()],
+ [
+ ...listKeys(),
+ // Open deal count, open value and last activity all sit on the
+ // company.
+ trpc.companies.byId.queryKey(),
+ // Setting a stage writes a STAGE_CHANGE activity onto the deal's and
+ // the company's timeline.
+ ...activityKeys(),
+ // Pipeline, closed-won, win rate, cycle time, the leaderboard — the
+ // entire overview is a function of the deals table.
+ trpc.dashboard.summary.queryKey(),
+ ],
+ options,
+ ),
+
+ activity: (options) =>
+ run(
+ activityKeys(),
+ [
+ // "Last activity" columns move whenever anything is logged, and the
+ // record's own page shows the entry.
+ ...listKeys(),
+ trpc.companies.byId.queryKey(),
+ trpc.contacts.byId.queryKey(),
+ trpc.deals.byId.queryKey(),
+ trpc.dashboard.summary.queryKey(),
+ ],
+ options,
+ ),
+
+ everything: () => queryClient.invalidateQueries(),
+ };
+}
diff --git a/apps/app/lib/trpc/client.tsx b/apps/app/lib/trpc/client.tsx
index 7b6ca290..b3da5249 100644
--- a/apps/app/lib/trpc/client.tsx
+++ b/apps/app/lib/trpc/client.tsx
@@ -15,7 +15,7 @@ import { getQueryClient } from "./query-client";
const { TRPCProvider: ContextProvider, useTRPC: useTRPCContext } =
createTRPCContext<AppRouter>();
-export const TRPCProvider: FC<{
+const TRPCProvider: FC<{
children: ReactNode;
queryClient: QueryClient;
trpcClient: TRPCClient<AppRouter>;
diff --git a/apps/app/lib/trpc/types.ts b/apps/app/lib/trpc/types.ts
index 05e61a4d..1a5c17fd 100644
--- a/apps/app/lib/trpc/types.ts
+++ b/apps/app/lib/trpc/types.ts
@@ -1,4 +1,4 @@
-import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
+import type { inferRouterOutputs } from "@trpc/server";
import type { AppRouter } from "api/app-router";
/**
@@ -7,5 +7,4 @@ import type { AppRouter } from "api/app-router";
* Prefer these over hand-written row types: `RouterOutputs["companies"]["list"]`
* changes the moment the service's `select` does, which is the point.
*/
-export type RouterInputs = inferRouterInputs<AppRouter>;
export type RouterOutputs = inferRouterOutputs<AppRouter>;
diff --git a/apps/app/package.json b/apps/app/package.json
index ed206050..12c8c3ed 100644
--- a/apps/app/package.json
+++ b/apps/app/package.json
@@ -25,17 +25,14 @@
"nuqs": "^2.8.9",
"react": "19.2.4",
"react-dom": "19.2.4",
- "sonner": "^2.0.7",
- "zod": "^4.4.3"
+ "sonner": "^2.0.7"
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
- "@tailwindcss/postcss": "^4",
"@tanstack/react-query-devtools": "^5.101.2",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
- "tailwindcss": "^4",
"typescript": "^5"
},
"ignoreScripts": [
diff --git a/bun.lock b/bun.lock
index 791b0a5d..748643bd 100644
--- a/bun.lock
+++ b/bun.lock
@@ -37,8 +37,6 @@
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
- "@nestjs/cli": "^11.0.0",
- "@nestjs/schematics": "^11.0.0",
"@nestjs/testing": "^11.0.1",
"@types/bun": "^1.3.14",
"@types/express": "^5.0.0",
@@ -69,16 +67,13 @@
"react": "19.2.4",
"react-dom": "19.2.4",
"sonner": "^2.0.7",
- "zod": "^4.4.3",
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
- "@tailwindcss/postcss": "^4",
"@tanstack/react-query-devtools": "^5.101.2",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
- "tailwindcss": "^4",
"typescript": "^5",
},
},
@@ -110,12 +105,10 @@
"dependencies": {
"@prisma/adapter-pg": "^7.9.1",
"@prisma/client": "^7.9.1",
- "pg": "^8.22.0",
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
"@types/node": "^24.10.1",
- "@types/pg": "^8.20.0",
"dotenv": "^17.2.4",
"prisma": "^7.9.1",
"typescript": "5.9.2",
@@ -130,19 +123,13 @@
"version": "0.0.0",
"dependencies": {
"@carbon/icons-react": "^11.82.0",
- "@shadcn/react": "^0.2.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
- "embla-carousel-react": "^8.6.0",
- "input-otp": "^1.4.2",
"lucide-react": "^1.28.0",
"next-themes": "^0.4.6",
"nuqs": "^2.8.9",
"radix-ui": "^1.6.0",
- "react-day-picker": "^10.0.1",
- "react-hook-form": "^7.80.0",
- "react-resizable-panels": "^4.12.2",
"recharts": "3.8.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.6.0",
@@ -173,12 +160,6 @@
"packages": {
"@alloc/quick-lru": ["@alloc/[email protected]", "", {}, "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw=="],
- "@angular-devkit/core": ["@angular-devkit/[email protected]", "", { "dependencies": { "ajv": "8.18.0", "ajv-formats": "3.0.1", "jsonc-parser": "3.3.1", "picomatch": "4.0.4", "rxjs": "7.8.1", "source-map": "0.7.4" }, "peerDependencies": { "chokidar": "^4.0.0" }, "optionalPeers": ["chokidar"] }, "sha512-3amNzoCVSKd7ah6l6lBQL4onwwJvqvam7FMoQBILrxtW5LB5ezh8gMSPuA4zJjKjoRzf9uoWdlzqv/84I52xZA=="],
-
- "@angular-devkit/schematics": ["@angular-devkit/[email protected]", "", { "dependencies": { "@angular-devkit/core": "19.2.27", "jsonc-parser": "3.3.1", "magic-string": "0.30.17", "ora": "5.4.1", "rxjs": "7.8.1" } }, "sha512-/PZmyAlb2NGWPikRRuiWLdfHQd8Wrx6lX4HqvTcaDhlU43M3T0ud4PH2T3QDp7BzHYY92xtD8iPxX2asg67G1A=="],
-
- "@angular-devkit/schematics-cli": ["@angular-devkit/[email protected]", "", { "dependencies": { "@angular-devkit/core": "19.2.27", "@angular-devkit/schematics": "19.2.27", "@inquirer/prompts": "7.3.2", "ansi-colors": "4.1.3", "symbol-observable": "4.0.0", "yargs-parser": "21.1.1" }, "bin": { "schematics": "bin/schematics.js" } }, "sha512-wHYH6SVXVykhLzovUHtYor3Nl4SpIiITi7r9DQDaKYUD4hpRBx25W6N9eGuakT9Vd5tV/x6wmvQFWQZQwFB7eA=="],
-
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="],
"@babel/compat-data": ["@babel/[email protected]", "", {}, "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg=="],
@@ -303,8 +284,6 @@
"@clack/prompts": ["@clack/[email protected]", "", { "dependencies": { "@clack/core": "0.5.0", "picocolors": "^1.0.0", "sisteransi": "^1.0.5" } }, "sha512-pMN5FcrEw9hUkZA4f+zLlzivQSeQf5dRGJjSUbvVYDLvpKCdQx5OaknvKzgbtXOizhP+SJJJjqEbOe55uKKfAw=="],
- "@colors/colors": ["@colors/[email protected]", "", {}, "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="],
-
"@crm/auth": ["@crm/auth@workspace:packages/auth"],
"@crm/db": ["@crm/db@workspace:packages/db"],
@@ -313,8 +292,6 @@
"@crm/ui": ["@crm/ui@workspace:packages/ui"],
- "@date-fns/tz": ["@date-fns/[email protected]", "", {}, "sha512-lwYN/vDPeNRULcepoE/LO2Pgx+7/RV+S9ARfbc9lr2DtGkOD7pAiruHvbR1RX3Qyf6ja47EWJDMsNK5vK08DJg=="],
-
"@dotenvx/dotenvx": ["@dotenvx/[email protected]", "", { "dependencies": { "@dotenvx/primitives": "^0.8.0", "commander": "^11.1.0", "conf": "^10.2.0", "dotenv": "^17.2.1", "enquirer": "^2.4.1", "env-paths": "^2.2.1", "execa": "^5.1.1", "fdir": "^6.2.0", "ignore": "^5.3.0", "object-treeify": "1.1.33", "open": "^8.4.2", "picomatch": "^4.0.4", "systeminformation": "^5.22.11", "undici": "^7.11.0", "which": "^4.0.0", "yocto-spinner": "^1.1.0" }, "bin": { "dotenvx": "src/cli/dotenvx.js" } }, "sha512-/BITOC9dmS/edY2zQwZNicQ059O6RKabtQfyEafV0nGtfYRNHYy1DIPiYVcov40+tob9hfmBnbR963dS+EQ1DQ=="],
"@dotenvx/primitives": ["@dotenvx/[email protected]", "", {}, "sha512-VYJy0uhFm9zTJ1TxBaW/pA8bjbOM/OttaNMwZ1RHG4JKyRG7DhSdiqD1ipQoAyoD22olUtxbP78W9xY3Wd11bg=="],
@@ -389,46 +366,12 @@
"@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="],
- "@inquirer/ansi": ["@inquirer/[email protected]", "", {}, "sha512-S8qNSZiYzFd0wAcyG5AXCvUHC5Sr7xpZ9wZ2py9XR88jUz8wooStVx5M6dRzczbBWjic9NP7+rY0Xi7qqK/aMQ=="],
-
- "@inquirer/checkbox": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", "@inquirer/figures": "^1.0.15", "@inquirer/type": "^3.0.10", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-VXukHf0RR1doGe6Sm4F0Em7SWYLTHSsbGfJdS9Ja2bX5/D5uwVOEjr07cncLROdBvmnvCATYEWlHqYmXv2IlQA=="],
-
- "@inquirer/confirm": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-KR8edRkIsUayMXV+o3Gv+q4jlhENF9nMYUZs9PA2HzrXeHI8M5uDag70U7RJn9yyiMZSbtF5/UexBtAVtZGSbQ=="],
-
- "@inquirer/core": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/figures": "^1.0.15", "@inquirer/type": "^3.0.10", "cli-width": "^4.1.0", "mute-stream": "^2.0.0", "signal-exit": "^4.1.0", "wrap-ansi": "^6.2.0", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-43RTuEbfP8MbKzedNqBrlhhNKVwoK//vUFNW3Q3vZ88BLcrs4kYpGg+B2mm5p2K/HfygoCxuKwJJiv8PbGmE0A=="],
-
- "@inquirer/editor": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/external-editor": "^1.0.3", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-aLSROkEwirotxZ1pBaP8tugXRFCxW94gwrQLxXfrZsKkfjOYC1aRvAZuhpJOb5cu4IBTJdsCigUlf2iCOu4ZDQ=="],
-
- "@inquirer/expand": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-nRzdOyFYnpeYTTR2qFwEVmIWypzdAx/sIkCMeTNTcflFOovfqUk+HcFhQQVBftAh9gmGrpFj6QcGEqrDMDOiew=="],
-
- "@inquirer/external-editor": ["@inquirer/[email protected]", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="],
-
- "@inquirer/figures": ["@inquirer/[email protected]", "", {}, "sha512-t2IEY+unGHOzAaVM5Xx6DEWKeXlDDcNPeDyUpsRc6CUhBfU3VQOEl+Vssh7VNp1dR8MdUJBWhuObjXCsVpjN5g=="],
-
- "@inquirer/input": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-kN0pAM4yPrLjJ1XJBjDxyfDduXOuQHrBB8aLDMueuwUGn+vNpF7Gq7TvyVxx8u4SHlFFj4trmj+a2cbpG4Jn1g=="],
-
- "@inquirer/number": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-5Smv0OK7K0KUzUfYUXDXQc9jrf8OHo4ktlEayFlelCjwMXz0299Y8OrI+lj7i4gCBY15UObk76q0QtxjzFcFcg=="],
-
- "@inquirer/password": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-zREJHjhT5vJBMZX/IUbyI9zVtVfOLiTO66MrF/3GFZYZ7T4YILW5MSkEYHceSii/KtRk+4i3RE7E1CUXA2jHcA=="],
-
- "@inquirer/prompts": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/checkbox": "^4.3.2", "@inquirer/confirm": "^5.1.21", "@inquirer/editor": "^4.2.23", "@inquirer/expand": "^4.0.23", "@inquirer/input": "^4.3.1", "@inquirer/number": "^3.0.23", "@inquirer/password": "^4.0.23", "@inquirer/rawlist": "^4.1.11", "@inquirer/search": "^3.2.2", "@inquirer/select": "^4.4.2" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-Dx/y9bCQcXLI5ooQ5KyvA4FTgeo2jYj/7plWfV5Ak5wDPKQZgudKez2ixyfz7tKXzcJciTxqLeK7R9HItwiByg=="],
-
- "@inquirer/rawlist": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/type": "^3.0.10", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-+LLQB8XGr3I5LZN/GuAHo+GpDJegQwuPARLChlMICNdwW7OwV2izlCSCxN6cqpL0sMXmbKbFcItJgdQq5EBXTw=="],
-
- "@inquirer/search": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/core": "^10.3.2", "@inquirer/figures": "^1.0.15", "@inquirer/type": "^3.0.10", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-p2bvRfENXCZdWF/U2BXvnSI9h+tuA8iNqtUKb9UWbmLYCRQxd8WkvwWvYn+3NgYaNwdUkHytJMGG4MMLucI1kA=="],
-
- "@inquirer/select": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/ansi": "^1.0.2", "@inquirer/core": "^10.3.2", "@inquirer/figures": "^1.0.15", "@inquirer/type": "^3.0.10", "yoctocolors-cjs": "^2.1.3" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-l4xMuJo55MAe+N7Qr4rX90vypFwCajSakx59qe/tMaC1aEHWLyw68wF4o0A4SLAY4E0nd+Vt+EyskeDIqu1M6w=="],
-
- "@inquirer/type": ["@inquirer/[email protected]", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-BvziSRxfz5Ov8ch0z/n3oijRSEcEsHnhggm4xFZe93DHcUCTlutlq9Ox4SVENAfcRD22UQq7T/atg9Wr3k09eA=="],
-
"@jridgewell/gen-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
"@jridgewell/remapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ=="],
"@jridgewell/resolve-uri": ["@jridgewell/[email protected]", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
- "@jridgewell/source-map": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25" } }, "sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA=="],
-
"@jridgewell/sourcemap-codec": ["@jridgewell/[email protected]", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
"@jridgewell/trace-mapping": ["@jridgewell/[email protected]", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="],
@@ -445,8 +388,6 @@
"@nestjs/cache-manager": ["@nestjs/[email protected]", "", { "peerDependencies": { "@nestjs/common": "^9.0.0 || ^10.0.0 || ^11.0.0", "@nestjs/core": "^9.0.0 || ^10.0.0 || ^11.0.0", "cache-manager": ">=6", "keyv": ">=5", "rxjs": "^7.8.1" } }, "sha512-HMtiOfHz75NZX7mJn1VnZGLSachVI04TnUc5wvEogIaKwk5BDQHgtP5htxreizjv7oxKalJbuTyxtiF6bE+bgQ=="],
- "@nestjs/cli": ["@nestjs/[email protected]", "", { "dependencies": { "@angular-devkit/core": "19.2.27", "@angular-devkit/schematics": "19.2.27", "@angular-devkit/schematics-cli": "19.2.27", "@inquirer/prompts": "7.10.1", "@nestjs/schematics": "^11.0.1", "ansis": "4.2.0", "chokidar": "4.0.3", "cli-table3": "0.6.5", "commander": "4.1.1", "fork-ts-checker-webpack-plugin": "9.1.0", "glob": "13.0.6", "node-emoji": "1.11.0", "ora": "5.4.1", "tsconfig-paths": "4.2.0", "tsconfig-paths-webpack-plugin": "4.2.0", "typescript": "5.9.3", "webpack": "5.106.2", "webpack-node-externals": "3.0.0" }, "peerDependencies": { "@swc/cli": "^0.1.62 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0", "@swc/core": "^1.3.62" }, "optionalPeers": ["@swc/cli", "@swc/core"], "bin": { "nest": "bin/nest.js" } }, "sha512-aIHxQLSYtXShifA3zwWIeznEsZnNa3Iz2QRykFj+sl9IcbERBHr5nH87FRgywM+He3NxoF5WazHfR8FsmVeWxw=="],
-
"@nestjs/common": ["@nestjs/[email protected]", "", { "dependencies": { "file-type": "21.3.4", "iterare": "1.2.1", "load-esm": "1.0.3", "tslib": "2.8.1", "uid": "2.0.2" }, "peerDependencies": { "class-transformer": ">=0.4.1", "class-validator": ">=0.13.2", "reflect-metadata": "^0.1.12 || ^0.2.0", "rxjs": "^7.1.0" }, "optionalPeers": ["class-transformer", "class-validator"] }, "sha512-bRImsxibie+AM7xjdwcrm/gr5YeacI65kSBNzTufa1Ib5iwziaY/lqMtRh9THq6pbV4e1HP9aI2ZxGUumnmaoQ=="],
"@nestjs/config": ["@nestjs/[email protected]", "", { "dependencies": { "dotenv": "17.4.1", "dotenv-expand": "12.0.3", "lodash": "4.18.1" }, "peerDependencies": { "@nestjs/common": "^10.0.0 || ^11.0.0", "rxjs": "^7.1.0" } }, "sha512-CJPjNitr0bAufSEnRe2N+JbnVmMmDoo6hvKCPzXgZoGwJSmp/dZPk9f/RMbuD/+Q1ZJPjwsRpq0vxna++Knwow=="],
@@ -455,8 +396,6 @@
"@nestjs/platform-express": ["@nestjs/[email protected]", "", { "dependencies": { "cors": "2.8.6", "express": "5.2.1", "multer": "2.2.0", "path-to-regexp": "8.4.2", "tslib": "2.8.1" }, "peerDependencies": { "@nestjs/common": "^11.0.0", "@nestjs/core": "^11.0.0" } }, "sha512-hU+9Sz4m+onHrR5AmelI59QKmY/Re546bPnygnpqqeQdHDiJpBgjWbL4t6Jr73CBpS60cpyng7WzjgphNB9iwA=="],
- "@nestjs/schematics": ["@nestjs/[email protected]", "", { "dependencies": { "@angular-devkit/core": "19.2.24", "@angular-devkit/schematics": "19.2.24", "comment-json": "5.0.0", "jsonc-parser": "3.3.1", "pluralize": "8.0.0" }, "peerDependencies": { "prettier": "^3.0.0", "typescript": ">=4.8.2" }, "optionalPeers": ["prettier"] }, "sha512-lVxGZ46tcdItFMoXr6vyKWlnOsm1SZm/GUqAEDvy2RL4Q4O+3bkziAhrO7Y8JLssFUUvNFEGqAizI52WAxhjDw=="],
-
"@nestjs/testing": ["@nestjs/[email protected]", "", { "dependencies": { "tslib": "2.8.1" }, "peerDependencies": { "@nestjs/common": "^11.0.0", "@nestjs/core": "^11.0.0", "@nestjs/microservices": "^11.0.0", "@nestjs/platform-express": "^11.0.0" }, "optionalPeers": ["@nestjs/microservices", "@nestjs/platform-express"] }, "sha512-B+VgRxeLaH7jkOMgAyUP3N3rpFlisQ7JRxixRbgHvG6a0VgKbbkNSofKExexCgKmQQak80undb3+2kE1lUBmRQ=="],
"@next/env": ["@next/[email protected]", "", {}, "sha512-d0Z5Bc13Fa4nR8pFAKx2jay2yhJM16vlfHbTzYnUQAxlNb6B6lmn4hjt69lYNt4kRtyYP6gEM49lPRHNbIyneg=="],
@@ -645,8 +584,6 @@
"@sec-ant/readable-stream": ["@sec-ant/[email protected]", "", {}, "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg=="],
- "@shadcn/react": ["@shadcn/[email protected]", "", { "peerDependencies": { "@types/react": ">=19", "react": ">=19" }, "optionalPeers": ["@types/react", "react"] }, "sha512-5krgi3dRMKb5jH6a+qPzVJUy/54s0kKE4Rw4LjDfLqOdVQTWKUgxWf1kW8r912I0jX/Lzxqc+pgjkjWxUIK5BQ=="],
-
"@sindresorhus/merge-streams": ["@sindresorhus/[email protected]", "", {}, "sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ=="],
"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
@@ -753,12 +690,6 @@
"@types/d3-timer": ["@types/[email protected]", "", {}, "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw=="],
- "@types/eslint": ["@types/[email protected]", "", { "dependencies": { "@types/estree": "*", "@types/json-schema": "*" } }, "sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag=="],
-
- "@types/eslint-scope": ["@types/[email protected]", "", { "dependencies": { "@types/eslint": "*", "@types/estree": "*" } }, "sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg=="],
-
- "@types/estree": ["@types/[email protected]", "", {}, "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg=="],
-
"@types/express": ["@types/[email protected]", "", { "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^5.0.0", "@types/serve-static": "^2" } }, "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA=="],
"@types/express-serve-static-core": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*", "@types/qs": "*", "@types/range-parser": "*", "@types/send": "*" } }, "sha512-d3KvEXBSo/lOAMc2u6fkyDHBvetBHeqD7wm/AcXfLpSOQwlmG9D/aQ0SFswVjv05p7ullQS7Mjohj6/VdbZuTg=="],
@@ -767,8 +698,6 @@
"@types/http-errors": ["@types/[email protected]", "", {}, "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg=="],
- "@types/json-schema": ["@types/[email protected]", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
-
"@types/lodash": ["@types/[email protected]", "", {}, "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ=="],
"@types/methods": ["@types/[email protected]", "", {}, "sha512-ymXWVrDiCxTBE3+RIrrP533E70eA+9qu7zdWoHuOmGujkYtzf4HQF96b8nwHLqhuf4ykX61IGRIB38CC6/sImQ=="],
@@ -817,60 +746,18 @@
"@visx/vendor": ["@visx/[email protected]", "", { "dependencies": { "@types/d3-array": "3.0.3", "@types/d3-color": "3.1.0", "@types/d3-delaunay": "6.0.1", "@types/d3-format": "3.0.1", "@types/d3-geo": "3.1.0", "@types/d3-interpolate": "3.0.1", "@types/d3-path": "3.1.1", "@types/d3-scale": "4.0.2", "@types/d3-shape": "3.1.7", "@types/d3-time": "3.0.0", "@types/d3-time-format": "2.1.0", "d3-array": "3.2.1", "d3-color": "3.1.0", "d3-delaunay": "6.0.2", "d3-format": "3.1.0", "d3-geo": "3.1.0", "d3-interpolate": "3.0.1", "d3-path": "3.1.0", "d3-scale": "4.0.2", "d3-shape": "3.2.0", "d3-time": "3.1.0", "d3-time-format": "4.1.0", "internmap": "2.0.3" } }, "sha512-6I+MuqXBcv9jnlcVowHoHKSdk9gXTWkHLKyqBwRWg7LY6A3Ei8SHfubpqGV5rBUSppxMq2RszPJUS6w+H0YgmQ=="],
- "@webassemblyjs/ast": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/helper-numbers": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2" } }, "sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ=="],
-
- "@webassemblyjs/floating-point-hex-parser": ["@webassemblyjs/[email protected]", "", {}, "sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA=="],
-
- "@webassemblyjs/helper-api-error": ["@webassemblyjs/[email protected]", "", {}, "sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ=="],
-
- "@webassemblyjs/helper-buffer": ["@webassemblyjs/[email protected]", "", {}, "sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA=="],
-
- "@webassemblyjs/helper-numbers": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/floating-point-hex-parser": "1.13.2", "@webassemblyjs/helper-api-error": "1.13.2", "@xtuc/long": "4.2.2" } }, "sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA=="],
-
- "@webassemblyjs/helper-wasm-bytecode": ["@webassemblyjs/[email protected]", "", {}, "sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA=="],
-
- "@webassemblyjs/helper-wasm-section": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/wasm-gen": "1.14.1" } }, "sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw=="],
-
- "@webassemblyjs/ieee754": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@xtuc/ieee754": "^1.2.0" } }, "sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw=="],
-
- "@webassemblyjs/leb128": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@xtuc/long": "4.2.2" } }, "sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw=="],
-
- "@webassemblyjs/utf8": ["@webassemblyjs/[email protected]", "", {}, "sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ=="],
-
- "@webassemblyjs/wasm-edit": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/helper-wasm-section": "1.14.1", "@webassemblyjs/wasm-gen": "1.14.1", "@webassemblyjs/wasm-opt": "1.14.1", "@webassemblyjs/wasm-parser": "1.14.1", "@webassemblyjs/wast-printer": "1.14.1" } }, "sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ=="],
-
- "@webassemblyjs/wasm-gen": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/ieee754": "1.13.2", "@webassemblyjs/leb128": "1.13.2", "@webassemblyjs/utf8": "1.13.2" } }, "sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg=="],
-
- "@webassemblyjs/wasm-opt": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-buffer": "1.14.1", "@webassemblyjs/wasm-gen": "1.14.1", "@webassemblyjs/wasm-parser": "1.14.1" } }, "sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw=="],
-
- "@webassemblyjs/wasm-parser": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@webassemblyjs/helper-api-error": "1.13.2", "@webassemblyjs/helper-wasm-bytecode": "1.13.2", "@webassemblyjs/ieee754": "1.13.2", "@webassemblyjs/leb128": "1.13.2", "@webassemblyjs/utf8": "1.13.2" } }, "sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ=="],
-
- "@webassemblyjs/wast-printer": ["@webassemblyjs/[email protected]", "", { "dependencies": { "@webassemblyjs/ast": "1.14.1", "@xtuc/long": "4.2.2" } }, "sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw=="],
-
- "@xtuc/ieee754": ["@xtuc/[email protected]", "", {}, "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA=="],
-
- "@xtuc/long": ["@xtuc/[email protected]", "", {}, "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="],
-
"accepts": ["[email protected]", "", { "dependencies": { "mime-types": "^3.0.0", "negotiator": "^1.0.0" } }, "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng=="],
- "acorn": ["[email protected]", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ=="],
-
- "acorn-import-phases": ["[email protected]", "", { "peerDependencies": { "acorn": "^8.14.0" } }, "sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ=="],
-
"ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="],
"ajv-formats": ["[email protected]", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ=="],
- "ajv-keywords": ["[email protected]", "", { "peerDependencies": { "ajv": "^6.9.1" } }, "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ=="],
-
"ansi-colors": ["[email protected]", "", {}, "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw=="],
"ansi-regex": ["[email protected]", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
"ansi-styles": ["[email protected]", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
- "ansis": ["[email protected]", "", {}, "sha512-HqZ5rWlFjGiV0tDm3UxxgNRqsOTniqoKZu0pIAfh7TZQMGuZK+hH0drySty0si0QXj1ieop4+SkSfPZBPPkHig=="],
-
"api": ["api@workspace:apps/api"],
"app": ["app@workspace:apps/app"],
@@ -881,8 +768,6 @@
"aria-hidden": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="],
- "array-timsort": ["[email protected]", "", {}, "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ=="],
-
"asap": ["[email protected]", "", {}, "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="],
"ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="],
@@ -893,7 +778,7 @@
"aws-ssl-profiles": ["[email protected]", "", {}, "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g=="],
- "balanced-match": ["[email protected]", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
+ "balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"base64-js": ["[email protected]", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
@@ -913,7 +798,7 @@
"body-parser": ["[email protected]", "", { "dependencies": { "bytes": "^3.1.2", "content-type": "^2.0.0", "debug": "^4.4.3", "http-errors": "^2.0.1", "iconv-lite": "^0.7.2", "on-finished": "^2.4.1", "qs": "^6.15.2", "raw-body": "^3.0.2", "type-is": "^2.1.0" } }, "sha512-2cGmJupaNgg+QUwVLAucDuWuoMZ6EX9iHDRswZ5lsNYEmwPaRknMPCLZz07yTzVq/83p4o/wzbDZbBrTvGGTIw=="],
- "brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw=="],
+ "brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="],
"braces": ["[email protected]", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
@@ -945,16 +830,12 @@
"chalk": ["[email protected]", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
- "chardet": ["[email protected]", "", {}, "sha512-rddelWYNPRrXq6PtNEN2S3f6t9ILzvqaN5pVgi4kqt9jHQaXIial9PznB5iSPVlQSLNaaH22ItWz3EJtQ10+OA=="],
-
"chevrotain": ["[email protected]", "", { "dependencies": { "@chevrotain/cst-dts-gen": "10.5.0", "@chevrotain/gast": "10.5.0", "@chevrotain/types": "10.5.0", "@chevrotain/utils": "10.5.0", "lodash": "4.17.21", "regexp-to-ast": "0.5.0" } }, "sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A=="],
- "chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
+ "chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="],
"chownr": ["[email protected]", "", {}, "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="],
- "chrome-trace-event": ["[email protected]", "", {}, "sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ=="],
-
"class-transformer": ["[email protected]", "", {}, "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw=="],
"class-validator": ["[email protected]", "", { "dependencies": { "@types/validator": "^13.15.3", "libphonenumber-js": "^1.11.1", "validator": "^13.15.22" } }, "sha512-LqoS80HBBSCVhz/3KloUly0ovokxpdOLR++Al3J3+dHXWt9sTKlKd4eYtoxhxyUjoe5+UcIM+5k9MIxyBWnRTw=="],
@@ -967,16 +848,10 @@
"cli-spinners": ["[email protected]", "", {}, "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg=="],
- "cli-table3": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0" }, "optionalDependencies": { "@colors/colors": "1.5.0" } }, "sha512-+W/5efTR7y5HRD7gACw9yQjqMVvEMLBHmboM/kPWam+H+Hmyrgjh6YncVKK122YZkXrLudzTuAukUw9FnMf7IQ=="],
-
- "cli-width": ["[email protected]", "", {}, "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ=="],
-
"client-only": ["[email protected]", "", {}, "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA=="],
"cliui": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
- "clone": ["[email protected]", "", {}, "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg=="],
-
"clsx": ["[email protected]", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="],
"cluster-key-slot": ["[email protected]", "", {}, "sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA=="],
@@ -993,12 +868,8 @@
"commander": ["[email protected]", "", {}, "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA=="],
- "comment-json": ["[email protected]", "", { "dependencies": { "array-timsort": "^1.0.3", "esprima": "^4.0.1" } }, "sha512-uiqLcOiVDJtBP8WGkZHEP+FZIhTzP1dxvn59EfoYUi9gqupjrBWVQkO2atDrbnKPwLeotFYDsuNb26uBMqB+hw=="],
-
"component-emitter": ["[email protected]", "", {}, "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ=="],
- "concat-map": ["[email protected]", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
-
"concat-stream": ["[email protected]", "", { "dependencies": { "buffer-from": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.0.2", "typedarray": "^0.0.6" } }, "sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A=="],
"concurrently": ["[email protected]", "", { "dependencies": { "chalk": "4.1.2", "rxjs": "7.8.2", "shell-quote": "1.9.0", "supports-color": "8.1.1", "tree-kill": "1.2.2", "yargs": "17.7.2" }, "bin": { "conc": "dist/bin/concurrently.js", "concurrently": "dist/bin/concurrently.js" } }, "sha512-TZ0CEhyzvFjgtAvHTusDMgj7wNdihCh7LLLrzdUOXIhdlnL2JBBGA9eJxR24rtqgmdjh3OA3hrN1rCHj6HM8qA=="],
@@ -1057,8 +928,6 @@
"d3-timer": ["[email protected]", "", {}, "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA=="],
- "date-fns": ["[email protected]", "", {}, "sha512-+1UMbeh68lH1SegH83CGWwpb6OHHbpSgr3+s5Eww5M4CAgswBpoWS0AjTOfEJ33HiYKz1hdj/KTFprzXHmq/6w=="],
-
"debounce-fn": ["[email protected]", "", { "dependencies": { "mimic-fn": "^3.0.0" } }, "sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ=="],
"debug": ["[email protected]", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
@@ -1079,8 +948,6 @@
"default-browser-id": ["[email protected]", "", {}, "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q=="],
- "defaults": ["[email protected]", "", { "dependencies": { "clone": "^1.0.2" } }, "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A=="],
-
"define-lazy-prop": ["[email protected]", "", {}, "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg=="],
"defu": ["[email protected]", "", {}, "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ=="],
@@ -1121,12 +988,6 @@
"elkjs": ["[email protected]", "", {}, "sha512-zxxR9k+rx5ktMwT/FwyLdPCrq7xN6e4VGGHH8hA01vVYKjTFik7nHOxBnAYtrgYUB1RpAiLvA1/U2YraWxyKKg=="],
- "embla-carousel": ["[email protected]", "", {}, "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA=="],
-
- "embla-carousel-react": ["[email protected]", "", { "dependencies": { "embla-carousel": "8.6.0", "embla-carousel-reactive-utils": "8.6.0" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.1 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-0/PjqU7geVmo6F734pmPqpyHqiM99olvyecY7zdweCw+6tKEXnrE90pBiBbMMU8s5tICemzpQ3hi5EpxzGW+JA=="],
-
- "embla-carousel-reactive-utils": ["[email protected]", "", { "peerDependencies": { "embla-carousel": "8.6.0" } }, "sha512-fMVUDUEx0/uIEDM0Mz3dHznDhfX+znCCDCeIophYb1QGVM7YThSWX+wz11zlYwWFOr74b4QLGg0hrGPJeG2s4A=="],
-
"emoji-regex": ["[email protected]", "", {}, "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A=="],
"empathic": ["[email protected]", "", {}, "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA=="],
@@ -1147,8 +1008,6 @@
"es-errors": ["[email protected]", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
- "es-module-lexer": ["[email protected]", "", {}, "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA=="],
-
"es-object-atoms": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw=="],
"es-set-tostringtag": ["[email protected]", "", { "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", "has-tostringtag": "^1.0.2", "hasown": "^2.0.2" } }, "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA=="],
@@ -1159,20 +1018,12 @@
"escape-html": ["[email protected]", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
- "eslint-scope": ["[email protected]", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" } }, "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw=="],
-
"esprima": ["[email protected]", "", { "bin": { "esparse": "./bin/esparse.js", "esvalidate": "./bin/esvalidate.js" } }, "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A=="],
- "esrecurse": ["[email protected]", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],
-
- "estraverse": ["[email protected]", "", {}, "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw=="],
-
"etag": ["[email protected]", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
"eventemitter3": ["[email protected]", "", {}, "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw=="],
- "events": ["[email protected]", "", {}, "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q=="],
-
"eventsource": ["[email protected]", "", { "dependencies": { "eventsource-parser": "^3.0.1" } }, "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA=="],
"eventsource-parser": ["[email protected]", "", {}, "sha512-kJezFj9YFAMLeORyi7aCLxLbD5/qWMQnoMVlVPyHIll7lgRJCc3JVln9Vgl9nwQi0YkMnhdGTMNn7CkRRAptMg=="],
@@ -1195,8 +1046,6 @@
"fast-glob": ["[email protected]", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],
- "fast-json-stable-stringify": ["[email protected]", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
-
"fast-querystring": ["[email protected]", "", { "dependencies": { "fast-decode-uri-component": "^1.0.1" } }, "sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg=="],
"fast-safe-stringify": ["[email protected]", "", {}, "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="],
@@ -1223,8 +1072,6 @@
"foreground-child": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" } }, "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw=="],
- "fork-ts-checker-webpack-plugin": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.16.7", "chalk": "^4.1.2", "chokidar": "^4.0.1", "cosmiconfig": "^8.2.0", "deepmerge": "^4.2.2", "fs-extra": "^10.0.0", "memfs": "^3.4.1", "minimatch": "^3.0.4", "node-abort-controller": "^3.0.1", "schema-utils": "^3.1.1", "semver": "^7.3.5", "tapable": "^2.2.1" }, "peerDependencies": { "typescript": ">3.6.0", "webpack": "^5.11.0" } }, "sha512-mpafl89VFPJmhnJ1ssH+8wmM2b50n+Rew5x42NeI2U78aRWgtkEtGmctp7iT16UjquJTjorEmIfESj3DxdW84Q=="],
-
"form-data": ["[email protected]", "", { "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", "hasown": "^2.0.4", "mime-types": "^2.1.35" } }, "sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ=="],
"formidable": ["[email protected]", "", { "dependencies": { "@paralleldrive/cuid2": "^2.2.2", "dezalgo": "^1.0.4", "once": "^1.4.0" } }, "sha512-YikH+7CUTOtP44ZTnUhR7Ic2UASBPOqmaRkRKxRbywPTe5VxF7RRCck4af9wutiZ/QKM5nME9Bie2fFaPz5Gug=="],
@@ -1237,8 +1084,6 @@
"fs-extra": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-EQsFzMUJkCKGr1ePqlYADkIUmHW1s3ZXr5Yqy6wbGrfUCphpl2maM/kyOIRA2HpP3AaFQTZXD4ldjek+nccddA=="],
- "fs-monkey": ["[email protected]", "", {}, "sha512-QMUezzXWII9EV5aTFXW1UBVUO77wYPpjqIF8/AviUCThNeSYZykpoTixUeaNNBwmCev0AMDWMAni+f8Hxb1IFw=="],
-
"function-bind": ["[email protected]", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"fuzzysort": ["[email protected]", "", {}, "sha512-sR9BNCjBg6LNgwvxlBd0sBABvQitkLzoVY9MYYROQVX/FvfJ4Mai9LsGhDgd8qYdds0bY77VzYd5iuB+v5rwQQ=="],
@@ -1267,12 +1112,8 @@
"github-from-package": ["[email protected]", "", {}, "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="],
- "glob": ["[email protected]", "", { "dependencies": { "minimatch": "^10.2.2", "minipass": "^7.1.3", "path-scurry": "^2.0.2" } }, "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw=="],
-
"glob-parent": ["[email protected]", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
- "glob-to-regexp": ["[email protected]", "", {}, "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw=="],
-
"gopd": ["[email protected]", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
"graceful-fs": ["[email protected]", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="],
@@ -1315,8 +1156,6 @@
"ini": ["[email protected]", "", {}, "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="],
- "input-otp": ["[email protected]", "", { "peerDependencies": { "react": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc", "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0.0 || ^19.0.0-rc" } }, "sha512-l3jWwYNvrEa6NTCt7BECfCm48GvwuZzkoeG3gBL2w4CHeOXW3eKFmf9UNYkNfYc3mxMrthMnxjIE07MT0zLBQA=="],
-
"internmap": ["[email protected]", "", {}, "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg=="],
"ip-address": ["[email protected]", "", {}, "sha512-oSK96Grm3aP6OrS263xVxbNDGVL7rzBtYdpGqlDG8iQdoenDoTs/nkki+DflYbAEE8Xl6o5YxhxlrKvI3nqKXQ=="],
@@ -1361,8 +1200,6 @@
"iterare": ["[email protected]", "", {}, "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q=="],
- "jest-worker": ["[email protected]", "", { "dependencies": { "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^8.0.0" } }, "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg=="],
-
"jiti": ["[email protected]", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="],
"jose": ["[email protected]", "", {}, "sha512-2E5L2yRp03FnwreJLJX8/r7mHiZICCf8kG7fAsTWkSQTDAcc46NIZoQLKy+EJ8sPoJlxyS4OQR5H70LjIZZlIQ=="],
@@ -1381,8 +1218,6 @@
"json5": ["[email protected]", "", { "bin": { "json5": "lib/cli.js" } }, "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg=="],
- "jsonc-parser": ["[email protected]", "", {}, "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ=="],
-
"jsonfile": ["[email protected]", "", { "dependencies": { "universalify": "^2.0.0" }, "optionalDependencies": { "graceful-fs": "^4.1.6" } }, "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q=="],
"keyv": ["[email protected]", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="],
@@ -1423,8 +1258,6 @@
"load-esm": ["[email protected]", "", {}, "sha512-v5xlu8eHD1+6r8EHTg6hfmO97LN8ugKtiXcy5e6oN72iD2r6u0RPfLl6fxM+7Wnh2ZRq15o0russMst44WauPA=="],
- "loader-runner": ["[email protected]", "", {}, "sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w=="],
-
"locate-path": ["[email protected]", "", { "dependencies": { "p-locate": "^3.0.0", "path-exists": "^3.0.0" } }, "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A=="],
"lodash": ["[email protected]", "", {}, "sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q=="],
@@ -1447,8 +1280,6 @@
"media-typer": ["[email protected]", "", {}, "sha512-yz3xRaG20c6/BOzvYoDaGtPmGscs7YivItZEEqe6GbwNfHuxu9YNmvnEkMzKldAGY4/80pRcQRZSEnhquk9XuQ=="],
- "memfs": ["[email protected]", "", { "dependencies": { "fs-monkey": "^1.0.4" } }, "sha512-EGowvkkgbMcIChjMTMkESFDbZeSh8xZ7kNSF0hAiAN4Jh6jgHCRS0Ga/+C8y6Au+oqpezRHCfPsmJ2+DwAgiwQ=="],
-
"merge-descriptors": ["[email protected]", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="],
"merge-stream": ["[email protected]", "", {}, "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w=="],
@@ -1471,20 +1302,16 @@
"mimic-response": ["[email protected]", "", {}, "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="],
- "minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="],
+ "minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
"minimist": ["[email protected]", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
- "minipass": ["[email protected]", "", {}, "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A=="],
-
"mkdirp-classic": ["[email protected]", "", {}, "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="],
"ms": ["[email protected]", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"multer": ["[email protected]", "", { "dependencies": { "append-field": "^1.0.0", "busboy": "^1.6.0", "concat-stream": "^2.0.0", "type-is": "^1.6.18" } }, "sha512-6rdyFg2kLrMh9Jee7/BMPuV9lEAd7lLW2YUpF9/YxR7njyoUwwQ0ZPh3TaIY50Sw6vlyD2HW3wGOkTS4P79xrQ=="],
- "mute-stream": ["[email protected]", "", {}, "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA=="],
-
"mysql2": ["[email protected]", "", { "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", "iconv-lite": "^0.7.0", "long": "^5.2.1", "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", "seq-queue": "^0.0.5", "sqlstring": "^2.3.2" } }, "sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg=="],
"named-placeholders": ["[email protected]", "", { "dependencies": { "lru.min": "^1.1.0" } }, "sha512-Tz09sEL2EEuv5fFowm419c1+a/jSMiBjI9gHxVLrVdbUkkNUUfjsVYs9pVZu5oCon/kmRh9TfLEObFtkVxmY0w=="],
@@ -1497,8 +1324,6 @@
"negotiator": ["[email protected]", "", {}, "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg=="],
- "neo-async": ["[email protected]", "", {}, "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw=="],
-
"nestjs-trpc": ["[email protected]", "", { "dependencies": { "lodash": "^4.17.21", "tslib": "^2.5.0" }, "peerDependencies": { "@nestjs/common": "^9.3.8 || ^10.0.0 || ^11.0.0", "@nestjs/core": "^9.3.8 || ^10.0.0 || ^11.0.0", "@trpc/server": "^11.0.0", "reflect-metadata": "^0.1.13 || ^0.2.0", "rxjs": "7.8.1", "zod": "^3.14.0 || ^4.0.0" }, "bin": { "nestjs-trpc": "bin/nestjs-trpc.js" } }, "sha512-kip+4dI6vnoe/wDDtCz9ITu9WJ80dHSnSQHJR5B0WNf5FIqB9Haz69msXwV/QI8GpHsBaU5Vs9nJC1dGJkroQw=="],
"next": ["[email protected]", "", { "dependencies": { "@next/env": "16.2.12", "@swc/helpers": "0.5.15", "baseline-browser-mapping": "^2.9.19", "caniuse-lite": "^1.0.30001579", "postcss": "8.4.31", "styled-jsx": "5.1.6" }, "optionalDependencies": { "@next/swc-darwin-arm64": "16.2.12", "@next/swc-darwin-x64": "16.2.12", "@next/swc-linux-arm64-gnu": "16.2.12", "@next/swc-linux-arm64-musl": "16.2.12", "@next/swc-linux-x64-gnu": "16.2.12", "@next/swc-linux-x64-musl": "16.2.12", "@next/swc-win32-arm64-msvc": "16.2.12", "@next/swc-win32-x64-msvc": "16.2.12", "sharp": "^0.34.5" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", "@playwright/test": "^1.51.1", "babel-plugin-react-compiler": "*", "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", "sass": "^1.3.0" }, "optionalPeers": ["@opentelemetry/api", "@playwright/test", "babel-plugin-react-compiler", "sass"], "bin": { "next": "dist/bin/next" } }, "sha512-iD59eYQWmbFcEbX7v/acG5DRym9iw1DdaPoD0WTA920naWsE25wShzJW4+UvAs8MK9EC2kBfIH6vtto1H1PHGw=="],
@@ -1507,10 +1332,6 @@
"node-abi": ["[email protected]", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-W5ZNO5KRPB5TkYmGVD9F6YqhsglXJzE6etpbmT+f6EQElhiX/UTG551cnsRGvLG3fyZEg9HwaDmNmj5nwJ4z9g=="],
- "node-abort-controller": ["[email protected]", "", {}, "sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ=="],
-
- "node-emoji": ["[email protected]", "", { "dependencies": { "lodash": "^4.17.21" } }, "sha512-wo2DpQkQp7Sjm2A0cq+sN7EHKO6Sl0ctXeBdFZrL9T9+UywORbufTcTZxom8YqpLQt/FqNMUkOpkZrJVYSKD3A=="],
-
"node-releases": ["[email protected]", "", {}, "sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ=="],
"npm-run-path": ["[email protected]", "", { "dependencies": { "path-key": "^4.0.0", "unicorn-magic": "^0.3.0" } }, "sha512-9qny7Z9DsQU8Ou39ERsPU4OZQlSTP47ShQzuKZ6PRXpYLtIFgl/DEBYEXKlvcEa+9tHVcK8CF81Y2V72qaZhWA=="],
@@ -1555,12 +1376,8 @@
"path-key": ["[email protected]", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
- "path-scurry": ["[email protected]", "", { "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" } }, "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg=="],
-
"path-to-regexp": ["[email protected]", "", {}, "sha512-qRcuIdP69NPm4qbACK+aDogI5CBDMi1jKe0ry5rSQJz8JVLsC7jV8XpiJjGRLLol3N+R5ihGYcrPLTno6pAdBA=="],
- "path-type": ["[email protected]", "", {}, "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="],
-
"pathe": ["[email protected]", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
"perfect-debounce": ["[email protected]", "", {}, "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g=="],
@@ -1591,8 +1408,6 @@
"pkg-up": ["[email protected]", "", { "dependencies": { "find-up": "^3.0.0" } }, "sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA=="],
- "pluralize": ["[email protected]", "", {}, "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA=="],
-
"postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.16", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-DTPx3RWSSnWyzLxQnlH0rJP+EW5ekl16ZU4/psbIhA0e53kJfdgaN5vKM+xP7yJtXVu+nfdVFmlgFDEKAe4Pyw=="],
"postcss-selector-parser": ["[email protected]", "", { "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" } }, "sha512-HeP7D2wyhkR+XaK6v4W8oRF62Dsz4flyuczALJp61GckGm42u1saSSJ/0auvcBqxs3jMRFEcPK34At/0JBKdOg=="],
@@ -1627,8 +1442,6 @@
"pump": ["[email protected]", "", { "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, "sha512-VS7sjc6KR7e1ukRFhQSY5LM2uBWAUPiOPa/A3mkKmiMwSmRFUITt0xuj+/lesgnCv+dPIEYlkzrcyXgquIHMcA=="],
- "punycode": ["[email protected]", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
-
"pure-rand": ["[email protected]", "", {}, "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA=="],
"qs": ["[email protected]", "", { "dependencies": { "es-define-property": "^1.0.1", "side-channel": "^1.1.1" } }, "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A=="],
@@ -1647,12 +1460,8 @@
"react": ["[email protected]", "", {}, "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw=="],
- "react-day-picker": ["[email protected]", "", { "dependencies": { "@date-fns/tz": "^1.4.1", "date-fns": "^4.1.0" }, "peerDependencies": { "@types/react": ">=16.8.0", "react": ">=16.8.0" }, "optionalPeers": ["@types/react"] }, "sha512-eNh6BlwcYInWaJtRv18mXQ06Ys/H6rdTZAnTaSdOYJuTpwP1JMCHNd1FDRadA+gbeinq+psdULN5Xnowy9mV8w=="],
-
"react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.27.0" }, "peerDependencies": { "react": "^19.2.4" } }, "sha512-AXJdLo8kgMbimY95O2aKQqsz2iWi9jMgKJhRBAxECE4IFxfcazB2LmzloIoibJI3C12IlY20+KFaLv+71bUJeQ=="],
- "react-hook-form": ["[email protected]", "", { "peerDependencies": { "react": "^16.8.0 || ^17 || ^18 || ^19" } }, "sha512-AXt8cMCmx5a7u4uvpb2uRFVrWQhllI4pV+LSykxIac/hjt44TnQkmX9BKuQi2i+LDC62esmiLpilkav+kjVf/A=="],
-
"react-is": ["[email protected]", "", {}, "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ=="],
"react-redux": ["[email protected]", "", { "dependencies": { "@types/use-sync-external-store": "^0.0.6", "use-sync-external-store": "^1.4.0" }, "peerDependencies": { "@types/react": "^18.2.25 || ^19", "react": "^18.0 || ^19", "redux": "^5.0.0" }, "optionalPeers": ["@types/react", "redux"] }, "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g=="],
@@ -1661,13 +1470,11 @@
"react-remove-scroll-bar": ["[email protected]", "", { "dependencies": { "react-style-singleton": "^2.2.2", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" }, "optionalPeers": ["@types/react"] }, "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q=="],
- "react-resizable-panels": ["[email protected]", "", { "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-NwY5LCo4WrxVvDh0xoMML6EMLPONP/8ckKcIdpnojxexoatZdjLiRqLJQjQK5CPkd4SYiB/2M5BVrjZBQtOO7Q=="],
-
"react-style-singleton": ["[email protected]", "", { "dependencies": { "get-nonce": "^1.0.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ=="],
"readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
- "readdirp": ["[email protected]", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
+ "readdirp": ["[email protected]", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="],
"recast": ["[email protected]", "", { "dependencies": { "ast-types": "^0.16.1", "esprima": "~4.0.0", "source-map": "~0.6.1", "tiny-invariant": "^1.3.3", "tslib": "^2.0.1" } }, "sha512-T98lym7kH+pnZmRaD8yDRdaNqyUbwnbEBx0MuchrzMFOEMray4AO3ZJoTUZ5r78Ao78X/OhzW0DL8GB85w/I2w=="],
@@ -1719,8 +1526,6 @@
"scheduler": ["[email protected]", "", {}, "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q=="],
- "schema-utils": ["[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.8", "ajv": "^6.12.5", "ajv-keywords": "^3.5.2" } }, "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg=="],
-
"semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA=="],
"send": ["[email protected]", "", { "dependencies": { "debug": "^4.4.3", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "etag": "^1.8.1", "fresh": "^2.0.0", "http-errors": "^2.0.1", "mime-types": "^3.0.2", "ms": "^2.1.3", "on-finished": "^2.4.1", "range-parser": "^1.2.1", "statuses": "^2.0.2" } }, "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ=="],
@@ -1765,8 +1570,6 @@
"source-map-js": ["[email protected]", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
- "source-map-support": ["[email protected]", "", { "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" } }, "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w=="],
-
"split2": ["[email protected]", "", {}, "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg=="],
"sqlstring": ["[email protected]", "", {}, "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg=="],
@@ -1803,8 +1606,6 @@
"supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q=="],
- "symbol-observable": ["[email protected]", "", {}, "sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ=="],
-
"systeminformation": ["[email protected]", "", { "os": "!aix", "bin": { "systeminformation": "lib/cli.js" } }, "sha512-DEN6ICHk3Tk0Uf/hrAHh7xlt7iL5CJFBtPZinA0H62DrGG/KPKqq/Nzj6lCXPS4Ay/sf/14zNnk9LpqKzBIc+w=="],
"tailwind-merge": ["[email protected]", "", {}, "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w=="],
@@ -1817,10 +1618,6 @@
"tar-stream": ["[email protected]", "", { "dependencies": { "bl": "^4.0.3", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", "readable-stream": "^3.1.1" } }, "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ=="],
- "terser": ["[email protected]", "", { "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, "bin": { "terser": "bin/terser" } }, "sha512-SNiDnXyHSrxVcIOtVbULzcTmniUiwcV7Nwdyj1twVubeTmbjoa8p69KKDpfkdoOavuM4/GRm1+ykI8qqnavHoA=="],
-
- "terser-webpack-plugin": ["[email protected]", "", { "dependencies": { "@jridgewell/trace-mapping": "^0.3.25", "jest-worker": "^27.4.5", "schema-utils": "^4.3.0", "terser": "^5.31.1" }, "peerDependencies": { "webpack": "^5.1.0" } }, "sha512-201R5j+sJpK8nFWwKVyNfZot8FaJbLZDq5evriVzbV1wDtSXDjRUDRfJzHpAaxFDMEhsZL1QkeqM61wgsS3KaQ=="],
-
"tiny-invariant": ["[email protected]", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="],
"to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
@@ -1835,8 +1632,6 @@
"tsconfig-paths": ["[email protected]", "", { "dependencies": { "json5": "^2.2.2", "minimist": "^1.2.6", "strip-bom": "^3.0.0" } }, "sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg=="],
- "tsconfig-paths-webpack-plugin": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.0", "enhanced-resolve": "^5.7.0", "tapable": "^2.2.1", "tsconfig-paths": "^4.1.2" } }, "sha512-zbem3rfRS8BgeNK50Zz5SIQgXzLafiHjOwUAvk/38/o1jHn/V5QAgVUcz884or7WYcPaH3N2CIfUc2u0ul7UcA=="],
-
"tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"tunnel-agent": ["[email protected]", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
@@ -1867,8 +1662,6 @@
"update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="],
- "uri-js": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
-
"use-callback-ref": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg=="],
"use-sidecar": ["[email protected]", "", { "dependencies": { "detect-node-es": "^1.1.0", "tslib": "^2.0.0" }, "peerDependencies": { "@types/react": "*", "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ=="],
@@ -1889,16 +1682,6 @@
"victory-vendor": ["[email protected]", "", { "dependencies": { "@types/d3-array": "^3.0.3", "@types/d3-ease": "^3.0.0", "@types/d3-interpolate": "^3.0.1", "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/d3-time": "^3.0.0", "@types/d3-timer": "^3.0.0", "d3-array": "^3.1.6", "d3-ease": "^3.0.1", "d3-interpolate": "^3.0.1", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", "d3-time": "^3.0.0", "d3-timer": "^3.0.1" } }, "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ=="],
- "watchpack": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.1.2" } }, "sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg=="],
-
- "wcwidth": ["[email protected]", "", { "dependencies": { "defaults": "^1.0.3" } }, "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg=="],
-
- "webpack": ["[email protected]", "", { "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", "@types/json-schema": "^7.0.15", "@webassemblyjs/ast": "^1.14.1", "@webassemblyjs/wasm-edit": "^1.14.1", "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.16.0", "acorn-import-phases": "^1.0.3", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.20.0", "es-module-lexer": "^2.0.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", "graceful-fs": "^4.2.11", "loader-runner": "^4.3.1", "mime-db": "^1.54.0", "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", "terser-webpack-plugin": "^5.3.17", "watchpack": "^2.5.1", "webpack-sources": "^3.3.4" }, "bin": { "webpack": "bin/webpack.js" } }, "sha512-wGN3qcrBQIFmQ/c0AiOAQBvrZ5lmY8vbbMv4Mxfgzqd/B6+9pXtLo73WuS1dSGXM5QYY3hZnIbvx+K1xxe6FyA=="],
-
- "webpack-node-externals": ["[email protected]", "", {}, "sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ=="],
-
- "webpack-sources": ["[email protected]", "", {}, "sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw=="],
-
"which": ["[email protected]", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="],
"wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
@@ -1921,28 +1704,12 @@
"yoctocolors": ["[email protected]", "", {}, "sha512-xYqdZFUK/VYazNl/oCDYN+3WloWQwMfZxBoiNt6qNyk+xfOdi598muWE42rNZFp1kNOiqW936q5RhUdnpqElSg=="],
- "yoctocolors-cjs": ["[email protected]", "", {}, "sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw=="],
-
"zeptomatch": ["[email protected]", "", { "dependencies": { "grammex": "^3.1.11", "graphmatch": "^1.1.0" } }, "sha512-KiGErG2J0G82LSpniV0CtIzjlJ10E04j02VOudJsPyPwNZgGnRKQy7I1R7GMyg/QswnE4l7ohSGrQbQbjXPPDA=="],
"zod": ["[email protected]", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="],
"zod-to-json-schema": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.28 || ^4" } }, "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA=="],
- "@angular-devkit/core/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="],
-
- "@angular-devkit/core/rxjs": ["[email protected]", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
-
- "@angular-devkit/core/source-map": ["[email protected]", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
-
- "@angular-devkit/schematics/magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="],
-
- "@angular-devkit/schematics/ora": ["[email protected]", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="],
-
- "@angular-devkit/schematics/rxjs": ["[email protected]", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
-
- "@angular-devkit/schematics-cli/@inquirer/prompts": ["@inquirer/[email protected]", "", { "dependencies": { "@inquirer/checkbox": "^4.1.2", "@inquirer/confirm": "^5.1.6", "@inquirer/editor": "^4.2.7", "@inquirer/expand": "^4.0.9", "@inquirer/input": "^4.1.6", "@inquirer/number": "^3.0.9", "@inquirer/password": "^4.0.9", "@inquirer/rawlist": "^4.0.9", "@inquirer/search": "^3.0.9", "@inquirer/select": "^4.0.9" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-G1ytyOoHh5BphmEBxSwALin3n1KGNYB6yImbICcRQdzXfOGbuJ9Jske/Of5Sebk339NSGGNfUshnzK8YWkTPsQ=="],
-
"@babel/core/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"@babel/helper-compilation-targets/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
@@ -1995,20 +1762,8 @@
"@dotenvx/dotenvx/yocto-spinner": ["[email protected]", "", { "dependencies": { "yoctocolors": "^2.1.1" } }, "sha512-DODGl1wJjA/s5pnJFKau9lIYHT81lnhob1i3e1TjxZRxEhWRKl74nTbWE6H5KlkViQQTo/Z29YFdxzTZAMY3ng=="],
- "@inquirer/core/wrap-ansi": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" } }, "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA=="],
-
- "@nestjs/cli/commander": ["[email protected]", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="],
-
- "@nestjs/cli/ora": ["[email protected]", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="],
-
- "@nestjs/cli/typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
-
"@nestjs/config/dotenv": ["[email protected]", "", {}, "sha512-k8DaKGP6r1G30Lx8V4+pCsLzKr8vLmV2paqEj1Y55GdAgJuIqpRp5FfajGF8KtwMxCz9qJc6wUIJnm053d/WCw=="],
- "@nestjs/schematics/@angular-devkit/core": ["@angular-devkit/[email protected]", "", { "dependencies": { "ajv": "8.18.0", "ajv-formats": "3.0.1", "jsonc-parser": "3.3.1", "picomatch": "4.0.4", "rxjs": "7.8.1", "source-map": "0.7.4" }, "peerDependencies": { "chokidar": "^4.0.0" }, "optionalPeers": ["chokidar"] }, "sha512-Kd49warf6U/EyWe5BszF/eebN3zQ3bk7tgfEljAw8q/rX95UUtriJubWvp6pgzHfzBA4jwq8f+QiNZB8eBEXPA=="],
-
- "@nestjs/schematics/@angular-devkit/schematics": ["@angular-devkit/[email protected]", "", { "dependencies": { "@angular-devkit/core": "19.2.24", "jsonc-parser": "3.3.1", "magic-string": "0.30.17", "ora": "5.4.1", "rxjs": "7.8.1" } }, "sha512-lnw+ZM1Io+cJAkReC0NPDjqObL8NtKzKIkdgEEKC8CUmkhurYhedbicN8Y8NYHgG1uLd2GozW3+/QqPRZaN+Lw=="],
-
"@paralleldrive/cuid2/@noble/hashes": ["@noble/[email protected]", "", {}, "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A=="],
"@prisma/engines/@prisma/get-platform": ["@prisma/[email protected]", "", { "dependencies": { "@prisma/debug": "7.9.1" } }, "sha512-PK8R60YZRQvYxBrGG9i7l2/rFyzy+2MuI1dKtmtrCqPH8YpiJx/MfiC7LRzX5786rZDEv7BngcjfIJW4/9ADuw=="],
@@ -2171,12 +1926,8 @@
"@tailwindcss/oxide-wasm32-wasi/tslib": ["[email protected]", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
- "@ts-morph/common/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
-
"@visx/vendor/d3-array": ["[email protected]", "", { "dependencies": { "internmap": "1 - 2" } }, "sha512-gUY/qeHq/yNqqoCKNq4vtpFLdoCdvyNpWoC/KNjhGbhDuQpAM9sIQQKkXSNpXa9h5KySs/gzm7R88WkUutgwWQ=="],
- "ajv-keywords/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
-
"api/typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
"app/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA=="],
@@ -2195,12 +1946,8 @@
"body-parser/content-type": ["[email protected]", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
- "c12/chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^5.0.0" } }, "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw=="],
-
"chevrotain/lodash": ["[email protected]", "", {}, "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="],
- "cli-table3/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
-
"cliui/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"cliui/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
@@ -2219,18 +1966,8 @@
"enquirer/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
- "esrecurse/estraverse": ["[email protected]", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
-
- "fork-ts-checker-webpack-plugin/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
-
- "fork-ts-checker-webpack-plugin/cosmiconfig": ["[email protected]", "", { "dependencies": { "import-fresh": "^3.3.0", "js-yaml": "^4.1.0", "parse-json": "^5.2.0", "path-type": "^4.0.0" }, "peerDependencies": { "typescript": ">=4.9.5" }, "optionalPeers": ["typescript"] }, "sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA=="],
-
- "fork-ts-checker-webpack-plugin/fs-extra": ["[email protected]", "", { "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" } }, "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ=="],
-
"form-data/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
- "glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.8" } }, "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A=="],
-
"log-symbols/is-unicode-supported": ["[email protected]", "", {}, "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ=="],
"micromatch/picomatch": ["[email protected]", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],
@@ -2245,8 +1982,6 @@
"onetime/mimic-fn": ["[email protected]", "", {}, "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="],
- "path-scurry/lru-cache": ["[email protected]", "", {}, "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g=="],
-
"pg-types/postgres-array": ["[email protected]", "", {}, "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA=="],
"prompts/kleur": ["[email protected]", "", {}, "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w=="],
@@ -2261,42 +1996,20 @@
"restore-cursor/onetime": ["[email protected]", "", { "dependencies": { "mimic-function": "^5.0.0" } }, "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ=="],
- "schema-utils/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw=="],
-
"shadcn/commander": ["[email protected]", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="],
"shadcn/open": ["[email protected]", "", { "dependencies": { "default-browser": "^5.4.0", "define-lazy-prop": "^3.0.0", "is-in-ssh": "^1.0.0", "is-inside-container": "^1.0.0", "powershell-utils": "^0.1.0", "wsl-utils": "^0.3.0" } }, "sha512-smsWv2LzFjP03xmvFoJ331ss6h+jixfA4UUV/Bsiyuu4YJPfN+FIQGOIiv4w9/+MoHkfkJ22UIaQWRVFRfH6Vw=="],
"shadcn/zod": ["[email protected]", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
- "terser/commander": ["[email protected]", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
-
- "terser-webpack-plugin/schema-utils": ["[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", "ajv-formats": "^2.1.1", "ajv-keywords": "^5.1.0" } }, "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA=="],
-
- "tsconfig-paths-webpack-plugin/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
-
"type-is/content-type": ["[email protected]", "", {}, "sha512-j/O/d7GcZCyNl7/hwZAb606rzqkyvaDctLmckbxLzHvFBzTJHuGEdodATcP3yIRoDrLHkIATJuvzbFlp/ki2cQ=="],
- "webpack/schema-utils": ["[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.9.0", "ajv-formats": "^2.1.1", "ajv-keywords": "^5.1.0" } }, "sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA=="],
-
"wrap-ansi/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
"wrap-ansi/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
"yargs/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
- "@angular-devkit/schematics/ora/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
-
- "@angular-devkit/schematics/ora/cli-cursor": ["[email protected]", "", { "dependencies": { "restore-cursor": "^3.1.0" } }, "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw=="],
-
- "@angular-devkit/schematics/ora/is-interactive": ["[email protected]", "", {}, "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="],
-
- "@angular-devkit/schematics/ora/is-unicode-supported": ["[email protected]", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
-
- "@angular-devkit/schematics/ora/log-symbols": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="],
-
- "@angular-devkit/schematics/ora/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
-
"@better-auth/cli/better-auth/@better-fetch/fetch": ["@better-fetch/[email protected]", "", {}, "sha512-/ImESw0sskqlVR94jB+5+Pxjf+xBwDZF/N5+y2/q4EqD7IARUTSpPfIo8uf39SYpCxyOCtbyYpUrZ3F/k0zT4A=="],
"@better-auth/cli/better-auth/better-call": ["[email protected]", "", { "dependencies": { "@better-auth/utils": "^0.3.0", "@better-fetch/fetch": "^1.1.4", "rou3": "^0.7.10", "set-cookie-parser": "^2.7.1" }, "peerDependencies": { "zod": "^4.0.0" }, "optionalPeers": ["zod"] }, "sha512-XMQ2rs6FNXasGNfMjzbyroSwKwYbZ/T3IxruSS6U2MJRsSYh3wYtG3o6H00ZlKZ/C/UPOAD97tqgQJNsxyeTXw=="],
@@ -2325,50 +2038,12 @@
"@dotenvx/dotenvx/open/is-wsl": ["[email protected]", "", { "dependencies": { "is-docker": "^2.0.0" } }, "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww=="],
- "@inquirer/core/wrap-ansi/string-width": ["[email protected]", "", { "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
-
- "@inquirer/core/wrap-ansi/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
-
- "@nestjs/cli/ora/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
-
- "@nestjs/cli/ora/cli-cursor": ["[email protected]", "", { "dependencies": { "restore-cursor": "^3.1.0" } }, "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw=="],
-
- "@nestjs/cli/ora/is-interactive": ["[email protected]", "", {}, "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="],
-
- "@nestjs/cli/ora/is-unicode-supported": ["[email protected]", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
-
- "@nestjs/cli/ora/log-symbols": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="],
-
- "@nestjs/cli/ora/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
-
- "@nestjs/schematics/@angular-devkit/core/ajv": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A=="],
-
- "@nestjs/schematics/@angular-devkit/core/rxjs": ["[email protected]", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
-
- "@nestjs/schematics/@angular-devkit/core/source-map": ["[email protected]", "", {}, "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/magic-string": ["[email protected]", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" } }, "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora": ["[email protected]", "", { "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", "cli-spinners": "^2.5.0", "is-interactive": "^1.0.0", "is-unicode-supported": "^0.1.0", "log-symbols": "^4.1.0", "strip-ansi": "^6.0.0", "wcwidth": "^1.0.1" } }, "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/rxjs": ["[email protected]", "", { "dependencies": { "tslib": "^2.1.0" } }, "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg=="],
-
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/primitive": ["@radix-ui/[email protected]", "", {}, "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="],
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-use-controllable-state": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-effect-event": "0.0.2", "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-BjasUjixPFdS+NKkypcyyN5Pmg83Olst0+c6vGov0diwTEo6mgdqVR6hxcEgFuh4QrAs7Rc+9KuGJ9TVCj0Zzg=="],
- "@ts-morph/common/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="],
-
- "ajv-keywords/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
-
"app/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
- "c12/chokidar/readdirp": ["[email protected]", "", {}, "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ=="],
-
- "cli-table3/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
-
- "cli-table3/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
-
"cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
"cliui/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
@@ -2379,30 +2054,14 @@
"enquirer/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
- "fork-ts-checker-webpack-plugin/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
-
"form-data/mime-types/mime-db": ["[email protected]", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
- "glob/minimatch/brace-expansion": ["[email protected]", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="],
-
"multer/type-is/media-typer": ["[email protected]", "", {}, "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ=="],
"multer/type-is/mime-types": ["[email protected]", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
- "schema-utils/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
-
"shadcn/open/wsl-utils": ["[email protected]", "", { "dependencies": { "is-wsl": "^3.1.0", "powershell-utils": "^0.1.0" } }, "sha512-g/eziiSUNBSsdDJtCLB8bdYEUMj4jR7AGeUo96p/3dTafgjHhpF4RiCFPiRILwjQoDXx5MqkBr4fwWtR3Ky4Wg=="],
- "terser-webpack-plugin/schema-utils/ajv-formats": ["[email protected]", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
-
- "terser-webpack-plugin/schema-utils/ajv-keywords": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3" }, "peerDependencies": { "ajv": "^8.8.2" } }, "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw=="],
-
- "tsconfig-paths-webpack-plugin/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
-
- "webpack/schema-utils/ajv-formats": ["[email protected]", "", { "dependencies": { "ajv": "^8.0.0" } }, "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA=="],
-
- "webpack/schema-utils/ajv-keywords": ["[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3" }, "peerDependencies": { "ajv": "^8.8.2" } }, "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw=="],
-
"wrap-ansi/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
"wrap-ansi/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
@@ -2411,62 +2070,16 @@
"yargs/string-width/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
- "@angular-devkit/schematics/ora/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
-
- "@angular-devkit/schematics/ora/cli-cursor/restore-cursor": ["[email protected]", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="],
-
- "@angular-devkit/schematics/ora/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
"@better-auth/cli/better-auth/better-call/@better-fetch/fetch": ["@better-fetch/[email protected]", "", {}, "sha512-ABkD1WhyfPZprKRQI3bhATjeiFuNWC9PXhfGWqL+sg/gKrM977oFrYkdb4msM3hgUGonr7KlOsOFT5TU2rht9g=="],
"@better-auth/cli/better-auth/better-call/set-cookie-parser": ["[email protected]", "", {}, "sha512-oeM1lpU/UvhTxw+g3cIfxXHyJRc/uidd3yK1P242gzHds0udQBYzs3y8j4gCCW+ZJ7ad0yctld8RYO+bdurlvw=="],
- "@inquirer/core/wrap-ansi/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
-
- "@inquirer/core/wrap-ansi/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
- "@nestjs/cli/ora/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
-
- "@nestjs/cli/ora/cli-cursor/restore-cursor": ["[email protected]", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="],
-
- "@nestjs/cli/ora/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/cli-cursor": ["[email protected]", "", { "dependencies": { "restore-cursor": "^3.1.0" } }, "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/is-interactive": ["[email protected]", "", {}, "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/is-unicode-supported": ["[email protected]", "", {}, "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/log-symbols": ["[email protected]", "", { "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" } }, "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/strip-ansi": ["[email protected]", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
-
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-use-controllable-state/@radix-ui/react-use-effect-event": ["@radix-ui/[email protected]", "", { "dependencies": { "@radix-ui/react-use-layout-effect": "1.1.1" }, "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-Qp8WbZOBe+blgpuUT+lw2xheLP8q0oatc9UpmiemEICxGvFLYmHm9QowVZGHtJlGbS6A6yJ3iViad/2cVjnOiA=="],
"@prisma/studio-core/@radix-ui/react-toggle/@radix-ui/react-use-controllable-state/@radix-ui/react-use-layout-effect": ["@radix-ui/[email protected]", "", { "peerDependencies": { "@types/react": "*", "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" }, "optionalPeers": ["@types/react"] }, "sha512-RbJRS4UWQFkzHTTwVymMTUv8EqYhOp8dOOviLj2ugtTiXRaRQS7GLGxZTLL1jWhMeoSCf5zmcZkqTl9IiYfXcQ=="],
- "@ts-morph/common/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
-
- "cli-table3/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
- "glob/minimatch/brace-expansion/balanced-match": ["[email protected]", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
-
"multer/type-is/mime-types/mime-db": ["[email protected]", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
"yargs/string-width/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
- "@angular-devkit/schematics/ora/cli-cursor/restore-cursor/signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
-
- "@nestjs/cli/ora/cli-cursor/restore-cursor/signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/chalk/supports-color": ["[email protected]", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/cli-cursor/restore-cursor": ["[email protected]", "", { "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" } }, "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/strip-ansi/ansi-regex": ["[email protected]", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
-
- "@nestjs/schematics/@angular-devkit/schematics/ora/cli-cursor/restore-cursor/signal-exit": ["[email protected]", "", {}, "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ=="],
}
}
diff --git a/docs/api.md b/docs/api.md
index 51a2f0c2..3193c1ef 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -81,9 +81,28 @@ Everything the app reads or writes goes through `nestjs-trpc` routers under
There is no HTTP response cache in front of tRPC. Freshness is TanStack Query's
job: a mutation invalidates the query keys it affected, and the list refetches.
-- **Invalidate on the client, in the mutation's `onSuccess`**, using the
- `queryKey` from `trpc.<router>.<procedure>.queryKey()` — invalidate the
- narrowest key that covers what changed.
+- **Invalidate on the client, in the mutation's `onSuccess`** — but **through
+ `useCrmCache()`** (`apps/app/lib/trpc/cache.ts`), not by listing keys at the
+ call site. Say *what changed* (`cache.deal(id)`, `cache.company(id)`,
+ `cache.contact(id)`, `cache.activity()`) and the module owns the fan-out. Twelve
+ hand-written key lists is how they drifted: a stage change did not refresh the
+ timeline entry it writes, creating a deal did not refresh the board, and nothing
+ refreshed the overview, so a rep could close a deal and watch their own numbers
+ not move. **A new mutation adds a call there, not a new list of keys.**
+- **Pass `{ settle: "record" }`** when the caller is an inline editor. The
+ default waits for every affected view to refetch, which is right when the point
+ of the action *is* the view changing (a card moving between board columns);
+ `"record"` waits only for the edited record so the field's spinner clears as
+ soon as the value under it is right, and lets the table behind the sheet catch
+ up on its own.
+- **An infinite query needs `pathKey()`, not `queryKey()`.** tRPC stamps the
+ query type into the key, so `queryKey()` yields `{ type: "query" }` and
+ `infiniteQueryOptions` caches under `{ type: "infinite" }` — the two cannot
+ partially match, and invalidating with the wrong one is silent: it reports
+ success, refetches the sibling non-infinite queries, and leaves the infinite
+ one stale until a reload. `pathKey()` carries no type and matches both, which
+ is what you want whenever a procedure is read both ways (`activities.timeline`
+ is, as a paged history and as a pinned top-ten).
- **`cache-manager` is still there** (`apps/api/src/cache`, Redis when
`REDIS_URL` is set) but it is used deliberately, per value, by services that
want it — `AuthService.getProfile` is the model: read through, write on miss,
@@ -92,4 +111,9 @@ job: a mutation invalidates the query keys it affected, and the list refetches.
- **Background writes the browser cannot see** — enrichment finishing, most
obviously — are not invalidations at all, because no client action caused
them. Poll for those: `refetchInterval` while the record's status is
- `PENDING`/`RUNNING`, and stop once it settles.
+ `PENDING`/`RUNNING`, and stop once it settles. Use `isEnriching()` and
+ `ENRICHMENT_POLL_MS` from `components/crm/enrichment-status` so the rule is one
+ definition. **A list polls too, not just the record sheet** — the company sheet
+ polled and the companies table did not, so a newly added company's logo and
+ industry appeared in the sheet and stayed blank in the table behind it until a
+ reload.
diff --git a/packages/db/package.json b/packages/db/package.json
index 4751fad3..abde779d 100644
--- a/packages/db/package.json
+++ b/packages/db/package.json
@@ -24,13 +24,11 @@
},
"dependencies": {
"@prisma/adapter-pg": "^7.9.1",
- "@prisma/client": "^7.9.1",
- "pg": "^8.22.0"
+ "@prisma/client": "^7.9.1"
},
"devDependencies": {
"@crm/typescript-config": "workspace:*",
"@types/node": "^24.10.1",
- "@types/pg": "^8.20.0",
"dotenv": "^17.2.4",
"prisma": "^7.9.1",
"typescript": "5.9.2"
diff --git a/packages/db/prisma/seed.ts b/packages/db/prisma/seed.ts
index 2b9cea66..0e9952a8 100644
--- a/packages/db/prisma/seed.ts
+++ b/packages/db/prisma/seed.ts
@@ -484,8 +484,20 @@ async function seedDeals(
const closed = chance(0.35);
const stage = closed ? pick(CLOSED_STAGES) : pick(OPEN_STAGES);
const ownerId = pick(ownerIds);
- const createdAt = daysFromNow(-integer(20, 200), 12);
- const stageChangedAt = daysFromNow(-integer(1, 20), 12);
+ const createdDaysAgo = integer(20, 210);
+ const createdAt = daysFromNow(-createdDaysAgo, 12);
+ // A closed deal closes somewhere between a fortnight after it opened and
+ // today, so the overview's six-month trend and its rolling win rate have
+ // something in every bucket. Closing them all inside the last fortnight —
+ // which is what a flat `integer(1, 20)` did — made every chart a spike
+ // against five empty months.
+ const closedDaysAgo = closed
+ ? integer(0, Math.max(createdDaysAgo - 14, 0))
+ : null;
+ const stageChangedAt = daysFromNow(
+ closedDaysAgo === null ? -integer(1, 20) : -closedDaysAgo,
+ 12,
+ );
await db.deal.upsert({
where: { id },
@@ -501,8 +513,12 @@ async function seedDeals(
stageChangedAt,
amount: integer(6, 90) * 1000,
currency: "USD",
+ // A closed deal landed near the date it was forecast for; an open one
+ // is still forecast, and some are already late.
expectedCloseDate: daysFromNow(
- closed ? -integer(1, 60) : integer(-10, 75),
+ closedDaysAgo === null
+ ? integer(-10, 75)
+ : -closedDaysAgo + integer(-4, 9),
),
closedAt: closed ? stageChangedAt : null,
closedReason:
diff --git a/packages/ui/package.json b/packages/ui/package.json
index b149b196..6a82a34c 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -18,19 +18,13 @@
},
"dependencies": {
"@carbon/icons-react": "^11.82.0",
- "@shadcn/react": "^0.2.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
- "embla-carousel-react": "^8.6.0",
- "input-otp": "^1.4.2",
"lucide-react": "^1.28.0",
"next-themes": "^0.4.6",
"nuqs": "^2.8.9",
"radix-ui": "^1.6.0",
- "react-day-picker": "^10.0.1",
- "react-hook-form": "^7.80.0",
- "react-resizable-panels": "^4.12.2",
"recharts": "3.8.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.6.0",
diff --git a/packages/ui/src/components/accordion.tsx b/packages/ui/src/components/accordion.tsx
deleted file mode 100644
index ee068760..00000000
--- a/packages/ui/src/components/accordion.tsx
+++ /dev/null
@@ -1,86 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { ChevronDownIcon, ChevronUpIcon } from "lucide-react";
-import { Accordion as AccordionPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function Accordion({
- className,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
- return (
- <AccordionPrimitive.Root
- data-slot="accordion"
- className={cn("flex w-full flex-col", className)}
- {...props}
- />
- );
-}
-
-function AccordionItem({
- className,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
- return (
- <AccordionPrimitive.Item
- data-slot="accordion-item"
- className={cn("not-last:border-b", className)}
- {...props}
- />
- );
-}
-
-function AccordionTrigger({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
- return (
- <AccordionPrimitive.Header className="flex">
- <AccordionPrimitive.Trigger
- data-slot="accordion-trigger"
- className={cn(
- "group/accordion-trigger relative flex flex-1 items-start justify-between rounded-none border border-transparent py-2.5 text-left text-xs font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 focus-visible:after:border-ring disabled:pointer-events-none disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronDownIcon
- data-slot="accordion-trigger-icon"
- className="pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"
- />
- <ChevronUpIcon
- data-slot="accordion-trigger-icon"
- className="pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"
- />
- </AccordionPrimitive.Trigger>
- </AccordionPrimitive.Header>
- );
-}
-
-function AccordionContent({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
- return (
- <AccordionPrimitive.Content
- data-slot="accordion-content"
- className="overflow-hidden text-xs data-open:animate-accordion-down data-closed:animate-accordion-up"
- {...props}
- >
- <div
- className={cn(
- "h-(--radix-accordion-content-height) pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",
- className,
- )}
- >
- {children}
- </div>
- </AccordionPrimitive.Content>
- );
-}
-
-export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
diff --git a/packages/ui/src/components/alert-dialog.tsx b/packages/ui/src/components/alert-dialog.tsx
deleted file mode 100644
index 7be0b107..00000000
--- a/packages/ui/src/components/alert-dialog.tsx
+++ /dev/null
@@ -1,198 +0,0 @@
-"use client";
-
-import { Button } from "@crm/ui/components/button";
-import { cn } from "@crm/ui/lib/utils";
-import { AlertDialog as AlertDialogPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function AlertDialog({
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
- return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />;
-}
-
-function AlertDialogTrigger({
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
- return (
- <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
- );
-}
-
-function AlertDialogPortal({
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
- return (
- <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
- );
-}
-
-function AlertDialogOverlay({
- className,
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
- return (
- <AlertDialogPrimitive.Overlay
- data-slot="alert-dialog-overlay"
- className={cn(
- "fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogContent({
- className,
- size = "default",
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
- size?: "default" | "sm";
-}) {
- return (
- <AlertDialogPortal>
- <AlertDialogOverlay />
- <AlertDialogPrimitive.Content
- data-slot="alert-dialog-content"
- data-size={size}
- className={cn(
- "group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-4 rounded-none bg-popover p-4 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- </AlertDialogPortal>
- );
-}
-
-function AlertDialogHeader({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="alert-dialog-header"
- className={cn(
- "grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogFooter({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="alert-dialog-footer"
- className={cn(
- "flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogMedia({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="alert-dialog-media"
- className={cn(
- "mb-2 inline-flex size-10 items-center justify-center rounded-none bg-muted sm:group-data-[size=default]/alert-dialog-content:row-span-2 *:[svg:not([class*='size-'])]:size-6",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogTitle({
- className,
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
- return (
- <AlertDialogPrimitive.Title
- data-slot="alert-dialog-title"
- className={cn(
- "font-heading text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogDescription({
- className,
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
- return (
- <AlertDialogPrimitive.Description
- data-slot="alert-dialog-description"
- className={cn(
- "text-xs/relaxed text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AlertDialogAction({
- className,
- variant = "default",
- size = "default",
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Action> &
- Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
- return (
- <Button variant={variant} size={size} asChild>
- <AlertDialogPrimitive.Action
- data-slot="alert-dialog-action"
- className={cn(className)}
- {...props}
- />
- </Button>
- );
-}
-
-function AlertDialogCancel({
- className,
- variant = "outline",
- size = "default",
- ...props
-}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> &
- Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
- return (
- <Button variant={variant} size={size} asChild>
- <AlertDialogPrimitive.Cancel
- data-slot="alert-dialog-cancel"
- className={cn(className)}
- {...props}
- />
- </Button>
- );
-}
-
-export {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogMedia,
- AlertDialogOverlay,
- AlertDialogPortal,
- AlertDialogTitle,
- AlertDialogTrigger,
-};
diff --git a/packages/ui/src/components/aspect-ratio.tsx b/packages/ui/src/components/aspect-ratio.tsx
deleted file mode 100644
index 956e8bb0..00000000
--- a/packages/ui/src/components/aspect-ratio.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-"use client";
-
-import { AspectRatio as AspectRatioPrimitive } from "radix-ui";
-
-function AspectRatio({
- ...props
-}: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
- return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />;
-}
-
-export { AspectRatio };
diff --git a/packages/ui/src/components/attachment.tsx b/packages/ui/src/components/attachment.tsx
deleted file mode 100644
index db4cd358..00000000
--- a/packages/ui/src/components/attachment.tsx
+++ /dev/null
@@ -1,205 +0,0 @@
-import { Button } from "@crm/ui/components/button";
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { Slot } from "radix-ui";
-import type * as React from "react";
-
-const attachmentVariants = cva(
- "group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-none border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed",
- {
- variants: {
- size: {
- default:
- "gap-2 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
- sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1",
- xs: "gap-1.5 rounded-none text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1",
- },
- orientation: {
- horizontal: "min-w-40 items-center",
- vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30",
- },
- },
- },
-);
-
-function Attachment({
- className,
- state = "done",
- size = "default",
- orientation = "horizontal",
- ...props
-}: React.ComponentProps<"div"> &
- VariantProps<typeof attachmentVariants> & {
- state?: "idle" | "uploading" | "processing" | "error" | "done";
- }) {
- const resolvedOrientation = orientation ?? "horizontal";
-
- return (
- <div
- data-slot="attachment"
- data-state={state}
- data-size={size}
- data-orientation={resolvedOrientation}
- className={cn(attachmentVariants({ size, orientation }), className)}
- {...props}
- />
- );
-}
-
-const attachmentMediaVariants = cva(
- "relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-none bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-none group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5",
- {
- variants: {
- variant: {
- icon: "",
- image:
- "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover",
- },
- },
- defaultVariants: {
- variant: "icon",
- },
- },
-);
-
-function AttachmentMedia({
- className,
- variant = "icon",
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>) {
- return (
- <div
- data-slot="attachment-media"
- data-variant={variant}
- className={cn(attachmentMediaVariants({ variant }), className)}
- {...props}
- />
- );
-}
-
-function AttachmentContent({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="attachment-content"
- className={cn(
- "max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AttachmentTitle({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="attachment-title"
- className={cn(
- "block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AttachmentDescription({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="attachment-description"
- className={cn(
- "mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80",
- "max-w-full",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AttachmentActions({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="attachment-actions"
- className={cn(
- "relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1",
- className,
- )}
- {...props}
- />
- );
-}
-
-function AttachmentAction({
- className,
- variant,
- size = "icon-xs",
- ...props
-}: React.ComponentProps<typeof Button>) {
- return (
- <Button
- data-slot="attachment-action"
- variant={variant ?? "ghost"}
- size={size}
- className={cn(className)}
- {...props}
- />
- );
-}
-
-function AttachmentTrigger({
- className,
- asChild = false,
- type,
- ...props
-}: React.ComponentProps<"button"> & {
- asChild?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "button";
-
- return (
- <Comp
- data-slot="attachment-trigger"
- type={asChild ? undefined : (type ?? "button")}
- className={cn("absolute inset-0 z-10 outline-none", className)}
- {...props}
- />
- );
-}
-
-function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="attachment-group"
- className={cn(
- "flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 scrollbar-none gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Attachment,
- AttachmentAction,
- AttachmentActions,
- AttachmentContent,
- AttachmentDescription,
- AttachmentGroup,
- AttachmentMedia,
- AttachmentTitle,
- AttachmentTrigger,
-};
diff --git a/packages/ui/src/components/breadcrumb.tsx b/packages/ui/src/components/breadcrumb.tsx
deleted file mode 100644
index 1aaae3f7..00000000
--- a/packages/ui/src/components/breadcrumb.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
-import { Slot } from "radix-ui";
-import type * as React from "react";
-
-function Breadcrumb({ className, ...props }: React.ComponentProps<"nav">) {
- return (
- <nav
- aria-label="breadcrumb"
- data-slot="breadcrumb"
- className={cn(className)}
- {...props}
- />
- );
-}
-
-function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">) {
- return (
- <ol
- data-slot="breadcrumb-list"
- className={cn(
- "flex flex-wrap items-center gap-1.5 text-xs wrap-break-word text-muted-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">) {
- return (
- <li
- data-slot="breadcrumb-item"
- className={cn("inline-flex items-center gap-1", className)}
- {...props}
- />
- );
-}
-
-function BreadcrumbLink({
- asChild,
- className,
- ...props
-}: React.ComponentProps<"a"> & {
- asChild?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "a";
-
- return (
- <Comp
- data-slot="breadcrumb-link"
- className={cn("transition-colors hover:text-foreground", className)}
- {...props}
- />
- );
-}
-
-function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="breadcrumb-page"
- role="link"
- aria-disabled="true"
- aria-current="page"
- className={cn("font-normal text-foreground", className)}
- {...props}
- />
- );
-}
-
-function BreadcrumbSeparator({
- children,
- className,
- ...props
-}: React.ComponentProps<"li">) {
- return (
- <li
- data-slot="breadcrumb-separator"
- role="presentation"
- aria-hidden="true"
- className={cn("[&>svg]:size-3.5", className)}
- {...props}
- >
- {children ?? <ChevronRightIcon />}
- </li>
- );
-}
-
-function BreadcrumbEllipsis({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="breadcrumb-ellipsis"
- role="presentation"
- aria-hidden="true"
- className={cn(
- "flex size-5 items-center justify-center [&>svg]:size-4",
- className,
- )}
- {...props}
- >
- <MoreHorizontalIcon />
- <span className="sr-only">More</span>
- </span>
- );
-}
-
-export {
- Breadcrumb,
- BreadcrumbEllipsis,
- BreadcrumbItem,
- BreadcrumbLink,
- BreadcrumbList,
- BreadcrumbPage,
- BreadcrumbSeparator,
-};
diff --git a/packages/ui/src/components/bubble.tsx b/packages/ui/src/components/bubble.tsx
deleted file mode 100644
index 0636f5a6..00000000
--- a/packages/ui/src/components/bubble.tsx
+++ /dev/null
@@ -1,124 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { Slot } from "radix-ui";
-import type * as React from "react";
-
-function BubbleGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="bubble-group"
- className={cn("flex min-w-0 flex-col gap-2", className)}
- {...props}
- />
- );
-}
-
-const bubbleVariants = cva(
- "group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",
- {
- variants: {
- variant: {
- default:
- "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
- secondary:
- "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
- muted:
- "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
- tinted:
- "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
- outline:
- "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
- ghost:
- "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
- destructive:
- "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- },
-);
-
-function Bubble({
- variant = "default",
- align = "start",
- className,
- ...props
-}: React.ComponentProps<"div"> &
- VariantProps<typeof bubbleVariants> & {
- align?: "start" | "end";
- }) {
- return (
- <div
- data-slot="bubble"
- data-variant={variant}
- data-align={align}
- className={cn(bubbleVariants({ variant }), className)}
- {...props}
- />
- );
-}
-
-function BubbleContent({
- asChild = false,
- className,
- ...props
-}: React.ComponentProps<"div"> & {
- asChild?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "div";
-
- return (
- <Comp
- data-slot="bubble-content"
- className={cn(
- "w-fit max-w-full min-w-0 overflow-hidden rounded-none border border-transparent px-2.5 py-2 text-xs leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-1 [button,a]:focus-visible:ring-ring/50",
- className,
- )}
- {...props}
- />
- );
-}
-
-const bubbleReactionsVariants = cva(
- "absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-none bg-muted px-1.5 py-0.5 text-xs ring-2 ring-card has-[button]:p-0",
- {
- variants: {
- side: {
- top: "top-0 -translate-y-3/4",
- bottom: "bottom-0 translate-y-3/4",
- },
- align: {
- start: "left-3",
- end: "right-3",
- },
- },
- defaultVariants: {
- side: "bottom",
- align: "end",
- },
- },
-);
-
-function BubbleReactions({
- side = "bottom",
- align = "end",
- className,
- ...props
-}: React.ComponentProps<"div"> & {
- align?: "start" | "end";
- side?: "top" | "bottom";
-}) {
- return (
- <div
- data-slot="bubble-reactions"
- data-align={align}
- data-side={side}
- className={cn(bubbleReactionsVariants({ side, align }), className)}
- {...props}
- />
- );
-}
-
-export { Bubble, BubbleContent, BubbleGroup, BubbleReactions };
diff --git a/packages/ui/src/components/button-group.tsx b/packages/ui/src/components/button-group.tsx
deleted file mode 100644
index 0751f3e2..00000000
--- a/packages/ui/src/components/button-group.tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { Separator } from "@crm/ui/components/separator";
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { Slot } from "radix-ui";
-
-const buttonGroupVariants = cva(
- "group/button-group flex w-fit items-stretch rounded-none *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-none [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
- {
- variants: {
- orientation: {
- horizontal:
- "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none",
- vertical:
- "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
- },
- },
- defaultVariants: {
- orientation: "horizontal",
- },
- },
-);
-
-function ButtonGroup({
- className,
- orientation,
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) {
- return (
- <div
- role="group"
- data-slot="button-group"
- data-orientation={orientation}
- className={cn(buttonGroupVariants({ orientation }), className)}
- {...props}
- />
- );
-}
-
-function ButtonGroupText({
- className,
- asChild = false,
- ...props
-}: React.ComponentProps<"div"> & {
- asChild?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "div";
-
- return (
- <Comp
- className={cn(
- "flex items-center gap-2 rounded-none border bg-muted px-2.5 text-xs font-medium [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ButtonGroupSeparator({
- className,
- orientation = "vertical",
- ...props
-}: React.ComponentProps<typeof Separator>) {
- return (
- <Separator
- data-slot="button-group-separator"
- orientation={orientation}
- className={cn(
- "relative self-stretch bg-input data-horizontal:mx-px data-horizontal:w-auto data-vertical:my-px data-vertical:h-auto",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- ButtonGroup,
- ButtonGroupSeparator,
- ButtonGroupText,
- buttonGroupVariants,
-};
diff --git a/packages/ui/src/components/calendar.tsx b/packages/ui/src/components/calendar.tsx
deleted file mode 100644
index 33b77880..00000000
--- a/packages/ui/src/components/calendar.tsx
+++ /dev/null
@@ -1,228 +0,0 @@
-"use client";
-
-import { Button, buttonVariants } from "@crm/ui/components/button";
-import { cn } from "@crm/ui/lib/utils";
-import {
- ChevronDownIcon,
- ChevronLeftIcon,
- ChevronRightIcon,
-} from "lucide-react";
-import * as React from "react";
-import {
- type DayButton,
- DayPicker,
- getDefaultClassNames,
- type Locale,
-} from "react-day-picker";
-
-function Calendar({
- className,
- classNames,
- showOutsideDays = true,
- captionLayout = "label",
- buttonVariant = "ghost",
- locale,
- formatters,
- components,
- ...props
-}: React.ComponentProps<typeof DayPicker> & {
- buttonVariant?: React.ComponentProps<typeof Button>["variant"];
-}) {
- const defaultClassNames = getDefaultClassNames();
-
- return (
- <DayPicker
- showOutsideDays={showOutsideDays}
- className={cn(
- "group/calendar bg-background p-2 [--cell-size:--spacing(7)] in-data-[slot=card-content]:bg-transparent in-data-[slot=popover-content]:bg-transparent",
- String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
- String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
- className,
- )}
- captionLayout={captionLayout}
- locale={locale}
- formatters={{
- formatMonthDropdown: (date) =>
- date.toLocaleString(locale?.code, { month: "short" }),
- ...formatters,
- }}
- classNames={{
- root: cn("w-fit", defaultClassNames.root),
- months: cn(
- "relative flex flex-col gap-4 md:flex-row",
- defaultClassNames.months,
- ),
- month: cn("flex w-full flex-col gap-4", defaultClassNames.month),
- nav: cn(
- "absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",
- defaultClassNames.nav,
- ),
- button_previous: cn(
- buttonVariants({ variant: buttonVariant }),
- "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
- defaultClassNames.button_previous,
- ),
- button_next: cn(
- buttonVariants({ variant: buttonVariant }),
- "size-(--cell-size) p-0 select-none aria-disabled:opacity-50",
- defaultClassNames.button_next,
- ),
- month_caption: cn(
- "flex h-(--cell-size) w-full items-center justify-center px-(--cell-size)",
- defaultClassNames.month_caption,
- ),
- dropdowns: cn(
- "flex h-(--cell-size) w-full items-center justify-center gap-1.5 text-sm font-medium",
- defaultClassNames.dropdowns,
- ),
- dropdown_root: cn(
- "relative rounded-(--cell-radius)",
- defaultClassNames.dropdown_root,
- ),
- dropdown: cn(
- "absolute inset-0 bg-popover opacity-0",
- defaultClassNames.dropdown,
- ),
- caption_label: cn(
- "font-medium select-none",
- captionLayout === "label"
- ? "text-sm"
- : "flex items-center gap-1 rounded-(--cell-radius) text-sm [&>svg]:size-3.5 [&>svg]:text-muted-foreground",
- defaultClassNames.caption_label,
- ),
- month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
- weekdays: cn("flex", defaultClassNames.weekdays),
- weekday: cn(
- "flex-1 rounded-(--cell-radius) text-[0.8rem] font-normal text-muted-foreground select-none",
- defaultClassNames.weekday,
- ),
- week: cn("mt-2 flex w-full", defaultClassNames.week),
- week_number_header: cn(
- "w-(--cell-size) select-none",
- defaultClassNames.week_number_header,
- ),
- week_number: cn(
- "text-[0.8rem] text-muted-foreground select-none",
- defaultClassNames.week_number,
- ),
- day: cn(
- "group/day relative aspect-square h-full w-full rounded-(--cell-radius) p-0 text-center select-none [&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
- props.showWeekNumber
- ? "[&:nth-child(2)[data-selected=true]_button]:rounded-l-(--cell-radius)"
- : "[&:first-child[data-selected=true]_button]:rounded-l-(--cell-radius)",
- defaultClassNames.day,
- ),
- range_start: cn(
- "relative isolate z-0 rounded-l-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:right-0 after:w-4 after:bg-muted",
- defaultClassNames.range_start,
- ),
- range_middle: cn("rounded-none", defaultClassNames.range_middle),
- range_end: cn(
- "relative isolate z-0 rounded-r-(--cell-radius) bg-muted after:absolute after:inset-y-0 after:left-0 after:w-4 after:bg-muted",
- defaultClassNames.range_end,
- ),
- today: cn(
- "rounded-(--cell-radius) bg-muted text-foreground data-[selected=true]:rounded-none",
- defaultClassNames.today,
- ),
- outside: cn(
- "text-muted-foreground aria-selected:text-muted-foreground",
- defaultClassNames.outside,
- ),
- disabled: cn(
- "text-muted-foreground opacity-50",
- defaultClassNames.disabled,
- ),
- hidden: cn("invisible", defaultClassNames.hidden),
- ...classNames,
- }}
- components={{
- Root: ({ className, rootRef, ...props }) => {
- return (
- <div
- data-slot="calendar"
- ref={rootRef}
- className={cn(className)}
- {...props}
- />
- );
- },
- Chevron: ({ className, orientation, ...props }) => {
- if (orientation === "left") {
- return (
- <ChevronLeftIcon className={cn("size-4", className)} {...props} />
- );
- }
-
- if (orientation === "right") {
- return (
- <ChevronRightIcon
- className={cn("size-4", className)}
- {...props}
- />
- );
- }
-
- return (
- <ChevronDownIcon className={cn("size-4", className)} {...props} />
- );
- },
- DayButton: ({ ...props }) => (
- <CalendarDayButton locale={locale} {...props} />
- ),
- WeekNumber: ({ children, ...props }) => {
- return (
- <td {...props}>
- <div className="flex size-(--cell-size) items-center justify-center text-center">
- {children}
- </div>
- </td>
- );
- },
- ...components,
- }}
- {...props}
- />
- );
-}
-
-function CalendarDayButton({
- className,
- day,
- modifiers,
- locale,
- ...props
-}: React.ComponentProps<typeof DayButton> & { locale?: Partial<Locale> }) {
- const defaultClassNames = getDefaultClassNames();
-
- const ref = React.useRef<HTMLButtonElement>(null);
- React.useEffect(() => {
- if (modifiers.focused) ref.current?.focus();
- }, [modifiers.focused]);
-
- return (
- <Button
- ref={ref}
- variant="ghost"
- size="icon"
- data-day={day.date.toLocaleDateString(locale?.code)}
- data-selected-single={
- modifiers.selected &&
- !modifiers.range_start &&
- !modifiers.range_end &&
- !modifiers.range_middle
- }
- data-range-start={modifiers.range_start}
- data-range-end={modifiers.range_end}
- data-range-middle={modifiers.range_middle}
- className={cn(
- "relative isolate z-10 flex aspect-square size-auto w-full min-w-(--cell-size) flex-col gap-1 border-0 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-[3px] group-data-[focused=true]/day:ring-ring/50 data-[range-end=true]:rounded-(--cell-radius) data-[range-end=true]:rounded-r-(--cell-radius) data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground data-[range-middle=true]:rounded-none data-[range-middle=true]:bg-muted data-[range-middle=true]:text-foreground data-[range-start=true]:rounded-(--cell-radius) data-[range-start=true]:rounded-l-(--cell-radius) data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground dark:hover:text-foreground [&>span]:text-xs [&>span]:opacity-70",
- defaultClassNames.day,
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Calendar, CalendarDayButton };
diff --git a/packages/ui/src/components/card.tsx b/packages/ui/src/components/card.tsx
index b8b59b62..5a0bc848 100644
--- a/packages/ui/src/components/card.tsx
+++ b/packages/ui/src/components/card.tsx
@@ -70,6 +70,45 @@ function CardContent({ className, ...props }: React.ComponentProps<"div">) {
);
}
+/**
+ * A card body pinned to one height, with its rows scrolling inside.
+ *
+ * Two lists side by side on a dashboard hold different numbers of rows, so
+ * left to themselves one panel ends level with nothing and the page below
+ * jumps whenever the shorter list gains a row. A set height fixes both the
+ * pair and the page. Pair with `SimpleTable variant="panel"` so the column
+ * header stays pinned while the rows move under it.
+ */
+function CardPanel({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="card-panel"
+ className={cn(
+ "flex h-80 min-h-0 flex-col overflow-hidden border",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
+/**
+ * The empty state for a {@link CardPanel}: centred in the height the panel
+ * holds open, rather than a line of text stranded at the top of it.
+ */
+function CardPanelEmpty({ className, ...props }: React.ComponentProps<"div">) {
+ return (
+ <div
+ data-slot="card-panel-empty"
+ className={cn(
+ "flex flex-1 items-center justify-center p-6 text-center text-muted-foreground text-xs",
+ className,
+ )}
+ {...props}
+ />
+ );
+}
+
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
@@ -87,5 +126,7 @@ export {
CardDescription,
CardFooter,
CardHeader,
+ CardPanel,
+ CardPanelEmpty,
CardTitle,
};
diff --git a/packages/ui/src/components/carousel.tsx b/packages/ui/src/components/carousel.tsx
deleted file mode 100644
index c5aa3e9c..00000000
--- a/packages/ui/src/components/carousel.tsx
+++ /dev/null
@@ -1,241 +0,0 @@
-"use client";
-
-import { Button } from "@crm/ui/components/button";
-import { cn } from "@crm/ui/lib/utils";
-import useEmblaCarousel, {
- type UseEmblaCarouselType,
-} from "embla-carousel-react";
-import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
-import * as React from "react";
-
-type CarouselApi = UseEmblaCarouselType[1];
-type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
-type CarouselOptions = UseCarouselParameters[0];
-type CarouselPlugin = UseCarouselParameters[1];
-
-type CarouselProps = {
- opts?: CarouselOptions;
- plugins?: CarouselPlugin;
- orientation?: "horizontal" | "vertical";
- setApi?: (api: CarouselApi) => void;
-};
-
-type CarouselContextProps = {
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
- api: ReturnType<typeof useEmblaCarousel>[1];
- scrollPrev: () => void;
- scrollNext: () => void;
- canScrollPrev: boolean;
- canScrollNext: boolean;
-} & CarouselProps;
-
-const CarouselContext = React.createContext<CarouselContextProps | null>(null);
-
-function useCarousel() {
- const context = React.useContext(CarouselContext);
-
- if (!context) {
- throw new Error("useCarousel must be used within a <Carousel />");
- }
-
- return context;
-}
-
-function Carousel({
- orientation = "horizontal",
- opts,
- setApi,
- plugins,
- className,
- children,
- ...props
-}: React.ComponentProps<"div"> & CarouselProps) {
- const [carouselRef, api] = useEmblaCarousel(
- {
- ...opts,
- axis: orientation === "horizontal" ? "x" : "y",
- },
- plugins,
- );
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
- const [canScrollNext, setCanScrollNext] = React.useState(false);
-
- const onSelect = React.useCallback((api: CarouselApi) => {
- if (!api) return;
- setCanScrollPrev(api.canScrollPrev());
- setCanScrollNext(api.canScrollNext());
- }, []);
-
- const scrollPrev = React.useCallback(() => {
- api?.scrollPrev();
- }, [api]);
-
- const scrollNext = React.useCallback(() => {
- api?.scrollNext();
- }, [api]);
-
- const handleKeyDown = React.useCallback(
- (event: React.KeyboardEvent<HTMLDivElement>) => {
- if (event.key === "ArrowLeft") {
- event.preventDefault();
- scrollPrev();
- } else if (event.key === "ArrowRight") {
- event.preventDefault();
- scrollNext();
- }
- },
- [scrollPrev, scrollNext],
- );
-
- React.useEffect(() => {
- if (!api || !setApi) return;
- setApi(api);
- }, [api, setApi]);
-
- React.useEffect(() => {
- if (!api) return;
- onSelect(api);
- api.on("reInit", onSelect);
- api.on("select", onSelect);
-
- return () => {
- api?.off("select", onSelect);
- };
- }, [api, onSelect]);
-
- return (
- <CarouselContext.Provider
- value={{
- carouselRef,
- api: api,
- opts,
- orientation:
- orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
- scrollPrev,
- scrollNext,
- canScrollPrev,
- canScrollNext,
- }}
- >
- <div
- onKeyDownCapture={handleKeyDown}
- className={cn("relative", className)}
- role="region"
- aria-roledescription="carousel"
- data-slot="carousel"
- {...props}
- >
- {children}
- </div>
- </CarouselContext.Provider>
- );
-}
-
-function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
- const { carouselRef, orientation } = useCarousel();
-
- return (
- <div
- ref={carouselRef}
- className="overflow-hidden"
- data-slot="carousel-content"
- >
- <div
- className={cn(
- "flex",
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
- className,
- )}
- {...props}
- />
- </div>
- );
-}
-
-function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
- const { orientation } = useCarousel();
-
- return (
- <div
- role="group"
- aria-roledescription="slide"
- data-slot="carousel-item"
- className={cn(
- "min-w-0 shrink-0 grow-0 basis-full",
- orientation === "horizontal" ? "pl-4" : "pt-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function CarouselPrevious({
- className,
- variant = "outline",
- size = "icon-sm",
- ...props
-}: React.ComponentProps<typeof Button>) {
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
-
- return (
- <Button
- data-slot="carousel-previous"
- variant={variant}
- size={size}
- className={cn(
- "absolute touch-manipulation",
- orientation === "horizontal"
- ? "inset-y-0 -left-12 my-auto"
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
- className,
- )}
- disabled={!canScrollPrev}
- onClick={scrollPrev}
- {...props}
- >
- <ChevronLeftIcon />
- <span className="sr-only">Previous slide</span>
- </Button>
- );
-}
-
-function CarouselNext({
- className,
- variant = "outline",
- size = "icon-sm",
- ...props
-}: React.ComponentProps<typeof Button>) {
- const { orientation, scrollNext, canScrollNext } = useCarousel();
-
- return (
- <Button
- data-slot="carousel-next"
- variant={variant}
- size={size}
- className={cn(
- "absolute touch-manipulation",
- orientation === "horizontal"
- ? "inset-y-0 -right-12 my-auto"
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
- className,
- )}
- disabled={!canScrollNext}
- onClick={scrollNext}
- {...props}
- >
- <ChevronRightIcon />
- <span className="sr-only">Next slide</span>
- </Button>
- );
-}
-
-export {
- Carousel,
- type CarouselApi,
- CarouselContent,
- CarouselItem,
- CarouselNext,
- CarouselPrevious,
- useCarousel,
-};
diff --git a/packages/ui/src/components/chart.tsx b/packages/ui/src/components/chart.tsx
index 18adaa3c..8324cb81 100644
--- a/packages/ui/src/components/chart.tsx
+++ b/packages/ui/src/components/chart.tsx
@@ -128,6 +128,7 @@ function ChartTooltipContent({
color,
nameKey,
labelKey,
+ valueFormatter,
}: React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
React.ComponentProps<"div"> & {
hideLabel?: boolean;
@@ -135,6 +136,12 @@ function ChartTooltipContent({
indicator?: "line" | "dot" | "dashed";
nameKey?: string;
labelKey?: string;
+ /**
+ * Formats the value only, keeping the indicator and label markup.
+ * `formatter` replaces the whole row, which is more than a chart
+ * plotting money needs.
+ */
+ valueFormatter?: (value: number | string) => React.ReactNode;
} & Omit<
RechartsPrimitive.DefaultTooltipContentProps<
TooltipValueType,
@@ -252,8 +259,12 @@ function ChartTooltipContent({
</div>
{item.value != null && (
<span className="font-mono font-medium text-foreground tabular-nums">
- {typeof item.value === "number"
- ? item.value.toLocaleString()
+ {typeof item.value === "number" ||
+ typeof item.value === "string"
+ ? (valueFormatter?.(item.value) ??
+ (typeof item.value === "number"
+ ? item.value.toLocaleString()
+ : item.value))
: String(item.value)}
</span>
)}
diff --git a/packages/ui/src/components/collapsible.tsx b/packages/ui/src/components/collapsible.tsx
deleted file mode 100644
index fddca16e..00000000
--- a/packages/ui/src/components/collapsible.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-"use client";
-
-import { Collapsible as CollapsiblePrimitive } from "radix-ui";
-
-function Collapsible({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
- return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />;
-}
-
-function CollapsibleTrigger({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
- return (
- <CollapsiblePrimitive.CollapsibleTrigger
- data-slot="collapsible-trigger"
- {...props}
- />
- );
-}
-
-function CollapsibleContent({
- ...props
-}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
- return (
- <CollapsiblePrimitive.CollapsibleContent
- data-slot="collapsible-content"
- {...props}
- />
- );
-}
-
-export { Collapsible, CollapsibleContent, CollapsibleTrigger };
diff --git a/packages/ui/src/components/context-menu.tsx b/packages/ui/src/components/context-menu.tsx
deleted file mode 100644
index 02d34ebf..00000000
--- a/packages/ui/src/components/context-menu.tsx
+++ /dev/null
@@ -1,266 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { CheckIcon, ChevronRightIcon } from "lucide-react";
-import { ContextMenu as ContextMenuPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function ContextMenu({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Root>) {
- return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />;
-}
-
-function ContextMenuTrigger({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>) {
- return (
- <ContextMenuPrimitive.Trigger
- data-slot="context-menu-trigger"
- className={cn("select-none", className)}
- {...props}
- />
- );
-}
-
-function ContextMenuGroup({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Group>) {
- return (
- <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
- );
-}
-
-function ContextMenuPortal({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Portal>) {
- return (
- <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
- );
-}
-
-function ContextMenuSub({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Sub>) {
- return <ContextMenuPrimitive.Sub data-slot="context-menu-sub" {...props} />;
-}
-
-function ContextMenuRadioGroup({
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.RadioGroup>) {
- return (
- <ContextMenuPrimitive.RadioGroup
- data-slot="context-menu-radio-group"
- {...props}
- />
- );
-}
-
-function ContextMenuContent({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Content> & {
- side?: "top" | "right" | "bottom" | "left";
-}) {
- return (
- <ContextMenuPrimitive.Portal>
- <ContextMenuPrimitive.Content
- data-slot="context-menu-content"
- className={cn(
- "z-50 max-h-(--radix-context-menu-content-available-height) min-w-36 origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-none bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- </ContextMenuPrimitive.Portal>
- );
-}
-
-function ContextMenuItem({
- className,
- inset,
- variant = "default",
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Item> & {
- inset?: boolean;
- variant?: "default" | "destructive";
-}) {
- return (
- <ContextMenuPrimitive.Item
- data-slot="context-menu-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "group/context-menu-item relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ContextMenuSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.SubTrigger> & {
- inset?: boolean;
-}) {
- return (
- <ContextMenuPrimitive.SubTrigger
- data-slot="context-menu-sub-trigger"
- data-inset={inset}
- className={cn(
- "flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto" />
- </ContextMenuPrimitive.SubTrigger>
- );
-}
-
-function ContextMenuSubContent({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.SubContent>) {
- return (
- <ContextMenuPrimitive.SubContent
- data-slot="context-menu-sub-content"
- className={cn(
- "z-50 min-w-32 origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-none border bg-popover text-popover-foreground shadow-lg duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ContextMenuCheckboxItem({
- className,
- children,
- checked,
- inset,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.CheckboxItem> & {
- inset?: boolean;
-}) {
- return (
- <ContextMenuPrimitive.CheckboxItem
- data-slot="context-menu-checkbox-item"
- data-inset={inset}
- className={cn(
- "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute right-2">
- <ContextMenuPrimitive.ItemIndicator>
- <CheckIcon />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.CheckboxItem>
- );
-}
-
-function ContextMenuRadioItem({
- className,
- children,
- inset,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.RadioItem> & {
- inset?: boolean;
-}) {
- return (
- <ContextMenuPrimitive.RadioItem
- data-slot="context-menu-radio-item"
- data-inset={inset}
- className={cn(
- "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-8 pl-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- <span className="pointer-events-none absolute right-2">
- <ContextMenuPrimitive.ItemIndicator>
- <CheckIcon />
- </ContextMenuPrimitive.ItemIndicator>
- </span>
- {children}
- </ContextMenuPrimitive.RadioItem>
- );
-}
-
-function ContextMenuLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Label> & {
- inset?: boolean;
-}) {
- return (
- <ContextMenuPrimitive.Label
- data-slot="context-menu-label"
- data-inset={inset}
- className={cn(
- "px-2 py-2 text-xs text-muted-foreground data-inset:pl-7",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ContextMenuSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof ContextMenuPrimitive.Separator>) {
- return (
- <ContextMenuPrimitive.Separator
- data-slot="context-menu-separator"
- className={cn("-mx-1 h-px bg-border", className)}
- {...props}
- />
- );
-}
-
-function ContextMenuShortcut({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="context-menu-shortcut"
- className={cn(
- "ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- ContextMenu,
- ContextMenuCheckboxItem,
- ContextMenuContent,
- ContextMenuGroup,
- ContextMenuItem,
- ContextMenuLabel,
- ContextMenuPortal,
- ContextMenuRadioGroup,
- ContextMenuRadioItem,
- ContextMenuSeparator,
- ContextMenuShortcut,
- ContextMenuSub,
- ContextMenuSubContent,
- ContextMenuSubTrigger,
- ContextMenuTrigger,
-};
diff --git a/packages/ui/src/components/danger-card.tsx b/packages/ui/src/components/danger-card.tsx
deleted file mode 100644
index 6afe69d7..00000000
--- a/packages/ui/src/components/danger-card.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-"use client";
-
-import {
- AlertDialog,
- AlertDialogAction,
- AlertDialogCancel,
- AlertDialogContent,
- AlertDialogDescription,
- AlertDialogFooter,
- AlertDialogHeader,
- AlertDialogTitle,
- AlertDialogTrigger,
-} from "@crm/ui/components/alert-dialog";
-import { Button } from "@crm/ui/components/button";
-import {
- Card,
- CardDescription,
- CardHeader,
- CardTitle,
-} from "@crm/ui/components/card";
-import { CardTable } from "@crm/ui/components/card-table";
-import { TableCell, TableRow } from "@crm/ui/components/table";
-import type { ReactNode } from "react";
-
-export type DangerAction = {
- id: string;
- action: ReactNode;
- description: ReactNode;
- buttonLabel: string;
- disabled?: boolean;
- confirmTitle: string;
- confirmDescription: ReactNode;
- confirmLabel: string;
- onConfirm: () => void;
-};
-
-export function DangerCard({
- title = "Danger zone",
- description,
- actions,
-}: {
- title?: string;
- description: ReactNode;
- actions: DangerAction[];
-}) {
- return (
- <Card>
- <CardHeader>
- <CardTitle>{title}</CardTitle>
- <CardDescription>{description}</CardDescription>
- </CardHeader>
- <CardTable
- columns={[
- { header: "Action", width: "w-64" },
- { header: "Description" },
- { header: "", width: "w-40", srLabel: "Actions", align: "right" },
- ]}
- >
- {actions.map((item) => (
- <TableRow key={item.id} className="hover:bg-transparent">
- <TableCell className="px-3 py-3 font-medium">
- {item.action}
- </TableCell>
- <TableCell className="whitespace-normal px-3 py-3 text-muted-foreground">
- {item.description}
- </TableCell>
- <TableCell className="px-3 py-3 text-right">
- <AlertDialog>
- <AlertDialogTrigger asChild>
- <Button
- variant="destructive"
- size="sm"
- disabled={item.disabled}
- >
- {item.buttonLabel}
- </Button>
- </AlertDialogTrigger>
- <AlertDialogContent>
- <AlertDialogHeader>
- <AlertDialogTitle>{item.confirmTitle}</AlertDialogTitle>
- <AlertDialogDescription>
- {item.confirmDescription}
- </AlertDialogDescription>
- </AlertDialogHeader>
- <AlertDialogFooter>
- <AlertDialogCancel>Cancel</AlertDialogCancel>
- <AlertDialogAction onClick={item.onConfirm}>
- {item.confirmLabel}
- </AlertDialogAction>
- </AlertDialogFooter>
- </AlertDialogContent>
- </AlertDialog>
- </TableCell>
- </TableRow>
- ))}
- </CardTable>
- </Card>
- );
-}
diff --git a/packages/ui/src/components/dashboard-chart.tsx b/packages/ui/src/components/dashboard-chart.tsx
index 0a0333af..37d3d99b 100644
--- a/packages/ui/src/components/dashboard-chart.tsx
+++ b/packages/ui/src/components/dashboard-chart.tsx
@@ -45,19 +45,28 @@ type CartesianProps = {
showLegend?: boolean;
/** Format an x-axis tick (e.g. shorten a date). */
formatX?: (value: string) => string;
+ /**
+ * Format a plotted value in the tooltip. Pass this whenever the series is
+ * money or a rate — a raw `1250000` in the tooltip tells a reader nothing.
+ */
+ formatValue?: (value: number | string) => string;
};
function seriesKeys(config: ChartConfig, series?: string[]) {
return series ?? Object.keys(config);
}
-const tooltip = (formatX?: (value: string) => string) => (
+const tooltip = (
+ formatX?: (value: string) => string,
+ formatValue?: (value: number | string) => string,
+) => (
<ChartTooltip
cursor={false}
content={
<ChartTooltipContent
indicator="dot"
labelFormatter={formatX ? (label) => formatX(String(label)) : undefined}
+ valueFormatter={formatValue}
/>
}
/>
@@ -220,6 +229,7 @@ function AreaTrend({
showXAxis = true,
showLegend = false,
formatX,
+ formatValue,
stacked = false,
variant = "gradient",
bloom = "low",
@@ -270,7 +280,7 @@ function AreaTrend({
tick={<EdgeTick formatX={formatX} />}
{...X_AXIS_PROPS}
/>
- {tooltip(formatX)}
+ {tooltip(formatX, formatValue)}
{keys.map((key) => (
<Area
key={key}
@@ -337,6 +347,7 @@ function BarTrend({
showXAxis = true,
showLegend = false,
formatX,
+ formatValue,
stacked = false,
}: CartesianProps & { stacked?: boolean }) {
const keys = seriesKeys(config, series);
@@ -355,13 +366,13 @@ function BarTrend({
tick={<EdgeTick formatX={formatX} />}
{...X_AXIS_PROPS}
/>
- {tooltip(formatX)}
+ {tooltip(formatX, formatValue)}
{keys.map((key) => (
<Bar
key={key}
dataKey={key}
fill={`var(--color-${key})`}
- radius={2}
+ radius={0}
stackId={stacked ? "stack" : undefined}
maxBarSize={40}
/>
@@ -384,11 +395,13 @@ function BarStat({
className,
height = 200,
onBarClick,
+ formatValue,
}: {
data: DonutSlice[];
className?: string;
height?: number;
onBarClick?: (key: string) => void;
+ formatValue?: (value: number | string) => string;
}) {
const config: ChartConfig = Object.fromEntries(
data.map((d) => [d.key, { label: d.label, color: d.color }]),
@@ -411,11 +424,17 @@ function BarStat({
/>
<ChartTooltip
cursor={false}
- content={<ChartTooltipContent hideLabel nameKey="key" />}
+ content={
+ <ChartTooltipContent
+ hideLabel
+ nameKey="key"
+ valueFormatter={formatValue}
+ />
+ }
/>
<Bar
dataKey="value"
- radius={2}
+ radius={0}
maxBarSize={40}
className={onBarClick ? "cursor-pointer" : undefined}
onClick={
@@ -454,6 +473,7 @@ function DonutStat({
centerValue,
centerLabel,
onSliceClick,
+ formatValue,
}: {
data: DonutSlice[];
className?: string;
@@ -461,6 +481,7 @@ function DonutStat({
centerValue?: React.ReactNode;
centerLabel?: React.ReactNode;
onSliceClick?: (key: string) => void;
+ formatValue?: (value: number | string) => string;
}) {
const config: ChartConfig = Object.fromEntries(
data.map((d) => [d.key, { label: d.label, color: d.color }]),
@@ -478,7 +499,13 @@ function DonutStat({
<PieChart>
<ChartTooltip
cursor={false}
- content={<ChartTooltipContent hideLabel nameKey="key" />}
+ content={
+ <ChartTooltipContent
+ hideLabel
+ nameKey="key"
+ valueFormatter={formatValue}
+ />
+ }
/>
{/* Faint track so a partial ring still reads as a full circle. */}
<Pie
diff --git a/packages/ui/src/components/direction.tsx b/packages/ui/src/components/direction.tsx
deleted file mode 100644
index eb9795f0..00000000
--- a/packages/ui/src/components/direction.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-"use client";
-
-import { Direction } from "radix-ui";
-import type * as React from "react";
-
-function DirectionProvider({
- dir,
- direction,
- children,
-}: React.ComponentProps<typeof Direction.DirectionProvider> & {
- direction?: React.ComponentProps<typeof Direction.DirectionProvider>["dir"];
-}) {
- return (
- <Direction.DirectionProvider dir={direction ?? dir}>
- {children}
- </Direction.DirectionProvider>
- );
-}
-
-const useDirection = Direction.useDirection;
-
-export { DirectionProvider, useDirection };
diff --git a/packages/ui/src/components/entity-logo.tsx b/packages/ui/src/components/entity-logo.tsx
index e07028f3..e4db95af 100644
--- a/packages/ui/src/components/entity-logo.tsx
+++ b/packages/ui/src/components/entity-logo.tsx
@@ -13,6 +13,13 @@ export type EntityLogoSize = "xs" | "sm" | "default" | "lg" | "xl";
* for a wordmark, and company logos arrive from Context.dev as squares already.
* Keeping it here rather than composing it per module means a company reads the
* same in a table row, a sheet header and an embedded list.
+ *
+ * One format for every logo, and no chrome around it. A border drawn around
+ * artwork that already carries its own edge — which is most of them, since the
+ * icons arrive pre-composed on a brand colour — reads as a box the logo is
+ * trapped in, and turns a column of companies into a strip of frames. Without
+ * it the artwork is the artwork: contained, never cropped, and occupying the
+ * same square whatever shape it came in.
*/
export function EntityLogo({
src,
@@ -29,12 +36,6 @@ export function EntityLogo({
// a poll, so a `true` left over from the placeholder would pin this to
// initials forever once the real logo arrived.
const [failedSrc, setFailedSrc] = useState<string | null>(null);
- // Whether the artwork is a square mark or a wide wordmark. Both arrive
- // through the same field and neither is tagged, so it is measured on load.
- // The fit is always `contain` — cropping a logo is never the right answer —
- // but a wordmark letterboxed edge to edge in a bordered tile reads as
- // broken, so a wide one gets breathing room and a square one does not.
- const [wide, setWide] = useState(false);
const url = src?.trim() ? src : null;
const showImage = url !== null && failedSrc !== url;
@@ -44,8 +45,11 @@ export function EntityLogo({
data-slot="entity-logo"
data-size={size}
className={cn(
- "inline-flex size-8 shrink-0 select-none items-center justify-center overflow-hidden border bg-card text-center font-medium text-muted-foreground text-xs uppercase leading-none",
+ "inline-flex size-8 shrink-0 select-none items-center justify-center overflow-hidden text-center font-medium text-muted-foreground text-xs uppercase leading-none",
"data-[size=xs]:size-5 data-[size=xs]:text-[9px] data-[size=sm]:size-6 data-[size=sm]:text-[10px] data-[size=lg]:size-10 data-[size=lg]:text-sm data-[size=xl]:size-14 data-[size=xl]:text-lg",
+ // Initials are type, and type needs a surface to sit on to read as a
+ // logo's stand-in rather than as two stray letters in the row.
+ // Artwork brings its own.
!showImage && "bg-muted",
className,
)}
@@ -58,15 +62,13 @@ export function EntityLogo({
decoding="async"
// Several logo CDNs refuse a request that carries our origin.
referrerPolicy="no-referrer"
- onLoad={(event) => {
- const { naturalWidth, naturalHeight } = event.currentTarget;
- if (!naturalHeight) return;
- setWide(naturalWidth / naturalHeight > 1.2);
- }}
// A dead logo URL is common — brands move them — and the alt text of
// a broken image is worse than the initials we would have shown.
onError={() => setFailedSrc(url)}
- className={cn("size-full object-contain", wide && "p-[3px]")}
+ // `contain`, always: cropping a logo is never the right answer, and
+ // with no border to letterbox against, a wide wordmark can use the
+ // full width instead of being inset to escape the frame.
+ className="size-full object-contain"
/>
) : (
initialsFromName(name)
diff --git a/packages/ui/src/components/form.tsx b/packages/ui/src/components/form.tsx
deleted file mode 100644
index 18f78ea4..00000000
--- a/packages/ui/src/components/form.tsx
+++ /dev/null
@@ -1,167 +0,0 @@
-"use client";
-
-import { Label } from "@crm/ui/components/label";
-import { cn } from "@crm/ui/lib/utils";
-import type { Label as LabelPrimitive } from "radix-ui";
-import { Slot } from "radix-ui";
-import * as React from "react";
-import {
- Controller,
- type ControllerProps,
- type FieldPath,
- type FieldValues,
- FormProvider,
- useFormContext,
- useFormState,
-} from "react-hook-form";
-
-const Form = FormProvider;
-
-type FormFieldContextValue<
- TFieldValues extends FieldValues = FieldValues,
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
-> = {
- name: TName;
-};
-
-const FormFieldContext = React.createContext<FormFieldContextValue>(
- {} as FormFieldContextValue,
-);
-
-const FormField = <
- TFieldValues extends FieldValues = FieldValues,
- TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
->({
- ...props
-}: ControllerProps<TFieldValues, TName>) => {
- return (
- <FormFieldContext.Provider value={{ name: props.name }}>
- <Controller {...props} />
- </FormFieldContext.Provider>
- );
-};
-
-const useFormField = () => {
- const fieldContext = React.useContext(FormFieldContext);
- const itemContext = React.useContext(FormItemContext);
- const { getFieldState } = useFormContext();
- const formState = useFormState({ name: fieldContext.name });
- const fieldState = getFieldState(fieldContext.name, formState);
-
- if (!fieldContext) {
- throw new Error("useFormField should be used within <FormField>");
- }
-
- const { id } = itemContext;
-
- return {
- id,
- name: fieldContext.name,
- formItemId: `${id}-form-item`,
- formDescriptionId: `${id}-form-item-description`,
- formMessageId: `${id}-form-item-message`,
- ...fieldState,
- };
-};
-
-type FormItemContextValue = {
- id: string;
-};
-
-const FormItemContext = React.createContext<FormItemContextValue>(
- {} as FormItemContextValue,
-);
-
-function FormItem({ className, ...props }: React.ComponentProps<"div">) {
- const id = React.useId();
-
- return (
- <FormItemContext.Provider value={{ id }}>
- <div
- data-slot="form-item"
- className={cn("grid gap-2", className)}
- {...props}
- />
- </FormItemContext.Provider>
- );
-}
-
-function FormLabel({
- className,
- ...props
-}: React.ComponentProps<typeof LabelPrimitive.Root>) {
- const { error, formItemId } = useFormField();
-
- return (
- <Label
- data-slot="form-label"
- data-error={!!error}
- className={cn("data-[error=true]:text-destructive", className)}
- htmlFor={formItemId}
- {...props}
- />
- );
-}
-
-function FormControl({ ...props }: React.ComponentProps<typeof Slot.Root>) {
- const { error, formItemId, formDescriptionId, formMessageId } =
- useFormField();
-
- return (
- <Slot.Root
- data-slot="form-control"
- id={formItemId}
- aria-describedby={
- !error
- ? `${formDescriptionId}`
- : `${formDescriptionId} ${formMessageId}`
- }
- aria-invalid={!!error}
- {...props}
- />
- );
-}
-
-function FormDescription({ className, ...props }: React.ComponentProps<"p">) {
- const { formDescriptionId } = useFormField();
-
- return (
- <p
- data-slot="form-description"
- id={formDescriptionId}
- className={cn("text-xs/relaxed text-muted-foreground", className)}
- {...props}
- />
- );
-}
-
-function FormMessage({ className, ...props }: React.ComponentProps<"p">) {
- const { error, formMessageId } = useFormField();
- const body = error ? String(error?.message ?? "") : props.children;
-
- if (!body) {
- return null;
- }
-
- return (
- <p
- data-slot="form-message"
- id={formMessageId}
- className={cn("text-sm text-destructive", className)}
- {...props}
- >
- {body}
- </p>
- );
-}
-
-export {
- Form,
- FormControl,
- FormDescription,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
- useFormField,
-};
diff --git a/packages/ui/src/components/hover-card.tsx b/packages/ui/src/components/hover-card.tsx
deleted file mode 100644
index 3363159e..00000000
--- a/packages/ui/src/components/hover-card.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { HoverCard as HoverCardPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function HoverCard({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Root>) {
- return <HoverCardPrimitive.Root data-slot="hover-card" {...props} />;
-}
-
-function HoverCardTrigger({
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Trigger>) {
- return (
- <HoverCardPrimitive.Trigger data-slot="hover-card-trigger" {...props} />
- );
-}
-
-function HoverCardContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof HoverCardPrimitive.Content>) {
- return (
- <HoverCardPrimitive.Portal data-slot="hover-card-portal">
- <HoverCardPrimitive.Content
- data-slot="hover-card-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-none bg-popover p-2.5 text-xs/relaxed text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- </HoverCardPrimitive.Portal>
- );
-}
-
-export { HoverCard, HoverCardContent, HoverCardTrigger };
diff --git a/packages/ui/src/components/input-otp.tsx b/packages/ui/src/components/input-otp.tsx
deleted file mode 100644
index 8c109d8a..00000000
--- a/packages/ui/src/components/input-otp.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { OTPInput, OTPInputContext } from "input-otp";
-import { MinusIcon } from "lucide-react";
-import * as React from "react";
-
-function InputOTP({
- className,
- containerClassName,
- ...props
-}: React.ComponentProps<typeof OTPInput> & {
- containerClassName?: string;
-}) {
- return (
- <OTPInput
- data-slot="input-otp"
- containerClassName={cn(
- "cn-input-otp flex items-center has-disabled:opacity-50",
- containerClassName,
- )}
- spellCheck={false}
- className={cn("disabled:cursor-not-allowed", className)}
- {...props}
- />
- );
-}
-
-function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="input-otp-group"
- className={cn(
- "flex items-center rounded-none has-aria-invalid:border-destructive has-aria-invalid:ring-1 has-aria-invalid:ring-destructive/20 dark:has-aria-invalid:ring-destructive/40",
- className,
- )}
- {...props}
- />
- );
-}
-
-function InputOTPSlot({
- index,
- className,
- ...props
-}: React.ComponentProps<"div"> & {
- index: number;
-}) {
- const inputOTPContext = React.useContext(OTPInputContext);
- const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
-
- return (
- <div
- data-slot="input-otp-slot"
- data-active={isActive}
- className={cn(
- "relative flex size-8 items-center justify-center border-y border-r border-input text-xs transition-all outline-none first:rounded-none first:border-l last:rounded-none aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:border-ring data-[active=true]:ring-1 data-[active=true]:ring-ring/50 data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:ring-destructive/20 dark:bg-input/30 dark:data-[active=true]:aria-invalid:ring-destructive/40",
- className,
- )}
- {...props}
- >
- {char}
- {hasFakeCaret && (
- <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
- <div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
- </div>
- )}
- </div>
- );
-}
-
-function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="input-otp-separator"
- className="flex items-center [&_svg:not([class*='size-'])]:size-4"
- role="separator"
- {...props}
- >
- <MinusIcon />
- </div>
- );
-}
-
-export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
diff --git a/packages/ui/src/components/item.tsx b/packages/ui/src/components/item.tsx
deleted file mode 100644
index a96b7f0b..00000000
--- a/packages/ui/src/components/item.tsx
+++ /dev/null
@@ -1,195 +0,0 @@
-import { Separator } from "@crm/ui/components/separator";
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { Slot } from "radix-ui";
-import type * as React from "react";
-
-function ItemGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- role="list"
- data-slot="item-group"
- className={cn(
- "group/item-group flex w-full flex-col gap-4 has-data-[size=sm]:gap-2.5 has-data-[size=xs]:gap-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ItemSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof Separator>) {
- return (
- <Separator
- data-slot="item-separator"
- orientation="horizontal"
- className={cn("my-2", className)}
- {...props}
- />
- );
-}
-
-const itemVariants = cva(
- "group/item flex w-full flex-wrap items-center rounded-none border text-xs transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",
- {
- variants: {
- variant: {
- default: "border-transparent",
- outline: "border-border",
- muted: "border-transparent bg-muted/50",
- },
- size: {
- default: "gap-2.5 px-3 py-2.5",
- sm: "gap-2.5 px-3 py-2.5",
- xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0",
- },
- },
- defaultVariants: {
- variant: "default",
- size: "default",
- },
- },
-);
-
-function Item({
- className,
- variant = "default",
- size = "default",
- asChild = false,
- ...props
-}: React.ComponentProps<"div"> &
- VariantProps<typeof itemVariants> & { asChild?: boolean }) {
- const Comp = asChild ? Slot.Root : "div";
- return (
- <Comp
- data-slot="item"
- data-variant={variant}
- data-size={size}
- className={cn(itemVariants({ variant, size, className }))}
- {...props}
- />
- );
-}
-
-const itemMediaVariants = cva(
- "flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none",
- {
- variants: {
- variant: {
- default: "bg-transparent",
- icon: "[&_svg:not([class*='size-'])]:size-4",
- image:
- "size-10 overflow-hidden rounded-none group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover",
- },
- },
- defaultVariants: {
- variant: "default",
- },
- },
-);
-
-function ItemMedia({
- className,
- variant = "default",
- ...props
-}: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>) {
- return (
- <div
- data-slot="item-media"
- data-variant={variant}
- className={cn(itemMediaVariants({ variant, className }))}
- {...props}
- />
- );
-}
-
-function ItemContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="item-content"
- className={cn(
- "flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ItemTitle({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="item-title"
- className={cn(
- "line-clamp-1 flex w-fit items-center gap-2 text-xs font-medium underline-offset-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ItemDescription({ className, ...props }: React.ComponentProps<"p">) {
- return (
- <p
- data-slot="item-description"
- className={cn(
- "line-clamp-2 text-left text-xs/relaxed font-normal text-muted-foreground group-data-[size=xs]/item:text-xs/relaxed [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ItemActions({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="item-actions"
- className={cn("flex items-center gap-2", className)}
- {...props}
- />
- );
-}
-
-function ItemHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="item-header"
- className={cn(
- "flex basis-full items-center justify-between gap-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ItemFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="item-footer"
- className={cn(
- "flex basis-full items-center justify-between gap-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Item,
- ItemActions,
- ItemContent,
- ItemDescription,
- ItemFooter,
- ItemGroup,
- ItemHeader,
- ItemMedia,
- ItemSeparator,
- ItemTitle,
-};
diff --git a/packages/ui/src/components/kbd.tsx b/packages/ui/src/components/kbd.tsx
deleted file mode 100644
index f0c8b64d..00000000
--- a/packages/ui/src/components/kbd.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-
-function Kbd({ className, ...props }: React.ComponentProps<"kbd">) {
- return (
- <kbd
- data-slot="kbd"
- className={cn(
- "pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-none bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",
- className,
- )}
- {...props}
- />
- );
-}
-
-function KbdGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <kbd
- data-slot="kbd-group"
- className={cn("inline-flex items-center gap-1", className)}
- {...props}
- />
- );
-}
-
-export { Kbd, KbdGroup };
diff --git a/packages/ui/src/components/marker.tsx b/packages/ui/src/components/marker.tsx
deleted file mode 100644
index e0315581..00000000
--- a/packages/ui/src/components/marker.tsx
+++ /dev/null
@@ -1,68 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { Slot } from "radix-ui";
-import type * as React from "react";
-
-const markerVariants = cva(
- "group/marker relative flex min-h-4 w-full items-center gap-2 text-left text-xs text-muted-foreground [&_svg:not([class*='size-'])]:size-3.5 [a]:underline [a]:underline-offset-3 [a]:hover:text-foreground",
- {
- variants: {
- variant: {
- default: "",
- separator:
- "before:mr-1 before:h-px before:min-w-0 before:flex-1 before:bg-border after:ml-1 after:h-px after:min-w-0 after:flex-1 after:bg-border",
- border: "border-b border-border pb-2",
- },
- },
- },
-);
-
-function Marker({
- className,
- variant = "default",
- asChild = false,
- ...props
-}: React.ComponentProps<"div"> &
- VariantProps<typeof markerVariants> & {
- asChild?: boolean;
- }) {
- const Comp = asChild ? Slot.Root : "div";
-
- return (
- <Comp
- data-slot="marker"
- data-variant={variant}
- className={cn(markerVariants({ variant, className }))}
- {...props}
- />
- );
-}
-
-function MarkerIcon({ className, ...props }: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="marker-icon"
- aria-hidden="true"
- className={cn(
- "size-3.5 shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MarkerContent({ className, ...props }: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="marker-content"
- className={cn(
- "min-w-0 wrap-break-word group-data-[variant=separator]/marker:flex-none group-data-[variant=separator]/marker:text-center *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-export { Marker, MarkerContent, MarkerIcon, markerVariants };
diff --git a/packages/ui/src/components/menubar.tsx b/packages/ui/src/components/menubar.tsx
deleted file mode 100644
index 9f8584ae..00000000
--- a/packages/ui/src/components/menubar.tsx
+++ /dev/null
@@ -1,280 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { CheckIcon, ChevronRightIcon } from "lucide-react";
-import { Menubar as MenubarPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function Menubar({
- className,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Root>) {
- return (
- <MenubarPrimitive.Root
- data-slot="menubar"
- className={cn(
- "flex h-8 items-center gap-0.5 rounded-none border p-1",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MenubarMenu({
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Menu>) {
- return <MenubarPrimitive.Menu data-slot="menubar-menu" {...props} />;
-}
-
-function MenubarGroup({
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Group>) {
- return <MenubarPrimitive.Group data-slot="menubar-group" {...props} />;
-}
-
-function MenubarPortal({
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Portal>) {
- return <MenubarPrimitive.Portal data-slot="menubar-portal" {...props} />;
-}
-
-function MenubarRadioGroup({
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.RadioGroup>) {
- return (
- <MenubarPrimitive.RadioGroup data-slot="menubar-radio-group" {...props} />
- );
-}
-
-function MenubarTrigger({
- className,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Trigger>) {
- return (
- <MenubarPrimitive.Trigger
- data-slot="menubar-trigger"
- className={cn(
- "flex items-center rounded-none px-1.5 py-[calc(--spacing(0.8))] text-xs font-medium outline-hidden select-none hover:bg-muted aria-expanded:bg-muted",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MenubarContent({
- className,
- align = "start",
- alignOffset = -4,
- sideOffset = 8,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Content>) {
- return (
- <MenubarPortal>
- <MenubarPrimitive.Content
- data-slot="menubar-content"
- align={align}
- alignOffset={alignOffset}
- sideOffset={sideOffset}
- className={cn(
- "z-50 min-w-36 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-none bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95",
- className,
- )}
- {...props}
- />
- </MenubarPortal>
- );
-}
-
-function MenubarItem({
- className,
- inset,
- variant = "default",
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Item> & {
- inset?: boolean;
- variant?: "default" | "destructive";
-}) {
- return (
- <MenubarPrimitive.Item
- data-slot="menubar-item"
- data-inset={inset}
- data-variant={variant}
- className={cn(
- "group/menubar-item relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive!",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MenubarCheckboxItem({
- className,
- children,
- checked,
- inset,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.CheckboxItem> & {
- inset?: boolean;
-}) {
- return (
- <MenubarPrimitive.CheckboxItem
- data-slot="menubar-checkbox-item"
- data-inset={inset}
- className={cn(
- "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-28 pl-8 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0",
- className,
- )}
- checked={checked}
- {...props}
- >
- <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
- <MenubarPrimitive.ItemIndicator>
- <CheckIcon />
- </MenubarPrimitive.ItemIndicator>
- </span>
- {children}
- </MenubarPrimitive.CheckboxItem>
- );
-}
-
-function MenubarRadioItem({
- className,
- children,
- inset,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.RadioItem> & {
- inset?: boolean;
-}) {
- return (
- <MenubarPrimitive.RadioItem
- data-slot="menubar-radio-item"
- data-inset={inset}
- className={cn(
- "relative flex cursor-default items-center gap-2 rounded-none py-2 pr-2 pl-8 text-xs outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- <span className="pointer-events-none absolute left-1.5 flex size-4 items-center justify-center [&_svg:not([class*='size-'])]:size-4">
- <MenubarPrimitive.ItemIndicator>
- <CheckIcon />
- </MenubarPrimitive.ItemIndicator>
- </span>
- {children}
- </MenubarPrimitive.RadioItem>
- );
-}
-
-function MenubarLabel({
- className,
- inset,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Label> & {
- inset?: boolean;
-}) {
- return (
- <MenubarPrimitive.Label
- data-slot="menubar-label"
- data-inset={inset}
- className={cn("px-2 py-2 text-xs data-inset:pl-8", className)}
- {...props}
- />
- );
-}
-
-function MenubarSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Separator>) {
- return (
- <MenubarPrimitive.Separator
- data-slot="menubar-separator"
- className={cn("-mx-1 my-1 h-px bg-border", className)}
- {...props}
- />
- );
-}
-
-function MenubarShortcut({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- data-slot="menubar-shortcut"
- className={cn(
- "ml-auto text-xs tracking-widest text-muted-foreground group-focus/menubar-item:text-accent-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MenubarSub({
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.Sub>) {
- return <MenubarPrimitive.Sub data-slot="menubar-sub" {...props} />;
-}
-
-function MenubarSubTrigger({
- className,
- inset,
- children,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.SubTrigger> & {
- inset?: boolean;
-}) {
- return (
- <MenubarPrimitive.SubTrigger
- data-slot="menubar-sub-trigger"
- data-inset={inset}
- className={cn(
- "flex cursor-default items-center gap-2 rounded-none px-2 py-2 text-xs outline-none select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- {children}
- <ChevronRightIcon className="ml-auto size-4" />
- </MenubarPrimitive.SubTrigger>
- );
-}
-
-function MenubarSubContent({
- className,
- ...props
-}: React.ComponentProps<typeof MenubarPrimitive.SubContent>) {
- return (
- <MenubarPrimitive.SubContent
- data-slot="menubar-sub-content"
- className={cn(
- "z-50 min-w-32 origin-(--radix-menubar-content-transform-origin) overflow-hidden rounded-none bg-popover text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Menubar,
- MenubarCheckboxItem,
- MenubarContent,
- MenubarGroup,
- MenubarItem,
- MenubarLabel,
- MenubarMenu,
- MenubarPortal,
- MenubarRadioGroup,
- MenubarRadioItem,
- MenubarSeparator,
- MenubarShortcut,
- MenubarSub,
- MenubarSubContent,
- MenubarSubTrigger,
- MenubarTrigger,
-};
diff --git a/packages/ui/src/components/message-scroller.tsx b/packages/ui/src/components/message-scroller.tsx
deleted file mode 100644
index 695aa9b5..00000000
--- a/packages/ui/src/components/message-scroller.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-"use client";
-
-import {
- MessageScroller as MessageScrollerPrimitive,
- useMessageScroller,
- useMessageScrollerScrollable,
- useMessageScrollerVisibility,
-} from "@shadcn/react/message-scroller";
-import { Button } from "@crm/ui/components/button";
-import { cn } from "@crm/ui/lib/utils";
-import { ArrowDown } from "lucide-react";
-import type * as React from "react";
-
-function MessageScrollerProvider(
- props: React.ComponentProps<typeof MessageScrollerPrimitive.Provider>,
-) {
- return <MessageScrollerPrimitive.Provider {...props} />;
-}
-
-function MessageScroller({
- className,
- ...props
-}: React.ComponentProps<typeof MessageScrollerPrimitive.Root>) {
- return (
- <MessageScrollerPrimitive.Root
- data-slot="message-scroller"
- className={cn(
- "group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageScrollerViewport({
- className,
- ...props
-}: React.ComponentProps<typeof MessageScrollerPrimitive.Viewport>) {
- return (
- <MessageScrollerPrimitive.Viewport
- data-slot="message-scroller-viewport"
- className={cn(
- "size-full min-h-0 min-w-0 overflow-y-auto overscroll-contain contain-content",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageScrollerContent({
- className,
- ...props
-}: React.ComponentProps<typeof MessageScrollerPrimitive.Content>) {
- return (
- <MessageScrollerPrimitive.Content
- data-slot="message-scroller-content"
- className={cn("flex h-max min-h-full flex-col", className)}
- {...props}
- />
- );
-}
-
-function MessageScrollerItem({
- className,
- scrollAnchor = false,
- ...props
-}: React.ComponentProps<typeof MessageScrollerPrimitive.Item>) {
- return (
- <MessageScrollerPrimitive.Item
- data-slot="message-scroller-item"
- scrollAnchor={scrollAnchor}
- className={cn("min-w-0 shrink-0", className)}
- {...props}
- />
- );
-}
-
-function MessageScrollerButton({
- direction = "end",
- className,
- children,
- render,
- variant = "secondary",
- size = "icon-sm",
- ...props
-}: React.ComponentProps<typeof MessageScrollerPrimitive.Button> &
- Pick<React.ComponentProps<typeof Button>, "variant" | "size">) {
- return (
- <MessageScrollerPrimitive.Button
- data-slot="message-scroller-button"
- data-direction={direction}
- data-variant={variant}
- data-size={size}
- direction={direction}
- className={cn(
- "absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground shadow-sm transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180",
- className,
- )}
- render={render ?? <Button variant={variant} size={size} />}
- {...props}
- >
- {children ?? (
- <>
- <ArrowDown />
- <span className="sr-only">
- {direction === "end" ? "Scroll to end" : "Scroll to start"}
- </span>
- </>
- )}
- </MessageScrollerPrimitive.Button>
- );
-}
-
-export {
- MessageScroller,
- MessageScrollerButton,
- MessageScrollerContent,
- MessageScrollerItem,
- MessageScrollerProvider,
- MessageScrollerViewport,
- useMessageScroller,
- useMessageScrollerScrollable,
- useMessageScrollerVisibility,
-};
diff --git a/packages/ui/src/components/message.tsx b/packages/ui/src/components/message.tsx
deleted file mode 100644
index 323091c0..00000000
--- a/packages/ui/src/components/message.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import type * as React from "react";
-
-function MessageGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="message-group"
- className={cn("flex min-w-0 flex-col gap-1.5", className)}
- {...props}
- />
- );
-}
-
-function Message({
- className,
- align = "start",
- ...props
-}: React.ComponentProps<"div"> & { align?: "start" | "end" }) {
- return (
- <div
- data-slot="message"
- data-align={align}
- className={cn(
- "group/message relative flex w-full min-w-0 gap-1.5 text-xs data-[align=end]:flex-row-reverse",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageAvatar({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="message-avatar"
- className={cn(
- "flex w-fit min-w-8 shrink-0 items-center justify-center self-end overflow-hidden rounded-full bg-muted group-has-data-[slot=message-footer]/message:-translate-y-8",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="message-content"
- className={cn(
- "flex w-full min-w-0 flex-col gap-2 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="message-header"
- className={cn(
- "flex max-w-full min-w-0 items-center px-2.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function MessageFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="message-footer"
- className={cn(
- "flex max-w-full min-w-0 items-center px-2.5 text-xs font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0 group-data-[align=end]/message:justify-end",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Message,
- MessageAvatar,
- MessageContent,
- MessageFooter,
- MessageGroup,
- MessageHeader,
-};
diff --git a/packages/ui/src/components/native-select.tsx b/packages/ui/src/components/native-select.tsx
deleted file mode 100644
index 25060e00..00000000
--- a/packages/ui/src/components/native-select.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import { ChevronDownIcon } from "lucide-react";
-import type * as React from "react";
-
-type NativeSelectProps = Omit<React.ComponentProps<"select">, "size"> & {
- size?: "sm" | "default";
-};
-
-function NativeSelect({
- className,
- size = "default",
- ...props
-}: NativeSelectProps) {
- return (
- <div
- className={cn(
- "group/native-select relative w-fit has-[select:disabled]:opacity-50",
- className,
- )}
- data-slot="native-select-wrapper"
- data-size={size}
- >
- <select
- data-slot="native-select"
- data-size={size}
- className="h-8 w-full min-w-0 appearance-none rounded-none border border-input bg-transparent py-1 pr-8 pl-2.5 text-xs transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-[size=sm]:h-7 data-[size=sm]:rounded-none data-[size=sm]:py-0.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40"
- {...props}
- />
- <ChevronDownIcon
- className="pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none"
- aria-hidden="true"
- data-slot="native-select-icon"
- />
- </div>
- );
-}
-
-function NativeSelectOption({
- className,
- ...props
-}: React.ComponentProps<"option">) {
- return (
- <option
- data-slot="native-select-option"
- className={cn("bg-[Canvas] text-[CanvasText]", className)}
- {...props}
- />
- );
-}
-
-function NativeSelectOptGroup({
- className,
- ...props
-}: React.ComponentProps<"optgroup">) {
- return (
- <optgroup
- data-slot="native-select-optgroup"
- className={cn("bg-[Canvas] text-[CanvasText]", className)}
- {...props}
- />
- );
-}
-
-export { NativeSelect, NativeSelectOptGroup, NativeSelectOption };
diff --git a/packages/ui/src/components/navigation-menu.tsx b/packages/ui/src/components/navigation-menu.tsx
deleted file mode 100644
index 9eb48ac6..00000000
--- a/packages/ui/src/components/navigation-menu.tsx
+++ /dev/null
@@ -1,166 +0,0 @@
-import { cn } from "@crm/ui/lib/utils";
-import { cva } from "class-variance-authority";
-import { ChevronDownIcon } from "lucide-react";
-import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function NavigationMenu({
- className,
- children,
- viewport = true,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
- viewport?: boolean;
-}) {
- return (
- <NavigationMenuPrimitive.Root
- data-slot="navigation-menu"
- data-viewport={viewport}
- className={cn(
- "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
- className,
- )}
- {...props}
- >
- {children}
- {viewport && <NavigationMenuViewport />}
- </NavigationMenuPrimitive.Root>
- );
-}
-
-function NavigationMenuList({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
- return (
- <NavigationMenuPrimitive.List
- data-slot="navigation-menu-list"
- className={cn(
- "group flex flex-1 list-none items-center justify-center gap-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function NavigationMenuItem({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
- return (
- <NavigationMenuPrimitive.Item
- data-slot="navigation-menu-item"
- className={cn("relative", className)}
- {...props}
- />
- );
-}
-
-const navigationMenuTriggerStyle = cva(
- "group/navigation-menu-trigger inline-flex h-9 w-max items-center justify-center rounded-none px-2.5 py-1.5 text-xs font-medium transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-1 focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-popup-open:bg-muted/50 data-popup-open:hover:bg-muted data-open:bg-muted/50 data-open:hover:bg-muted data-open:focus:bg-muted",
-);
-
-function NavigationMenuTrigger({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
- return (
- <NavigationMenuPrimitive.Trigger
- data-slot="navigation-menu-trigger"
- className={cn(navigationMenuTriggerStyle(), "group", className)}
- {...props}
- >
- {children}{" "}
- <ChevronDownIcon
- className="relative top-px ml-1 size-3 transition duration-300 group-data-popup-open/navigation-menu-trigger:rotate-180 group-data-open/navigation-menu-trigger:rotate-180"
- aria-hidden="true"
- />
- </NavigationMenuPrimitive.Trigger>
- );
-}
-
-function NavigationMenuContent({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
- return (
- <NavigationMenuPrimitive.Content
- data-slot="navigation-menu-content"
- className={cn(
- "top-0 left-0 w-full p-1 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-none group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:ring-1 group-data-[viewport=false]/navigation-menu:ring-foreground/10 group-data-[viewport=false]/navigation-menu:duration-300 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none md:absolute md:w-auto group-data-[viewport=false]/navigation-menu:data-open:animate-in group-data-[viewport=false]/navigation-menu:data-open:fade-in-0 group-data-[viewport=false]/navigation-menu:data-open:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-closed:animate-out group-data-[viewport=false]/navigation-menu:data-closed:fade-out-0 group-data-[viewport=false]/navigation-menu:data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- );
-}
-
-function NavigationMenuViewport({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
- return (
- <div
- className={cn(
- "absolute top-full left-0 isolate z-50 flex justify-center",
- )}
- >
- <NavigationMenuPrimitive.Viewport
- data-slot="navigation-menu-viewport"
- className={cn(
- "origin-top-center relative mt-1.5 h-(--radix-navigation-menu-viewport-height) w-full overflow-hidden rounded-none bg-popover text-popover-foreground shadow ring-1 ring-foreground/10 duration-100 md:w-(--radix-navigation-menu-viewport-width) data-open:animate-in data-open:zoom-in-90 data-closed:animate-out data-closed:zoom-out-90",
- className,
- )}
- {...props}
- />
- </div>
- );
-}
-
-function NavigationMenuLink({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
- return (
- <NavigationMenuPrimitive.Link
- data-slot="navigation-menu-link"
- className={cn(
- "flex items-center gap-2 rounded-none p-2 text-xs transition-all outline-none hover:bg-muted focus:bg-muted focus-visible:ring-1 focus-visible:ring-ring/50 focus-visible:outline-1 in-data-[slot=navigation-menu-content]:rounded-none data-active:bg-muted/50 data-active:hover:bg-muted data-active:focus:bg-muted [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- />
- );
-}
-
-function NavigationMenuIndicator({
- className,
- ...props
-}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
- return (
- <NavigationMenuPrimitive.Indicator
- data-slot="navigation-menu-indicator"
- className={cn(
- "top-full z-1 flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
- className,
- )}
- {...props}
- >
- <div className="relative top-[60%] h-2 w-2 rotate-45 rounded-none bg-border shadow-md" />
- </NavigationMenuPrimitive.Indicator>
- );
-}
-
-export {
- NavigationMenu,
- NavigationMenuContent,
- NavigationMenuIndicator,
- NavigationMenuItem,
- NavigationMenuLink,
- NavigationMenuList,
- NavigationMenuTrigger,
- NavigationMenuViewport,
- navigationMenuTriggerStyle,
-};
diff --git a/packages/ui/src/components/numbered-pagination.tsx b/packages/ui/src/components/numbered-pagination.tsx
deleted file mode 100644
index 83774ec3..00000000
--- a/packages/ui/src/components/numbered-pagination.tsx
+++ /dev/null
@@ -1,103 +0,0 @@
-"use client";
-
-import {
- Pagination,
- PaginationContent,
- PaginationEllipsis,
- PaginationItem,
- PaginationLink,
- PaginationNext,
- PaginationPrevious,
-} from "@crm/ui/components/pagination";
-
-type PageEntry = number | "start-ellipsis" | "end-ellipsis";
-
-/** First, last, and a window around the current page; ellipses for the rest. */
-function paginationRange(current: number, total: number): PageEntry[] {
- if (total <= 7) {
- return Array.from({ length: total }, (_, index) => index + 1);
- }
-
- const start = Math.max(2, current - 1);
- const end = Math.min(total - 1, current + 1);
- const entries: PageEntry[] = [1];
-
- if (start > 2) entries.push("start-ellipsis");
- for (let page = start; page <= end; page++) entries.push(page);
- if (end < total - 1) entries.push("end-ellipsis");
-
- entries.push(total);
- return entries;
-}
-
-export function NumberedPagination({
- currentPage,
- totalPages,
- onPageChange,
-}: {
- currentPage: number;
- totalPages: number;
- onPageChange: (page: number) => void;
-}) {
- if (totalPages <= 1) return null;
-
- const goToPage = (page: number) => {
- const next = Math.min(Math.max(page, 1), totalPages);
- if (next !== currentPage) onPageChange(next);
- };
-
- return (
- <Pagination>
- <PaginationContent>
- <PaginationItem>
- <PaginationPrevious
- href="#"
- aria-disabled={currentPage === 1 || undefined}
- className={
- currentPage === 1 ? "pointer-events-none opacity-50" : undefined
- }
- onClick={(event) => {
- event.preventDefault();
- goToPage(currentPage - 1);
- }}
- />
- </PaginationItem>
- {paginationRange(currentPage, totalPages).map((entry) =>
- entry === "start-ellipsis" || entry === "end-ellipsis" ? (
- <PaginationItem key={entry} className="max-sm:hidden">
- <PaginationEllipsis />
- </PaginationItem>
- ) : (
- <PaginationItem key={entry} className="max-sm:hidden">
- <PaginationLink
- href="#"
- isActive={entry === currentPage}
- onClick={(event) => {
- event.preventDefault();
- goToPage(entry);
- }}
- >
- {entry}
- </PaginationLink>
- </PaginationItem>
- ),
- )}
- <PaginationItem>
- <PaginationNext
- href="#"
- aria-disabled={currentPage === totalPages || undefined}
- className={
- currentPage === totalPages
- ? "pointer-events-none opacity-50"
- : undefined
- }
- onClick={(event) => {
- event.preventDefault();
- goToPage(currentPage + 1);
- }}
- />
- </PaginationItem>
- </PaginationContent>
- </Pagination>
- );
-}
diff --git a/packages/ui/src/components/pagination.tsx b/packages/ui/src/components/pagination.tsx
deleted file mode 100644
index 3c131d2b..00000000
--- a/packages/ui/src/components/pagination.tsx
+++ /dev/null
@@ -1,132 +0,0 @@
-import { Button } from "@crm/ui/components/button";
-
-import { cn } from "@crm/ui/lib/utils";
-import {
- ChevronLeftIcon,
- ChevronRightIcon,
- MoreHorizontalIcon,
-} from "lucide-react";
-import type * as React from "react";
-
-function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
- return (
- <nav
- role="navigation"
- aria-label="pagination"
- data-slot="pagination"
- className={cn("mx-auto flex w-full justify-center", className)}
- {...props}
- />
- );
-}
-
-function PaginationContent({
- className,
- ...props
-}: React.ComponentProps<"ul">) {
- return (
- <ul
- data-slot="pagination-content"
- className={cn("flex items-center gap-0.5", className)}
- {...props}
- />
- );
-}
-
-function PaginationItem({ ...props }: React.ComponentProps<"li">) {
- return <li data-slot="pagination-item" {...props} />;
-}
-
-type PaginationLinkProps = {
- isActive?: boolean;
-} & Pick<React.ComponentProps<typeof Button>, "size"> &
- React.ComponentProps<"a">;
-
-function PaginationLink({
- className,
- isActive,
- size = "icon",
- ...props
-}: PaginationLinkProps) {
- return (
- <Button
- asChild
- variant={isActive ? "outline" : "ghost"}
- size={size}
- className={cn(className)}
- >
- <a
- aria-current={isActive ? "page" : undefined}
- data-slot="pagination-link"
- data-active={isActive}
- {...props}
- />
- </Button>
- );
-}
-
-function PaginationPrevious({
- className,
- text = "Previous",
- ...props
-}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
- return (
- <PaginationLink
- aria-label="Go to previous page"
- size="default"
- className={cn("pl-1.5!", className)}
- {...props}
- >
- <ChevronLeftIcon data-icon="inline-start" />
- <span className="hidden sm:block">{text}</span>
- </PaginationLink>
- );
-}
-
-function PaginationNext({
- className,
- text = "Next",
- ...props
-}: React.ComponentProps<typeof PaginationLink> & { text?: string }) {
- return (
- <PaginationLink
- aria-label="Go to next page"
- size="default"
- className={cn("pr-1.5!", className)}
- {...props}
- >
- <span className="hidden sm:block">{text}</span>
- <ChevronRightIcon data-icon="inline-end" />
- </PaginationLink>
- );
-}
-
-function PaginationEllipsis({
- className,
- ...props
-}: React.ComponentProps<"span">) {
- return (
- <span
- aria-hidden
- data-slot="pagination-ellipsis"
- className={cn(
- "flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
- {...props}
- >
- <MoreHorizontalIcon />
- <span className="sr-only">More pages</span>
- </span>
- );
-}
-
-export {
- Pagination,
- PaginationContent,
- PaginationEllipsis,
- PaginationItem,
- PaginationLink,
- PaginationNext,
- PaginationPrevious,
-};
diff --git a/packages/ui/src/components/popover.tsx b/packages/ui/src/components/popover.tsx
deleted file mode 100644
index 3200a759..00000000
--- a/packages/ui/src/components/popover.tsx
+++ /dev/null
@@ -1,88 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { Popover as PopoverPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function Popover({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Root>) {
- return <PopoverPrimitive.Root data-slot="popover" {...props} />;
-}
-
-function PopoverTrigger({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
- return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;
-}
-
-function PopoverContent({
- className,
- align = "center",
- sideOffset = 4,
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Content>) {
- return (
- <PopoverPrimitive.Portal>
- <PopoverPrimitive.Content
- data-slot="popover-content"
- align={align}
- sideOffset={sideOffset}
- className={cn(
- "z-50 flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-none bg-popover p-2.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
- className,
- )}
- {...props}
- />
- </PopoverPrimitive.Portal>
- );
-}
-
-function PopoverAnchor({
- ...props
-}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
- return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />;
-}
-
-function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="popover-header"
- className={cn("flex flex-col gap-1 text-xs", className)}
- {...props}
- />
- );
-}
-
-function PopoverTitle({ className, ...props }: React.ComponentProps<"h2">) {
- return (
- <div
- data-slot="popover-title"
- className={cn("text-sm font-medium", className)}
- {...props}
- />
- );
-}
-
-function PopoverDescription({
- className,
- ...props
-}: React.ComponentProps<"p">) {
- return (
- <p
- data-slot="popover-description"
- className={cn("text-xs/relaxed text-muted-foreground", className)}
- {...props}
- />
- );
-}
-
-export {
- Popover,
- PopoverAnchor,
- PopoverContent,
- PopoverDescription,
- PopoverHeader,
- PopoverTitle,
- PopoverTrigger,
-};
diff --git a/packages/ui/src/components/progress.tsx b/packages/ui/src/components/progress.tsx
deleted file mode 100644
index c0aa9b6e..00000000
--- a/packages/ui/src/components/progress.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-"use client";
-
-import { type Bloom, bloomClass } from "@crm/ui/lib/dither";
-import { cn } from "@crm/ui/lib/utils";
-import { Progress as ProgressPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function Progress({
- className,
- value,
- bloom = "low",
- ...props
-}: React.ComponentProps<typeof ProgressPrimitive.Root> & {
- bloom?: Bloom;
-}) {
- return (
- <ProgressPrimitive.Root
- data-slot="progress"
- className={cn(
- "relative flex h-1 w-full items-center overflow-hidden rounded-none bg-muted",
- className,
- )}
- {...props}
- >
- <ProgressPrimitive.Indicator
- data-slot="progress-indicator"
- className={cn(
- "size-full flex-1 bg-primary transition-all",
- bloomClass(bloom),
- )}
- style={
- {
- transform: `translateX(-${100 - (value || 0)}%)`,
- "--bloom-color": "var(--color-primary)",
- } as React.CSSProperties
- }
- />
- </ProgressPrimitive.Root>
- );
-}
-
-export { Progress };
diff --git a/packages/ui/src/components/radio-group.tsx b/packages/ui/src/components/radio-group.tsx
deleted file mode 100644
index b4254523..00000000
--- a/packages/ui/src/components/radio-group.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { RadioGroup as RadioGroupPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function RadioGroup({
- className,
- ...props
-}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
- return (
- <RadioGroupPrimitive.Root
- data-slot="radio-group"
- className={cn("grid w-full gap-2", className)}
- {...props}
- />
- );
-}
-
-function RadioGroupItem({
- className,
- ...props
-}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
- return (
- <RadioGroupPrimitive.Item
- data-slot="radio-group-item"
- className={cn(
- "group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary",
- className,
- )}
- {...props}
- >
- <RadioGroupPrimitive.Indicator
- data-slot="radio-group-indicator"
- className="flex size-4 items-center justify-center"
- >
- <span className="absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground" />
- </RadioGroupPrimitive.Indicator>
- </RadioGroupPrimitive.Item>
- );
-}
-
-export { RadioGroup, RadioGroupItem };
diff --git a/packages/ui/src/components/resizable.tsx b/packages/ui/src/components/resizable.tsx
deleted file mode 100644
index 4f79c43c..00000000
--- a/packages/ui/src/components/resizable.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import * as ResizablePrimitive from "react-resizable-panels";
-
-function ResizablePanelGroup({
- className,
- ...props
-}: ResizablePrimitive.GroupProps) {
- return (
- <ResizablePrimitive.Group
- data-slot="resizable-panel-group"
- className={cn(
- "flex h-full w-full aria-[orientation=vertical]:flex-col",
- className,
- )}
- {...props}
- />
- );
-}
-
-function ResizablePanel({ ...props }: ResizablePrimitive.PanelProps) {
- return <ResizablePrimitive.Panel data-slot="resizable-panel" {...props} />;
-}
-
-function ResizableHandle({
- withHandle,
- className,
- ...props
-}: ResizablePrimitive.SeparatorProps & {
- withHandle?: boolean;
-}) {
- return (
- <ResizablePrimitive.Separator
- data-slot="resizable-handle"
- className={cn(
- "relative flex w-px items-center justify-center bg-border ring-offset-background after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",
- className,
- )}
- {...props}
- >
- {withHandle && (
- <div className="z-10 flex h-6 w-1 shrink-0 rounded-none bg-border" />
- )}
- </ResizablePrimitive.Separator>
- );
-}
-
-export { ResizableHandle, ResizablePanel, ResizablePanelGroup };
diff --git a/packages/ui/src/components/scroll-area.tsx b/packages/ui/src/components/scroll-area.tsx
deleted file mode 100644
index d20b380b..00000000
--- a/packages/ui/src/components/scroll-area.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function ScrollArea({
- className,
- children,
- ...props
-}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
- return (
- <ScrollAreaPrimitive.Root
- data-slot="scroll-area"
- className={cn("relative", className)}
- {...props}
- >
- <ScrollAreaPrimitive.Viewport
- data-slot="scroll-area-viewport"
- className="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1"
- >
- {children}
- </ScrollAreaPrimitive.Viewport>
- <ScrollBar />
- <ScrollAreaPrimitive.Corner />
- </ScrollAreaPrimitive.Root>
- );
-}
-
-function ScrollBar({
- className,
- orientation = "vertical",
- ...props
-}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
- return (
- <ScrollAreaPrimitive.ScrollAreaScrollbar
- data-slot="scroll-area-scrollbar"
- data-orientation={orientation}
- orientation={orientation}
- className={cn(
- "flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
- className,
- )}
- {...props}
- >
- <ScrollAreaPrimitive.ScrollAreaThumb
- data-slot="scroll-area-thumb"
- className="relative flex-1 rounded-none bg-border"
- />
- </ScrollAreaPrimitive.ScrollAreaScrollbar>
- );
-}
-
-export { ScrollArea, ScrollBar };
diff --git a/packages/ui/src/components/select.tsx b/packages/ui/src/components/select.tsx
index 9d65cb55..12eabac4 100644
--- a/packages/ui/src/components/select.tsx
+++ b/packages/ui/src/components/select.tsx
@@ -1,6 +1,7 @@
"use client";
import { cn } from "@crm/ui/lib/utils";
+import { cva, type VariantProps } from "class-variance-authority";
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
import { Select as SelectPrimitive } from "radix-ui";
import type * as React from "react";
@@ -30,27 +31,48 @@ function SelectValue({
return <SelectPrimitive.Value data-slot="select-value" {...props} />;
}
+// `ghost` is for a select sitting in a row of otherwise plain values — an
+// editable property in a record sheet. A boxed control among bare text reads
+// as the only thing on the panel you are allowed to touch, which is the
+// opposite of true: it borrows the surrounding row's look until you point at
+// it, and its chevron only appears on hover or focus.
+const selectTriggerVariants = cva(
+ "flex w-fit items-center justify-between gap-1.5 rounded-none text-xs whitespace-nowrap transition-colors outline-none select-none disabled:cursor-not-allowed disabled:opacity-50 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
+ {
+ variants: {
+ variant: {
+ default:
+ "border border-input bg-transparent py-2 pr-2 pl-2.5 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
+ ghost:
+ "border border-transparent bg-transparent px-2 hover:border-input hover:bg-muted/40 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 data-[state=open]:border-input data-[state=open]:bg-muted/40 [&_svg]:opacity-0 hover:[&_svg]:opacity-100 focus-visible:[&_svg]:opacity-100 data-[state=open]:[&_svg]:opacity-100",
+ },
+ },
+ defaultVariants: {
+ variant: "default",
+ },
+ },
+);
+
function SelectTrigger({
className,
size = "default",
+ variant,
children,
...props
-}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
- size?: "sm" | "default";
-}) {
+}: React.ComponentProps<typeof SelectPrimitive.Trigger> &
+ VariantProps<typeof selectTriggerVariants> & {
+ size?: "sm" | "default";
+ }) {
return (
<SelectPrimitive.Trigger
data-slot="select-trigger"
data-size={size}
- className={cn(
- "flex w-fit items-center justify-between gap-1.5 rounded-none border border-input bg-transparent py-2 pr-2 pl-2.5 text-xs whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-none *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- className,
- )}
+ className={cn(selectTriggerVariants({ variant }), className)}
{...props}
>
{children}
<SelectPrimitive.Icon asChild>
- <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground" />
+ <ChevronDownIcon className="pointer-events-none size-4 text-muted-foreground transition-opacity" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
);
diff --git a/packages/ui/src/components/sidebar.tsx b/packages/ui/src/components/sidebar.tsx
deleted file mode 100644
index 63d4c2ac..00000000
--- a/packages/ui/src/components/sidebar.tsx
+++ /dev/null
@@ -1,692 +0,0 @@
-"use client";
-
-import { Button } from "@crm/ui/components/button";
-import { Input } from "@crm/ui/components/input";
-import { Separator } from "@crm/ui/components/separator";
-import {
- Sheet,
- SheetContent,
- SheetDescription,
- SheetHeader,
- SheetTitle,
-} from "@crm/ui/components/sheet";
-import { Skeleton } from "@crm/ui/components/skeleton";
-import {
- Tooltip,
- TooltipContent,
- TooltipTrigger,
-} from "@crm/ui/components/tooltip";
-import { useIsMobile } from "@crm/ui/hooks/use-mobile";
-import { cn } from "@crm/ui/lib/utils";
-import { cva, type VariantProps } from "class-variance-authority";
-import { PanelLeftIcon } from "lucide-react";
-import { Slot } from "radix-ui";
-import * as React from "react";
-
-const SIDEBAR_COOKIE_NAME = "sidebar_state";
-const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
-const SIDEBAR_WIDTH = "16rem";
-const SIDEBAR_WIDTH_MOBILE = "18rem";
-const SIDEBAR_WIDTH_ICON = "3rem";
-const SIDEBAR_KEYBOARD_SHORTCUT = "b";
-
-type SidebarContextProps = {
- state: "expanded" | "collapsed";
- open: boolean;
- setOpen: (open: boolean) => void;
- openMobile: boolean;
- setOpenMobile: (open: boolean) => void;
- isMobile: boolean;
- toggleSidebar: () => void;
-};
-
-const SidebarContext = React.createContext<SidebarContextProps | null>(null);
-
-function useSidebar() {
- const context = React.useContext(SidebarContext);
- if (!context) {
- throw new Error("useSidebar must be used within a SidebarProvider.");
- }
-
- return context;
-}
-
-function SidebarProvider({
- defaultOpen = true,
- open: openProp,
- onOpenChange: setOpenProp,
- className,
- style,
- children,
- ...props
-}: React.ComponentProps<"div"> & {
- defaultOpen?: boolean;
- open?: boolean;
- onOpenChange?: (open: boolean) => void;
-}) {
- const isMobile = useIsMobile();
- const [openMobile, setOpenMobile] = React.useState(false);
-
- const [_open, _setOpen] = React.useState(defaultOpen);
- const open = openProp ?? _open;
- const setOpen = React.useCallback(
- (value: boolean | ((value: boolean) => boolean)) => {
- const openState = typeof value === "function" ? value(open) : value;
- if (setOpenProp) {
- setOpenProp(openState);
- } else {
- _setOpen(openState);
- }
-
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
- },
- [setOpenProp, open],
- );
-
- const toggleSidebar = React.useCallback(() => {
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
- }, [isMobile, setOpen, setOpenMobile]);
-
- React.useEffect(() => {
- const handleKeyDown = (event: KeyboardEvent) => {
- if (
- event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
- (event.metaKey || event.ctrlKey)
- ) {
- event.preventDefault();
- toggleSidebar();
- }
- };
-
- window.addEventListener("keydown", handleKeyDown);
- return () => window.removeEventListener("keydown", handleKeyDown);
- }, [toggleSidebar]);
-
- const state = open ? "expanded" : "collapsed";
-
- const contextValue = React.useMemo<SidebarContextProps>(
- () => ({
- state,
- open,
- setOpen,
- isMobile,
- openMobile,
- setOpenMobile,
- toggleSidebar,
- }),
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
- );
-
- return (
- <SidebarContext.Provider value={contextValue}>
- <div
- data-slot="sidebar-wrapper"
- style={
- {
- "--sidebar-width": SIDEBAR_WIDTH,
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
- ...style,
- } as React.CSSProperties
- }
- className={cn(
- "group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- </SidebarContext.Provider>
- );
-}
-
-function Sidebar({
- side = "left",
- variant = "sidebar",
- collapsible = "offcanvas",
- className,
- children,
- dir,
- ...props
-}: React.ComponentProps<"div"> & {
- side?: "left" | "right";
- variant?: "sidebar" | "floating" | "inset";
- collapsible?: "offcanvas" | "icon" | "none";
-}) {
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
-
- if (collapsible === "none") {
- return (
- <div
- data-slot="sidebar"
- className={cn(
- "flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
- className,
- )}
- {...props}
- >
- {children}
- </div>
- );
- }
-
- if (isMobile) {
- return (
- <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
- <SheetContent
- dir={dir}
- data-sidebar="sidebar"
- data-slot="sidebar"
- data-mobile="true"
- className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
- style={
- {
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
- } as React.CSSProperties
- }
- side={side}
- >
- <SheetHeader className="sr-only">
- <SheetTitle>Sidebar</SheetTitle>
- <SheetDescription>Displays the mobile sidebar.</SheetDescription>
- </SheetHeader>
- <div className="flex h-full w-full flex-col">{children}</div>
- </SheetContent>
- </Sheet>
- );
- }
-
- return (
- <div
- className="group peer hidden text-sidebar-foreground md:block"
- data-state={state}
- data-collapsible={state === "collapsed" ? collapsible : ""}
- data-variant={variant}
- data-side={side}
- data-slot="sidebar"
- >
- {/* This is what handles the sidebar gap on desktop */}
- <div
- data-slot="sidebar-gap"
- className={cn(
- "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
- "group-data-[collapsible=offcanvas]:w-0",
- "group-data-[side=right]:rotate-180",
- variant === "floating" || variant === "inset"
- ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
- )}
- />
- <div
- data-slot="sidebar-container"
- data-side={side}
- className={cn(
- "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",
- variant === "floating" || variant === "inset"
- ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
- className,
- )}
- {...props}
- >
- <div
- data-sidebar="sidebar"
- data-slot="sidebar-inner"
- className="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-none group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
- >
- {children}
- </div>
- </div>
- </div>
- );
-}
-
-function SidebarTrigger({
- className,
- onClick,
- ...props
-}: React.ComponentProps<typeof Button>) {
- const { toggleSidebar } = useSidebar();
-
- return (
- <Button
- data-sidebar="trigger"
- data-slot="sidebar-trigger"
- variant="ghost"
- size="icon-sm"
- className={cn(className)}
- onClick={(event) => {
- onClick?.(event);
- toggleSidebar();
- }}
- {...props}
- >
- <PanelLeftIcon />
- <span className="sr-only">Toggle Sidebar</span>
- </Button>
- );
-}
-
-function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
- const { toggleSidebar } = useSidebar();
-
- return (
- <button
- data-sidebar="rail"
- data-slot="sidebar-rail"
- aria-label="Toggle Sidebar"
- tabIndex={-1}
- onClick={toggleSidebar}
- title="Toggle Sidebar"
- className={cn(
- "absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
- "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
- "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
- return (
- <main
- data-slot="sidebar-inset"
- className={cn(
- "relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-none md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarInput({
- className,
- ...props
-}: React.ComponentProps<typeof Input>) {
- return (
- <Input
- data-slot="sidebar-input"
- data-sidebar="input"
- className={cn("h-8 w-full bg-background shadow-none", className)}
- {...props}
- />
- );
-}
-
-function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-header"
- data-sidebar="header"
- className={cn("flex flex-col gap-2 p-2", className)}
- {...props}
- />
- );
-}
-
-function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-footer"
- data-sidebar="footer"
- className={cn("flex flex-col gap-2 p-2", className)}
- {...props}
- />
- );
-}
-
-function SidebarSeparator({
- className,
- ...props
-}: React.ComponentProps<typeof Separator>) {
- return (
- <Separator
- data-slot="sidebar-separator"
- data-sidebar="separator"
- className={cn("mx-2 w-auto bg-sidebar-border", className)}
- {...props}
- />
- );
-}
-
-function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-content"
- data-sidebar="content"
- className={cn(
- "no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-group"
- data-sidebar="group"
- className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
- {...props}
- />
- );
-}
-
-function SidebarGroupLabel({
- className,
- asChild = false,
- ...props
-}: React.ComponentProps<"div"> & { asChild?: boolean }) {
- const Comp = asChild ? Slot.Root : "div";
-
- return (
- <Comp
- data-slot="sidebar-group-label"
- data-sidebar="group-label"
- className={cn(
- "flex h-8 shrink-0 items-center rounded-none px-2 text-xs text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarGroupAction({
- className,
- asChild = false,
- ...props
-}: React.ComponentProps<"button"> & { asChild?: boolean }) {
- const Comp = asChild ? Slot.Root : "button";
-
- return (
- <Comp
- data-slot="sidebar-group-action"
- data-sidebar="group-action"
- className={cn(
- "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-none p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarGroupContent({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-group-content"
- data-sidebar="group-content"
- className={cn("w-full text-xs", className)}
- {...props}
- />
- );
-}
-
-function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
- return (
- <ul
- data-slot="sidebar-menu"
- data-sidebar="menu"
- className={cn("flex w-full min-w-0 flex-col gap-0", className)}
- {...props}
- />
- );
-}
-
-function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
- return (
- <li
- data-slot="sidebar-menu-item"
- data-sidebar="menu-item"
- className={cn("group/menu-item relative", className)}
- {...props}
- />
- );
-}
-
-const sidebarMenuButtonVariants = cva(
- "peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-none p-2 text-left text-xs ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate",
- {
- variants: {
- variant: {
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
- outline:
- "bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]",
- },
- size: {
- default: "h-8 text-xs",
- sm: "h-7 text-xs",
- lg: "h-12 text-xs group-data-[collapsible=icon]:p-0!",
- },
- },
- defaultVariants: {
- variant: "default",
- size: "default",
- },
- },
-);
-
-function SidebarMenuButton({
- asChild = false,
- isActive = false,
- variant = "default",
- size = "default",
- tooltip,
- className,
- ...props
-}: React.ComponentProps<"button"> & {
- asChild?: boolean;
- isActive?: boolean;
- tooltip?: string | React.ComponentProps<typeof TooltipContent>;
-} & VariantProps<typeof sidebarMenuButtonVariants>) {
- const Comp = asChild ? Slot.Root : "button";
- const { isMobile, state } = useSidebar();
-
- const button = (
- <Comp
- data-slot="sidebar-menu-button"
- data-sidebar="menu-button"
- data-size={size}
- data-active={isActive}
- className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
- {...props}
- />
- );
-
- if (!tooltip) {
- return button;
- }
-
- if (typeof tooltip === "string") {
- tooltip = {
- children: tooltip,
- };
- }
-
- return (
- <Tooltip>
- <TooltipTrigger asChild>{button}</TooltipTrigger>
- <TooltipContent
- side="right"
- align="center"
- hidden={state !== "collapsed" || isMobile}
- {...tooltip}
- />
- </Tooltip>
- );
-}
-
-function SidebarMenuAction({
- className,
- asChild = false,
- showOnHover = false,
- ...props
-}: React.ComponentProps<"button"> & {
- asChild?: boolean;
- showOnHover?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "button";
-
- return (
- <Comp
- data-slot="sidebar-menu-action"
- data-sidebar="menu-action"
- className={cn(
- "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-none p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
- showOnHover &&
- "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarMenuBadge({
- className,
- ...props
-}: React.ComponentProps<"div">) {
- return (
- <div
- data-slot="sidebar-menu-badge"
- data-sidebar="menu-badge"
- className={cn(
- "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-none px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarMenuSkeleton({
- className,
- showIcon = false,
- ...props
-}: React.ComponentProps<"div"> & {
- showIcon?: boolean;
-}) {
- const [width] = React.useState(() => {
- return `${Math.floor(Math.random() * 40) + 50}%`;
- });
-
- return (
- <div
- data-slot="sidebar-menu-skeleton"
- data-sidebar="menu-skeleton"
- className={cn("flex h-8 items-center gap-2 rounded-none px-2", className)}
- {...props}
- >
- {showIcon && (
- <Skeleton
- className="size-4 rounded-none"
- data-sidebar="menu-skeleton-icon"
- />
- )}
- <Skeleton
- className="h-4 max-w-(--skeleton-width) flex-1"
- data-sidebar="menu-skeleton-text"
- style={
- {
- "--skeleton-width": width,
- } as React.CSSProperties
- }
- />
- </div>
- );
-}
-
-function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
- return (
- <ul
- data-slot="sidebar-menu-sub"
- data-sidebar="menu-sub"
- className={cn(
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
- className,
- )}
- {...props}
- />
- );
-}
-
-function SidebarMenuSubItem({
- className,
- ...props
-}: React.ComponentProps<"li">) {
- return (
- <li
- data-slot="sidebar-menu-sub-item"
- data-sidebar="menu-sub-item"
- className={cn("group/menu-sub-item relative", className)}
- {...props}
- />
- );
-}
-
-function SidebarMenuSubButton({
- asChild = false,
- size = "md",
- isActive = false,
- className,
- ...props
-}: React.ComponentProps<"a"> & {
- asChild?: boolean;
- size?: "sm" | "md";
- isActive?: boolean;
-}) {
- const Comp = asChild ? Slot.Root : "a";
-
- return (
- <Comp
- data-slot="sidebar-menu-sub-button"
- data-sidebar="menu-sub-button"
- data-size={size}
- data-active={isActive}
- className={cn(
- "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-none px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[size=md]:text-xs data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
- className,
- )}
- {...props}
- />
- );
-}
-
-export {
- Sidebar,
- SidebarContent,
- SidebarFooter,
- SidebarGroup,
- SidebarGroupAction,
- SidebarGroupContent,
- SidebarGroupLabel,
- SidebarHeader,
- SidebarInput,
- SidebarInset,
- SidebarMenu,
- SidebarMenuAction,
- SidebarMenuBadge,
- SidebarMenuButton,
- SidebarMenuItem,
- SidebarMenuSkeleton,
- SidebarMenuSub,
- SidebarMenuSubButton,
- SidebarMenuSubItem,
- SidebarProvider,
- SidebarRail,
- SidebarSeparator,
- SidebarTrigger,
- useSidebar,
-};
diff --git a/packages/ui/src/components/simple-table.tsx b/packages/ui/src/components/simple-table.tsx
index 494bbdb6..3b143d4c 100644
--- a/packages/ui/src/components/simple-table.tsx
+++ b/packages/ui/src/components/simple-table.tsx
@@ -28,10 +28,16 @@ const ALIGN_CLASS = {
center: "text-center",
} as const;
+const PANEL_SURFACE = {
+ popover: "bg-popover [&_th]:bg-popover",
+ page: "bg-background [&_th]:bg-background",
+} as const;
+
export function SimpleTable({
columns,
children,
variant = "default",
+ surface = "popover",
className,
containerClassName,
headerClassName,
@@ -46,6 +52,12 @@ export function SimpleTable({
* a column of blocks and scrolls with the page.
*/
variant?: "default" | "panel";
+ /**
+ * What the pinned header sits on, so it hides the rows passing under it
+ * instead of showing a strip of the wrong surface: `popover` inside a sheet,
+ * `page` inside a panel on the page itself.
+ */
+ surface?: keyof typeof PANEL_SURFACE;
className?: string;
containerClassName?: string;
headerClassName?: string;
@@ -64,7 +76,7 @@ export function SimpleTable({
>
<TableHeader
className={cn(
- panel && "sticky top-0 z-10 bg-popover [&_th]:bg-popover",
+ panel && ["sticky top-0 z-10", PANEL_SURFACE[surface]],
headerClassName,
)}
>
diff --git a/packages/ui/src/components/slider.tsx b/packages/ui/src/components/slider.tsx
deleted file mode 100644
index c2895a23..00000000
--- a/packages/ui/src/components/slider.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { Slider as SliderPrimitive } from "radix-ui";
-import * as React from "react";
-
-function Slider({
- className,
- defaultValue,
- value,
- min = 0,
- max = 100,
- ...props
-}: React.ComponentProps<typeof SliderPrimitive.Root>) {
- const _values = React.useMemo(
- () =>
- Array.isArray(value)
- ? value
- : Array.isArray(defaultValue)
- ? defaultValue
- : [min, max],
- [value, defaultValue, min, max],
- );
-
- return (
- <SliderPrimitive.Root
- data-slot="slider"
- defaultValue={defaultValue}
- value={value}
- min={min}
- max={max}
- className={cn(
- "relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col",
- className,
- )}
- {...props}
- >
- <SliderPrimitive.Track
- data-slot="slider-track"
- className="relative grow overflow-hidden rounded-none bg-muted data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
- >
- <SliderPrimitive.Range
- data-slot="slider-range"
- className="absolute bg-primary select-none data-horizontal:h-full data-vertical:w-full"
- />
- </SliderPrimitive.Track>
- {Array.from({ length: _values.length }, (_, index) => (
- <SliderPrimitive.Thumb
- data-slot="slider-thumb"
- key={index}
- className="relative block size-3 shrink-0 rounded-none border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-1 focus-visible:ring-1 focus-visible:outline-hidden active:ring-1 disabled:pointer-events-none disabled:opacity-50"
- />
- ))}
- </SliderPrimitive.Root>
- );
-}
-
-export { Slider };
diff --git a/packages/ui/src/components/switch.tsx b/packages/ui/src/components/switch.tsx
deleted file mode 100644
index 1df25c8b..00000000
--- a/packages/ui/src/components/switch.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-"use client";
-
-import { cn } from "@crm/ui/lib/utils";
-import { Switch as SwitchPrimitive } from "radix-ui";
-import type * as React from "react";
-
-function Switch({
- className,
- size = "default",
- ...props
-}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
- size?: "sm" | "default";
-}) {
- return (
- <SwitchPrimitive.Root
- data-slot="switch"
- data-size={size}
- className={cn(
- "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
- className,
- )}
- {...props}
- >
- <SwitchPrimitive.Thumb
- data-slot="switch-thumb"
- className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
- />
- </SwitchPrimitive.Root>
- );
-}
-
-export { Switch };
diff --git a/packages/ui/src/components/tabs.tsx b/packages/ui/src/components/tabs.tsx
index 1161a43b..e516fd06 100644
--- a/packages/ui/src/components/tabs.tsx
+++ b/packages/ui/src/components/tabs.tsx
@@ -63,7 +63,12 @@ function TabsTrigger({
data-slot="tabs-trigger"
className={cn(
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-none border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
- "group-data-[variant=line]/tabs-list:px-0 group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
+ // `flex-none` for line tabs: they are labels with a rule under the
+ // active one, so each is as wide as its word. Letting them share the
+ // row equally stretches four tabs across a whole sheet, and then the
+ // underline and the hover target are a quarter of the panel wide with
+ // the label marooned in the middle of them.
+ "group-data-[variant=line]/tabs-list:flex-none group-data-[variant=line]/tabs-list:px-0 group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
className,
diff --git a/packages/ui/src/lib/dither.ts b/packages/ui/src/lib/dither.ts
index 8fb7b9a6..dd4a8c84 100644
--- a/packages/ui/src/lib/dither.ts
+++ b/packages/ui/src/lib/dither.ts
@@ -10,9 +10,3 @@ const BLOOM_CLASS: Record<Bloom, string> = {
export function bloomClass(bloom: Bloom = "off"): string {
return BLOOM_CLASS[bloom];
}
-
-export const DITHER_CLASS = "dither";
-
-export function bloomColorForBgClass(bgClass: string): string {
- return `var(--color-${bgClass.replace(/^bg-/, "")})`;
-}
diff --git a/packages/ui/src/lib/format.ts b/packages/ui/src/lib/format.ts
index ec82b929..24ae28c1 100644
--- a/packages/ui/src/lib/format.ts
+++ b/packages/ui/src/lib/format.ts
@@ -24,7 +24,7 @@ export function formatCount(count: number, noun: string): string {
const WELL_FORMED_CURRENCY_CODE = /^[A-Za-z]{3}$/;
-export function displayCurrencyCode(currency: string): string {
+function displayCurrencyCode(currency: string): string {
return WELL_FORMED_CURRENCY_CODE.test(currency)
? currency.toUpperCase()
: "USD";
@@ -38,6 +38,30 @@ export function formatMoney(cents: number, currency = "usd"): string {
}).format(cents / 100);
}
+/**
+ * `"$128K"` — a headline where the exact dollar is noise.
+ *
+ * Deliberately separate from `formatMoney`: a figure a rep reads at a glance
+ * wants three characters, and a figure they are about to act on wants all of
+ * them. Rounding a row in a table would be a bug; rounding a KPI is the point.
+ */
+export function formatMoneyCompact(cents: number, currency = "usd"): string {
+ return new Intl.NumberFormat(undefined, {
+ style: "currency",
+ currency: displayCurrencyCode(currency),
+ notation: "compact",
+ maximumFractionDigits: cents % 100_000 === 0 ? 0 : 1,
+ }).format(cents / 100);
+}
+
+/** A 0–1 rate as `"62%"`. */
+export function formatPercent(rate: number): string {
+ return new Intl.NumberFormat(undefined, {
+ style: "percent",
+ maximumFractionDigits: 0,
+ }).format(rate);
+}
+
export function relativeTimeFromIso(iso: string | null | undefined): string {
if (!iso) return "—";
const then = new Date(iso).getTime();
diff --git a/packages/ui/src/styles/globals.css b/packages/ui/src/styles/globals.css
index 29a7a232..585e36bf 100644
--- a/packages/ui/src/styles/globals.css
+++ b/packages/ui/src/styles/globals.css
@@ -251,33 +251,14 @@
}
/*
- * Dither + bloom — the chart aesthetic (see dashboard-chart.tsx), ported to
- * plain HTML surfaces (status/severity indicators, meters, progress bars).
+ * Bloom — the chart aesthetic (see dashboard-chart.tsx), ported to plain HTML
+ * surfaces (status/severity indicators, meters, progress bars).
*
- * `.dither` overlays an ordered two-tone dot texture (a light dot + an offset
- * dark dot per 4px tile, matching the chart's SVG <pattern>) on top of any
- * filled element, adapting to the fill beneath it. `.bloom-*` adds a soft
- * colored halo via box-shadow; set `--bloom-color` on the element (defaults to
- * currentColor). Both are theme-independent.
+ * `.bloom-*` adds a soft colored halo via box-shadow; set `--bloom-color` on
+ * the element (it defaults to currentColor). Theme-independent, so a meter
+ * beside a row matches the plot above it.
*/
-:root {
- --dither-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Crect width='1.4' height='1.4' fill='%23ffffff' fill-opacity='.55'/%3E%3Crect x='2' y='2' width='1.4' height='1.4' fill='%23000000' fill-opacity='.5'/%3E%3C/svg%3E");
-}
-
@layer utilities {
- .dither {
- position: relative;
- }
- .dither::after {
- content: "";
- position: absolute;
- inset: 0;
- pointer-events: none;
- background-image: var(--dither-pattern);
- background-size: var(--dither-size, 4px) var(--dither-size, 4px);
- background-repeat: repeat;
- }
-
.bloom-low {
box-shadow: 0 0 4px var(--bloom-color, currentColor);
}