|
| 1 | +// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license. |
| 2 | + |
| 3 | +import { Page } from '@objectstack/spec/ui'; |
| 4 | + |
| 5 | +/** |
| 6 | + * Account Workbench — ADR-0047 interface page (Airtable Interfaces parity). |
| 7 | + * |
| 8 | + * The author-curated counterpart to the Accounts object nav entry. Where |
| 9 | + * the object entry (data mode) shows every list view as switcher tabs and |
| 10 | + * offers the full toolbar, this page is deliberately closed: |
| 11 | + * |
| 12 | + * • it REFERENCES the account default view (`sourceView`) — columns, |
| 13 | + * base filter and sort are inherited, never restated (the iron rule); |
| 14 | + * • end users get exactly three quick filters: industry (with record |
| 15 | + * counts), customer type, and owner (a user lookup — renders as a |
| 16 | + * record-picker dropdown); |
| 17 | + * • the visualization is locked to grid (single-entry whitelist); |
| 18 | + * • advanced filtering / view management are not offered. |
| 19 | + * |
| 20 | + * Filter selections persist as `uf_*` URL params — reload-safe, shareable. |
| 21 | + * |
| 22 | + * NOTE: `interfaceConfig.userFilters` requires @objectstack/spec > 9.2.0 |
| 23 | + * (ADR-0047). On older specs defineStack strips the unknown keys and the |
| 24 | + * page renders without the filter bar — a harmless no-op until the |
| 25 | + * dependency bump activates it. |
| 26 | + */ |
| 27 | +export const AccountWorkbenchPage: Page = { |
| 28 | + name: 'account_workbench', |
| 29 | + label: 'Account Workbench', |
| 30 | + description: 'Curated account list for the sales team: quick filters only, no view management.', |
| 31 | + type: 'list', |
| 32 | + object: 'crm_account', |
| 33 | + kind: 'full', |
| 34 | + template: 'default', |
| 35 | + isDefault: false, |
| 36 | + // Interface pages carry no regions — the list surface is generated from |
| 37 | + // `interfaceConfig` (ADR-0047), not composed from components. |
| 38 | + regions: [], |
| 39 | + interfaceConfig: { |
| 40 | + source: 'crm_account', |
| 41 | + sourceView: 'all_accounts', |
| 42 | + |
| 43 | + ...({ |
| 44 | + userFilters: { |
| 45 | + element: 'dropdown', |
| 46 | + fields: [ |
| 47 | + { field: 'industry', showCount: true }, |
| 48 | + { field: 'type' }, |
| 49 | + { field: 'owner' }, |
| 50 | + ], |
| 51 | + }, |
| 52 | + // typed via spread-as-any until @objectstack/spec ships ADR-0047 |
| 53 | + // (UserFiltersSchema is in framework main, > 9.2.0) |
| 54 | + } as any), |
| 55 | + |
| 56 | + appearance: { |
| 57 | + showDescription: true, |
| 58 | + allowedVisualizations: ['grid'], |
| 59 | + }, |
| 60 | + |
| 61 | + userActions: { |
| 62 | + sort: true, |
| 63 | + search: true, |
| 64 | + filter: false, |
| 65 | + rowHeight: false, |
| 66 | + addRecordForm: false, |
| 67 | + }, |
| 68 | + |
| 69 | + showRecordCount: true, |
| 70 | + }, |
| 71 | +}; |
0 commit comments