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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | 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 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 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 31x 31x 23x 23x 31x 31x 31x 31x 31x 31x 31x 31x 1x 1x 1x 1x 11x 11x 11x 11x | <template>
<!--
One team's details under the Scouting tab's head-to-head rows (SB-1782,
SB-1906): context labels, its other conferences, key wins and stat-board
badges. Its main table and form are in the rows above. Degrades per
field; absent renders as "—" or says so, never as 0.
-->
<section
v-if="hasContent"
class="rounded-lg border border-line bg-card p-3 min-w-0"
:data-testid="`scouting-${role}`"
>
<h4
class="m-0 mb-2 text-[11px] font-semibold uppercase tracking-wide text-fg-muted break-words"
data-testid="scouting-column-team"
>
{{ dossier?.team?.name || teamName }}
</h4>
<div
v-if="!dossier || dossier.error"
class="py-4 text-center text-sm text-fg-muted"
data-testid="scouting-side-error"
>
<p>This team's scouting report is unavailable right now.</p>
</div>
<template v-else>
<!-- Labels -->
<div
v-if="labels.length"
class="flex flex-wrap gap-1 mb-2"
data-testid="scouting-labels"
>
<span
v-for="label in labels"
:key="label"
class="rounded px-1.5 py-0.5 text-[11px] bg-surface-alt text-fg-muted"
data-testid="scouting-label"
>{{ label }}</span
>
</div>
<!-- Honest empty states -->
<div
v-if="noResults || noConference"
class="rounded border border-dashed border-line px-3 py-3 mb-2 text-center"
data-testid="scouting-side-empty"
>
<p v-if="noResults" class="m-0 text-xs font-semibold text-fg">
No results tracked this season
</p>
<p v-if="noConference" class="m-0 text-xs text-fg-muted">
Not registered in a conference at {{ ageName }}
</p>
</div>
<!-- Other conferences, one line each -->
<div v-if="others.length" class="mb-3">
<h5
class="m-0 mb-1 text-[11px] font-semibold uppercase tracking-wide text-fg-muted"
>
Also plays
</h5>
<ul
class="m-0 p-0 list-none space-y-1.5"
data-testid="scouting-conferences"
>
<li
v-for="line in others"
:key="line.division.id"
class="flex flex-wrap items-baseline justify-between gap-x-3 gap-y-0.5 rounded-md border border-line px-2.5 py-2 text-xs"
:data-testid="`scouting-conference-${line.kind}`"
>
<span class="min-w-0 text-fg">
<span class="font-semibold">{{ kindLabel(line) }}</span
>{{ ' '
}}<span class="text-fg-muted">{{ conferenceName(line) }}</span>
</span>
<span
v-if="line.no_results"
class="text-fg-muted"
data-testid="scouting-line-empty"
>No results yet</span
>
<span
v-else
class="tabular-nums text-fg"
data-testid="scouting-line-stats"
>
<span data-testid="scouting-position">{{
positionText(line)
}}</span>
· {{ recordText(line) }}
<span class="text-fg-muted"
>· GF {{ perGame(line.gf_per_game) }} · GA
{{ perGame(line.ga_per_game) }}</span
>
</span>
</li>
</ul>
</div>
<!-- The main table has no results: say so here, under its name -->
<p
v-if="primary?.no_results && !noResults"
class="m-0 mb-2 text-xs text-fg-muted"
data-testid="scouting-line-empty"
>
No {{ kindLabel(primary) }} results yet
</p>
<!-- Key wins -->
<div v-if="dossier.key_wins?.length" class="mb-3">
<h5
class="m-0 mb-1 text-[11px] font-semibold uppercase tracking-wide text-fg-muted"
>
Key wins
</h5>
<ul class="m-0 p-0 list-none space-y-1">
<li
v-for="win in dossier.key_wins.slice(0, 3)"
:key="win.match_id"
class="flex flex-wrap items-center gap-1 text-xs text-fg"
data-testid="scouting-key-win"
>
<span class="font-mono font-semibold">{{ win.score }}</span>
<span class="break-words">v {{ win.opponent.name }}</span>
<span v-if="win.opponent_position != null" class="text-fg-muted"
>({{ ordinal(win.opponent_position) }} of
{{ fmt(win.opponent_table_size) }} in
{{ win.opponent_conference }})</span
>
</li>
</ul>
</div>
<!-- Stat-board badges -->
<div v-if="side.badges?.length" data-testid="scouting-badges">
<ul class="m-0 p-0 list-none space-y-1">
<li
v-for="badge in side.badges"
:key="badge.fact_id"
class="text-xs text-fg"
data-testid="scouting-badge"
>
{{ badgeText(badge) }}
</li>
</ul>
<!-- The full coverage note is a tooltip: nobody reads a paragraph here (SB-1887). -->
<p
v-if="side.badges_note"
class="m-0 mt-1 text-[11px] text-fg-muted cursor-help"
:title="side.badges_note"
data-testid="scouting-badges-note"
>
Stat boards across all conferences
</p>
</div>
<p
v-else-if="side.badges == null && !noResults"
class="m-0 text-[11px] text-fg-muted"
data-testid="scouting-badges-unavailable"
>
Stat boards are unavailable right now.
</p>
</template>
</section>
</template>
<script setup>
import { computed } from 'vue';
import {
conferenceName,
dossierLabels,
fmt,
kindLabel,
ordinal,
otherLines,
perGame,
positionText,
primaryLine,
recordText,
} from '../../utils/scoutingCompare';
const props = defineProps({
/** One MatchupSide from GET /api/matches/{id}/matchup. */
side: { type: Object, required: true },
/** Fallback name when the dossier could not be built. */
teamName: { type: String, default: '' },
/** "home" or "away": names the test id only. */
role: { type: String, default: 'home' },
});
const dossier = computed(() => props.side?.dossier || null);
const flags = computed(() => dossier.value?.flags || []);
const noResults = computed(() => flags.value.includes('no_results'));
const noConference = computed(() => flags.value.includes('no_conference'));
const ageName = computed(() => dossier.value?.age_group?.name || 'this age');
const labels = computed(() => dossierLabels(dossier.value));
const primary = computed(() => primaryLine(dossier.value));
const others = computed(() => otherLines(dossier.value));
// Nothing below the rows for this team: no empty box either.
const hasContent = computed(() => {
const d = dossier.value;
if (!d || d.error) return true;
return Boolean(
labels.value.length ||
noResults.value ||
noConference.value ||
others.value.length ||
primary.value?.no_results ||
d.key_wins?.length ||
props.side?.badges?.length ||
props.side?.badges == null
);
});
// "2nd in U15 Homegrown goals for per game, of 134 teams": a stat board, not a ranking.
// The title keeps its case but for the first letter ("W=3" stays "W=3").
const badgeText = b => {
const title = b.title.charAt(0).toLowerCase() + b.title.slice(1);
const teams = b.of === 1 ? 'team' : 'teams';
return `${ordinal(b.rank)} in ${b.age_group} ${b.league} ${title}, of ${b.of} ${teams}`;
};
</script>
|