Skip to content

Commit

Permalink
Merge pull request #58 from ssciwr/hide-detail-controls
Browse files Browse the repository at this point in the history
Hide detail controls when there is only the asset viewer to show
  • Loading branch information
dokempf authored Oct 7, 2024
2 parents 029fb17 + 5b2d688 commit 932edd3
Showing 1 changed file with 42 additions and 22 deletions.
64 changes: 42 additions & 22 deletions src/components/logic/DetailControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
</script>

<ButtonGroup class="pb-2">
{#if $systemidStore.length > 1}
<Button id="back-nav" on:click={popSystemID}>
<BackwardStepOutline class="inline-block w-6 h-6"/>
</Button>
<Tooltip triggeredBy="#back-nav" placement="bottom" class="z-10">
{l10n.returntext[$appLanguageStore]}{$systemidStore.at(-2)}
</Tooltip>
{/if}
{#if hasRelations()}
<Button id="hierarchy-nav" on:click={() => { viewerPanelStateStore.set("hierarchy"); }}>
<RectangleListOutline class="inline-block w-6 h-6"/>
{#if displayedButtons.length > 0}
<ButtonGroup class="pb-2">
{#if displayedButtons.includes("back")}
<Button id="back-nav" on:click={popSystemID}>
<BackwardStepOutline class="inline-block w-6 h-6"/>
</Button>
<Tooltip triggeredBy="#back-nav" placement="bottom" class="z-10">
{l10n.returntext[$appLanguageStore]}{$systemidStore.at(-2)}
</Tooltip>
{/if}
{#if displayedButtons.includes("hierarchy")}
<Button id="hierarchy-nav" on:click={() => { viewerPanelStateStore.set("hierarchy"); }}>
<RectangleListOutline class="inline-block w-6 h-6"/>
</Button>
<Tooltip triggeredBy="#hierarchy-nav" placement="bottom" class="z-10">
{l10n.hierarchytext[$appLanguageStore]}
</Tooltip>
{/if}
<Button id="assets-nav" on:click={() => { viewerPanelStateStore.set("asset"); }}>
<ImageOutline class="inline-block w-6 h-6"/>
</Button>
<Tooltip triggeredBy="#hierarchy-nav" placement="bottom" class="z-10">
{l10n.hierarchytext[$appLanguageStore]}
<Tooltip triggeredBy="#assets-nav" placement="bottom" class="z-10">
{l10n.assettext[$appLanguageStore]}
</Tooltip>
{/if}
<Button id="assets-nav" on:click={() => { viewerPanelStateStore.set("asset"); }}>
<ImageOutline class="inline-block w-6 h-6"/>
</Button>
<Tooltip triggeredBy="#assets-nav" placement="bottom" class="z-10">
{l10n.assettext[$appLanguageStore]}
</Tooltip>
</ButtonGroup>
</ButtonGroup>
{/if}

0 comments on commit 932edd3

Please sign in to comment.