@dcrackel/hematournamentui 1.0.712 → 1.0.713
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.
- package/.prettierignore +7 -7
- package/.storybook/main.js +3 -1
- package/README.md +30 -0
- package/package.json +96 -96
- package/prettier.config.js +16 -16
- package/src/main.js +1 -1
- package/src/mocks/getDEBouts-TableOf128.js +37 -37
- package/src/mocks/getDEBouts-TableOf64.js +35 -35
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
- package/src/stories/Atoms/Input/BaseInput.vue +149 -149
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
- package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
- package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -33
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -45
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -103
- package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
- package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
- package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
- package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
- package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -29
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -46
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
- package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
- package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
- package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
- package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
- package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +123 -12
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +178 -166
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +35 -7
- package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +42 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +80 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
- package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
- package/src/stories/Util/Validations/PriceValidation.js +6 -6
- package/src/stories/Util/boutDirectorAssignment.js +46 -0
- package/src/stories/Util/registrationStatus.js +11 -11
- package/src/stories/Util/tabs.js +19 -47
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="trigger"
|
|
4
|
+
data-testid="bout-actions-trigger"
|
|
5
|
+
:tabindex="focusable && actions.length ? 0 : undefined"
|
|
6
|
+
:role="focusable && actions.length ? 'button' : undefined"
|
|
7
|
+
:aria-label="focusable ? label : undefined"
|
|
8
|
+
:aria-haspopup="focusable && actions.length ? 'menu' : undefined"
|
|
9
|
+
:aria-expanded="focusable && actions.length ? isOpen : undefined"
|
|
10
|
+
@mouseenter="queueOpen"
|
|
11
|
+
@mouseleave="queueClose"
|
|
12
|
+
@focusin="handleTriggerFocus"
|
|
13
|
+
@focusout="handleFocusOut"
|
|
14
|
+
@keydown="handleTriggerKeydown"
|
|
15
|
+
@click="closeMenu()"
|
|
16
|
+
>
|
|
17
|
+
<slot :isOpen="isOpen" />
|
|
18
|
+
<Teleport to="body">
|
|
19
|
+
<div
|
|
20
|
+
v-if="isOpen && actions.length"
|
|
21
|
+
ref="panel"
|
|
22
|
+
role="menu"
|
|
23
|
+
:aria-label="label"
|
|
24
|
+
data-testid="bout-actions-menu"
|
|
25
|
+
class="fixed z-[100] min-w-36 rounded-md border border-dropdownSelect bg-white p-1 text-primaryHighlight shadow-lg"
|
|
26
|
+
:style="panelStyle"
|
|
27
|
+
@mouseenter="keepOpen"
|
|
28
|
+
@mouseleave="queueClose"
|
|
29
|
+
@focusout="handleFocusOut"
|
|
30
|
+
@keydown="handlePanelKeydown"
|
|
31
|
+
@click.stop
|
|
32
|
+
>
|
|
33
|
+
<template v-for="action in actions" :key="action.id">
|
|
34
|
+
<div
|
|
35
|
+
v-if="action.description"
|
|
36
|
+
role="presentation"
|
|
37
|
+
data-testid="action-description"
|
|
38
|
+
class="cursor-default px-3 pt-2 text-left text-xs font-semibold text-bright"
|
|
39
|
+
:style="{ color: action.descriptionColor || undefined }"
|
|
40
|
+
>
|
|
41
|
+
{{ action.description }}
|
|
42
|
+
</div>
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
role="menuitem"
|
|
46
|
+
:data-action="action.id"
|
|
47
|
+
class="block w-full rounded px-3 py-2 text-left text-xs hover:bg-dropdownSelect focus-visible:bg-dropdownSelect focus-visible:outline-none disabled:opacity-50"
|
|
48
|
+
:disabled="action.disabled"
|
|
49
|
+
@click.stop="selectAction(action.id)"
|
|
50
|
+
>
|
|
51
|
+
{{ action.label }}
|
|
52
|
+
</button>
|
|
53
|
+
</template>
|
|
54
|
+
</div>
|
|
55
|
+
</Teleport>
|
|
56
|
+
</div>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script>
|
|
60
|
+
let activeMenu = null;
|
|
61
|
+
|
|
62
|
+
export default {
|
|
63
|
+
name: 'HoverActions',
|
|
64
|
+
emits: ['action'],
|
|
65
|
+
props: {
|
|
66
|
+
actions: { type: Array, default: () => [] },
|
|
67
|
+
label: { type: String, default: 'Bout actions' },
|
|
68
|
+
focusable: { type: Boolean, default: false }
|
|
69
|
+
},
|
|
70
|
+
data() {
|
|
71
|
+
return {
|
|
72
|
+
isOpen: false,
|
|
73
|
+
isHovered: false,
|
|
74
|
+
openTimer: null,
|
|
75
|
+
closeTimer: null,
|
|
76
|
+
ignoreFocus: false,
|
|
77
|
+
triggerFocus: null,
|
|
78
|
+
panelStyle: { top: '0px', left: '0px' }
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
actions: {
|
|
83
|
+
deep: true,
|
|
84
|
+
handler() {
|
|
85
|
+
if (!this.actions.length) this.closeMenu();
|
|
86
|
+
if (this.isOpen) this.$nextTick(this.positionPanel);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
beforeUnmount() {
|
|
91
|
+
this.closeMenu();
|
|
92
|
+
},
|
|
93
|
+
methods: {
|
|
94
|
+
clearTimers() {
|
|
95
|
+
clearTimeout(this.openTimer);
|
|
96
|
+
clearTimeout(this.closeTimer);
|
|
97
|
+
this.openTimer = null;
|
|
98
|
+
this.closeTimer = null;
|
|
99
|
+
},
|
|
100
|
+
queueOpen() {
|
|
101
|
+
this.keepOpen();
|
|
102
|
+
if (this.isOpen || !this.actions.length) return;
|
|
103
|
+
this.openTimer = setTimeout(this.openMenu, 200);
|
|
104
|
+
},
|
|
105
|
+
keepOpen() {
|
|
106
|
+
this.isHovered = true;
|
|
107
|
+
this.clearTimers();
|
|
108
|
+
},
|
|
109
|
+
queueClose() {
|
|
110
|
+
this.isHovered = false;
|
|
111
|
+
this.clearTimers();
|
|
112
|
+
this.closeTimer = setTimeout(this.closeWhenOutside, 150);
|
|
113
|
+
},
|
|
114
|
+
containsElement(element) {
|
|
115
|
+
return Boolean(element && (this.$refs.trigger?.contains(element) || this.$refs.panel?.contains(element)));
|
|
116
|
+
},
|
|
117
|
+
closeWhenOutside() {
|
|
118
|
+
if (this.isHovered || this.containsElement(document.activeElement)) return;
|
|
119
|
+
this.closeMenu();
|
|
120
|
+
},
|
|
121
|
+
async openMenu() {
|
|
122
|
+
this.clearTimers();
|
|
123
|
+
if (this.isOpen || !this.actions.length) return;
|
|
124
|
+
activeMenu?.closeMenu();
|
|
125
|
+
activeMenu = this;
|
|
126
|
+
this.isOpen = true;
|
|
127
|
+
document.addEventListener('pointerdown', this.handleOutsidePointer);
|
|
128
|
+
window.addEventListener('scroll', this.handleViewportChange, true);
|
|
129
|
+
window.addEventListener('resize', this.handleViewportChange);
|
|
130
|
+
await this.$nextTick();
|
|
131
|
+
this.positionPanel();
|
|
132
|
+
},
|
|
133
|
+
positionPanel() {
|
|
134
|
+
const trigger = this.$refs.trigger?.getBoundingClientRect();
|
|
135
|
+
const panel = this.$refs.panel?.getBoundingClientRect();
|
|
136
|
+
if (!trigger || !panel) return;
|
|
137
|
+
const left = Math.max(4, Math.min(trigger.left, window.innerWidth - panel.width - 4));
|
|
138
|
+
const below = trigger.bottom + 4;
|
|
139
|
+
const top = below + panel.height <= window.innerHeight - 4 ? below : Math.max(4, trigger.top - panel.height - 4);
|
|
140
|
+
this.panelStyle = { top: top + 'px', left: left + 'px' };
|
|
141
|
+
},
|
|
142
|
+
closeMenu(restoreFocus = false) {
|
|
143
|
+
this.clearTimers();
|
|
144
|
+
this.isOpen = false;
|
|
145
|
+
if (activeMenu === this) activeMenu = null;
|
|
146
|
+
document.removeEventListener('pointerdown', this.handleOutsidePointer);
|
|
147
|
+
window.removeEventListener('scroll', this.handleViewportChange, true);
|
|
148
|
+
window.removeEventListener('resize', this.handleViewportChange);
|
|
149
|
+
if (!restoreFocus) return;
|
|
150
|
+
this.ignoreFocus = true;
|
|
151
|
+
const focusTarget =
|
|
152
|
+
this.triggerFocus || this.$refs.trigger?.querySelector('button:not(:disabled)') || this.$refs.trigger;
|
|
153
|
+
focusTarget?.focus();
|
|
154
|
+
this.ignoreFocus = false;
|
|
155
|
+
},
|
|
156
|
+
handleViewportChange(event) {
|
|
157
|
+
if (this.$refs.panel?.contains(event.target)) return;
|
|
158
|
+
this.closeMenu();
|
|
159
|
+
},
|
|
160
|
+
handleOutsidePointer(event) {
|
|
161
|
+
if (!this.containsElement(event.target)) this.closeMenu();
|
|
162
|
+
},
|
|
163
|
+
handleTriggerFocus(event) {
|
|
164
|
+
if (this.ignoreFocus) return;
|
|
165
|
+
this.triggerFocus = event.target;
|
|
166
|
+
this.openMenu();
|
|
167
|
+
},
|
|
168
|
+
handleFocusOut(event) {
|
|
169
|
+
if (!this.containsElement(event.relatedTarget)) this.queueClose();
|
|
170
|
+
},
|
|
171
|
+
async focusFirstAction() {
|
|
172
|
+
await this.openMenu();
|
|
173
|
+
this.$refs.panel?.querySelector('button:not(:disabled)')?.focus();
|
|
174
|
+
},
|
|
175
|
+
handleTriggerKeydown(event) {
|
|
176
|
+
if (event.key === 'Escape') {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
event.stopPropagation();
|
|
179
|
+
this.closeMenu(true);
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const isWrapperActivation = event.target === this.$refs.trigger && ['Enter', ' '].includes(event.key);
|
|
183
|
+
if (event.key !== 'ArrowDown' && !isWrapperActivation) return;
|
|
184
|
+
event.preventDefault();
|
|
185
|
+
event.stopPropagation();
|
|
186
|
+
this.focusFirstAction();
|
|
187
|
+
},
|
|
188
|
+
handlePanelKeydown(event) {
|
|
189
|
+
const handlers = {
|
|
190
|
+
Escape: () => this.closeMenu(true),
|
|
191
|
+
ArrowDown: () => this.moveActionFocus(1),
|
|
192
|
+
ArrowUp: () => this.moveActionFocus(-1)
|
|
193
|
+
};
|
|
194
|
+
const handler = handlers[event.key];
|
|
195
|
+
if (!handler) return;
|
|
196
|
+
event.preventDefault();
|
|
197
|
+
event.stopPropagation();
|
|
198
|
+
handler();
|
|
199
|
+
},
|
|
200
|
+
moveActionFocus(direction) {
|
|
201
|
+
const buttons = Array.from(this.$refs.panel.querySelectorAll('button:not(:disabled)'));
|
|
202
|
+
if (!buttons.length) return;
|
|
203
|
+
const currentIndex = buttons.indexOf(document.activeElement);
|
|
204
|
+
buttons[(currentIndex + direction + buttons.length) % buttons.length].focus();
|
|
205
|
+
},
|
|
206
|
+
selectAction(actionId) {
|
|
207
|
+
this.closeMenu(true);
|
|
208
|
+
this.$emit('action', actionId);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
</script>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import DirectorModal from './DirectorModal.vue';
|
|
4
|
-
|
|
5
|
-
describe('DirectorModal backdrop', () => {
|
|
6
|
-
it('keeps the directing screen visible through a 25 percent backdrop', () => {
|
|
7
|
-
const wrapper = shallowMount(DirectorModal, {
|
|
8
|
-
props: {
|
|
9
|
-
show: true,
|
|
10
|
-
bout: { BoutId: 42 },
|
|
11
|
-
eventRules: {},
|
|
12
|
-
hostingClubColors: {}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
expect(wrapper.find('[data-testid="director-modal-backdrop"]').classes()).toContain('bg-secondary/25');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import DirectorModal from './DirectorModal.vue';
|
|
4
|
+
|
|
5
|
+
describe('DirectorModal backdrop', () => {
|
|
6
|
+
it('keeps the directing screen visible through a 25 percent backdrop', () => {
|
|
7
|
+
const wrapper = shallowMount(DirectorModal, {
|
|
8
|
+
props: {
|
|
9
|
+
show: true,
|
|
10
|
+
bout: { BoutId: 42 },
|
|
11
|
+
eventRules: {},
|
|
12
|
+
hostingClubColors: {}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(wrapper.find('[data-testid="director-modal-backdrop"]').classes()).toContain('bg-secondary/25');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -51,16 +51,24 @@
|
|
|
51
51
|
|
|
52
52
|
<!-- Mobile active -->
|
|
53
53
|
<div
|
|
54
|
-
class="flex md:hidden justify-between items-center
|
|
55
|
-
:class="mobileCardActionClass"
|
|
54
|
+
class="flex md:hidden justify-between items-center px-3 py-2 border-alarm rounded-md bg-poolBox transition"
|
|
55
|
+
:class="[mobileCardActionClass, mobileCardLayoutClass]"
|
|
56
56
|
@click="onCardClick"
|
|
57
57
|
>
|
|
58
|
-
<div class="relative
|
|
58
|
+
<div class="relative h-12 w-12 flex-none">
|
|
59
59
|
<img :src="fencer1Portrait" alt="Portrait" class="w-12 h-12 rounded-full" />
|
|
60
|
-
<div :class="`w-4 h-4 rounded-full bg-${card.fencer1.colorDot} absolute
|
|
60
|
+
<div :class="`w-4 h-4 rounded-full bg-${card.fencer1.colorDot} absolute bottom-0 -right-1`"></div>
|
|
61
|
+
<span
|
|
62
|
+
class="pointer-events-none absolute -top-1 left-1/2 z-10 -translate-x-1/2 whitespace-nowrap rounded bg-alarm px-1 py-0.5 text-[9px] font-bold leading-none text-white"
|
|
63
|
+
>
|
|
64
|
+
In progress
|
|
65
|
+
</span>
|
|
61
66
|
</div>
|
|
62
67
|
|
|
63
|
-
<div class="text-center flex-1 mx-
|
|
68
|
+
<div class="text-center flex-1 min-w-0 mx-3">
|
|
69
|
+
<div v-if="$slots['mobile-details']" class="mb-1 min-w-0">
|
|
70
|
+
<slot name="mobile-details" />
|
|
71
|
+
</div>
|
|
64
72
|
<BaseText :text="`${card.score1} - ${card.fencer1.name}`" size="sm" color="quinary" weight="bold" />
|
|
65
73
|
<div>
|
|
66
74
|
<BaseText :text="displayTime" size="xs" color="quaternary" weight="bold" class="-mt-0.5" />
|
|
@@ -68,8 +76,8 @@
|
|
|
68
76
|
<BaseText :text="`${card.score2} - ${card.fencer2.name}`" size="sm" color="quinary" weight="bold" />
|
|
69
77
|
</div>
|
|
70
78
|
|
|
71
|
-
<div class="relative
|
|
72
|
-
<div :class="`w-4 h-4 rounded-full bg-${card.fencer2.colorDot} absolute
|
|
79
|
+
<div class="relative h-12 w-12 flex-none">
|
|
80
|
+
<div :class="`w-4 h-4 rounded-full bg-${card.fencer2.colorDot} absolute bottom-0 -right-1`"></div>
|
|
73
81
|
<img :src="fencer2Portrait" alt="Portrait" class="w-12 h-12 rounded-full" />
|
|
74
82
|
</div>
|
|
75
83
|
</div>
|
|
@@ -101,6 +109,9 @@ export default {
|
|
|
101
109
|
hasCard() {
|
|
102
110
|
return !!this.card;
|
|
103
111
|
},
|
|
112
|
+
mobileCardLayoutClass() {
|
|
113
|
+
return this.$slots['mobile-details'] ? 'border-2' : 'border';
|
|
114
|
+
},
|
|
104
115
|
mobileCardActionClass() {
|
|
105
116
|
if (this.editMode) return 'cursor-pointer';
|
|
106
117
|
return 'cursor-default';
|
|
@@ -131,9 +142,7 @@ export default {
|
|
|
131
142
|
'card.timeLeftSeconds': {
|
|
132
143
|
immediate: true,
|
|
133
144
|
handler(n) {
|
|
134
|
-
|
|
135
|
-
if (this.timerStatus !== 'running') this.remaining = next;
|
|
136
|
-
if (this.timerStatus === 'running' && this.remaining === 0) this.remaining = next;
|
|
145
|
+
this.remaining = Math.max(0, Math.floor(Number(n) || 0));
|
|
137
146
|
}
|
|
138
147
|
},
|
|
139
148
|
timerStatus(n) {
|
|
@@ -59,15 +59,16 @@
|
|
|
59
59
|
|
|
60
60
|
<!-- Mobile -->
|
|
61
61
|
<section
|
|
62
|
-
class="relative flex md:hidden items-center border rounded-md bg-poolBox transition overflow-hidden"
|
|
62
|
+
class="relative flex flex-col md:hidden items-center border rounded-md bg-poolBox transition overflow-hidden"
|
|
63
63
|
:class="mobileCardActionClass"
|
|
64
|
+
@click="onCardClick"
|
|
64
65
|
>
|
|
65
66
|
<!-- main tappable area -->
|
|
66
|
-
<div class="flex flex-1 items-center
|
|
67
|
+
<div class="flex w-full flex-1 items-center px-3 py-2 min-w-0">
|
|
67
68
|
<!-- left portrait or index when reordering -->
|
|
68
|
-
<div v-if="!reorderMode" class="relative
|
|
69
|
+
<div v-if="!reorderMode" class="relative w-12 h-12 flex-none">
|
|
69
70
|
<img :src="fencer1Portrait" alt="Portrait" class="w-12 h-12 rounded-full" />
|
|
70
|
-
<div :class="`w-4 h-4 rounded-full bg-${card.fencer1.colorDot}
|
|
71
|
+
<div :class="`w-4 h-4 rounded-full bg-${card.fencer1.colorDot} absolute bottom-0 -right-1 z-10`"></div>
|
|
71
72
|
</div>
|
|
72
73
|
|
|
73
74
|
<div v-if="reorderMode" class="flex flex-col items-center -mt-3 select-none flex-none">
|
|
@@ -76,8 +77,11 @@
|
|
|
76
77
|
</div>
|
|
77
78
|
|
|
78
79
|
<!-- center -->
|
|
79
|
-
<div class="text-center flex-1 mx-
|
|
80
|
-
<div class="
|
|
80
|
+
<div class="text-center flex-1 mx-3 min-w-0 flex flex-col items-center justify-center leading-none">
|
|
81
|
+
<div v-if="$slots['mobile-details']" class="mb-1 w-full min-w-0">
|
|
82
|
+
<slot name="mobile-details" />
|
|
83
|
+
</div>
|
|
84
|
+
<div class="flex max-w-full items-center justify-center">
|
|
81
85
|
<div :class="`mr-2 bg-${card.fencer1.colorDot} w-3 h-3 flex-none`"></div>
|
|
82
86
|
<BaseText
|
|
83
87
|
:text="c.fencer1.name"
|
|
@@ -90,7 +94,7 @@
|
|
|
90
94
|
|
|
91
95
|
<BaseText text="vs" size="xs" color="quaternary" />
|
|
92
96
|
|
|
93
|
-
<div class="flex items-center justify-center">
|
|
97
|
+
<div class="flex max-w-full items-center justify-center">
|
|
94
98
|
<div :class="`mr-2 bg-${card.fencer2.colorDot} w-3 h-3 flex-none`"></div>
|
|
95
99
|
<BaseText
|
|
96
100
|
:text="c.fencer2.name"
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import BracketDirectorAssignmentCard from './BracketDirectorAssignmentCard.vue';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
title: 'Organisms/Cards/BracketDirectorAssignmentCard',
|
|
5
|
-
component: BracketDirectorAssignmentCard,
|
|
6
|
-
args: {
|
|
7
|
-
station: {
|
|
8
|
-
RingId: 1,
|
|
9
|
-
RingName: 'Ring 1',
|
|
10
|
-
Color: '#2563eb',
|
|
11
|
-
Director: {
|
|
12
|
-
PersonId: 1001,
|
|
13
|
-
DisplayName: 'Alex Morgan',
|
|
14
|
-
PortraitUrl: ''
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
variant: 'assigned'
|
|
18
|
-
},
|
|
19
|
-
argTypes: {
|
|
20
|
-
station: { control: 'object' },
|
|
21
|
-
variant: { control: 'select', options: ['assigned', 'add'] },
|
|
22
|
-
addLabel: { control: 'text' }
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Assigned = {};
|
|
27
|
-
|
|
28
|
-
export const AddDirector = {
|
|
29
|
-
args: {
|
|
30
|
-
station: null,
|
|
31
|
-
variant: 'add'
|
|
32
|
-
}
|
|
33
|
-
};
|
|
1
|
+
import BracketDirectorAssignmentCard from './BracketDirectorAssignmentCard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Organisms/Cards/BracketDirectorAssignmentCard',
|
|
5
|
+
component: BracketDirectorAssignmentCard,
|
|
6
|
+
args: {
|
|
7
|
+
station: {
|
|
8
|
+
RingId: 1,
|
|
9
|
+
RingName: 'Ring 1',
|
|
10
|
+
Color: '#2563eb',
|
|
11
|
+
Director: {
|
|
12
|
+
PersonId: 1001,
|
|
13
|
+
DisplayName: 'Alex Morgan',
|
|
14
|
+
PortraitUrl: ''
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
variant: 'assigned'
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
station: { control: 'object' },
|
|
21
|
+
variant: { control: 'select', options: ['assigned', 'add'] },
|
|
22
|
+
addLabel: { control: 'text' }
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const Assigned = {};
|
|
27
|
+
|
|
28
|
+
export const AddDirector = {
|
|
29
|
+
args: {
|
|
30
|
+
station: null,
|
|
31
|
+
variant: 'add'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import BracketDirectorAssignmentCard from './BracketDirectorAssignmentCard.vue';
|
|
4
|
-
|
|
5
|
-
const station = {
|
|
6
|
-
RingId: 3,
|
|
7
|
-
RingName: 'Ring 3',
|
|
8
|
-
Color: '#059669',
|
|
9
|
-
Director: { PersonId: 1003, DisplayName: 'Sam Rivera', PortraitUrl: '/portrait.png' }
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
describe('BracketDirectorAssignmentCard', () => {
|
|
13
|
-
it('renders the ring, portrait, and director name', () => {
|
|
14
|
-
const wrapper = shallowMount(BracketDirectorAssignmentCard, { props: { station } });
|
|
15
|
-
|
|
16
|
-
expect(wrapper.find('img').attributes()).toMatchObject({
|
|
17
|
-
src: '/portrait.png',
|
|
18
|
-
alt: 'Sam Rivera portrait'
|
|
19
|
-
});
|
|
20
|
-
expect(wrapper.findAll('base-text-stub').map(text => text.attributes('text'))).toContain('Sam Rivera');
|
|
21
|
-
expect(wrapper.find('[data-testid="bracket-director-assignment"]').attributes('style')).toBeUndefined();
|
|
22
|
-
expect(wrapper.find('[data-testid="director-color-dot"]').attributes('style')).toContain('#059669');
|
|
23
|
-
expect(wrapper.find('[data-testid="ring-number-icon"]').exists()).toBe(false);
|
|
24
|
-
expect(wrapper.findAll('base-text-stub').map(text => text.attributes('text'))).toContain('Ring 3');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('uses director initials when no portrait is supplied', () => {
|
|
28
|
-
const wrapper = shallowMount(BracketDirectorAssignmentCard, {
|
|
29
|
-
props: { station: { ...station, Director: { ...station.Director, PortraitUrl: '' } } }
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
expect(wrapper.find('img').exists()).toBe(false);
|
|
33
|
-
expect(wrapper.find('[data-testid="director-initials"]').classes()).toContain('rounded-xl');
|
|
34
|
-
expect(wrapper.find('[data-testid="director-initials"] base-text-stub').attributes('text')).toBe('SR');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('emits add intent from the summary card', async () => {
|
|
38
|
-
const wrapper = shallowMount(BracketDirectorAssignmentCard, { props: { variant: 'add' } });
|
|
39
|
-
|
|
40
|
-
await wrapper.find('[data-testid="add-bracket-director"]').trigger('click');
|
|
41
|
-
|
|
42
|
-
expect(wrapper.emitted('action:add')).toEqual([[]]);
|
|
43
|
-
expect(wrapper.find('base-text-stub').attributes('text')).toBe('Click here to add director');
|
|
44
|
-
});
|
|
45
|
-
});
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import BracketDirectorAssignmentCard from './BracketDirectorAssignmentCard.vue';
|
|
4
|
+
|
|
5
|
+
const station = {
|
|
6
|
+
RingId: 3,
|
|
7
|
+
RingName: 'Ring 3',
|
|
8
|
+
Color: '#059669',
|
|
9
|
+
Director: { PersonId: 1003, DisplayName: 'Sam Rivera', PortraitUrl: '/portrait.png' }
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe('BracketDirectorAssignmentCard', () => {
|
|
13
|
+
it('renders the ring, portrait, and director name', () => {
|
|
14
|
+
const wrapper = shallowMount(BracketDirectorAssignmentCard, { props: { station } });
|
|
15
|
+
|
|
16
|
+
expect(wrapper.find('img').attributes()).toMatchObject({
|
|
17
|
+
src: '/portrait.png',
|
|
18
|
+
alt: 'Sam Rivera portrait'
|
|
19
|
+
});
|
|
20
|
+
expect(wrapper.findAll('base-text-stub').map(text => text.attributes('text'))).toContain('Sam Rivera');
|
|
21
|
+
expect(wrapper.find('[data-testid="bracket-director-assignment"]').attributes('style')).toBeUndefined();
|
|
22
|
+
expect(wrapper.find('[data-testid="director-color-dot"]').attributes('style')).toContain('#059669');
|
|
23
|
+
expect(wrapper.find('[data-testid="ring-number-icon"]').exists()).toBe(false);
|
|
24
|
+
expect(wrapper.findAll('base-text-stub').map(text => text.attributes('text'))).toContain('Ring 3');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('uses director initials when no portrait is supplied', () => {
|
|
28
|
+
const wrapper = shallowMount(BracketDirectorAssignmentCard, {
|
|
29
|
+
props: { station: { ...station, Director: { ...station.Director, PortraitUrl: '' } } }
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
expect(wrapper.find('img').exists()).toBe(false);
|
|
33
|
+
expect(wrapper.find('[data-testid="director-initials"]').classes()).toContain('rounded-xl');
|
|
34
|
+
expect(wrapper.find('[data-testid="director-initials"] base-text-stub').attributes('text')).toBe('SR');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('emits add intent from the summary card', async () => {
|
|
38
|
+
const wrapper = shallowMount(BracketDirectorAssignmentCard, { props: { variant: 'add' } });
|
|
39
|
+
|
|
40
|
+
await wrapper.find('[data-testid="add-bracket-director"]').trigger('click');
|
|
41
|
+
|
|
42
|
+
expect(wrapper.emitted('action:add')).toEqual([[]]);
|
|
43
|
+
expect(wrapper.find('base-text-stub').attributes('text')).toBe('Click here to add director');
|
|
44
|
+
});
|
|
45
|
+
});
|