From 5b2d68844c846883bc214060cc2d7fd4429c56c2 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Mon, 7 Oct 2024 15:28:43 +0200 Subject: [PATCH] Hide detail controls when there is only the asset viewer to show --- src/components/logic/DetailControls.svelte | 64 ++++++++++++++-------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/src/components/logic/DetailControls.svelte b/src/components/logic/DetailControls.svelte index 7f824f2..d9e8ad1 100644 --- a/src/components/logic/DetailControls.svelte +++ b/src/components/logic/DetailControls.svelte @@ -37,29 +37,49 @@ } return false; } + + function calculate(ids) { + let ret = []; + + if(ids.length > 1) { + ret.push("back"); + } + + if(hasRelations()) { + ret.push("hierarchy"); + } + + return ret + } + + $: displayedButtons = calculate($systemidStore); + + console.log(displayedButtons); - - {#if $systemidStore.length > 1} - - - {l10n.returntext[$appLanguageStore]}{$systemidStore.at(-2)} - - {/if} - {#if hasRelations()} - + + {l10n.returntext[$appLanguageStore]}{$systemidStore.at(-2)} + + {/if} + {#if displayedButtons.includes("hierarchy")} + + + {l10n.hierarchytext[$appLanguageStore]} + + {/if} + - - {l10n.hierarchytext[$appLanguageStore]} + + {l10n.assettext[$appLanguageStore]} - {/if} - - - {l10n.assettext[$appLanguageStore]} - - \ No newline at end of file + +{/if}