Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/console/src/hooks/useNavPins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @module
*/

import { useState, useCallback, useEffect, useMemo } from 'react';
import { useState, useCallback, useEffect } from 'react';
import type { NavigationItem } from '@object-ui/types';

const STORAGE_KEY = 'objectui-nav-pins';
Expand Down
42 changes: 21 additions & 21 deletions examples/crm/src/dashboards/crm.dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,56 @@ export const CrmDashboard = {
widgets: [
// --- KPI Row ---
{
type: 'metric',
type: 'metric' as const,
layout: { x: 0, y: 0, w: 1, h: 1 },
options: {
label: 'Total Revenue',
value: '$652,000',
trend: { value: 12.5, direction: 'up', label: 'vs last month' },
trend: { value: 12.5, direction: 'up' as const, label: 'vs last month' },
icon: 'DollarSign'
}
},
{
type: 'metric',
type: 'metric' as const,
layout: { x: 1, y: 0, w: 1, h: 1 },
options: {
label: 'Active Deals',
value: '5',
trend: { value: 2.1, direction: 'down', label: 'vs last month' },
trend: { value: 2.1, direction: 'down' as const, label: 'vs last month' },
icon: 'Briefcase'
}
},
{
type: 'metric',
type: 'metric' as const,
layout: { x: 2, y: 0, w: 1, h: 1 },
options: {
label: 'Win Rate',
value: '42%',
trend: { value: 4.3, direction: 'up', label: 'vs last month' },
trend: { value: 4.3, direction: 'up' as const, label: 'vs last month' },
icon: 'Trophy'
}
},
{
type: 'metric',
type: 'metric' as const,
layout: { x: 3, y: 0, w: 1, h: 1 },
options: {
label: 'Avg Deal Size',
value: '$93,000',
trend: { value: 1.2, direction: 'up', label: 'vs last month' },
trend: { value: 1.2, direction: 'up' as const, label: 'vs last month' },
icon: 'BarChart3'
}
},

// --- Row 2: Charts ---
{
title: 'Revenue Trends',
type: 'area',
type: 'area' as const,
layout: { x: 0, y: 1, w: 3, h: 2 },
options: {
xField: 'month',
yField: 'revenue',
data: {
provider: 'value',
provider: 'value' as const,
items: [
{ month: 'Jan', revenue: 155000 },
{ month: 'Feb', revenue: 87000 },
Expand All @@ -68,13 +68,13 @@ export const CrmDashboard = {
},
{
title: 'Lead Source',
type: 'donut',
type: 'donut' as const,
layout: { x: 3, y: 1, w: 1, h: 2 },
options: {
xField: 'source',
yField: 'value',
data: {
provider: 'value',
provider: 'value' as const,
items: [
{ source: 'Web', value: 2 },
{ source: 'Referral', value: 1 },
Expand All @@ -88,13 +88,13 @@ export const CrmDashboard = {
// --- Row 3: More Charts ---
{
title: 'Pipeline by Stage',
type: 'bar',
type: 'bar' as const,
layout: { x: 0, y: 3, w: 2, h: 2 },
options: {
xField: 'stage',
yField: 'amount',
data: {
provider: 'value',
provider: 'value' as const,
items: [
{ stage: 'Prospecting', amount: 250000 },
{ stage: 'Qualification', amount: 35000 },
Expand All @@ -107,13 +107,13 @@ export const CrmDashboard = {
},
{
title: 'Top Products',
type: 'bar',
type: 'bar' as const,
layout: { x: 2, y: 3, w: 2, h: 2 },
options: {
xField: 'name',
yField: 'sales',
data: {
provider: 'value',
provider: 'value' as const,
items: [
{ name: 'Workstation Pro Laptop', sales: 45000 },
{ name: 'Implementation Service', sales: 32000 },
Expand All @@ -127,7 +127,7 @@ export const CrmDashboard = {
// --- Row 4: Table ---
{
title: 'Recent Opportunities',
type: 'table',
type: 'table' as const,
layout: { x: 0, y: 5, w: 4, h: 2 },
options: {
columns: [
Expand All @@ -137,7 +137,7 @@ export const CrmDashboard = {
{ header: 'Close Date', accessorKey: 'date' }
],
data: {
provider: 'value',
provider: 'value' as const,
items: [
{ name: 'Berlin Automation Project', amount: '$250,000', stage: 'Prospecting', date: '2024-09-01' },
{ name: 'ObjectStack Enterprise License', amount: '$150,000', stage: 'Closed Won', date: '2024-01-15' },
Expand All @@ -152,15 +152,15 @@ export const CrmDashboard = {
// --- Row 5: Dynamic KPI from Object Data ---
{
title: 'Revenue by Account',
type: 'bar',
type: 'bar' as const,
layout: { x: 0, y: 7, w: 4, h: 2 },
options: {
xField: 'account',
yField: 'total',
data: {
provider: 'object',
provider: 'object' as const,
object: 'opportunity',
aggregate: { field: 'amount', function: 'sum', groupBy: 'account' }
aggregate: { field: 'amount', function: 'sum' as const, groupBy: 'account' }
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/account.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const AccountData = {
object: 'account',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{
_id: "1",
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/contact.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const ContactData = {
object: 'contact',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{
_id: "1",
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/event.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const EventData = {
object: 'event',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "e1", subject: "Weekly Standup", start: new Date("2024-02-05T09:00:00"), end: new Date("2024-02-05T10:00:00"), location: "Conference Room A", type: "meeting", status: "completed", organizer: "1", reminder: "min_15", description: "Team synchronization regarding Project Alpha", participants: ["1", "2", "5"] },
{ _id: "e2", subject: "Client Call - TechCorp", start: new Date("2024-02-06T14:00:00"), end: new Date("2024-02-06T15:00:00"), location: "Zoom", type: "call", status: "completed", organizer: "2", reminder: "min_5", description: "Reviewing Q1 Goals and Roadblocks", participants: ["2", "7"] },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/opportunity.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const OpportunityData = {
object: 'opportunity',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{
_id: "101",
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/opportunity_contact.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const OpportunityContactData = {
object: 'opportunity_contact',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "oc1", name: 'Bob Smith — Enterprise License', opportunity: "101", contact: "2", role: 'decision_maker', is_primary: true },
{ _id: "oc2", name: 'George Martin — Enterprise License', opportunity: "101", contact: "7", role: 'evaluator', is_primary: false },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/order.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const OrderData = {
object: 'order',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "o1", name: 'ORD-2024-001', customer: "2", account: "2", order_date: new Date('2024-01-15'), amount: 15459.99, status: 'paid', payment_method: 'Wire Transfer', shipping_address: '415 Mission St, San Francisco, CA 94105', tracking_number: '1Z999AA10123456784' },
{ _id: "o2", name: 'ORD-2024-002', customer: "3", account: "3", order_date: new Date('2024-01-18'), amount: 289.50, status: 'pending', payment_method: 'Credit Card', discount: 5 },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/order_item.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const OrderItemData = {
object: 'order_item',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "li1", name: 'LI-001', order: "o1", product: "p1", quantity: 5, unit_price: 2499.99, discount: 0, line_total: 12499.95, item_type: 'product' },
{ _id: "li2", name: 'LI-002', order: "o1", product: "p2", quantity: 10, unit_price: 89.99, discount: 0, line_total: 899.90, item_type: 'product' },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/product.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const ProductData = {
object: 'product',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "p1", sku: 'HW-LAP-001', name: 'Workstation Pro Laptop', category: 'electronics', price: 2499.99, stock: 15, is_active: true, manufacturer: 'TechPro', weight: 2.1, tags: ['best_seller'], image: 'https://images.unsplash.com/photo-1593642702821-c8da6771f0c6?w=600&q=80' },
{ _id: "p2", sku: 'HW-ACC-002', name: 'Wireless Ergonomic Mouse', category: 'electronics', price: 89.99, stock: 120, is_active: true, manufacturer: 'ErgoTech', weight: 0.12, tags: ['new'], image: 'https://images.unsplash.com/photo-1527864550417-7fd91fc51a46?w=600&q=80' },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/project_task.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const ProjectTaskData = {
object: 'project_task',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "t1", name: "Requirements Gathering", start_date: new Date("2024-02-01"), end_date: new Date("2024-02-14"), progress: 100, estimated_hours: 40, actual_hours: 38, status: 'completed', color: '#10b981', priority: 'high', manager: "1", assignee: "2" },
{ _id: "t2", name: "Architecture Design", start_date: new Date("2024-02-15"), end_date: new Date("2024-03-01"), progress: 100, estimated_hours: 60, actual_hours: 55, status: 'completed', color: '#3b82f6', priority: 'high', dependencies: 't1', manager: "1", assignee: "1" },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/data/user.data.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const UserData = {
object: 'user',
mode: 'upsert',
mode: 'upsert' as const,
records: [
{ _id: "1", name: 'Martin CEO', email: 'martin@example.com', username: 'martin', role: 'admin', title: 'Chief Executive Officer', department: 'Executive', phone: '415-555-2001', active: true },
{ _id: "2", name: 'Sarah Sales', email: 'sarah@example.com', username: 'sarah', role: 'user', title: 'Sales Manager', department: 'Sales', phone: '415-555-2002', active: true },
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/pages/getting_started.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const GettingStartedPage = {
name: 'crm_getting_started',
label: 'Getting Started',
type: 'app',
type: 'app' as const,
regions: [
{
name: 'main',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/pages/help.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const HelpPage = {
name: 'crm_help',
label: 'Help & Resources',
type: 'app',
type: 'app' as const,
regions: [
{
name: 'main',
Expand Down
2 changes: 1 addition & 1 deletion examples/crm/src/pages/settings.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const SettingsPage = {
name: 'crm_settings',
label: 'Settings',
type: 'utility',
type: 'utility' as const,
regions: [
{
name: 'main',
Expand Down
10 changes: 5 additions & 5 deletions examples/crm/src/reports/pipeline.report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ export const PipelineReport = {
label: 'Pipeline Report',
description: 'Sales pipeline analysis by stage, forecast category, and expected close date',
objectName: 'opportunity',
type: 'summary',
type: 'summary' as const,
columns: [
{ field: 'name', label: 'Opportunity' },
{ field: 'amount', label: 'Amount', aggregate: 'sum' },
{ field: 'expected_revenue', label: 'Expected Revenue', aggregate: 'sum' },
{ field: 'amount', label: 'Amount', aggregate: 'sum' as const },
{ field: 'expected_revenue', label: 'Expected Revenue', aggregate: 'sum' as const },
{ field: 'stage', label: 'Stage' },
{ field: 'probability', label: 'Probability' },
{ field: 'close_date', label: 'Close Date' },
{ field: 'forecast_category', label: 'Forecast' },
],
groupingsDown: [{ field: 'stage', sortOrder: 'asc' }],
groupingsDown: [{ field: 'stage', sortOrder: 'asc' as const }],
filter: { field: 'stage', op: 'neq', value: 'closed_lost' },
chart: { type: 'bar', xAxis: 'stage', yAxis: 'amount', groupBy: 'stage' },
chart: { type: 'bar' as const, xAxis: 'stage', yAxis: 'amount', groupBy: 'stage' },
};
8 changes: 4 additions & 4 deletions examples/crm/src/reports/sales.report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ export const SalesReport = {
label: 'Sales Report',
description: 'Monthly sales performance breakdown by account and product category',
objectName: 'order',
type: 'summary',
type: 'summary' as const,
columns: [
{ field: 'name', label: 'Order Number' },
{ field: 'account', label: 'Account' },
{ field: 'amount', label: 'Amount', aggregate: 'sum' },
{ field: 'amount', label: 'Amount', aggregate: 'sum' as const },
{ field: 'status', label: 'Status' },
{ field: 'order_date', label: 'Order Date' },
{ field: 'payment_method', label: 'Payment Method' },
],
groupingsDown: [{ field: 'status', sortOrder: 'asc' }],
chart: { type: 'bar', xAxis: 'status', yAxis: 'amount', groupBy: 'status' },
groupingsDown: [{ field: 'status', sortOrder: 'asc' as const }],
chart: { type: 'bar' as const, xAxis: 'status', yAxis: 'amount', groupBy: 'status' },
};