From 80b2e14d2627081e69aa23cc7acac7dccb54050a Mon Sep 17 00:00:00 2001 From: theborakompanioni Date: Tue, 31 Oct 2023 11:34:50 +0100 Subject: [PATCH] ui(jar): hide empty internal change accounts --- src/components/jar_details/DisplayBranch.tsx | 11 +--------- .../jar_details/JarDetailsOverlay.tsx | 22 ++++++++++--------- src/context/ServiceInfoContext.tsx | 2 +- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/components/jar_details/DisplayBranch.tsx b/src/components/jar_details/DisplayBranch.tsx index 5cc0fafc1..e84b4f95b 100644 --- a/src/components/jar_details/DisplayBranch.tsx +++ b/src/components/jar_details/DisplayBranch.tsx @@ -4,9 +4,9 @@ import { useTranslation } from 'react-i18next' import Balance from '../Balance' import { useSettings } from '../../context/SettingsContext' import { Branch, BranchEntry } from '../../context/WalletContext' -import styles from './DisplayBranch.module.css' import { CopyButton } from '../CopyButton' import Sprite from '../Sprite' +import styles from './DisplayBranch.module.css' const toHdPathIndex = (hdPath: string) => { const indexOfLastSeparator = hdPath.lastIndexOf('/') @@ -76,15 +76,6 @@ export function DisplayBranchBody({ branch }: DisplayBranchProps) { ) } -export default function DisplayBranch({ branch }: DisplayBranchProps) { - return ( -
- - -
- ) -} - interface DisplayBranchEntryProps extends rb.CardProps { entry: BranchEntry } diff --git a/src/components/jar_details/JarDetailsOverlay.tsx b/src/components/jar_details/JarDetailsOverlay.tsx index b4d74ea07..5f122e217 100644 --- a/src/components/jar_details/JarDetailsOverlay.tsx +++ b/src/components/jar_details/JarDetailsOverlay.tsx @@ -414,16 +414,18 @@ const JarDetailsOverlay = (props: JarDetailsOverlayProps) => { ) : ( - {jar.branches.map((branch, index) => ( - - - - - - - - - ))} + {jar.branches + .filter((it) => it.entries.length > 0) + .map((branch, index) => ( + + + + + + + + + ))} )} diff --git a/src/context/ServiceInfoContext.tsx b/src/context/ServiceInfoContext.tsx index 219fbf78e..87a97d3f3 100644 --- a/src/context/ServiceInfoContext.tsx +++ b/src/context/ServiceInfoContext.tsx @@ -208,7 +208,7 @@ const ServiceInfoProvider = ({ children }: PropsWithChildren<{}>) => { }) .catch((err) => { if (!signal.aborted) { - const isUnauthorized = err instanceof Api.JmApiError && err.response.status === 401 + const isUnauthorized = err instanceof Api.JmApiError && err.response?.status === 401 if (isUnauthorized) { resetWalletAndClearSession() } else {