@dcrackel/hematournamentui 1.0.707 → 1.0.708

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/AGENTS.md +118 -118
  2. package/dist/HemaTournamentUI-lib.es.js +4483 -4618
  3. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  4. package/dist/hematournamentui-tailwind.css +185 -406
  5. package/package.json +10 -10
  6. package/src/index.js +2 -0
  7. package/src/mocks/getDEBouts-42Fencers.js +4 -4
  8. package/src/mocks/getDEBouts-TableOf128.js +37 -0
  9. package/src/mocks/getDEBouts-TableOf64.js +35 -0
  10. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -0
  11. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -0
  12. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -0
  13. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +3 -2
  14. package/src/stories/Molecules/Modals/EditBoutModal/EditBoutModal.vue +1 -1
  15. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -0
  16. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -0
  17. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -0
  18. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -278
  19. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +60 -98
  20. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +103 -4
  21. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +256 -215
  22. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -92
  23. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -128
  24. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +14 -4
  25. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +2 -2
  26. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +131 -3
  27. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +287 -89
  28. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -0
  29. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -0
  30. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -0
  31. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -0
  32. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -0
  33. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -0
  34. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +57 -0
  35. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +65 -0
  36. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +31 -29
  37. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +146 -18
  38. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +52 -2
  39. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +53 -17
  40. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +39 -0
  41. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -0
  42. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -0
  43. package/src/stories/Organisms/Cards/TableauBoutCard/SpacingConfig.js +0 -111
  44. package/src/stories/Organisms/Containers/TableauLines/SpacingConfig.js +0 -162
  45. package/src/stories/Organisms/Containers/TableauLines/TableauLines.stories.js +0 -21
  46. package/src/stories/Organisms/Containers/TableauLines/TableauLines.vue +0 -78
@@ -1,128 +1,80 @@
1
- <!-- TableauFencerCard.vue -->
2
- <template>
3
- <section
4
- class="bg-poolSetup flex rounded-md border"
5
- @mouseover="handleHighLight(true)"
6
- @mouseout="handleHighLight(false)"
7
- :class="[width, highLighted, opacity]"
8
- >
9
- <!-- Left position -->
10
- <div class="text-center px-1 w-5 flex items-center justify-center rounded-l-md z-50" :class="[`bg-${color}`]">
11
- <BaseText :text="position" size="xs" color="neutral" />
12
- </div>
13
-
14
- <div class="flex w-full items-center">
15
- <!-- Portrait and Name/Club -->
16
- <div class="flex w-full">
17
- <div v-if="large" class="">
18
- <div v-if="!portraitURL" class="w-9 h-9 rounded-r-md bg-dropdownSelect flex items-center justify-center">
19
- <BaseText text="" size="sm" color="neutral" weight="bold" />
20
- </div>
21
- <img v-if="portraitURL" :src="portraitURL" alt="Portrait" class="w-9 h-9 rounded-r-md" />
22
- </div>
23
- <div class="flex flex-col justify-center ml-2">
24
- <BaseText
25
- :text="name"
26
- :size="large ? 'sm' : 'xs'"
27
- :weight="large ? 'bold' : 'normal'"
28
- color="quaternary"
29
- class="truncate text-nowrap overflow-hidden"
30
- />
31
- <BaseText
32
- v-if="club.length > 1 && large"
33
- color="quinary"
34
- :text="club.substring(0, 28)"
35
- size="xs"
36
- class="truncate text-nowrap overflow-hidden"
37
- />
38
- </div>
39
- </div>
40
- </div>
41
-
42
- <!-- Right position (Score) -->
43
- <div class="text-center px-1 w-5 flex items-center justify-center rounded-r-md" :class="scoreColor">
44
- <BaseText :text="fencerScore" size="xs" color="neutral" />
45
- </div>
46
- </section>
47
- </template>
48
-
49
- <script>
50
- import BaseText from '../../../Atoms/Text/BaseText.vue';
51
-
52
- export default {
53
- name: 'TableauFencerCard',
54
- emits: ['action:highLight'],
55
- components: { BaseText },
56
- props: {
57
- fencer: {
58
- type: Object,
59
- required: true
60
- },
61
- score: {
62
- type: String,
63
- required: true
64
- },
65
- position: {
66
- type: [String, Number],
67
- required: true
68
- },
69
- color: {
70
- type: String,
71
- required: true
72
- },
73
- scoreColor: {
74
- type: String,
75
- required: true
76
- },
77
- large: {
78
- type: Boolean,
79
- default: true
80
- },
81
- highLight: {
82
- type: Boolean,
83
- default: false
84
- },
85
- faded: {
86
- type: Boolean,
87
- default: false
88
- },
89
- isCountingBackwardsMaxScore: {
90
- type: Number,
91
- default: 0
92
- }
93
- },
94
- computed: {
95
- portraitURL() {
96
- const images = this.fencer.Images || [];
97
- const portrait = images.find(image => image.URL);
98
- return portrait ? portrait.URL : '';
99
- },
100
- fencerScore() {
101
- const rawScore = this.score;
102
- return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - rawScore : rawScore;
103
- },
104
- name() {
105
- //if (this.fencer.DisplayName === "BYE") return "";
106
- return this.fencer.DisplayName;
107
- },
108
- club() {
109
- if (this.fencer.DisplayName === 'BYE' || this.fencer.DisplayName === '') return '';
110
- return this.fencer.Club.Name;
111
- },
112
- width() {
113
- return this.large ? ' w-72' : ' w-40';
114
- },
115
- highLighted() {
116
- return this.highLight ? 'border-bright' : 'border-poolSetup';
117
- },
118
- opacity() {
119
- return this.faded ? 'opacity-60 shadow-md' : 'shadow-xl';
120
- }
121
- },
122
- methods: {
123
- handleHighLight(value) {
124
- this.$emit('action:highLight', value);
125
- }
126
- }
127
- };
128
- </script>
1
+ <template>
2
+ <section class="flex h-7 w-40 overflow-hidden border border-poolSetup bg-poolSetup" :class="cornerClass">
3
+ <div class="flex w-5 shrink-0 items-center justify-center px-1" :class="positionColorClass">
4
+ <BaseText :text="position" size="xs" color="neutral" />
5
+ </div>
6
+
7
+ <div class="flex min-w-0 flex-1 items-center px-2">
8
+ <BaseText :text="name" size="xs" color="quaternary" class="truncate whitespace-nowrap" />
9
+ </div>
10
+
11
+ <div class="flex w-7 shrink-0 items-center justify-center border-l border-poolSetup" :class="scoreColor">
12
+ <BaseText v-if="showScore" :text="displayedScore" size="xs" color="neutral" />
13
+ </div>
14
+ </section>
15
+ </template>
16
+
17
+ <script>
18
+ import BaseText from '../../../Atoms/Text/BaseText.vue';
19
+
20
+ const cornerClasses = {
21
+ none: '',
22
+ top: 'rounded-t',
23
+ bottom: 'rounded-b'
24
+ };
25
+
26
+ export default {
27
+ name: 'TableauFencerCard',
28
+ components: { BaseText },
29
+ props: {
30
+ fencer: {
31
+ type: Object,
32
+ required: true
33
+ },
34
+ score: {
35
+ type: String,
36
+ required: true
37
+ },
38
+ position: {
39
+ type: [String, Number],
40
+ required: true
41
+ },
42
+ color: {
43
+ type: String,
44
+ default: ''
45
+ },
46
+ scoreColor: {
47
+ type: String,
48
+ required: true
49
+ },
50
+ showScore: {
51
+ type: Boolean,
52
+ default: true
53
+ },
54
+ isCountingBackwardsMaxScore: {
55
+ type: Number,
56
+ default: 0
57
+ },
58
+ corners: {
59
+ type: String,
60
+ default: 'none',
61
+ validator: value => Object.hasOwn(cornerClasses, value)
62
+ }
63
+ },
64
+ computed: {
65
+ cornerClass() {
66
+ return cornerClasses[this.corners];
67
+ },
68
+ displayedScore() {
69
+ const score = Number(this.score || 0);
70
+ return this.isCountingBackwardsMaxScore > 0 ? this.isCountingBackwardsMaxScore - score : score;
71
+ },
72
+ name() {
73
+ return String(this.fencer?.DisplayName || '');
74
+ },
75
+ positionColorClass() {
76
+ return this.color ? `bg-${this.color}` : 'bg-dropdownSelect';
77
+ }
78
+ }
79
+ };
80
+ </script>
@@ -18,9 +18,18 @@
18
18
  </div>
19
19
 
20
20
  <div class="flex flex-col w-3/4 md:w-4/12 justify-start">
21
- <button class="flex justify-start overflow-hidden text-left" type="button" @click="handleForwardToProfile">
22
- <BaseText :text="displayName" size="md" color="quaternary" weight="bold" class="text-sm md:text-xl truncate" />
23
- </button>
21
+ <div class="flex items-center justify-start gap-2 min-w-0">
22
+ <button class="min-w-0 text-left" type="button" @click="handleForwardToProfile">
23
+ <BaseText
24
+ :text="displayName"
25
+ size="md"
26
+ color="quaternary"
27
+ weight="bold"
28
+ class="text-sm md:text-xl truncate"
29
+ />
30
+ </button>
31
+ <MissingHemaRatingsId :person="person.Person" />
32
+ </div>
24
33
  <span class="w-full flex justify-start">
25
34
  <BaseText :text="clubName" size="md" color="quinary" weight="normal" class="hidden md:block" />
26
35
  <BaseText :text="clubShortName" size="xs" color="quinary" weight="normal" class="block md:hidden" />
@@ -86,10 +95,11 @@
86
95
  import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
87
96
  import BaseText from '../../../Atoms/Text/BaseText.vue';
88
97
  import BaseButton from '../../../Molecules/Buttons/BaseButton/BaseButton.vue';
98
+ import MissingHemaRatingsId from '../../../Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue';
89
99
 
90
100
  export default {
91
101
  name: 'WaitlistFencerCard',
92
- components: { BaseButton, BaseIcon, BaseText },
102
+ components: { BaseButton, BaseIcon, BaseText, MissingHemaRatingsId },
93
103
  emits: ['forward:toProfile', 'move:active', 'remove:fencer'],
94
104
  props: {
95
105
  person: {
@@ -11,12 +11,12 @@ export default {
11
11
  },
12
12
  argTypes: {
13
13
  bouts: {
14
- control: 'array',
14
+ control: 'object',
15
15
  description: 'Array of bracket objects to display'
16
16
  },
17
17
  bracketSize: {
18
18
  control: 'string',
19
- description: 'sets spacing for bracket connector lines'
19
+ description: 'Name of the opening bracket round'
20
20
  },
21
21
  hostingClubColors: {
22
22
  control: 'object'
@@ -1,5 +1,8 @@
1
1
  import { shallowMount } from '@vue/test-utils';
2
2
  import { describe, expect, it } from 'vitest';
3
+ import getDEWithBouts42Fencers from '../../../../mocks/getDEBouts-42Fencers.js';
4
+ import getDEBoutsTableOf128 from '../../../../mocks/getDEBouts-TableOf128.js';
5
+ import getDEBoutsTableOf64 from '../../../../mocks/getDEBouts-TableOf64.js';
3
6
  import BoutCard from '../../Cards/BoutCard/BoutCard.vue';
4
7
  import TableauColumn from '../TableauColumn/TableauColumn.vue';
5
8
  import Tableau from './Tableau.vue';
@@ -19,7 +22,6 @@ const mountListView = () =>
19
22
  bouts: [bout],
20
23
  bracketSize: 'Final',
21
24
  hostingClubColors: {},
22
- largeCards: true,
23
25
  listView: true
24
26
  }
25
27
  });
@@ -44,7 +46,6 @@ describe('Tableau list view', () => {
44
46
  bouts: [activeBout],
45
47
  bracketSize: 'Final',
46
48
  hostingClubColors: {},
47
- largeCards: true,
48
49
  listView: true
49
50
  }
50
51
  });
@@ -54,6 +55,35 @@ describe('Tableau list view', () => {
54
55
 
55
56
  expect(wrapper.emitted('action:directingBout')).toEqual([[activeBout]]);
56
57
  });
58
+
59
+ it('bubbles the viewer suggestions to the top without removing other scheduled bouts', () => {
60
+ const viewerBout = { ...bout, BoutId: 43, DEBoutId: 2 };
61
+ const wrapper = shallowMount(Tableau, {
62
+ props: {
63
+ bouts: [bout, viewerBout],
64
+ bracketSize: 'Final',
65
+ hostingClubColors: {},
66
+ listView: true,
67
+ plannedDirectingStations: [
68
+ {
69
+ RingId: 7,
70
+ RingName: 'Ring 7',
71
+ Color: '#2563eb',
72
+ Director: { PersonId: 99, DisplayName: 'Viewer Director' }
73
+ }
74
+ ],
75
+ plannedBoutAssignments: [{ DEBoutId: viewerBout.DEBoutId, RingId: 7 }],
76
+ viewerPersonId: '99'
77
+ }
78
+ });
79
+
80
+ expect(wrapper.vm.listSections[0]).toMatchObject({
81
+ key: 'suggested-for-viewer',
82
+ label: 'Suggested for You',
83
+ bouts: [viewerBout]
84
+ });
85
+ expect(wrapper.vm.listSections.flatMap(section => section.bouts)).toEqual([viewerBout, bout]);
86
+ });
57
87
  });
58
88
 
59
89
  describe('Tableau bracket view', () => {
@@ -63,7 +93,6 @@ describe('Tableau bracket view', () => {
63
93
  bouts: [bout],
64
94
  bracketSize: 'Final',
65
95
  hostingClubColors: {},
66
- largeCards: true,
67
96
  listView: false
68
97
  }
69
98
  });
@@ -73,4 +102,103 @@ describe('Tableau bracket view', () => {
73
102
 
74
103
  expect(wrapper.emitted('action:directingBout')).toEqual([[bout]]);
75
104
  });
105
+
106
+ it('spaces each rendered round by its actual column depth', () => {
107
+ const wrapper = shallowMount(Tableau, {
108
+ props: {
109
+ bouts: [bout],
110
+ bracketSize: 'Table of 8',
111
+ hostingClubColors: {},
112
+ listView: false
113
+ }
114
+ });
115
+
116
+ expect(wrapper.vm.getRoundLayout(0)).toEqual({ gapPx: 16, padTopPx: 0 });
117
+ expect(wrapper.vm.getRoundLayout(1)).toEqual({ gapPx: 89, padTopPx: 36.5 });
118
+ expect(wrapper.vm.getRoundLayout(2)).toEqual({ gapPx: 235, padTopPx: 109.5 });
119
+ });
120
+
121
+ it('orders the current 42-fencer fixture through Table of 8 without a legacy quarterfinal', () => {
122
+ const wrapper = shallowMount(Tableau, {
123
+ props: {
124
+ bouts: getDEWithBouts42Fencers.pools[0].Bouts,
125
+ bracketSize: 'Table of 64',
126
+ hostingClubColors: getDEWithBouts42Fencers.hostingClubColors,
127
+ listView: false
128
+ }
129
+ });
130
+
131
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName]) => roundName)).toEqual([
132
+ 'Table of 64',
133
+ 'Table of 32',
134
+ 'Table of 16',
135
+ 'Table of 8',
136
+ 'Semifinal',
137
+ 'Final'
138
+ ]);
139
+ });
140
+
141
+ it('renders a current Table of 64 fixture with the expected bout count per round', () => {
142
+ const wrapper = shallowMount(Tableau, {
143
+ props: {
144
+ bouts: getDEBoutsTableOf64.pools[0].Bouts,
145
+ bracketSize: 'Table of 64',
146
+ hostingClubColors: getDEBoutsTableOf64.hostingClubColors,
147
+ listView: false
148
+ }
149
+ });
150
+
151
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
152
+ ['Table of 64', 32],
153
+ ['Table of 32', 16],
154
+ ['Table of 16', 8],
155
+ ['Table of 8', 4],
156
+ ['Semifinal', 2],
157
+ ['Final', 1]
158
+ ]);
159
+
160
+ const openingRound = wrapper.vm.winnerRoundEntries[0][1];
161
+ const openingFencers = openingRound.flatMap(roundBout => [roundBout.Person1, roundBout.Person2]);
162
+ const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
163
+
164
+ expect(assignedFencerIds.size).toBe(61);
165
+ expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(3);
166
+ });
167
+
168
+ it('renders a complete Table of 128 fixture for large-bracket layout coverage', () => {
169
+ const wrapper = shallowMount(Tableau, {
170
+ props: {
171
+ bouts: getDEBoutsTableOf128.pools[0].Bouts,
172
+ bracketSize: 'Table of 128',
173
+ hostingClubColors: getDEBoutsTableOf128.hostingClubColors,
174
+ listView: false
175
+ }
176
+ });
177
+
178
+ expect(wrapper.vm.winnerRoundEntries.map(([roundName, roundBouts]) => [roundName, roundBouts.length])).toEqual([
179
+ ['Table of 128', 64],
180
+ ['Table of 64', 32],
181
+ ['Table of 32', 16],
182
+ ['Table of 16', 8],
183
+ ['Table of 8', 4],
184
+ ['Semifinal', 2],
185
+ ['Final', 1]
186
+ ]);
187
+
188
+ const allBouts = getDEBoutsTableOf128.pools[0].Bouts;
189
+ const openingFencers = wrapper.vm.winnerRoundEntries[0][1].flatMap(roundBout => [
190
+ roundBout.Person1,
191
+ roundBout.Person2
192
+ ]);
193
+ const assignedFencerIds = new Set(openingFencers.filter(fencer => fencer.PersonId).map(fencer => fencer.PersonId));
194
+ const boutIds = new Set(allBouts.map(roundBout => roundBout.DEBoutId));
195
+ const missingNextBouts = allBouts.filter(
196
+ roundBout => roundBout.DENextBoutId && !boutIds.has(roundBout.DENextBoutId)
197
+ );
198
+
199
+ expect(allBouts).toHaveLength(127);
200
+ expect(assignedFencerIds.size).toBe(67);
201
+ expect(openingFencers.filter(fencer => fencer.DisplayName === 'BYE')).toHaveLength(61);
202
+ expect(missingNextBouts).toEqual([]);
203
+ });
76
204
  });