Skip to content

Commit

Permalink
feat(settings): add channel status for unusable
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr committed Nov 7, 2024
1 parent 3927859 commit a1b5e4e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/screens/Settings/Lightning/ChannelDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ const ChannelDetails = ({
<View style={styles.sectionTitle}>
<Caption13Up color="secondary">{t('status')}</Caption13Up>
</View>
<ChannelStatus status={channel.status} order={blocktankOrder} />
<ChannelStatus
status={channel.status}
order={blocktankOrder}
isUsable={channel.is_usable}
/>
</View>

{order && (
Expand Down
13 changes: 13 additions & 0 deletions src/screens/Settings/Lightning/ChannelStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,29 @@ import {

const ChannelStatus = ({
status,
isUsable,
order,
}: {
status: EChannelStatus;
isUsable: boolean;
order?: IBtOrder;
}): ReactElement => {
const { t } = useTranslation('lightning');

// Use open/closed status from LDK if available
switch (status) {
case EChannelStatus.open: {
if (!isUsable) {
return (
<View style={styles.statusRow}>
<ThemedView style={styles.statusIcon} color="yellow16">
<LightningIcon color="yellow" width={16} height={16} />
</ThemedView>
<BodyMSB color="yellow">{t('order_state.inactive')}</BodyMSB>
</View>
);
}

return (
<View style={styles.statusRow}>
<ThemedView style={styles.statusIcon} color="green16">
Expand Down
3 changes: 3 additions & 0 deletions src/utils/i18n/locales/en/lightning.json
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,9 @@
},
"open": {
"string": "Connection open"
},
"inactive": {
"string": "Connection inactive"
}
},
"wait_text_top": {
Expand Down

0 comments on commit a1b5e4e

Please sign in to comment.