Implemented the database, authentication, access rules, and seed data
This commit is contained in:
+42
-18
@@ -1,3 +1,11 @@
|
||||
import {
|
||||
MerchantControls,
|
||||
ChecklistControl,
|
||||
ReviewHistory,
|
||||
InteractionHistory,
|
||||
MerchantTasks,
|
||||
RecentInteractions,
|
||||
} from '../components/merchant-workflow';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link, useOutletContext, useParams, useSearchParams } from 'react-router';
|
||||
import { keepPreviousData, useQuery } from '@tanstack/react-query';
|
||||
@@ -174,7 +182,7 @@ export function Dashboard() {
|
||||
title={t('dashboard.activity')}
|
||||
description={t('dashboard.activityText')}
|
||||
/>
|
||||
<ActivityFeed events={data.recentEvents} />
|
||||
<RecentInteractions activities={data.recentActivities} />
|
||||
</section>
|
||||
<section className="surface self-start">
|
||||
<SectionHeader
|
||||
@@ -255,7 +263,9 @@ function MerchantTable({ merchants }: { merchants: Merchant[] }) {
|
||||
<TableCell className="text-xs text-muted-foreground">
|
||||
{f.country(m.country)}
|
||||
</TableCell>
|
||||
<TableCell className="text-xs">{m.owner.name}</TableCell>
|
||||
<TableCell className="text-xs">
|
||||
{m.owner?.name ?? t('workflow.unassigned')}
|
||||
</TableCell>
|
||||
<TableCell className="pr-6 text-right text-xs text-muted-foreground">
|
||||
{f.shortDate(m.createdAt)}
|
||||
</TableCell>
|
||||
@@ -279,7 +289,9 @@ function MerchantTable({ merchants }: { merchants: Merchant[] }) {
|
||||
</div>
|
||||
<div className="mt-4 flex flex-wrap items-center justify-between gap-2">
|
||||
<StatusBadge status={m.status} />
|
||||
<span className="text-xs text-muted-foreground">{m.owner.name}</span>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{m.owner?.name ?? t('workflow.unassigned')}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
@@ -459,6 +471,7 @@ export function MerchantDetail() {
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<MerchantControls merchant={m} />
|
||||
<div className="grid gap-6 xl:grid-cols-[1.15fr_1fr]">
|
||||
<div className="min-w-0 space-y-6">
|
||||
<section className="surface">
|
||||
@@ -468,8 +481,28 @@ export function MerchantDetail() {
|
||||
/>
|
||||
<dl className="grid grid-cols-1 gap-5 p-5 sm:grid-cols-2 sm:p-6">
|
||||
{[
|
||||
{ label: t('common.owner'), value: m.owner.name },
|
||||
{
|
||||
label: t('common.owner'),
|
||||
value: m.owner?.name ?? t('workflow.unassigned'),
|
||||
},
|
||||
{ label: t('merchants.contact'), value: m.contactName },
|
||||
...(
|
||||
[
|
||||
'legalName',
|
||||
'registrationNumber',
|
||||
'address',
|
||||
'contactPhone',
|
||||
'contactTitle',
|
||||
] as const
|
||||
).map((key) => ({ label: t(`workflow.${key}`), value: m[key] ?? '—' })),
|
||||
{
|
||||
label: t('workflow.estimatedMonthlyVolumeUsd'),
|
||||
value: f.usd(m.estimatedMonthlyVolumeUsd),
|
||||
},
|
||||
{
|
||||
label: t('workflow.source'),
|
||||
value: m.source ? t(`workflow.${m.source}`) : '—',
|
||||
},
|
||||
{
|
||||
label: t('merchants.website'),
|
||||
value: (
|
||||
@@ -505,6 +538,7 @@ export function MerchantDetail() {
|
||||
))}
|
||||
</dl>
|
||||
</section>
|
||||
<ReviewHistory merchant={m} />
|
||||
<section id="checklist" className="surface">
|
||||
<SectionHeader
|
||||
title={t('merchants.checklist')}
|
||||
@@ -541,6 +575,7 @@ export function MerchantDetail() {
|
||||
{t(`checklist.${doc.state}`)}
|
||||
</Badge>
|
||||
</div>
|
||||
<ChecklistControl merchant={m} item={doc} />
|
||||
{doc.note && (
|
||||
<p className="mt-2 text-xs leading-relaxed text-muted-foreground">
|
||||
{doc.note}
|
||||
@@ -580,19 +615,8 @@ export function MerchantDetail() {
|
||||
/>
|
||||
<ActivityFeed events={m.events} detail />
|
||||
</section>
|
||||
<section className="surface">
|
||||
<SectionHeader
|
||||
title={t('merchants.tasks')}
|
||||
description={t('merchants.tasksText')}
|
||||
/>
|
||||
<div className="mt-4">
|
||||
{m.tasks.length ? (
|
||||
m.tasks.map((task) => <TaskRow key={task.id} task={task} />)
|
||||
) : (
|
||||
<EmptyState title={t('merchants.noTasks')} />
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
<MerchantTasks merchant={m} />
|
||||
<InteractionHistory merchant={m} />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
@@ -787,7 +811,7 @@ export function ReviewQueue() {
|
||||
{m.name}
|
||||
</Link>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
{m.owner.name} · {t(`industry.${m.industry}`)}
|
||||
{m.owner?.name ?? t('workflow.unassigned')} · {t(`industry.${m.industry}`)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user