All files / repo/src/components/Sidebar/SidebarInfoPanel SidebarInfoPanel.vue

0% Statements 0/43
100% Branches 1/1
100% Functions 1/1
0% Lines 0/43

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                                                                                                     
<template>
  <div class="sidebar-info-panel">
    <p>
      <strong>{{ $t('sidebar.time') }}</strong> {{ formattedTime ?? '' }}
    </p>
    <p>
      <strong>{{ $t('sidebar.dateStart') }}</strong> {{ formattedDateTime ?? '' }}
    </p>
    <p>
      <strong>{{ $t('sidebar.moves') }}</strong> {{ gameStore.moves ?? 0 }}
    </p>
    <p>
      <strong>{{ $t('sidebar.matchCount') }}</strong> {{ gameStore.matchCount ?? 0 }}
    </p>
    <p>
      <strong>{{ $t('sidebar.mismatchCount') }}</strong> {{ gameStore.mismatchCount ?? 0 }}
    </p>
    <p>
      <strong>{{ $t('sidebar.seed') }}</strong> {{ gameStore.seed ?? '' }}
    </p>
    <p>
      <strong>{{ $t('sidebar.difficulty') }}</strong> {{ difficultyLabel ?? '' }}
    </p>
  </div>
</template>
 
<script setup lang="ts">
import { useFormattedTime } from '@/hooks/useFormattedTime';
import { useGameStore } from '@/stores/useGameStore';
import { useI18n } from 'vue-i18n';
 
defineOptions({
  inheritAttrs: false,
});
defineProps<{}>();
 
const { t } = useI18n();
 
const gameStore = useGameStore();
const elapsed = computed(() => gameStore.elapsed);
const formattedTime = useFormattedTime(elapsed);
const formattedDateTime = useDateFormat(gameStore.dateStart ?? '', 'YYYY-MM-DD HH:mm:ss');
 
const difficultyLabel = computed(() => {
  switch (gameStore.difficulty) {
    case 1:
      return t('difficultyDict.easy');
    case 2:
      return t('difficultyDict.medium');
    case 3:
      return t('difficultyDict.hard');
    default:
      return t('difficultyDict.unknown');
  }
});
</script>
 
<style scoped src="././SidebarInfoPanel.scss" />