@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.
- package/AGENTS.md +118 -118
- package/dist/HemaTournamentUI-lib.es.js +4483 -4618
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +185 -406
- package/package.json +10 -10
- package/src/index.js +2 -0
- package/src/mocks/getDEBouts-42Fencers.js +4 -4
- package/src/mocks/getDEBouts-TableOf128.js +37 -0
- package/src/mocks/getDEBouts-TableOf64.js +35 -0
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -0
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +3 -2
- package/src/stories/Molecules/Modals/EditBoutModal/EditBoutModal.vue +1 -1
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -0
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -0
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -0
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -278
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +60 -98
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +103 -4
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +256 -215
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -92
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -128
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +14 -4
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +2 -2
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +131 -3
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +287 -89
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -0
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -0
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -0
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -0
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -0
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -0
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +57 -0
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +65 -0
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +31 -29
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +146 -18
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +52 -2
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +53 -17
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +39 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -0
- package/src/stories/Organisms/Cards/TableauBoutCard/SpacingConfig.js +0 -111
- package/src/stories/Organisms/Containers/TableauLines/SpacingConfig.js +0 -162
- package/src/stories/Organisms/Containers/TableauLines/TableauLines.stories.js +0 -21
- package/src/stories/Organisms/Containers/TableauLines/TableauLines.vue +0 -78
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
const toNodeKey = value => String(value);
|
|
2
|
+
|
|
3
|
+
const snapToPixel = value => Math.round(value) + 0.5;
|
|
4
|
+
|
|
5
|
+
const getPointRelativeToRoot = (rootElement, element) => {
|
|
6
|
+
const rootBounds = rootElement.getBoundingClientRect();
|
|
7
|
+
const elementBounds = element.getBoundingClientRect();
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
x: snapToPixel(elementBounds.left - rootBounds.left + elementBounds.width / 2),
|
|
11
|
+
y: snapToPixel(elementBounds.top - rootBounds.top + elementBounds.height / 2)
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const createDomAnchorLayout = ({ rootElement, getInputAnchor, getOutputAnchor }) => ({
|
|
16
|
+
size: {
|
|
17
|
+
width: Math.ceil(rootElement.scrollWidth),
|
|
18
|
+
height: Math.ceil(rootElement.scrollHeight)
|
|
19
|
+
},
|
|
20
|
+
getInputPoint: nodeId => {
|
|
21
|
+
const element = getInputAnchor(toNodeKey(nodeId));
|
|
22
|
+
return element ? getPointRelativeToRoot(rootElement, element) : null;
|
|
23
|
+
},
|
|
24
|
+
getOutputPoint: nodeId => {
|
|
25
|
+
const element = getOutputAnchor(toNodeKey(nodeId));
|
|
26
|
+
return element ? getPointRelativeToRoot(rootElement, element) : null;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const groupChildrenByParent = bouts => {
|
|
31
|
+
const childrenByParent = new Map();
|
|
32
|
+
|
|
33
|
+
bouts.forEach(bout => {
|
|
34
|
+
if (!bout?.DEBoutId || !bout?.DENextBoutId) return;
|
|
35
|
+
const parentId = toNodeKey(bout.DENextBoutId);
|
|
36
|
+
const childIds = childrenByParent.get(parentId) || [];
|
|
37
|
+
childrenByParent.set(parentId, [...childIds, toNodeKey(bout.DEBoutId)]);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return childrenByParent;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const clamp = (value, minimum, maximum) => Math.max(minimum, Math.min(maximum, value));
|
|
44
|
+
|
|
45
|
+
const getTrunkX = (childPoints, parentPoint) => {
|
|
46
|
+
const averageChildX = childPoints.reduce((total, point) => total + point.x, 0) / childPoints.length;
|
|
47
|
+
const childrenAreRightOfParent = averageChildX > parentPoint.x;
|
|
48
|
+
const minimumChildX = Math.min(...childPoints.map(point => point.x));
|
|
49
|
+
const maximumChildX = Math.max(...childPoints.map(point => point.x));
|
|
50
|
+
|
|
51
|
+
if (childrenAreRightOfParent) {
|
|
52
|
+
return clamp(parentPoint.x + 120, parentPoint.x + 6, minimumChildX - 16);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return clamp(parentPoint.x - 120, maximumChildX + 16, parentPoint.x - 6);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const createSingleChildPath = ({ childId, childPoint, parentId, parentPoint }) => {
|
|
59
|
+
const trunkX = getTrunkX([childPoint], parentPoint);
|
|
60
|
+
return {
|
|
61
|
+
key: `${childId}->${parentId}`,
|
|
62
|
+
path: `M ${childPoint.x} ${childPoint.y} L ${trunkX} ${childPoint.y} L ${trunkX} ${parentPoint.y} L ${parentPoint.x} ${parentPoint.y}`,
|
|
63
|
+
segmentRole: 'single',
|
|
64
|
+
sourceBoutId: childId,
|
|
65
|
+
sourceBoutIds: [childId],
|
|
66
|
+
targetBoutId: parentId
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const createPairedChildPaths = ({ childIds, childPoints, parentId, parentPoint }) => {
|
|
71
|
+
const trunkX = getTrunkX(childPoints, parentPoint);
|
|
72
|
+
const [firstPoint, secondPoint] = childPoints;
|
|
73
|
+
const top = firstPoint.y <= secondPoint.y ? firstPoint : secondPoint;
|
|
74
|
+
const bottom = firstPoint.y <= secondPoint.y ? secondPoint : firstPoint;
|
|
75
|
+
const middleY = (top.y + bottom.y) / 2;
|
|
76
|
+
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
key: `${childIds[0]}->join(${parentId})`,
|
|
80
|
+
path: `M ${firstPoint.x} ${firstPoint.y} L ${trunkX} ${firstPoint.y}`,
|
|
81
|
+
segmentRole: 'child',
|
|
82
|
+
sourceBoutId: childIds[0],
|
|
83
|
+
sourceBoutIds: [childIds[0]],
|
|
84
|
+
targetBoutId: parentId
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
key: `${childIds[1]}->join(${parentId})`,
|
|
88
|
+
path: `M ${secondPoint.x} ${secondPoint.y} L ${trunkX} ${secondPoint.y}`,
|
|
89
|
+
segmentRole: 'child',
|
|
90
|
+
sourceBoutId: childIds[1],
|
|
91
|
+
sourceBoutIds: [childIds[1]],
|
|
92
|
+
targetBoutId: parentId
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: `trunk(${parentId})`,
|
|
96
|
+
path: `M ${trunkX} ${top.y} L ${trunkX} ${bottom.y}`,
|
|
97
|
+
segmentRole: 'merge',
|
|
98
|
+
sourceBoutIds: [...childIds],
|
|
99
|
+
targetBoutId: parentId
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: `join(${parentId})->parent`,
|
|
103
|
+
path: `M ${trunkX} ${middleY} L ${parentPoint.x} ${middleY} L ${parentPoint.x} ${parentPoint.y}`,
|
|
104
|
+
segmentRole: 'parent',
|
|
105
|
+
sourceBoutIds: [...childIds],
|
|
106
|
+
targetBoutId: parentId
|
|
107
|
+
}
|
|
108
|
+
];
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const buildBracketPaths = ({ bouts, getInputPoint, getOutputPoint }) => {
|
|
112
|
+
const paths = [];
|
|
113
|
+
|
|
114
|
+
groupChildrenByParent(bouts).forEach((childIds, parentId) => {
|
|
115
|
+
const parentPoint = getInputPoint(parentId);
|
|
116
|
+
const children = childIds
|
|
117
|
+
.map(childId => ({ id: childId, point: getOutputPoint(childId) }))
|
|
118
|
+
.filter(child => child.point);
|
|
119
|
+
if (!parentPoint || children.length === 0) return;
|
|
120
|
+
|
|
121
|
+
if (children.length === 1) {
|
|
122
|
+
paths.push(
|
|
123
|
+
createSingleChildPath({
|
|
124
|
+
childId: children[0].id,
|
|
125
|
+
childPoint: children[0].point,
|
|
126
|
+
parentId,
|
|
127
|
+
parentPoint
|
|
128
|
+
})
|
|
129
|
+
);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const pairedChildren = children.slice(0, 2);
|
|
134
|
+
paths.push(
|
|
135
|
+
...createPairedChildPaths({
|
|
136
|
+
childIds: pairedChildren.map(child => child.id),
|
|
137
|
+
childPoints: pairedChildren.map(child => child.point),
|
|
138
|
+
parentId,
|
|
139
|
+
parentPoint
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
return paths;
|
|
145
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { buildBracketPaths, createDomAnchorLayout } from './TableauLayoutEngine';
|
|
3
|
+
|
|
4
|
+
const createElement = ({ left, top, width = 0, height = 0 }) => ({
|
|
5
|
+
getBoundingClientRect: () => ({ left, top, width, height })
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
describe('createDomAnchorLayout', () => {
|
|
9
|
+
it('measures anchors relative to the tableau root', () => {
|
|
10
|
+
const rootElement = {
|
|
11
|
+
...createElement({ left: 10, top: 20 }),
|
|
12
|
+
scrollWidth: 400,
|
|
13
|
+
scrollHeight: 300
|
|
14
|
+
};
|
|
15
|
+
const inputAnchor = createElement({ left: 110, top: 70 });
|
|
16
|
+
const layout = createDomAnchorLayout({
|
|
17
|
+
rootElement,
|
|
18
|
+
getInputAnchor: () => inputAnchor,
|
|
19
|
+
getOutputAnchor: () => null
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(layout.size).toEqual({ width: 400, height: 300 });
|
|
23
|
+
expect(layout.getInputPoint('3')).toEqual({ x: 100.5, y: 50.5 });
|
|
24
|
+
expect(layout.getOutputPoint('3')).toBeNull();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('buildBracketPaths', () => {
|
|
29
|
+
const bouts = [
|
|
30
|
+
{ DEBoutId: 1, DENextBoutId: 3 },
|
|
31
|
+
{ DEBoutId: 2, DENextBoutId: 3 },
|
|
32
|
+
{ DEBoutId: 3, DENextBoutId: null }
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
it('joins two child bouts to their next bout', () => {
|
|
36
|
+
const outputPoints = {
|
|
37
|
+
1: { x: 160, y: 30 },
|
|
38
|
+
2: { x: 160, y: 100 }
|
|
39
|
+
};
|
|
40
|
+
const paths = buildBracketPaths({
|
|
41
|
+
bouts,
|
|
42
|
+
getInputPoint: id => (id === '3' ? { x: 200, y: 65 } : null),
|
|
43
|
+
getOutputPoint: id => outputPoints[id] || null
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(paths).toHaveLength(4);
|
|
47
|
+
expect(paths.map(path => path.key)).toEqual(['1->join(3)', '2->join(3)', 'trunk(3)', 'join(3)->parent']);
|
|
48
|
+
expect(paths.map(path => path.segmentRole)).toEqual(['child', 'child', 'merge', 'parent']);
|
|
49
|
+
expect(paths[0]).toMatchObject({ sourceBoutId: '1', sourceBoutIds: ['1'], targetBoutId: '3' });
|
|
50
|
+
expect(paths[2]).toMatchObject({ sourceBoutIds: ['1', '2'], targetBoutId: '3' });
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('keeps the correct child id when only one anchor is mounted', () => {
|
|
54
|
+
const paths = buildBracketPaths({
|
|
55
|
+
bouts,
|
|
56
|
+
getInputPoint: id => (id === '3' ? { x: 200, y: 65 } : null),
|
|
57
|
+
getOutputPoint: id => (id === '2' ? { x: 160, y: 100 } : null)
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(paths).toHaveLength(1);
|
|
61
|
+
expect(paths[0].key).toBe('2->3');
|
|
62
|
+
expect(paths[0]).toMatchObject({ segmentRole: 'single', sourceBoutId: '2', targetBoutId: '3' });
|
|
63
|
+
});
|
|
64
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const toKey = value => String(value ?? '');
|
|
2
|
+
|
|
3
|
+
const hasIdentity = value => value !== null && value !== undefined && String(value).length > 0;
|
|
4
|
+
|
|
5
|
+
export const createStationByRing = stations =>
|
|
6
|
+
Object.fromEntries(
|
|
7
|
+
(stations || []).filter(station => hasIdentity(station?.RingId)).map(station => [toKey(station.RingId), station])
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export const createPlannedStationByBout = ({ assignments, stations }) => {
|
|
11
|
+
const stationByRing = createStationByRing(stations);
|
|
12
|
+
|
|
13
|
+
return Object.fromEntries(
|
|
14
|
+
(assignments || [])
|
|
15
|
+
.filter(assignment => hasIdentity(assignment?.DEBoutId))
|
|
16
|
+
.map(assignment => [toKey(assignment.DEBoutId), stationByRing[toKey(assignment.RingId)]])
|
|
17
|
+
.filter(([, station]) => station)
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getPlannedStationForBout = (plannedStationByBout, bout) =>
|
|
22
|
+
plannedStationByBout[toKey(bout?.DEBoutId ?? bout?.BoutId)] || null;
|
|
23
|
+
|
|
24
|
+
export const isBoutSuggestedForViewer = ({ bout, plannedStationByBout, viewerPersonId }) => {
|
|
25
|
+
if (!hasIdentity(viewerPersonId)) return false;
|
|
26
|
+
const directorId = getPlannedStationForBout(plannedStationByBout, bout)?.Director?.PersonId;
|
|
27
|
+
return hasIdentity(directorId) && toKey(directorId) === toKey(viewerPersonId);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getStationColor = (plannedStationByBout, boutId) => plannedStationByBout[toKey(boutId)]?.Color || null;
|
|
31
|
+
|
|
32
|
+
const getSharedSourceColor = (plannedStationByBout, sourceBoutIds) => {
|
|
33
|
+
const colors = sourceBoutIds.map(boutId => getStationColor(plannedStationByBout, boutId));
|
|
34
|
+
if (colors.some(color => !color)) return null;
|
|
35
|
+
return new Set(colors).size === 1 ? colors[0] : null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const connectorStrokeRules = [
|
|
39
|
+
{
|
|
40
|
+
matches: connector => ['child', 'single'].includes(connector.segmentRole),
|
|
41
|
+
resolve: (connector, stations) => getStationColor(stations, connector.sourceBoutId)
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
matches: connector => connector.segmentRole === 'merge',
|
|
45
|
+
resolve: (connector, stations) => getSharedSourceColor(stations, connector.sourceBoutIds || [])
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
matches: connector => connector.segmentRole === 'parent',
|
|
49
|
+
resolve: (connector, stations) => getStationColor(stations, connector.targetBoutId)
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
export const addPlannedStrokesToConnectors = (connectors, plannedStationByBout) =>
|
|
54
|
+
connectors.map(connector => ({
|
|
55
|
+
...connector,
|
|
56
|
+
stroke: connectorStrokeRules.find(rule => rule.matches(connector))?.resolve(connector, plannedStationByBout) || null
|
|
57
|
+
}));
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
addPlannedStrokesToConnectors,
|
|
4
|
+
createPlannedStationByBout,
|
|
5
|
+
isBoutSuggestedForViewer
|
|
6
|
+
} from './plannedAssignments';
|
|
7
|
+
|
|
8
|
+
const stations = [
|
|
9
|
+
{ RingId: 1, Color: '#2563eb', Director: { PersonId: 10 } },
|
|
10
|
+
{ RingId: 2, Color: '#dc2626', Director: { PersonId: 20 } }
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
describe('planned directing presentation helpers', () => {
|
|
14
|
+
it('joins planned bout data to its display station without mutating either input', () => {
|
|
15
|
+
const assignments = [{ DEBoutId: 101, RingId: 1 }];
|
|
16
|
+
|
|
17
|
+
const plannedStationByBout = createPlannedStationByBout({ assignments, stations });
|
|
18
|
+
|
|
19
|
+
expect(plannedStationByBout['101']).toBe(stations[0]);
|
|
20
|
+
expect(assignments).toEqual([{ DEBoutId: 101, RingId: 1 }]);
|
|
21
|
+
expect(stations[0]).toEqual({ RingId: 1, Color: '#2563eb', Director: { PersonId: 10 } });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('identifies suggestions for the viewer without treating other suggestions as locks', () => {
|
|
25
|
+
const plannedStationByBout = createPlannedStationByBout({
|
|
26
|
+
assignments: [
|
|
27
|
+
{ DEBoutId: 101, RingId: 1 },
|
|
28
|
+
{ DEBoutId: 102, RingId: 2 }
|
|
29
|
+
],
|
|
30
|
+
stations
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
expect(isBoutSuggestedForViewer({ bout: { DEBoutId: 101 }, plannedStationByBout, viewerPersonId: '10' })).toBe(
|
|
34
|
+
true
|
|
35
|
+
);
|
|
36
|
+
expect(isBoutSuggestedForViewer({ bout: { DEBoutId: 102 }, plannedStationByBout, viewerPersonId: '10' })).toBe(
|
|
37
|
+
false
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('colors source and parent segments while leaving mixed merge trunks neutral', () => {
|
|
42
|
+
const plannedStationByBout = createPlannedStationByBout({
|
|
43
|
+
assignments: [
|
|
44
|
+
{ DEBoutId: 1, RingId: 1 },
|
|
45
|
+
{ DEBoutId: 2, RingId: 2 },
|
|
46
|
+
{ DEBoutId: 3, RingId: 1 }
|
|
47
|
+
],
|
|
48
|
+
stations
|
|
49
|
+
});
|
|
50
|
+
const connectors = [
|
|
51
|
+
{ key: 'child-1', segmentRole: 'child', sourceBoutId: 1 },
|
|
52
|
+
{ key: 'child-2', segmentRole: 'child', sourceBoutId: 2 },
|
|
53
|
+
{ key: 'merge', segmentRole: 'merge', sourceBoutIds: [1, 2] },
|
|
54
|
+
{ key: 'parent', segmentRole: 'parent', targetBoutId: 3 }
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
expect(addPlannedStrokesToConnectors(connectors, plannedStationByBout).map(path => path.stroke)).toEqual([
|
|
58
|
+
'#2563eb',
|
|
59
|
+
'#dc2626',
|
|
60
|
+
null,
|
|
61
|
+
'#2563eb'
|
|
62
|
+
]);
|
|
63
|
+
expect(connectors.some(connector => Object.hasOwn(connector, 'stroke'))).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<section>
|
|
3
|
-
<div
|
|
4
|
-
v-if="roundName !== 'Third Place' && roundName !== 'Final' && roundName !== 'Grand Final'"
|
|
5
|
-
class="flex justify-center mb-4 border-b"
|
|
6
|
-
:class="largeCards ? 'w-72' : 'w-40'"
|
|
7
|
-
>
|
|
2
|
+
<section class="relative z-10 w-[200px] flex-none">
|
|
3
|
+
<div class="mb-4 flex w-40 justify-center border-b border-dropdownSelect">
|
|
8
4
|
<BaseText :text="roundName" size="sm" color="quaternary" />
|
|
9
5
|
</div>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
|
|
7
|
+
<div :style="columnStyle">
|
|
8
|
+
<div v-for="(bout, index) in bouts" :key="bout.DEBoutId ?? bout.BoutId" :style="getBoutStyle(index)">
|
|
9
|
+
<TableauBoutCard
|
|
10
|
+
:bout="bout"
|
|
11
|
+
:hostingClubColors="hostingClubColors"
|
|
12
|
+
:roundName="roundName"
|
|
13
|
+
:bracketSize="bracketSize"
|
|
14
|
+
:isCountingBackwardsMaxScore="isCountingBackwardsMaxScore"
|
|
15
|
+
@register-node-anchor="registerNodeAnchor"
|
|
16
|
+
@action:editBout="handleEditBout"
|
|
17
|
+
@action:directingBout="handleDirectorBout"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
22
20
|
</div>
|
|
23
21
|
</section>
|
|
24
22
|
</template>
|
|
@@ -26,12 +24,11 @@
|
|
|
26
24
|
<script>
|
|
27
25
|
import TableauBoutCard from '../../Cards/TableauBoutCard/TableauBoutCard.vue';
|
|
28
26
|
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
29
|
-
import TableauLines from '../TableauLines/TableauLines.vue';
|
|
30
27
|
|
|
31
28
|
export default {
|
|
32
29
|
name: 'TableauColumn',
|
|
33
|
-
emits: ['action:directingBout', 'action:editBout'],
|
|
34
|
-
components: {
|
|
30
|
+
emits: ['action:directingBout', 'action:editBout', 'register-node-anchor'],
|
|
31
|
+
components: { BaseText, TableauBoutCard },
|
|
35
32
|
props: {
|
|
36
33
|
bouts: {
|
|
37
34
|
type: Array,
|
|
@@ -49,22 +46,27 @@ export default {
|
|
|
49
46
|
type: String,
|
|
50
47
|
required: true
|
|
51
48
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
54
|
-
|
|
49
|
+
layout: {
|
|
50
|
+
type: Object,
|
|
51
|
+
default: () => ({ gapPx: 16, padTopPx: 0 })
|
|
55
52
|
},
|
|
56
53
|
isCountingBackwardsMaxScore: {
|
|
57
54
|
type: Number,
|
|
58
55
|
default: 0
|
|
59
56
|
}
|
|
60
57
|
},
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
58
|
+
computed: {
|
|
59
|
+
columnStyle() {
|
|
60
|
+
return { paddingTop: `${this.layout.padTopPx}px` };
|
|
61
|
+
}
|
|
65
62
|
},
|
|
66
|
-
computed: {},
|
|
67
63
|
methods: {
|
|
64
|
+
getBoutStyle(index) {
|
|
65
|
+
return { marginBottom: index < this.bouts.length - 1 ? `${this.layout.gapPx}px` : '0' };
|
|
66
|
+
},
|
|
67
|
+
registerNodeAnchor(anchor) {
|
|
68
|
+
this.$emit('register-node-anchor', anchor);
|
|
69
|
+
},
|
|
68
70
|
handleEditBout(bout) {
|
|
69
71
|
this.$emit('action:editBout', bout);
|
|
70
72
|
},
|
|
@@ -1,39 +1,151 @@
|
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
1
2
|
import Bracket from './Bracket.vue';
|
|
3
|
+
import {
|
|
4
|
+
activateStoryBout,
|
|
5
|
+
canStoryDirectorDirectBout,
|
|
6
|
+
clearStoryBoutChrome,
|
|
7
|
+
cloneStoryBouts,
|
|
8
|
+
getStoryDirectorId,
|
|
9
|
+
replaceStoryBout
|
|
10
|
+
} from './BracketStoryHarness.js';
|
|
11
|
+
import {
|
|
12
|
+
plannedBoutAssignments,
|
|
13
|
+
plannedDirectingStations,
|
|
14
|
+
plannedSuggestionViewerId
|
|
15
|
+
} from './BracketPlannedSuggestions.js';
|
|
2
16
|
//import getDEWithBouts from '../../../../mocks/getDEWithBouts.js';
|
|
3
17
|
import getDEWithBouts6Fencers from '../../../../mocks/getDeBouts-6fencers.js';
|
|
4
18
|
import getDEWithBouts12Fencers from '../../../../mocks/getDeBouts-12fencers.js';
|
|
5
19
|
import getDEWithBouts22Fencers from '../../../../mocks/getDeBouts-22fencers.js';
|
|
6
|
-
import getDEWithBout42Fencers from '../../../../mocks/
|
|
7
|
-
import
|
|
8
|
-
import
|
|
20
|
+
import getDEWithBout42Fencers from '../../../../mocks/getDEBouts-42Fencers.js';
|
|
21
|
+
import getDEBoutsTableOf64 from '../../../../mocks/getDEBouts-TableOf64.js';
|
|
22
|
+
import getDEBoutsTableOf128 from '../../../../mocks/getDEBouts-TableOf128.js';
|
|
9
23
|
import getDEWithBouts from '../../../../mocks/getDEBouts-DoubleElim.js';
|
|
10
24
|
|
|
25
|
+
const cloneStations = stations =>
|
|
26
|
+
(stations || []).map(station => ({ ...station, Director: station.Director ? { ...station.Director } : null }));
|
|
27
|
+
|
|
28
|
+
const renderInteractiveBracket = args => ({
|
|
29
|
+
components: { Bracket },
|
|
30
|
+
setup() {
|
|
31
|
+
const storyBouts = ref(cloneStoryBouts(args.bouts));
|
|
32
|
+
const storyStations = ref(cloneStations(args.plannedDirectingStations));
|
|
33
|
+
|
|
34
|
+
watch(
|
|
35
|
+
() => args.bouts,
|
|
36
|
+
bouts => {
|
|
37
|
+
storyBouts.value = cloneStoryBouts(bouts);
|
|
38
|
+
},
|
|
39
|
+
{ deep: true }
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
watch(
|
|
43
|
+
() => args.plannedDirectingStations,
|
|
44
|
+
stations => {
|
|
45
|
+
storyStations.value = cloneStations(stations);
|
|
46
|
+
},
|
|
47
|
+
{ deep: true }
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
const persistStoryBout = bout => {
|
|
51
|
+
storyBouts.value = replaceStoryBout(storyBouts.value, bout);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const getViewerStation = () =>
|
|
55
|
+
storyStations.value.find(station => String(station.Director?.PersonId) === String(args.viewerPersonId));
|
|
56
|
+
|
|
57
|
+
const handleAddPlannedDirector = () => {
|
|
58
|
+
const assignedRingIds = new Set(storyStations.value.map(station => String(station.RingId)));
|
|
59
|
+
const nextStation = plannedDirectingStations.find(station => !assignedRingIds.has(String(station.RingId)));
|
|
60
|
+
if (!nextStation) return;
|
|
61
|
+
storyStations.value = [...storyStations.value, ...cloneStations([nextStation])];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleDirectingBout = bout => {
|
|
65
|
+
const viewerStation = getViewerStation();
|
|
66
|
+
if (!canStoryDirectorDirectBout(bout, getStoryDirectorId(viewerStation))) return;
|
|
67
|
+
persistStoryBout(activateStoryBout(bout, viewerStation));
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleCloseDirectingBout = bout => {
|
|
71
|
+
persistStoryBout(clearStoryBoutChrome(bout));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
args,
|
|
76
|
+
storyBouts,
|
|
77
|
+
storyStations,
|
|
78
|
+
handleAddPlannedDirector,
|
|
79
|
+
handleCloseDirectingBout,
|
|
80
|
+
handleDirectingBout,
|
|
81
|
+
persistStoryBout
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
template: `
|
|
85
|
+
<Bracket
|
|
86
|
+
v-bind="args"
|
|
87
|
+
:connectedToServer="args.connectedToServer"
|
|
88
|
+
:eventRules="args.eventRules"
|
|
89
|
+
:hostingClubColors="args.hostingClubColors"
|
|
90
|
+
:bouts="storyBouts"
|
|
91
|
+
:plannedDirectingStations="storyStations"
|
|
92
|
+
@close:directing-bout="handleCloseDirectingBout"
|
|
93
|
+
@request:add-planned-director="handleAddPlannedDirector"
|
|
94
|
+
@update:directing-bout="handleDirectingBout"
|
|
95
|
+
@request:bout-active="handleDirectingBout"
|
|
96
|
+
@update:bout="persistStoryBout"
|
|
97
|
+
@submit:bout="persistStoryBout"
|
|
98
|
+
/>
|
|
99
|
+
`
|
|
100
|
+
});
|
|
101
|
+
|
|
11
102
|
export default {
|
|
12
103
|
title: 'Templates/EventManagement/Bracket',
|
|
13
104
|
component: Bracket,
|
|
14
105
|
tags: ['Bracket'],
|
|
106
|
+
render: renderInteractiveBracket,
|
|
15
107
|
args: {
|
|
16
108
|
bouts: getDEWithBouts.pools[0].Bouts,
|
|
17
109
|
eventRules: getDEWithBouts.eventRules,
|
|
18
110
|
hostingClubColors: getDEWithBouts.hostingClubColors,
|
|
19
111
|
connectedToServer: true,
|
|
20
|
-
role: 'admin'
|
|
112
|
+
role: 'admin',
|
|
113
|
+
plannedDirectingStations: [],
|
|
114
|
+
plannedBoutAssignments: [],
|
|
115
|
+
viewerPersonId: null,
|
|
116
|
+
showPlannedDirectorAssignments: false,
|
|
117
|
+
showAddPlannedDirectorCard: true
|
|
21
118
|
},
|
|
22
119
|
argTypes: {
|
|
23
120
|
bouts: {
|
|
24
|
-
control:
|
|
121
|
+
control: 'object'
|
|
25
122
|
},
|
|
26
123
|
eventRules: {
|
|
27
|
-
control:
|
|
124
|
+
control: 'object'
|
|
28
125
|
},
|
|
29
126
|
hostingClubColors: {
|
|
30
|
-
control:
|
|
127
|
+
control: 'object'
|
|
31
128
|
},
|
|
32
129
|
connectedToServer: {
|
|
33
|
-
control:
|
|
130
|
+
control: 'boolean'
|
|
34
131
|
},
|
|
35
132
|
role: {
|
|
36
|
-
control:
|
|
133
|
+
control: 'text'
|
|
134
|
+
},
|
|
135
|
+
plannedDirectingStations: {
|
|
136
|
+
control: 'object'
|
|
137
|
+
},
|
|
138
|
+
plannedBoutAssignments: {
|
|
139
|
+
control: 'object'
|
|
140
|
+
},
|
|
141
|
+
viewerPersonId: {
|
|
142
|
+
control: 'text'
|
|
143
|
+
},
|
|
144
|
+
showPlannedDirectorAssignments: {
|
|
145
|
+
control: 'boolean'
|
|
146
|
+
},
|
|
147
|
+
showAddPlannedDirectorCard: {
|
|
148
|
+
control: 'boolean'
|
|
37
149
|
}
|
|
38
150
|
}
|
|
39
151
|
};
|
|
@@ -79,7 +191,7 @@ export const tableOfThirtyTwo = {
|
|
|
79
191
|
}
|
|
80
192
|
};
|
|
81
193
|
|
|
82
|
-
export const
|
|
194
|
+
export const TableOfFortyTwo = {
|
|
83
195
|
args: {
|
|
84
196
|
bouts: getDEWithBout42Fencers.pools[0].Bouts,
|
|
85
197
|
eventRules: getDEWithBout42Fencers.eventRules,
|
|
@@ -89,21 +201,37 @@ export const tableOfFourtyTwo = {
|
|
|
89
201
|
}
|
|
90
202
|
};
|
|
91
203
|
|
|
92
|
-
export const
|
|
204
|
+
export const TableOfSixtyFour = {
|
|
93
205
|
args: {
|
|
94
|
-
bouts:
|
|
95
|
-
eventRules:
|
|
96
|
-
hostingClubColors:
|
|
206
|
+
bouts: getDEBoutsTableOf64.pools[0].Bouts,
|
|
207
|
+
eventRules: getDEBoutsTableOf64.eventRules,
|
|
208
|
+
hostingClubColors: getDEBoutsTableOf64.hostingClubColors,
|
|
97
209
|
connectedToServer: true,
|
|
98
210
|
status: 'de'
|
|
99
211
|
}
|
|
100
212
|
};
|
|
101
213
|
|
|
102
|
-
export const
|
|
214
|
+
export const PlannedDirectorSuggestions = {
|
|
215
|
+
args: {
|
|
216
|
+
bouts: getDEBoutsTableOf64.pools[0].Bouts,
|
|
217
|
+
eventRules: getDEBoutsTableOf64.eventRules,
|
|
218
|
+
hostingClubColors: getDEBoutsTableOf64.hostingClubColors,
|
|
219
|
+
connectedToServer: true,
|
|
220
|
+
status: 'de',
|
|
221
|
+
role: 'Admin',
|
|
222
|
+
plannedDirectingStations: plannedDirectingStations.slice(0, 2),
|
|
223
|
+
plannedBoutAssignments,
|
|
224
|
+
viewerPersonId: plannedSuggestionViewerId,
|
|
225
|
+
showPlannedDirectorAssignments: true,
|
|
226
|
+
showAddPlannedDirectorCard: true
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
export const TableOfOneHundredTwentyEight = {
|
|
103
231
|
args: {
|
|
104
|
-
bouts:
|
|
105
|
-
eventRules:
|
|
106
|
-
hostingClubColors:
|
|
232
|
+
bouts: getDEBoutsTableOf128.pools[0].Bouts,
|
|
233
|
+
eventRules: getDEBoutsTableOf128.eventRules,
|
|
234
|
+
hostingClubColors: getDEBoutsTableOf128.hostingClubColors,
|
|
107
235
|
connectedToServer: true,
|
|
108
236
|
status: 'de'
|
|
109
237
|
}
|