Files
portal/app/resources/js/composables/useStatusPill.ts
T
Дмитрий e746b3c9a4 chore(cleanup): dead code removal + DemoSeeder env-conditional + schema header drift
Closes Audit #3 P2 batch (knip dead exports/components, DemoSeeder
hygiene, schema header drift).

- Remove app/resources/js/views/admin/AdminPlaceholderView.vue
  (unreferenced placeholder view — confirmed via repo-wide grep, only
  doc references remain)
- npm uninstall concurrently (no script invoked it; --legacy-peer-deps
  for Histoire 1.0-beta.1 peerDep quirk)
- 12 unused exports → internal types (remove `export` keyword):
  - api/admin.ts: AdminTenantsStats, ApiTenantMetrics,
    ApiAdminBillingSummary, ApiAdminIncidentsSummary
  - api/notifications.ts: NotificationEvent
  - api/reports.ts: ApiReportType, ApiReportFormat, ApiReportParameters,
    ReportCounts, ReportQuota
  - composables/mockBilling.ts: TxType
  - composables/useStatusPill.ts: StatusPillSlug
  All 12 are used INSIDE their own file (response shapes), just not
  exported externally — converting to internal types satisfies knip
  without losing type-checking inside the file.
- DatabaseSeeder::run() — DemoSeeder runs only in local+testing envs
  (`migrate:fresh --seed` in dev now produces demo tenant + admin@demo.local
  + 3 projects + ~14 demo deals; prod environments skip)
- db/schema.sql header line 4: «62 базовые таблицы» → «63 базовые
  таблицы (61 regular + 2 partitioned parents: deals + supplier_lead_costs)»
  Closes schema header drift finding from Phase 3.

Verification:
- vue-tsc --noEmit: 0 errors
- ESLint on touched files: 0 errors
- Pest --parallel: 742/739/3sk/0 failed (identical to baseline, no regressions)
- 2243 assertions / 34.46s

Plan: docs/superpowers/plans/2026-05-14-audit3-deferred-fixes.md Task 2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 08:28:44 +03:00

55 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Маппинг slug'ов lead_statuses → стилевые токены пилюли.
* Slugs синхронизированы с db/schema.sql:2076 (источник истины).
*
* Spec §8. Используется компонентом StatusPill.vue.
*/
export interface PillStyle {
bg: string;
color: string;
fontWeight?: number;
textDecoration?: 'line-through' | 'none';
}
export const STATUS_PILL_SLUGS = [
'new',
'in_progress',
'callback',
'quality',
'meeting_set',
'won',
'refund',
'duplicate',
'junk',
'no_answer',
'cancelled',
'closed',
'postponed',
'archived',
] as const;
type StatusPillSlug = (typeof STATUS_PILL_SLUGS)[number];
const STYLES: Record<StatusPillSlug, PillStyle> = {
new: { bg: 'rgba(15,110,86,0.12)', color: '#0F6E56' },
in_progress: { bg: 'rgba(63,124,149,0.12)', color: '#2A5A6E' },
callback: { bg: 'rgba(217,164,65,0.18)', color: '#A07820' },
quality: { bg: 'rgba(46,139,87,0.15)', color: '#2E8B57' },
meeting_set: { bg: 'rgba(122,91,163,0.15)', color: '#7A5BA3' },
won: { bg: 'rgba(46,139,87,0.22)', color: '#1F6940', fontWeight: 600 },
refund: { bg: 'rgba(204,110,80,0.15)', color: '#B0563D' },
duplicate: { bg: 'rgba(1,32,25,0.08)', color: '#3A3A3A' },
junk: { bg: 'rgba(184,58,58,0.10)', color: '#B83A3A' },
no_answer: { bg: 'rgba(107,99,86,0.15)', color: '#6B6356' },
cancelled: { bg: 'rgba(107,99,86,0.18)', color: '#6B6356', textDecoration: 'line-through' },
closed: { bg: 'rgba(1,32,25,0.10)', color: '#3A3A3A' },
postponed: { bg: 'rgba(15,110,86,0.06)', color: '#6B6356' },
archived: { bg: '#012019', color: '#E8E2D4' },
};
const FALLBACK: PillStyle = { bg: 'rgba(1,32,25,0.08)', color: '#3A3A3A' };
export function useStatusPill(slug: string): PillStyle {
return STYLES[slug as StatusPillSlug] ?? FALLBACK;
}