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 56 57 58 59 60 61 62 63 64 65 66 67 | 46x 24x 96x 96x 96x 96x 96x 384x 96x 24x 24x | import { Outlet } from 'react-router-dom'
import { DataTable, Crud } from '@/layers/L2R'
import type { ListConfig, CrudConfig } from '@/layers/interfaces'
import { formatRelativeTime } from '@/shared/utils/format'
import { BOT_ACCOUNT_FIELD_SET, BOT_ACCOUNT_FIELD_TYPES } from './botAccountsCrudConfig'
import { mockRepositories } from '@/msw/mock-data'
export function BotAccountsListTab() {
const listConfig: ListConfig = {
entityPath: 'bot-accounts',
prefix: 'botacct',
columns: [
{
field: 'name',
label: 'Name',
sortable: true,
render: (row) => <a href={`#/repositories/bot-accounts/${row.id}`}>{row.name as string}</a>,
},
{
field: 'description',
label: 'Description',
sortable: true,
render: (row) => (row.description ? String(row.description) : '\u2014'),
},
{
field: 'created_at',
label: 'Created',
sortable: true,
render: (row) => {
const val = row.created_at as string | null | undefined
return val ? formatRelativeTime(val) : 'Never'
},
},
{
field: 'used_by',
label: 'Used By',
render: (row) => {
const accountId = row.id as string
const count = mockRepositories.filter((r) => (r as Record<string, unknown>).bot_account_id === accountId).length
return String(count)
},
},
],
sort: { field: 'name', order: 'asc' },
createTarget: '/repositories/bot-accounts/add',
createLabel: '+ New Bot Account',
rowTarget: '/repositories/bot-accounts/:id',
}
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',
title: 'Add New Bot Account',
}
return (
<>
<DataTable config={listConfig} />
<Crud config={crudConfig} />
<Outlet />
</>
)
}
|