@dcrackel/hematournamentui 1.0.712 → 1.0.714
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 +42 -0
- package/dist/HemaTournamentUI-lib.es.js +6856 -6243
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +79 -9
- package/package.json +96 -96
- package/prettier.config.js +16 -16
- package/src/index.js +43 -42
- 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/BracketDirectorsModal/BracketDirectorsModal.stories.js +49 -0
- package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.test.js +129 -0
- package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.vue +165 -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 +42 -33
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +76 -45
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +122 -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 +51 -29
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +63 -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 +149 -9
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +54 -2
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +77 -8
- 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 +50 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +201 -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/bracketDirectors.js +86 -0
- package/src/stories/Util/registrationStatus.js +11 -11
- package/src/stories/Util/tabs.js +19 -47
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
function isBlankHemaRatingsId(value) {
|
|
2
|
-
return value === undefined || value === null || (typeof value === 'string' && value.trim() === '');
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function isPositiveIntegerId(value) {
|
|
6
|
-
if (!['string', 'number'].includes(typeof value)) return false;
|
|
7
|
-
if (typeof value === 'string' && !/^\d+$/.test(value.trim())) return false;
|
|
8
|
-
return Number.isSafeInteger(Number(value)) && Number(value) > 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function isInvalidHemaRatingsId(value) {
|
|
12
|
-
if (isBlankHemaRatingsId(value)) return false;
|
|
13
|
-
return !isPositiveIntegerId(value);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function validateField(field, value) {
|
|
17
|
-
const rules = {
|
|
18
|
-
DisplayName: [
|
|
19
|
-
{ check: v => !v || v.trim().length === 0, message: 'Must have a name.' },
|
|
20
|
-
{ check: v => v.trim().length < 3, message: 'Must be at least 3 characters.' }
|
|
21
|
-
],
|
|
22
|
-
LegalName: [
|
|
23
|
-
{ check: v => !v || v.trim().length === 0, message: 'Must have a name.' },
|
|
24
|
-
{ check: v => v.trim().length < 4, message: 'Must be at least 4 characters.' }
|
|
25
|
-
],
|
|
26
|
-
EmailAddress: [
|
|
27
|
-
{ check: v => v && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v), message: 'Must be a valid email address.' }
|
|
28
|
-
],
|
|
29
|
-
HemaRatingsId: [{ check: isInvalidHemaRatingsId, message: 'Enter a positive whole-number ID, or leave it blank.' }],
|
|
30
|
-
SelectedClub: [
|
|
31
|
-
{
|
|
32
|
-
check: v =>
|
|
33
|
-
!v ||
|
|
34
|
-
(typeof v === 'string' && v.trim().length === 0) ||
|
|
35
|
-
(typeof v === 'object' && (!v.text || v.text.trim().length === 0)),
|
|
36
|
-
message: 'Please select a Club.'
|
|
37
|
-
}
|
|
38
|
-
]
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const ruleSet = rules[field] || [];
|
|
42
|
-
const failedRule = ruleSet.find(rule => rule.check(value));
|
|
43
|
-
|
|
44
|
-
return failedRule ? { invalid: true, message: failedRule.message } : { invalid: false, message: '' };
|
|
45
|
-
}
|
|
1
|
+
function isBlankHemaRatingsId(value) {
|
|
2
|
+
return value === undefined || value === null || (typeof value === 'string' && value.trim() === '');
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
function isPositiveIntegerId(value) {
|
|
6
|
+
if (!['string', 'number'].includes(typeof value)) return false;
|
|
7
|
+
if (typeof value === 'string' && !/^\d+$/.test(value.trim())) return false;
|
|
8
|
+
return Number.isSafeInteger(Number(value)) && Number(value) > 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function isInvalidHemaRatingsId(value) {
|
|
12
|
+
if (isBlankHemaRatingsId(value)) return false;
|
|
13
|
+
return !isPositiveIntegerId(value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function validateField(field, value) {
|
|
17
|
+
const rules = {
|
|
18
|
+
DisplayName: [
|
|
19
|
+
{ check: v => !v || v.trim().length === 0, message: 'Must have a name.' },
|
|
20
|
+
{ check: v => v.trim().length < 3, message: 'Must be at least 3 characters.' }
|
|
21
|
+
],
|
|
22
|
+
LegalName: [
|
|
23
|
+
{ check: v => !v || v.trim().length === 0, message: 'Must have a name.' },
|
|
24
|
+
{ check: v => v.trim().length < 4, message: 'Must be at least 4 characters.' }
|
|
25
|
+
],
|
|
26
|
+
EmailAddress: [
|
|
27
|
+
{ check: v => v && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v), message: 'Must be a valid email address.' }
|
|
28
|
+
],
|
|
29
|
+
HemaRatingsId: [{ check: isInvalidHemaRatingsId, message: 'Enter a positive whole-number ID, or leave it blank.' }],
|
|
30
|
+
SelectedClub: [
|
|
31
|
+
{
|
|
32
|
+
check: v =>
|
|
33
|
+
!v ||
|
|
34
|
+
(typeof v === 'string' && v.trim().length === 0) ||
|
|
35
|
+
(typeof v === 'object' && (!v.text || v.text.trim().length === 0)),
|
|
36
|
+
message: 'Please select a Club.'
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const ruleSet = rules[field] || [];
|
|
42
|
+
const failedRule = ruleSet.find(rule => rule.check(value));
|
|
43
|
+
|
|
44
|
+
return failedRule ? { invalid: true, message: failedRule.message } : { invalid: false, message: '' };
|
|
45
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function validatePrice(value) {
|
|
2
|
-
const amount = Number(value);
|
|
3
|
-
const invalid = !Number.isFinite(amount) || amount < 0;
|
|
4
|
-
|
|
5
|
-
return { invalid, message: invalid ? 'Price must be a non-negative number.' : '' };
|
|
6
|
-
}
|
|
1
|
+
export function validatePrice(value) {
|
|
2
|
+
const amount = Number(value);
|
|
3
|
+
const invalid = !Number.isFinite(amount) || amount < 0;
|
|
4
|
+
|
|
5
|
+
return { invalid, message: invalid ? 'Price must be a non-negative number.' : '' };
|
|
6
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const FINAL_ROUND_NAMES = new Set(['final', 'finals', 'grand final', 'grand finals', 'table of 2']);
|
|
2
|
+
const isFinalBout = bout =>
|
|
3
|
+
FINAL_ROUND_NAMES.has(
|
|
4
|
+
String(bout?.RoundLabel || '')
|
|
5
|
+
.trim()
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
);
|
|
8
|
+
|
|
9
|
+
export const canAssignBoutDirector = bout =>
|
|
10
|
+
Boolean(bout?.BoutId) && String(bout.Status || '').toLowerCase() === 'scheduled' && !isFinalBout(bout);
|
|
11
|
+
|
|
12
|
+
const openActionLabels = { active: 'Resume bout', completed: 'Edit bout' };
|
|
13
|
+
|
|
14
|
+
export const canOpenBracketBout = bout => {
|
|
15
|
+
if (!bout?.BoutId) return false;
|
|
16
|
+
if (String(bout.Status || '').toLowerCase() === 'completed') return true;
|
|
17
|
+
return [bout.Person1, bout.Person2].every(
|
|
18
|
+
person => Number(person?.PersonId) > 0 && String(person?.DisplayName || '').toUpperCase() !== 'BYE'
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const normalizeDirectorName = name => {
|
|
23
|
+
const value = String(name || '').trim();
|
|
24
|
+
return value.toLowerCase() === 'unassigned' ? '' : value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const getAssignedDirectorName = (bout, plannedDirectorName) => {
|
|
28
|
+
const savedName = normalizeDirectorName(bout?.RefName);
|
|
29
|
+
if (!canAssignBoutDirector(bout)) return savedName;
|
|
30
|
+
return normalizeDirectorName(plannedDirectorName) || savedName;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const createBoutActions = (bout, showAssignment, plannedDirectorName = '', plannedDirectorColor = '') => {
|
|
34
|
+
const canAssignDirector = showAssignment && canAssignBoutDirector(bout);
|
|
35
|
+
const directorName = getAssignedDirectorName(bout, plannedDirectorName);
|
|
36
|
+
const descriptionColor = directorName === normalizeDirectorName(plannedDirectorName) ? plannedDirectorColor : '';
|
|
37
|
+
const actions = [];
|
|
38
|
+
if (canOpenBracketBout(bout)) {
|
|
39
|
+
const label = openActionLabels[String(bout.Status || '').toLowerCase()] || 'Open bout';
|
|
40
|
+
actions.push({ id: 'open', label, description: canAssignDirector ? '' : directorName, descriptionColor });
|
|
41
|
+
}
|
|
42
|
+
if (canAssignDirector) {
|
|
43
|
+
actions.push({ id: 'assign-director', label: 'Assign Director', description: directorName, descriptionColor });
|
|
44
|
+
}
|
|
45
|
+
return actions;
|
|
46
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const getIdentityKey = value => String(value ?? '');
|
|
2
|
+
export const cloneDirectorData = value => JSON.parse(JSON.stringify(value));
|
|
3
|
+
const hasIdentity = value => value !== null && value !== undefined && String(value) !== '';
|
|
4
|
+
const isDirector = director => hasIdentity(director?.PersonId) && getIdentityKey(director.PersonId) !== '0';
|
|
5
|
+
|
|
6
|
+
export const getRingOptions = rings => {
|
|
7
|
+
const options = new Map();
|
|
8
|
+
for (const ring of rings || []) {
|
|
9
|
+
if (!hasIdentity(ring?.RingId)) continue;
|
|
10
|
+
options.set(getIdentityKey(ring.RingId), { ...ring, RingName: ring.RingName || 'Ring ' + ring.RingId });
|
|
11
|
+
}
|
|
12
|
+
return [...options.values()];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getDirectorOptions = (availableDirectors, stations) => {
|
|
16
|
+
const options = new Map();
|
|
17
|
+
for (const director of availableDirectors || []) {
|
|
18
|
+
if (isDirector(director)) options.set(getIdentityKey(director.PersonId), cloneDirectorData(director));
|
|
19
|
+
}
|
|
20
|
+
for (const station of stations || []) {
|
|
21
|
+
const director = station?.Director;
|
|
22
|
+
if (!isDirector(director) || options.has(getIdentityKey(director.PersonId))) continue;
|
|
23
|
+
options.set(getIdentityKey(director.PersonId), cloneDirectorData(director));
|
|
24
|
+
}
|
|
25
|
+
return [...options.values()];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const createDirectorDraft = (availableDirectors, stations) => {
|
|
29
|
+
const stationByDirector = new Map(
|
|
30
|
+
(stations || [])
|
|
31
|
+
.filter(station => isDirector(station?.Director))
|
|
32
|
+
.map(station => [getIdentityKey(station.Director.PersonId), station])
|
|
33
|
+
);
|
|
34
|
+
return getDirectorOptions(availableDirectors, stations).map(candidate => {
|
|
35
|
+
const station = stationByDirector.get(getIdentityKey(candidate.PersonId));
|
|
36
|
+
const savedStation = station ? cloneDirectorData(station) : {};
|
|
37
|
+
const { DefaultRingId, Color, ...director } = candidate;
|
|
38
|
+
return {
|
|
39
|
+
Director: { ...savedStation.Director, ...director, DisplayName: director.DisplayName || 'Unnamed director' },
|
|
40
|
+
Color: savedStation.Color || Color || '',
|
|
41
|
+
RingId: savedStation.RingId ?? DefaultRingId ?? '',
|
|
42
|
+
Selected: Boolean(station),
|
|
43
|
+
station: savedStation
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const reconcileDirectorDraft = (availableDirectors, stations, draft) => {
|
|
49
|
+
const previous = new Map(draft.map(row => [getIdentityKey(row.Director.PersonId), row]));
|
|
50
|
+
return createDirectorDraft(availableDirectors, stations).map(row => {
|
|
51
|
+
const existing = previous.get(getIdentityKey(row.Director.PersonId));
|
|
52
|
+
if (!existing) return row;
|
|
53
|
+
return { ...row, Selected: existing.Selected, RingId: existing.RingId };
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const getDirectorDraftError = (draft, rings) => {
|
|
58
|
+
const selected = draft.filter(row => row.Selected);
|
|
59
|
+
const availableIds = new Set(
|
|
60
|
+
getRingOptions(rings)
|
|
61
|
+
.filter(ring => !ring.Disabled)
|
|
62
|
+
.map(ring => getIdentityKey(ring.RingId))
|
|
63
|
+
);
|
|
64
|
+
if (selected.some(row => !availableIds.has(getIdentityKey(row.RingId))))
|
|
65
|
+
return 'Choose a ring for each selected director.';
|
|
66
|
+
const selectedIds = selected.map(row => getIdentityKey(row.RingId));
|
|
67
|
+
if (new Set(selectedIds).size !== selectedIds.length) return 'Each selected director needs a different ring.';
|
|
68
|
+
return '';
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const createDirectorStations = (draft, rings) => {
|
|
72
|
+
if (getDirectorDraftError(draft, rings)) return null;
|
|
73
|
+
const ringById = new Map(getRingOptions(rings).map(ring => [getIdentityKey(ring.RingId), ring]));
|
|
74
|
+
return draft
|
|
75
|
+
.filter(row => row.Selected)
|
|
76
|
+
.map(row => {
|
|
77
|
+
const ring = ringById.get(getIdentityKey(row.RingId));
|
|
78
|
+
return cloneDirectorData({
|
|
79
|
+
...row.station,
|
|
80
|
+
RingId: ring.RingId,
|
|
81
|
+
RingName: ring.RingName,
|
|
82
|
+
Color: row.Color || ring.Color || '',
|
|
83
|
+
Director: row.Director
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const statusLabels = new Map([
|
|
2
|
-
['open', 'Open'],
|
|
3
|
-
['waitlist', 'Waitlist'],
|
|
4
|
-
['full', 'Full'],
|
|
5
|
-
['closed', 'Closed']
|
|
6
|
-
]);
|
|
7
|
-
|
|
8
|
-
export function getRegistrationStatusLabel(status) {
|
|
9
|
-
const value = typeof status === 'string' ? status.trim().toLowerCase() : '';
|
|
10
|
-
return statusLabels.get(value) ?? '';
|
|
11
|
-
}
|
|
1
|
+
const statusLabels = new Map([
|
|
2
|
+
['open', 'Open'],
|
|
3
|
+
['waitlist', 'Waitlist'],
|
|
4
|
+
['full', 'Full'],
|
|
5
|
+
['closed', 'Closed']
|
|
6
|
+
]);
|
|
7
|
+
|
|
8
|
+
export function getRegistrationStatusLabel(status) {
|
|
9
|
+
const value = typeof status === 'string' ? status.trim().toLowerCase() : '';
|
|
10
|
+
return statusLabels.get(value) ?? '';
|
|
11
|
+
}
|
package/src/stories/Util/tabs.js
CHANGED
|
@@ -1,52 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
color: 'primaryHighlight',
|
|
9
|
-
icon: 'fa-cog',
|
|
10
|
-
group: 'Settings',
|
|
11
|
-
children: [
|
|
12
|
-
{ id: 'Edit', label: 'Edit', color: 'primaryHighlight', icon: 'fa-pencil-alt' },
|
|
13
|
-
{ id: 'Staff', label: 'Staff', color: 'primaryHighlight', icon: 'fa-users-cog' },
|
|
14
|
-
{ id: 'Displays', label: 'Displays', color: 'primaryHighlight', icon: 'fa-tv' },
|
|
15
|
-
{ id: 'Penalties', label: 'Penalties', color: 'primaryHighlight', icon: 'fa-cards-blank' }
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
{ id: 'Checkin', label: 'Checkin', color: 'primaryHighlight', icon: 'fa-clipboard-check' },
|
|
19
|
-
{ id: 'Pools', label: 'Pools', color: 'primaryHighlight', icon: 'fa-swords' },
|
|
20
|
-
{ id: 'Pool Results', label: 'Pool Results', color: 'primaryHighlight', icon: 'fa-chart-bar' },
|
|
21
|
-
{ id: 'Bracket', label: 'Bracket', color: 'primaryHighlight', icon: 'fa-sitemap' },
|
|
22
|
-
{ id: 'Final', label: 'Final Results', color: 'primaryHighlight', icon: 'fa-trophy' }
|
|
23
|
-
];
|
|
24
|
-
}
|
|
1
|
+
const directingTabs = [
|
|
2
|
+
{ id: 'Pools', label: 'Pools', color: 'primaryHighlight', icon: 'fa-swords' },
|
|
3
|
+
{ id: 'Pool Results', label: 'Pool Results', color: 'primaryHighlight', icon: 'fa-chart-bar' },
|
|
4
|
+
{ id: 'Bracket', label: 'Bracket', color: 'primaryHighlight', icon: 'fa-sitemap' },
|
|
5
|
+
{ id: 'Final', label: 'Final Results', color: 'primaryHighlight', icon: 'fa-trophy' },
|
|
6
|
+
{ id: 'Penalties', label: 'Penalties', color: 'primaryHighlight', icon: 'fa-cards-blank' }
|
|
7
|
+
];
|
|
25
8
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{ id: 'Pool Results', label: 'Pool Results', color: 'primaryHighlight', icon: 'fa-chart-bar' },
|
|
33
|
-
{ id: 'Bracket', label: 'Bracket', color: 'primaryHighlight', icon: 'fa-sitemap' },
|
|
34
|
-
{ id: 'Final', label: 'Final Results', color: 'primaryHighlight', icon: 'fa-trophy' },
|
|
35
|
-
{ id: 'Penalties', label: 'Penalties', color: 'primaryHighlight', icon: 'fa-cards' }
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (role.toLocaleLowerCase() === 'director') {
|
|
40
|
-
return [
|
|
41
|
-
{ id: 'Pools', label: 'Pools', color: 'primaryHighlight', icon: 'fa-swords' },
|
|
42
|
-
{ id: 'Pool Results', label: 'Pool Results', color: 'primaryHighlight', icon: 'fa-chart-bar' },
|
|
43
|
-
{ id: 'Bracket', label: 'Bracket', color: 'primaryHighlight', icon: 'fa-sitemap' },
|
|
44
|
-
{ id: 'Final', label: 'Final Results', color: 'primaryHighlight', icon: 'fa-trophy' },
|
|
45
|
-
{ id: 'Penalties', label: 'Penalties', color: 'primaryHighlight', icon: 'fa-cards-blank' }
|
|
46
|
-
];
|
|
47
|
-
}
|
|
9
|
+
const organisingTabs = [
|
|
10
|
+
{ id: 'Edit', label: 'Edit', color: 'primaryHighlight', icon: 'fa-pencil-alt', mobileHidden: true },
|
|
11
|
+
{ id: 'Staff', label: 'Staff', color: 'primaryHighlight', icon: 'fa-users-cog', mobileHidden: true },
|
|
12
|
+
{ id: 'Displays', label: 'Displays', color: 'primaryHighlight', icon: 'fa-tv', mobileHidden: true },
|
|
13
|
+
{ id: 'Checkin', label: 'Checkin', color: 'primaryHighlight', icon: 'fa-clipboard-check', mobileHidden: true }
|
|
14
|
+
];
|
|
48
15
|
|
|
49
|
-
|
|
16
|
+
export const tabs = (role, isMobile = false) => {
|
|
17
|
+
const normalizedRole = String(role || '').toLowerCase();
|
|
18
|
+
const isOrganiser = ['admin', 'club'].includes(normalizedRole);
|
|
19
|
+
if (!isOrganiser && normalizedRole !== 'director') return [];
|
|
20
|
+
if (isMobile || !isOrganiser) return directingTabs.map(tab => ({ ...tab }));
|
|
21
|
+
return [...organisingTabs, ...directingTabs].map(tab => ({ ...tab }));
|
|
50
22
|
};
|
|
51
23
|
|
|
52
24
|
export const personProfileTabs = role => {
|