feat: add preview functionality to BracketPanel and i18n support for preview text

This commit is contained in:
2026-05-15 02:14:03 +02:00
parent 4da00508d3
commit a4dc89575d
2 changed files with 55 additions and 1 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from 'vue';
import { t } from '../i18n'; import { t } from '../i18n';
import { useScoreboardStore } from '../stores/scoreboard'; import { useScoreboardStore } from '../stores/scoreboard';
@@ -34,6 +34,14 @@ const customActive = ref(false);
const customText = ref(''); const customText = ref('');
const hasChanges = ref(false); const hasChanges = ref(false);
const previewText = computed(() => {
if (customActive.value) {
return customText.value.trim() || '—';
}
const prefix = bracketSide.value ? `${bracketSide.value} ` : '';
return `${prefix}${stage.value}`.trim() || '—';
});
const parseInitialRound = () => { const parseInitialRound = () => {
const round = scoreboardStore.scoreboard.round.trim(); const round = scoreboardStore.scoreboard.round.trim();
if (!round) { if (!round) {
@@ -138,6 +146,17 @@ onMounted(() => {
class="bracket-panel-custom-toggle" class="bracket-panel-custom-toggle"
/> />
</div> </div>
<!-- Preview -->
<div class="bracket-panel__preview">
<span class="bracket-panel__preview-label">{{ t('bracketPreview') }}</span>
<span
class="bracket-panel__preview-text"
:class="{ 'bracket-panel__preview-text--custom': customActive }"
>
{{ previewText }}
</span>
</div>
</div> </div>
</div> </div>
</template> </template>
@@ -183,4 +202,36 @@ onMounted(() => {
.bracket-panel__field :deep(.q-field__label) { .bracket-panel__field :deep(.q-field__label) {
color: rgba(255, 255, 255, 0.92); color: rgba(255, 255, 255, 0.92);
} }
.bracket-panel__preview {
display: flex;
align-items: baseline;
gap: 10px;
padding: 8px 10px;
border-radius: 4px;
border: 1px solid rgba(255, 255, 255, 0.12);
background: rgba(255, 255, 255, 0.04);
}
.bracket-panel__preview-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: rgba(255, 255, 255, 0.45);
white-space: nowrap;
flex-shrink: 0;
}
.bracket-panel__preview-text {
font-size: 1rem;
font-weight: 600;
color: rgba(255, 255, 255, 0.92);
letter-spacing: 0.02em;
word-break: break-word;
transition: color 0.2s ease;
}
.bracket-panel__preview-text--custom {
color: var(--q-secondary, #26a69a);
}
</style> </style>
+3
View File
@@ -69,6 +69,7 @@ type Translations = {
bracketStage: string; bracketStage: string;
bracketSide: string; bracketSide: string;
bracketCustomProgress: string; bracketCustomProgress: string;
bracketPreview: string;
playersLabelTeam: string; playersLabelTeam: string;
playersLabelCountry: string; playersLabelCountry: string;
playersLabelActions: string; playersLabelActions: string;
@@ -156,6 +157,7 @@ const messages: Record<Locale, Translations> = {
bracketStage: 'Stage', bracketStage: 'Stage',
bracketSide: 'Bracket side', bracketSide: 'Bracket side',
bracketCustomProgress: 'Custom progress', bracketCustomProgress: 'Custom progress',
bracketPreview: 'Preview',
playersLabelTeam: 'Team', playersLabelTeam: 'Team',
playersLabelCountry: 'Country', playersLabelCountry: 'Country',
playersLabelActions: 'Actions', playersLabelActions: 'Actions',
@@ -239,6 +241,7 @@ const messages: Record<Locale, Translations> = {
bracketStage: 'Etapa', bracketStage: 'Etapa',
bracketSide: 'Lado del bracket', bracketSide: 'Lado del bracket',
bracketCustomProgress: 'Progreso personalizado', bracketCustomProgress: 'Progreso personalizado',
bracketPreview: 'Vista previa',
playersLabelTeam: 'Equipo', playersLabelTeam: 'Equipo',
playersLabelCountry: 'País', playersLabelCountry: 'País',
playersLabelActions: 'Acciones', playersLabelActions: 'Acciones',