Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide detail controls when there is only the asset viewer to show #58

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}