feat: Enhance provider components with detailed documentation and comments
- Added comprehensive comments and JSDoc-style documentation to NotificationProvider, ThemeProvider, UserProvider, and WebsiteThemeProvider for better clarity and maintainability. - Improved type definitions in index.ts for better code understanding and usage. - Introduced Docker support with Dockerfiles for various services including AI server, signaling server, and browser-use service. - Created a docker-compose.yml file to orchestrate multiple services including PostgreSQL, AI, scraper, and frontend. - Added a startup guide (startup.txt) for setting up the CRM environment on Ubuntu with Docker. - Included a .dockerignore file to exclude unnecessary files from Docker builds.
This commit is contained in:
@@ -1,11 +1,25 @@
|
||||
// ───────────────────────────────────────────────
|
||||
// Central Type Definitions
|
||||
// ───────────────────────────────────────────────
|
||||
// All shared TypeScript types used across the CRM.
|
||||
// Grouped by domain: auth, leads, notes, dashboard,
|
||||
// notifications, chats, and calendar.
|
||||
// ───────────────────────────────────────────────
|
||||
|
||||
// ── Lead Pipeline ──
|
||||
|
||||
/** Possible states for a lead in the sales pipeline. */
|
||||
export type LeadStatus =
|
||||
| "open"
|
||||
| "contacted"
|
||||
| "pending"
|
||||
| "closed"
|
||||
| "ignored";
|
||||
|
||||
/** Access roles assigned to users. */
|
||||
export type UserRole = "super_admin" | "admin" | "sales" | "dev";
|
||||
|
||||
/** A registered user of the CRM. */
|
||||
export interface User {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -17,6 +31,7 @@ export interface User {
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
/** A sales lead record with contact info and pipeline status. */
|
||||
export interface Lead {
|
||||
id: string;
|
||||
companyName: string;
|
||||
@@ -32,6 +47,7 @@ export interface Lead {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/** A note attached to a lead (timeline-style). */
|
||||
export interface Note {
|
||||
id: string;
|
||||
leadId: string;
|
||||
@@ -44,6 +60,9 @@ export interface Note {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
// ── Dashboard ──
|
||||
|
||||
/** Aggregate statistics returned by the dashboard API. */
|
||||
export interface DashboardStats {
|
||||
totalLeads: number;
|
||||
openLeads: number;
|
||||
@@ -52,11 +71,13 @@ export interface DashboardStats {
|
||||
closedLeads: number;
|
||||
ignoredLeads: number;
|
||||
conversionRate: number;
|
||||
/** Per-month breakdown for sparkline / chart rendering. */
|
||||
monthlyBreakdown: { label: string; total: number; open: number; contacted: number; pending: number; closed: number; ignored: number }[];
|
||||
leadsPerMonth: { label: string; leads: number; closed: number }[];
|
||||
recentLeads: Lead[];
|
||||
statusDistribution: { name: string; value: number; color: string }[];
|
||||
periodLabel: string;
|
||||
/** Trend percentages + direction (up/down) vs prior period. */
|
||||
trends: {
|
||||
totalLeads: { pct: number; up: boolean };
|
||||
openLeads: { pct: number; up: boolean };
|
||||
@@ -68,11 +89,15 @@ export interface DashboardStats {
|
||||
};
|
||||
}
|
||||
|
||||
/** A generic column filter used by data tables. */
|
||||
export interface ColumnFilter {
|
||||
id: string;
|
||||
value: unknown;
|
||||
}
|
||||
|
||||
// ── Notifications ──
|
||||
|
||||
/** Categories of in-app notifications. */
|
||||
export type NotificationType =
|
||||
| "lead_created"
|
||||
| "lead_status_changed"
|
||||
@@ -81,6 +106,7 @@ export type NotificationType =
|
||||
| "note_added"
|
||||
| "event_scheduled";
|
||||
|
||||
/** A single in-app notification displayed in the bell dropdown. */
|
||||
export interface Notification {
|
||||
id: string;
|
||||
type: NotificationType;
|
||||
@@ -91,6 +117,9 @@ export interface Notification {
|
||||
link?: string;
|
||||
}
|
||||
|
||||
// ── Chat / Messaging ──
|
||||
|
||||
/** A single message within a conversation. */
|
||||
export interface ChatMessage {
|
||||
id: string;
|
||||
conversationId: string;
|
||||
@@ -101,6 +130,7 @@ export interface ChatMessage {
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
/** A conversation thread between two (or more) users. */
|
||||
export interface Conversation {
|
||||
id: string;
|
||||
participants: { id: string; name: string; avatar: string; role: string }[];
|
||||
@@ -110,9 +140,14 @@ export interface Conversation {
|
||||
messages: ChatMessage[];
|
||||
}
|
||||
|
||||
// ── Calendar / Events ──
|
||||
|
||||
/** Types of calendar events. */
|
||||
export type EventType = "call" | "follow_up" | "website_creation";
|
||||
/** Lifecycle status for a calendar event. */
|
||||
export type EventStatus = "scheduled" | "completed" | "cancelled" | "rescheduled";
|
||||
|
||||
/** A full calendar event with related entities (lead, participant, developer). */
|
||||
export interface CalendarEvent {
|
||||
id: string;
|
||||
userId: string;
|
||||
|
||||
Reference in New Issue
Block a user