mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-22 14:22:33 +01:00
chore: 🔧 channel alias color
This commit is contained in:
parent
c756432dc3
commit
0e09873dd1
3 changed files with 37 additions and 18 deletions
|
@ -49,6 +49,10 @@ export const ChannelNodeTitle = styled.div`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const ChannelAlias = styled.div<{ textColor?: string }>`
|
||||||
|
${({ textColor }) => textColor && `color: ${textColor}`}
|
||||||
|
`;
|
||||||
|
|
||||||
export const ChannelSingleLine = styled.div`
|
export const ChannelSingleLine = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -21,11 +21,7 @@ import {
|
||||||
blockToTime,
|
blockToTime,
|
||||||
formatSats,
|
formatSats,
|
||||||
} from '../../../utils/helpers';
|
} from '../../../utils/helpers';
|
||||||
import {
|
import { ProgressBar, MainInfo } from '../../../components/generic/CardGeneric';
|
||||||
ProgressBar,
|
|
||||||
StatusLine,
|
|
||||||
MainInfo,
|
|
||||||
} from '../../../components/generic/CardGeneric';
|
|
||||||
import {
|
import {
|
||||||
SubCard,
|
SubCard,
|
||||||
Separation,
|
Separation,
|
||||||
|
@ -36,7 +32,6 @@ import {
|
||||||
} from '../../../components/generic/Styled';
|
} from '../../../components/generic/Styled';
|
||||||
import { useConfigState } from '../../../context/ConfigContext';
|
import { useConfigState } from '../../../context/ConfigContext';
|
||||||
import {
|
import {
|
||||||
getStatusDot,
|
|
||||||
getFormatDate,
|
getFormatDate,
|
||||||
getDateDif,
|
getDateDif,
|
||||||
renderLine,
|
renderLine,
|
||||||
|
@ -58,8 +53,10 @@ import {
|
||||||
ChannelBalanceRow,
|
ChannelBalanceRow,
|
||||||
ChannelBalanceButton,
|
ChannelBalanceButton,
|
||||||
WumboTag,
|
WumboTag,
|
||||||
|
ChannelAlias,
|
||||||
} from './Channel.style';
|
} from './Channel.style';
|
||||||
import { WUMBO_MIN_SIZE } from './Channels';
|
import { WUMBO_MIN_SIZE } from './Channels';
|
||||||
|
import { getTitleColor } from './helpers';
|
||||||
|
|
||||||
const MAX_HTLCS = 483;
|
const MAX_HTLCS = 483;
|
||||||
|
|
||||||
|
@ -79,7 +76,7 @@ const getBar = (top: number, bottom: number) => {
|
||||||
interface ChannelCardProps {
|
interface ChannelCardProps {
|
||||||
channelInfo: ChannelType;
|
channelInfo: ChannelType;
|
||||||
index: number;
|
index: number;
|
||||||
setIndexOpen: (index: number) => void;
|
setIndexOpen: (indexNumber: number) => void;
|
||||||
indexOpen: number;
|
indexOpen: number;
|
||||||
biggest: number;
|
biggest: number;
|
||||||
biggestPartner: number;
|
biggestPartner: number;
|
||||||
|
@ -492,16 +489,17 @@ export const ChannelCard: React.FC<ChannelCardProps> = ({
|
||||||
disabled={channelBarStyle === 'balancing'}
|
disabled={channelBarStyle === 'balancing'}
|
||||||
onClick={() => channelBarStyle !== 'balancing' && handleClick()}
|
onClick={() => channelBarStyle !== 'balancing' && handleClick()}
|
||||||
>
|
>
|
||||||
{channelBarStyle === 'normal' && (
|
|
||||||
<StatusLine data-tip data-for={`node_status_tip_${index}`}>
|
|
||||||
{getStatusDot(is_active, 'active')}
|
|
||||||
{getStatusDot(is_opening, 'opening')}
|
|
||||||
{getStatusDot(is_closing, 'closing')}
|
|
||||||
</StatusLine>
|
|
||||||
)}
|
|
||||||
<ResponsiveLine>
|
<ResponsiveLine>
|
||||||
<ChannelNodeTitle style={{ flexGrow: 2 }}>
|
<ChannelNodeTitle
|
||||||
{alias || partner_public_key?.substring(0, 6)}
|
style={{ flexGrow: 2 }}
|
||||||
|
data-tip
|
||||||
|
data-for={`node_status_tip_${index}`}
|
||||||
|
>
|
||||||
|
<ChannelAlias
|
||||||
|
textColor={getTitleColor(is_active, is_opening, is_closing)}
|
||||||
|
>
|
||||||
|
{alias || partner_public_key?.substring(0, 6)}
|
||||||
|
</ChannelAlias>
|
||||||
{!(
|
{!(
|
||||||
channelBarStyle === 'ultracompact' ||
|
channelBarStyle === 'ultracompact' ||
|
||||||
channelBarStyle === 'balancing'
|
channelBarStyle === 'balancing'
|
||||||
|
@ -553,8 +551,8 @@ export const ChannelCard: React.FC<ChannelCardProps> = ({
|
||||||
place={'bottom'}
|
place={'bottom'}
|
||||||
>
|
>
|
||||||
{renderLine('Status:', is_active ? 'Active' : 'Not Active')}
|
{renderLine('Status:', is_active ? 'Active' : 'Not Active')}
|
||||||
{renderLine('Is Opening:', is_opening ? 'True' : 'False')}
|
{is_opening && renderLine('Is Opening:', 'True')}
|
||||||
{renderLine('Is Closing:', is_closing ? 'True' : 'False')}
|
{is_closing && renderLine('Is Closing:', 'True')}
|
||||||
</ReactTooltip>
|
</ReactTooltip>
|
||||||
<ReactTooltip
|
<ReactTooltip
|
||||||
id={`node_balance_tip_${index}`}
|
id={`node_balance_tip_${index}`}
|
||||||
|
|
17
src/views/channels/channels/helpers.ts
Normal file
17
src/views/channels/channels/helpers.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import { themeColors } from 'src/styles/Themes';
|
||||||
|
|
||||||
|
export const getTitleColor = (
|
||||||
|
active: boolean,
|
||||||
|
opening: boolean,
|
||||||
|
closing: boolean
|
||||||
|
): string | undefined => {
|
||||||
|
switch (true) {
|
||||||
|
case active:
|
||||||
|
return undefined;
|
||||||
|
case opening:
|
||||||
|
case closing:
|
||||||
|
return themeColors.blue2;
|
||||||
|
default:
|
||||||
|
return 'red';
|
||||||
|
}
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue