Skip to content

Commit

Permalink
feat: stylize channel page
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Sep 27, 2024
1 parent 4467ac6 commit c457bc0
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 40 deletions.
14 changes: 11 additions & 3 deletions src/pages/Fiber/Channel/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
}
}

.overview {
@extend %base-card;
}

.id {
overflow: hidden;

Expand All @@ -60,8 +64,9 @@
}

.transactions {
margin-top: 16px;
border-top: 1px solid #ccc;
@extend %base-card;

margin-top: 8px;
padding-top: 16px;

h3 {
Expand All @@ -71,12 +76,15 @@
}

.peers {
margin-top: 8px;
display: flex;
flex-wrap: wrap;

.local,
.remote {
flex: 1 0 50%;
@extend %base-card;

flex: 1 0 40%;
border: 1px solid #ccc;
padding: 32px;

Expand Down
76 changes: 39 additions & 37 deletions src/pages/Fiber/Channel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,48 +54,50 @@ const Channel = () => {
<Content>
<div className={styles.container} onClick={handleCopy}>
<div>
<dl>
<dt>{t('fiber.channel.channel_id')}</dt>
<dd className={styles.id}>
<span>{channel.channelId}</span>
<button type="button" data-copy-text={channel.channelId}>
<CopyIcon />
</button>
</dd>
</dl>
<dl>
<dt>{t('fiber.channel.state')}</dt>
<dd>{channel.stateName}</dd>
</dl>
<div className={styles.overview}>
<dl>
<dt>{t('fiber.channel.channel_id')}</dt>
<dd className={styles.id}>
<span>{channel.channelId}</span>
<button type="button" data-copy-text={channel.channelId}>
<CopyIcon />
</button>
</dd>
</dl>
<dl>
<dt>{t('fiber.channel.state')}</dt>
<dd>{channel.stateName}</dd>
</dl>

<dl>
<dt>{t('fiber.channel.balance')}</dt>
<dd>{`${localeNumberString(
shannonToCkb(totalBalance.toFormat({ groupSeparator: '' })),
)} CKB(Total) | ${localeNumberString(
shannonToCkb(totalTLCBalance.toFormat({ groupSeparator: '' })),
)} CKB(TLC)`}</dd>
</dl>
<dl>
<dt>{t('fiber.channel.open_time')}</dt>
<dd>
<time dateTime={channel.createdAt}>{dayjs(channel.createdAt).format(TIME_TEMPLATE)}</time>
</dd>
</dl>
<dl>
<dt>{t('fiber.channel.update_time')}</dt>
<dd>
<time dateTime={channel.updatedAt}>{dayjs(channel.updatedAt).format(TIME_TEMPLATE)}</time>
</dd>
</dl>
{channel.shutdownAt ? (
<dl>
<dt>{t('fiber.channel.shutdown_time')}</dt>
<dt>{t('fiber.channel.balance')}</dt>
<dd>{`${localeNumberString(
shannonToCkb(totalBalance.toFormat({ groupSeparator: '' })),
)} CKB(Total) | ${localeNumberString(
shannonToCkb(totalTLCBalance.toFormat({ groupSeparator: '' })),
)} CKB(TLC)`}</dd>
</dl>
<dl>
<dt>{t('fiber.channel.open_time')}</dt>
<dd>
<time dateTime={channel.createdAt}>{dayjs(channel.createdAt).format(TIME_TEMPLATE)}</time>
</dd>
</dl>
<dl>
<dt>{t('fiber.channel.update_time')}</dt>
<dd>
<time dateTime={channel.shutdownAt}>{dayjs(channel.shutdownAt).format(TIME_TEMPLATE)}</time>
<time dateTime={channel.updatedAt}>{dayjs(channel.updatedAt).format(TIME_TEMPLATE)}</time>
</dd>
</dl>
) : null}
{channel.shutdownAt ? (
<dl>
<dt>{t('fiber.channel.shutdown_time')}</dt>
<dd>
<time dateTime={channel.shutdownAt}>{dayjs(channel.shutdownAt).format(TIME_TEMPLATE)}</time>
</dd>
</dl>
) : null}
</div>
<div className={styles.peers}>
<div className={styles.local}>
<dl>
Expand Down

0 comments on commit c457bc0

Please sign in to comment.