Skip to content

Commit 47fdce7

Browse files
committed
chore: very close, before switching to grid
1 parent 95eb573 commit 47fdce7

File tree

5 files changed

+46
-11
lines changed

5 files changed

+46
-11
lines changed

src/assets/svg/pointer-left.svg

Lines changed: 4 additions & 0 deletions
Loading

src/assets/svg/pointer-right.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as React from "react";
2+
import type { SVGProps } from "react";
3+
const SvgPointerLeft = (props: SVGProps<SVGSVGElement>) => <svg xmlnsXlink="http://www.w3.org/1999/xlink" width="11px" height="19px" preserveAspectRatio="xMinYMid meet" viewBox="159 229 7 10" xmlns="http://www.w3.org/2000/svg" {...props}><path d="M 165.8 228.1 L 159.1 234.1 L 165.8 240.1 L 163.5 234.1 L 165.8 228.1 Z" fillRule="nonzero" fill="currentColor" stroke="none" /></svg>;
4+
export default SvgPointerLeft;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import * as React from "react";
2+
import type { SVGProps } from "react";
3+
const SvgPointerRight = (props: SVGProps<SVGSVGElement>) => <svg xmlnsXlink="http://www.w3.org/1999/xlink" width="11px" height="19px" preserveAspectRatio="xMinYMid meet" viewBox="340 139 1 13" xmlns="http://www.w3.org/2000/svg" {...props}><path d="M 340.3 151.3 L 347 145.3 L 340.3 139.3 L 342.6 145.3 L 340.3 151.3 Z" fillRule="nonzero" fill="currentColor" stroke="none" /></svg>;
4+
export default SvgPointerRight;

src/features/transactions/pages/group-page.tsx

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import SvgCircle from '@/features/common/components/svg/circle'
2+
import SvgPointerLeft from '@/features/common/components/svg/pointer-left'
3+
import SvgPointerRight from '@/features/common/components/svg/pointer-right'
24
import { cn } from '@/features/common/utils'
35
import { useMemo, useState } from 'react'
46

@@ -65,12 +67,16 @@ function TransactionTableRow({
6567
if (index === foo.from)
6668
return (
6769
<td key={index} colSpan={foo.to - foo.from + 1}>
68-
<div className={cn('flex items-center justify-center bg-red-200')}>
70+
<div className={cn('flex items-center justify-center')}>
6971
<SvgCircle width={20} height={20}></SvgCircle>
7072
<div
71-
className={cn('border-primary border-b-2')}
72-
style={{ width: `calc(${(100 - 100 / (foo.to - foo.from + 1)).toFixed(2)}% - 20px)` }}
73-
></div>
73+
style={{ width: `calc(${(100 - 100 / (foo.to - foo.from + 1)).toFixed(2)}% - 20px)`, height: '20px' }}
74+
className="relative text-primary"
75+
>
76+
{foo.direction === 'rightToLeft' && <SvgPointerLeft className={cn('absolute top-0 left-0')} />}
77+
<div className={cn('border-primary border-b-2 h-1/2')}></div>
78+
{foo.direction === 'leftToRight' && <SvgPointerRight className={cn('absolute top-0 right-0')} />}
79+
</div>
7480
<SvgCircle width={20} height={20}></SvgCircle>
7581
</div>
7682
</td>
@@ -123,7 +129,14 @@ export function GroupPage() {
123129
name: 'Inner 5',
124130
sender: 'Account 3',
125131
receiver: 'Account 1',
126-
transactions: [{ name: 'Inner 10', sender: 'Account 2', receiver: 'Account 6' }],
132+
transactions: [
133+
{
134+
name: 'Inner 10',
135+
sender: 'Account 2',
136+
receiver: 'Account 6',
137+
transactions: [{ name: 'Inner 12', sender: 'Account 5', receiver: 'Account 6' }],
138+
},
139+
],
127140
},
128141
],
129142
},
@@ -147,21 +160,27 @@ export function GroupPage() {
147160
],
148161
}
149162
const accounts = extractSendersAndReceivers(group)
150-
const allTransactionCounts = 15
163+
const allTransactionCounts = 16
164+
151165
return (
152-
<table className={cn('')}>
166+
<table className={cn('relative')}>
153167
<tr>
154168
<th></th>
155169
{accounts.map((account, index) => (
156-
<th className={cn('w-32 p-2')} key={index}>
170+
<th className={cn('w-32 p-2 h-10')} key={index}>
157171
{account}
158172
</th>
159173
))}
160174
</tr>
161-
<tbody style={{ height: `${allTransactionCounts * 40}px` }}>
175+
<tbody className={cn('absolute top-10 right-0 -z-10')}>
162176
<tr>
163177
<td className={cn('p-0')}></td>
164-
<td className={cn('p-0')} rowSpan={allTransactionCounts} colSpan={accounts.length}>
178+
<td
179+
className={cn('p-0')}
180+
rowSpan={allTransactionCounts}
181+
colSpan={accounts.length}
182+
style={{ height: `${allTransactionCounts * 40}px`, width: `${128 * accounts.length}px` }}
183+
>
165184
<div
166185
className={cn('grid h-full')}
167186
style={{
@@ -178,7 +197,7 @@ export function GroupPage() {
178197
</td>
179198
</tr>
180199
</tbody>
181-
<tbody className="relative" style={{ top: `-${15 * 40}px` }}>
200+
<tbody>
182201
{group.transactions.map((transaction, index, arr) => (
183202
<TransactionTableRow
184203
transaction={transaction}

0 commit comments

Comments
 (0)