diff --git a/src/App.routes.tsx b/src/App.routes.tsx index 9b6451393..119f6e68b 100644 --- a/src/App.routes.tsx +++ b/src/App.routes.tsx @@ -4,6 +4,7 @@ import { Urls } from './routes/urls' import { evalTemplates } from './routes/templated-route' import { TransactionPage } from './features/transactions/pages/transaction-page' import { ExplorePage } from './features/explore/pages/explore-page' +import { GroupPage } from './features/transactions/pages/group-page' export const routes = evalTemplates([ { @@ -33,6 +34,10 @@ export const routes = evalTemplates([ template: Urls.Explore.Transaction.ById, element: , }, + { + template: Urls.Explore.Group.ById, + element: , + }, ], }, { diff --git a/src/features/explore/pages/explore-page.tsx b/src/features/explore/pages/explore-page.tsx index 716b673ac..1b36bd6fe 100644 --- a/src/features/explore/pages/explore-page.tsx +++ b/src/features/explore/pages/explore-page.tsx @@ -1,15 +1,19 @@ +import { cn } from '@/features/common/utils' import { TemplatedNavLink } from '@/features/routing/components/templated-nav-link/templated-nav-link' import { Urls } from '@/routes/urls' export function ExplorePage() { return ( -
+
View sample transaction + + View sample group +
) } diff --git a/src/features/transactions/pages/group-page.tsx b/src/features/transactions/pages/group-page.tsx new file mode 100644 index 000000000..051c7d530 --- /dev/null +++ b/src/features/transactions/pages/group-page.tsx @@ -0,0 +1,95 @@ +import { cn } from '@/features/common/utils' + +type TransactionTrProps = { + transaction: Transaction + cellHeight?: number + lineWidth?: number + hasParent?: boolean + hasNextSibbling?: boolean + hasChildren?: boolean +} +function TransactionTr({ transaction, hasParent = false, hasNextSibbling = false, hasChildren = false }: TransactionTrProps) { + return ( + + +
+ {hasParent && ( +
+ )} +
{transaction.name}
+ {hasParent && hasNextSibbling && ( +
+ )} + {hasChildren && !hasParent && ( +
+ )} + {hasChildren && hasParent && ( +
+ )} +
+ {hasChildren && ( +
+ {hasNextSibbling &&
} + + {transaction.transactions?.map((childTransaction, index, arr) => ( + 0} + hasParent={true} + hasNextSibbling={index < arr.length - 1} + /> + ))} +
+
+ )} + + + + ) +} + +export function GroupPage() { + const group: Transaction = { + name: '', + transactions: [ + { name: '7VSN...' }, + { + name: 'NDQX...', + transactions: [ + { name: 'Inner 1' }, + { name: 'Inner 2', transactions: [{ name: 'Inner 3' }, { name: 'Inner 5' }] }, + { name: 'Inner 9' }, + { name: 'Inner 4', transactions: [{ name: 'Inner 6' }, { name: 'Inner 7' }] }, + { name: 'Inner 8' }, + ], + }, + ], + } + + return ( + + {group.transactions?.map((transaction, index, arr) => ( + 0} + hasParent={false} + hasNextSibbling={index < arr.length - 1} + /> + ))} +
+ ) +} + +export type Transaction = { + name: string + transactions?: Transaction[] +} diff --git a/src/routes/urls.ts b/src/routes/urls.ts index f5bdf5991..c8d57b9bb 100644 --- a/src/routes/urls.ts +++ b/src/routes/urls.ts @@ -4,6 +4,7 @@ export type UrlParameterValue = `${string}:${string}` export const UrlParams = { TransactionId: 'transactionId:string', + GroupId: 'groupId:string', } as const satisfies Record export const Urls = { @@ -12,6 +13,9 @@ export const Urls = { Transaction: UrlTemplate`/transaction`.extend({ ById: UrlTemplate`/${UrlParams.TransactionId}`, }), + Group: UrlTemplate`/group`.extend({ + ById: UrlTemplate`/${UrlParams.GroupId}`, + }), }), AppStudio: UrlTemplate`/app-studio`, }