From 461f72f878bba87fcdb1bf49451f16d9e2c857d1 Mon Sep 17 00:00:00 2001 From: Pandipipas <62224708+Pandipipas@users.noreply.github.com> Date: Sun, 15 Feb 2026 11:12:57 +0100 Subject: [PATCH] Mejora panel de comentaristas con Twitter y swap central --- schemas/commentary.json | 16 +++- .../components/CommentaryPanel.vue | 83 +++++++++++++++---- .../scoreko-dev/stores/commentary.ts | 28 +++++++ src/extension/util/replicants.ts | 2 + src/graphics/commentary/main.vue | 2 + src/types/schemas/commentary.d.ts | 2 + 6 files changed, 116 insertions(+), 17 deletions(-) diff --git a/schemas/commentary.json b/schemas/commentary.json index 455a223..2e49904 100644 --- a/schemas/commentary.json +++ b/schemas/commentary.json @@ -7,17 +7,29 @@ "type": "string", "default": "" }, + "leftCommentatorTwitter": { + "type": "string", + "default": "" + }, "rightCommentator": { "type": "string", "default": "" + }, + "rightCommentatorTwitter": { + "type": "string", + "default": "" } }, "required": [ "leftCommentator", - "rightCommentator" + "leftCommentatorTwitter", + "rightCommentator", + "rightCommentatorTwitter" ], "default": { "leftCommentator": "", - "rightCommentator": "" + "leftCommentatorTwitter": "", + "rightCommentator": "", + "rightCommentatorTwitter": "" } } diff --git a/src/dashboard/scoreko-dev/components/CommentaryPanel.vue b/src/dashboard/scoreko-dev/components/CommentaryPanel.vue index fc29584..e549fcf 100644 --- a/src/dashboard/scoreko-dev/components/CommentaryPanel.vue +++ b/src/dashboard/scoreko-dev/components/CommentaryPanel.vue @@ -10,30 +10,53 @@ const commentaryStore = useCommentaryStore();
Commentary
- - -
-
+
+
+ + + +
-
+ + +
+ + + + @@ -49,6 +72,22 @@ const commentaryStore = useCommentaryStore(); gap: 16px; } +.commentary-panel__layout { + display: grid; + grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); + align-items: center; + gap: 12px; +} + +.commentary-panel__commentator { + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 4px; + padding: 8px; + display: flex; + flex-direction: column; + gap: 2px; +} + .commentary-panel__field :deep(.q-field__control) { min-height: 28px; padding: 0; @@ -62,19 +101,33 @@ const commentaryStore = useCommentaryStore(); border-bottom: 1px solid rgba(255, 255, 255, 0.34); } +.commentary-panel__field :deep(.q-field__prepend) { + color: rgba(255, 255, 255, 0.6); +} + .commentary-panel__field :deep(.q-field__native), .commentary-panel__field :deep(.q-field__input), .commentary-panel__field :deep(.q-field__label) { color: rgba(255, 255, 255, 0.92); } -.commentary-panel__action-btn { +.commentary-panel__swap-btn { color: #fff; opacity: 0.85; } -.commentary-panel__action-btn:hover { +.commentary-panel__swap-btn:hover { opacity: 1; text-shadow: 0 0 10px rgba(255, 255, 255, 0.45); } + +@media (max-width: 900px) { + .commentary-panel__layout { + grid-template-columns: 1fr; + } + + .commentary-panel__swap-btn { + justify-self: center; + } +} diff --git a/src/dashboard/scoreko-dev/stores/commentary.ts b/src/dashboard/scoreko-dev/stores/commentary.ts index 0db68b0..cba56ef 100644 --- a/src/dashboard/scoreko-dev/stores/commentary.ts +++ b/src/dashboard/scoreko-dev/stores/commentary.ts @@ -8,14 +8,18 @@ type Commentary = Schemas.Commentary; const defaultCommentary: Commentary = { leftCommentator: '', + leftCommentatorTwitter: '', rightCommentator: '', + rightCommentatorTwitter: '', }; const normalizeCommentary = (input: unknown): Commentary => { const candidate = typeof input === 'object' && input !== null ? (input as Record) : {}; return { leftCommentator: typeof candidate.leftCommentator === 'string' ? candidate.leftCommentator : '', + leftCommentatorTwitter: typeof candidate.leftCommentatorTwitter === 'string' ? candidate.leftCommentatorTwitter : '', rightCommentator: typeof candidate.rightCommentator === 'string' ? candidate.rightCommentator : '', + rightCommentatorTwitter: typeof candidate.rightCommentatorTwitter === 'string' ? candidate.rightCommentatorTwitter : '', }; }; @@ -34,6 +38,16 @@ export const useCommentaryStore = defineStore('commentary', () => { }, }); + const leftCommentatorTwitter = computed({ + get: () => commentary.value.leftCommentatorTwitter, + set: (value: string) => { + commentary.value = { + ...commentary.value, + leftCommentatorTwitter: value, + }; + }, + }); + const rightCommentator = computed({ get: () => commentary.value.rightCommentator, set: (value: string) => { @@ -44,17 +58,31 @@ export const useCommentaryStore = defineStore('commentary', () => { }, }); + const rightCommentatorTwitter = computed({ + get: () => commentary.value.rightCommentatorTwitter, + set: (value: string) => { + commentary.value = { + ...commentary.value, + rightCommentatorTwitter: value, + }; + }, + }); + const swapCommentators = () => { commentary.value = { leftCommentator: commentary.value.rightCommentator, + leftCommentatorTwitter: commentary.value.rightCommentatorTwitter, rightCommentator: commentary.value.leftCommentator, + rightCommentatorTwitter: commentary.value.leftCommentatorTwitter, }; }; return { commentary, leftCommentator, + leftCommentatorTwitter, rightCommentator, + rightCommentatorTwitter, swapCommentators, }; }); diff --git a/src/extension/util/replicants.ts b/src/extension/util/replicants.ts index 155f82d..bd943c4 100644 --- a/src/extension/util/replicants.ts +++ b/src/extension/util/replicants.ts @@ -23,7 +23,9 @@ export const scoreboardReplicant = hasDefault('scoreboard'); export const commentaryReplicant = nodecg.Replicant('commentary', { defaultValue: { leftCommentator: '', + leftCommentatorTwitter: '', rightCommentator: '', + rightCommentatorTwitter: '', }, persistent: false, }); diff --git a/src/graphics/commentary/main.vue b/src/graphics/commentary/main.vue index 945fc25..03f7068 100644 --- a/src/graphics/commentary/main.vue +++ b/src/graphics/commentary/main.vue @@ -8,7 +8,9 @@ useHead({ title: 'Commentary' }); const defaultCommentary: Schemas.Commentary = { leftCommentator: '', + leftCommentatorTwitter: '', rightCommentator: '', + rightCommentatorTwitter: '', }; const commentary = computed(() => commentaryReplicant?.data ?? defaultCommentary); diff --git a/src/types/schemas/commentary.d.ts b/src/types/schemas/commentary.d.ts index 4515a7f..5624eb3 100644 --- a/src/types/schemas/commentary.d.ts +++ b/src/types/schemas/commentary.d.ts @@ -8,5 +8,7 @@ export interface Commentary { leftCommentator: string; + leftCommentatorTwitter: string; rightCommentator: string; + rightCommentatorTwitter: string; }