Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 47x 47x 28x 28x 28x 28x 28x 32x 32x 28x | import { Outlet, useParams } from 'react-router-dom'
import { Page, EntityDetail, Crud } from '@/layers/L2R'
import type { PageConfig, DetailConfig, CrudConfig } from '@/layers/interfaces'
import { useEntityDetail } from '@/layers/L1/entityResolver'
import { formatDateTime } from '@/shared/utils/format'
import { BOT_ACCOUNT_FIELD_SET, BOT_ACCOUNT_FIELD_TYPES } from './botAccountsCrudConfig'
export function BotAccountDetailPage() {
const { id } = useParams<{ id: string }>()
const { data: account } = useEntityDetail('bot-accounts', id ?? '')
const pageConfig: PageConfig = {
title: account?.name ?? 'Bot Account',
breadcrumbs: [
{ label: 'Dashboard', href: '/' },
{ label: 'Repositories', href: '/repositories/repos' },
{ label: 'Bot Accounts', href: '/repositories/bot-accounts' },
{ label: account?.name ?? id ?? '' },
],
}
const detailConfig: DetailConfig = {
entityPath: 'bot-accounts',
title: 'Bot Account',
actionTargets: { edit: '/repositories/bot-accounts/:id/edit', delete: true },
readGrouping: [
{
label: 'Details',
fields: ['name', 'description', 'created_at', 'updated_at'],
},
],
fieldFormatters: {
created_at: (value: unknown) => formatDateTime(value as string | null | undefined),
updated_at: (value: unknown) => formatDateTime(value as string | null | undefined),
},
}
const crudConfig: CrudConfig = {
entityPath: 'bot-accounts',
fieldSet: BOT_ACCOUNT_FIELD_SET,
fieldTypes: BOT_ACCOUNT_FIELD_TYPES,
successTarget: '/repositories/bot-accounts/:id',
cancelTarget: '/repositories/bot-accounts/:id',
title: 'Edit Bot Account',
}
return (
<Page config={pageConfig}>
<EntityDetail config={detailConfig} />
<Crud config={crudConfig} />
<Outlet />
</Page>
)
}
|