All files / src/components/match LiveScoringHint.vue

100% Statements 54/54
100% Branches 5/5
100% Functions 2/2
100% Lines 54/54

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 60 61 62 63 64 65 66 67 68 691x 1x       1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x   1x     1x 1x 1x 1x 1x 1x 1x   1x 1x 1x       1x 1x   1x 1x 1x 1x 1x 1x    
<template>
  <!--
    SB-1800: a quiet way to learn that MT has live scoring. One small icon;
    tapping it reveals a line and a link to the Manager roles page. No claim
    or request action, by design: the goal is awareness, not inbound requests.
  -->
  <div class="relative" data-testid="live-scoring-hint">
    <button
      type="button"
      class="inline-flex items-center justify-center w-10 h-10 rounded-full text-fg-muted hover:text-fg hover:bg-surface-alt focus:outline-none focus:ring-2 focus:ring-brand-500"
      :aria-expanded="open ? 'true' : 'false'"
      aria-controls="live-scoring-hint-panel"
      aria-label="About live scoring"
      data-testid="live-scoring-hint-toggle"
      @click="open = !open"
    >
      <!-- broadcast icon -->
      <svg
        viewBox="0 0 24 24"
        class="w-4 h-4"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        aria-hidden="true"
      >
        <circle cx="12" cy="12" r="2" />
        <path d="M16.24 7.76a6 6 0 0 1 0 8.49M7.76 16.24a6 6 0 0 1 0-8.49" />
        <path
          d="M19.07 4.93a10 10 0 0 1 0 14.14M4.93 19.07a10 10 0 0 1 0-14.14"
        />
      </svg>
    </button>
    <div
      v-if="open"
      id="live-scoring-hint-panel"
      role="note"
      class="absolute right-0 top-full mt-2 w-64 max-w-[calc(100vw-2rem)] rounded-lg bg-card border border-line p-3 text-xs text-fg shadow-lg z-20"
      data-testid="live-scoring-hint-panel"
    >
      <p>
        Team managers can live score matches in Missing Table: goals, halftime
        and full time, as they happen.
      </p>
      <button
        type="button"
        class="mt-2 text-xs font-medium text-brand-600 hover:text-brand-700 dark:text-brand-300 dark:hover:text-brand-200 underline underline-offset-2"
        data-testid="live-scoring-hint-roles"
        @click="openRoles"
      >
        Learn about manager roles
      </button>
    </div>
  </div>
</template>
 
<script setup>
import { ref } from 'vue';
import { useManagerRolesPage } from '@/composables/useManagerRolesPage';
 
const open = ref(false);
const roles = useManagerRolesPage();
const openRoles = () => {
  open.value = false;
  roles.open();
};
</script>