diff --git a/src/views/channels/channels/Channel.style.ts b/src/views/channels/channels/Channel.style.ts
new file mode 100644
index 00000000..93d6d2a4
--- /dev/null
+++ b/src/views/channels/channels/Channel.style.ts
@@ -0,0 +1,55 @@
+import styled from 'styled-components';
+import { mediaWidths } from 'src/styles/Themes';
+
+export const ChannelIconPadding = styled.div`
+ display: flex;
+ margin-left: 8px;
+`;
+
+export const ChannelStatsColumn = styled.div`
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+`;
+
+export const ChannelStatsLine = styled.div`
+ width: 100%;
+ display: flex;
+`;
+
+export const ChannelBarSide = styled.div`
+ width: 50%;
+ display: flex;
+ flex-direction: column;
+ cursor: pointer;
+
+ @media (${mediaWidths.mobile}) {
+ width: 100%;
+ }
+`;
+
+export const ChannelNodeTitle = styled.div`
+ font-size: 16px;
+ font-weight: 700;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+
+ @media (${mediaWidths.mobile}) {
+ text-align: center;
+ margin-bottom: 8px;
+ }
+`;
+
+export const ChannelSingleLine = styled.div`
+ display: flex;
+ align-items: center;
+`;
+
+export const IconCursor = styled.div`
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ margin-left: 8px;
+`;
diff --git a/src/views/channels/channels/ChannelCard.tsx b/src/views/channels/channels/ChannelCard.tsx
index 7592f9bd..8bf37e45 100644
--- a/src/views/channels/channels/ChannelCard.tsx
+++ b/src/views/channels/channels/ChannelCard.tsx
@@ -1,8 +1,6 @@
import React, { useState } from 'react';
import ReactTooltip from 'react-tooltip';
-import styled from 'styled-components';
import { ArrowDown, ArrowUp, EyeOff } from 'react-feather';
-import { mediaWidths } from 'src/styles/Themes';
import { ChannelType } from 'src/graphql/types';
import { getPercent, formatSeconds } from '../../../utils/helpers';
import {
@@ -18,10 +16,7 @@ import {
ResponsiveLine,
DarkSubTitle,
} from '../../../components/generic/Styled';
-import {
- useConfigState,
- useConfigDispatch,
-} from '../../../context/ConfigContext';
+import { useConfigState } from '../../../context/ConfigContext';
import {
getStatusDot,
getTooltipType,
@@ -37,47 +32,14 @@ import { AdminSwitch } from '../../../components/adminSwitch/AdminSwitch';
import { ColorButton } from '../../../components/buttons/colorButton/ColorButton';
import { getPrice } from '../../../components/price/Price';
import { usePriceState } from '../../../context/PriceContext';
-
-const IconPadding = styled.div`
- display: flex;
- flex-direction: column;
- margin-left: 8px;
-
- @media (${mediaWidths.mobile}) {
- display: none;
- }
-`;
-
-const StatsColumn = styled.div`
- width: 100%;
- display: flex;
- flex-direction: column;
- align-items: flex-end;
-`;
-
-const BarSide = styled.div`
- width: 50%;
- display: flex;
- flex-direction: column;
- cursor: pointer;
-
- @media (${mediaWidths.mobile}) {
- width: 100%;
- }
-`;
-
-const NodeTitle = styled.div`
- font-size: 16px;
- font-weight: 700;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-
- @media (${mediaWidths.mobile}) {
- text-align: center;
- margin-bottom: 8px;
- }
-`;
+import {
+ ChannelNodeTitle,
+ ChannelBarSide,
+ ChannelIconPadding,
+ ChannelStatsColumn,
+ ChannelSingleLine,
+ ChannelStatsLine,
+} from './Channel.style';
const getSymbol = (status: boolean) => {
return status ? : ;
@@ -115,8 +77,7 @@ export const ChannelCard = ({
biggestBaseFee,
biggestRateFee,
}: ChannelCardProps) => {
- const { channelBarType } = useConfigState();
- const dispatch = useConfigDispatch();
+ const { channelBarType, channelBarStyle } = useConfigState();
const [modalOpen, setModalOpen] = useState(false);
const { theme, currency, displayValues } = useConfigState();
@@ -180,13 +141,6 @@ export const ChannelCard = ({
}
};
- const handleBarClick = () => {
- dispatch({
- type: 'change',
- channelBarType: channelBarType === 'normal' ? 'partner' : 'normal',
- });
- };
-
const renderPartner = () =>
alias ? (
<>
@@ -196,8 +150,8 @@ export const ChannelCard = ({
'Last Update:',
`${getDateDif(updated_at)} ago (${getFormatDate(updated_at)})`
)}
- {renderLine('Base Fee:', `${base_fee} mSats`)}
- {renderLine('Fee Rate:', `${fee_rate} sats/MSats`)}
+ {renderLine('Base Fee:', `${base_fee} msats`)}
+ {renderLine('Fee Rate:', `${fee_rate} sats/Msats`)}
{renderLine('CTLV Delta:', cltv_delta)}
>
) : (
@@ -253,7 +207,7 @@ export const ChannelCard = ({
switch (channelBarType) {
case 'partner':
return (
- <>
+
- >
+
);
- default:
+ case 'details':
return (
- <>
+
- >
+
+ );
+ default:
+ return (
+
+
+
+
+
+
+
+
+
+
);
}
};
@@ -285,10 +258,11 @@ export const ChannelCard = ({
<>
{`Partner Capacity: ${nodeCapacity}`}
{`Partner Channels: ${channel_count}`}
- {`Partner Base Fee: ${base_fee} mSats`}
- {`Partner Fee Rate: ${fee_rate} sats/MSats`}
+ {`Partner Base Fee: ${base_fee} msats`}
+ {`Partner Fee Rate: ${fee_rate} sats/Msats`}
>
);
+ case 'details':
default:
return (
<>
@@ -301,34 +275,52 @@ export const ChannelCard = ({
}
};
+ const getSubCardProps = () => {
+ switch (channelBarStyle) {
+ case 'ultracompact':
+ return {
+ withMargin: '0 0 4px 0',
+ padding: index === indexOpen ? '0 0 16px' : '2px 0',
+ noBackground: true,
+ };
+ case 'compact':
+ return {
+ withMargin: '0 0 4px 0',
+ padding: index === indexOpen ? '4px 8px 16px' : '4px 8px',
+ };
+ default:
+ return {};
+ }
+ };
+
return (
-
-
- {getStatusDot(is_active, 'active')}
- {getStatusDot(is_opening, 'opening')}
- {getStatusDot(is_closing, 'closing')}
-
-
-
- handleClick()}>
+
+ handleClick()}>
+ {channelBarStyle === 'normal' && (
+
+ {getStatusDot(is_active, 'active')}
+ {getStatusDot(is_opening, 'opening')}
+ {getStatusDot(is_closing, 'closing')}
+
+ )}
+
+
{alias || partner_public_key?.substring(0, 6)}
- {formatBalance}
-
-
-
-
+ {channelBarStyle !== 'ultracompact' && (
+
+ {formatBalance}
+
+ {getPrivate(is_private)}
+ {getSymbol(is_partner_initiated)}
+
+
+ )}
+
+
{renderBars()}
-
-
-
- {getPrivate(is_private)}
- {getSymbol(is_partner_initiated)}
-
-
+
+