mirror of
https://github.com/Pandipipas/scoreko-dev.git
synced 2026-06-06 03:32:06 +00:00
Corrige persistencia del selector de skin en GraphicsView
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useHead } from '@unhead/vue';
|
import { useHead } from '@unhead/vue';
|
||||||
import { computed, ref, watch, watchEffect } from 'vue';
|
import { computed, ref, watch } from 'vue';
|
||||||
import { graphicsSettingsReplicant } from '../../../browser_shared/replicants';
|
import { graphicsSettingsReplicant } from '../../../browser_shared/replicants';
|
||||||
import { t } from '../i18n';
|
import { t } from '../i18n';
|
||||||
|
|
||||||
@@ -60,29 +60,30 @@ const commentaryGraphic = computed(() =>
|
|||||||
|
|
||||||
const selectedScoreboardSkin = ref<string>('');
|
const selectedScoreboardSkin = ref<string>('');
|
||||||
|
|
||||||
watchEffect(() => {
|
watch(
|
||||||
const availableSkins = scoreboardGraphics.value;
|
[scoreboardGraphics, () => graphicsSettingsReplicant?.data?.scoreboardSkin],
|
||||||
|
([availableSkins, replicatedSkin]) => {
|
||||||
|
if (availableSkins.length === 0) {
|
||||||
|
selectedScoreboardSkin.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (availableSkins.length === 0) {
|
const hasReplicatedSkin = availableSkins.some((graphic) => graphic.file === replicatedSkin);
|
||||||
selectedScoreboardSkin.value = '';
|
if (hasReplicatedSkin) {
|
||||||
return;
|
selectedScoreboardSkin.value = replicatedSkin ?? "";
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const replicatedSkin = graphicsSettingsReplicant?.data?.scoreboardSkin ?? '';
|
const hasCurrentSkin = availableSkins.some(
|
||||||
const hasReplicatedSkin = availableSkins.some((graphic) => graphic.file === replicatedSkin);
|
(graphic) => graphic.file === selectedScoreboardSkin.value,
|
||||||
if (hasReplicatedSkin && selectedScoreboardSkin.value !== replicatedSkin) {
|
);
|
||||||
selectedScoreboardSkin.value = replicatedSkin;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasCurrentSkin = availableSkins.some(
|
if (!hasCurrentSkin) {
|
||||||
(graphic) => graphic.file === selectedScoreboardSkin.value,
|
selectedScoreboardSkin.value = availableSkins[0]!.file;
|
||||||
);
|
}
|
||||||
|
},
|
||||||
if (!hasCurrentSkin) {
|
{ immediate: true },
|
||||||
selectedScoreboardSkin.value = availableSkins[0]!.file;
|
);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
selectedScoreboardSkin,
|
selectedScoreboardSkin,
|
||||||
|
|||||||
Reference in New Issue
Block a user