Files
dragonroll/frontend/app/components/viewer/TopBar.vue
Gitea OpenCode Agent abcec4d2ff
All checks were successful
Test / test (push) Successful in 2s
Fix issue #95: Make documentation a resizable window
2026-10-15 22:33:31 +00:00

109 lines
2.9 KiB
Vue

<script setup>
import TopSearchBar from './topbar/TopSearchBar.vue';
import { useCampaignService } from '~/services/Campaign.js';
import { SetShowContent } from '~/services/Content.js';
import { ClearWindow, CreateWindow } from '~/services/Windows';
const { Campaign, SetCampaign } = useCampaignService();
const campaignName = computed(() => Campaign.value?.name || 'Campaign');
function OpenCampaignSettings() {
if (!Campaign.value) return;
ClearWindow({ type: 'campaign_settings' });
CreateWindow('campaign_settings', { campaign: Campaign.value });
}
function OpenDocumentation() {
// La documentació és una finestra que va davant de l'espai de treball, així que les notes
// obertes no es perden. CreateWindow deixa sola una finestra que ja és oberta: tornar a
// prémer el botó no la torna a la primera pàgina.
CreateWindow('documentation');
}
function ExitCampaign() {
// Torn al menú principal: neteja la campanya (i el localStorage), amaga
// l'espai de treball i reobre el menú
ClearWindow({ type: 'campaign_settings' });
SetCampaign(null);
SetShowContent(false);
CreateWindow('main_menu');
}
</script>
<template>
<div class="top-bar">
<div class="left">
<span class="top-bar-title">
<img src="/img/logo.png" alt="Dragonroll Logo" class="logo">
<span>{{ campaignName }}</span>
</span>
</div>
<div class="center">
<TopSearchBar></TopSearchBar>
</div>
<div class="right">
<!-- La documentació s'obre en una finestra seva, davant de la campanya: les notes
obertes no es perden i no cal obrir una pestanya nova. -->
<button class="btn-primary settings-button docs-button sound-click" type="button" @click="OpenDocumentation">
{{ $t('main-menu.documentation') }}
</button>
<button class="btn-primary settings-button sound-click" type="button" @click="OpenCampaignSettings">
{{ $t('main-menu.settings') }}
</button>
<button class="btn-primary settings-button exit-button sound-click" type="button" @click="ExitCampaign">
{{ $t('main-menu.exit') }}
</button>
</div>
</div>
</template>
<style scoped>
.top-bar {
flex-grow: 0;
flex-shrink: 0;
min-height: 40px;
width: 100%;
background-color: var(--color-background-light);
display: flex;
}
.logo {
height: 32px;
width: 32px;
position: absolute;
top: 0px;
left: 6px;
}
.left {
flex: 1;
}
.center {
display: flex;
align-items: center;
}
.right {
display: flex;
align-items: center;
justify-content: flex-end;
flex: 1;
padding: 0 10px;
gap: 8px;
}
.settings-button {
padding: 5px 10px;
}
.top-bar-title {
padding: 10px;
display: flex;
margin-left: 48px;
font-weight: bold;
}
</style>