@dcrackel/hematournamentui 1.0.119 → 1.0.121

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 (22) hide show
  1. package/dist/HemaTournamentUI-lib.es.js +1066 -1018
  2. package/dist/HemaTournamentUI-lib.umd.js +14 -14
  3. package/package.json +1 -1
  4. package/src/mocks/eventPersonGetPoolAssignmentEvent.js +2 -0
  5. package/src/mocks/getPoolResults.js +168 -0
  6. package/src/stories/Atoms/Input/BaseInput.vue +38 -1
  7. package/src/stories/Molecules/Boxes/CounterBox/CounterBox.vue +25 -10
  8. package/src/stories/Organisms/Cards/FencerPoolResultsCard/FencerPoolResults.stories.js +31 -0
  9. package/src/stories/Organisms/Cards/FencerPoolResultsCard/FencerPoolResultsCard.vue +70 -0
  10. package/src/stories/Organisms/Containers/Pool/Pool.vue +0 -4
  11. package/src/stories/Organisms/Containers/PoolResults/PoolResultsTable.stories.js +37 -0
  12. package/src/stories/Organisms/Containers/PoolResults/PoolResultsTable.vue +91 -0
  13. package/src/stories/Organisms/Headers/PoolResultsHeader/PoolResultsHeader.stories.js +38 -0
  14. package/src/stories/Organisms/Headers/PoolResultsHeader/PoolResultsHeader.vue +99 -0
  15. package/src/stories/Organisms/Headers/PoolSummary/PoolSummary.stories.js +7 -42
  16. package/src/stories/Organisms/Headers/PoolSummary/PoolSummary.vue +9 -4
  17. package/src/stories/Templates/EventManagement/ListEvents/ListEvents.vue +0 -1
  18. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.vue +0 -1
  19. package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.vue +0 -5
  20. package/src/stories/Templates/EventManagement/PoolResults/PoolResults.stories.js +31 -0
  21. package/src/stories/Templates/EventManagement/PoolResults/PoolResults.vue +134 -0
  22. package/tailwind.config.js +1 -0
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <div class="bg-poolSetup px-4 rounded-xl flex justify-between items-center shadow border border-dropdownSelect">
3
+ <section class="flex flex-col w-1/3 mt-2">
4
+ <BaseText :text="event.EventName" size="lg" color="primary" weight="bold" class="pt-4" />
5
+ <BaseText :text="event.RuleSummary" size="md" color="quinary" weight="normal" />
6
+ <span class="h-8"></span>
7
+ </section>
8
+
9
+ <section class="flex rounded-xl border border-dropdownSelect my-2 px-4 pt-2 pb-4 bg-neutral w-2/3 shadow">
10
+ <div class="mt-1 w-10 mr-3">
11
+ <BaseIcon icon-name="fa-chart-simple-horizontal" size="3xl" color="quaternary" class="" />
12
+ </div>
13
+ <div class="w-full">
14
+ <BaseText text="Pool Standings and Results" size="lg" color="quaternary" weight="bold" class="" />
15
+ <div class="grid grid-cols-3">
16
+ <div class="flex">
17
+ <BaseText text="W%" size="xs" color="primaryHighlight" weight="bold" />
18
+ <BaseText text="win percent" size="xs" color="primaryHighlight" class="ml-1"/>
19
+ </div>
20
+ <div class="flex">
21
+ <BaseText text="W/L" size="xs" color="primaryHighlight" weight="bold" />
22
+ <BaseText text="win # / loss #" size="xs" color="primaryHighlight" class="ml-1"/>
23
+ </div>
24
+ <div class="flex">
25
+ <BaseText text="PS" size="xs" color="primaryHighlight" weight="bold" />
26
+ <BaseText text="Points Scored" size="xs" color="primaryHighlight" class="ml-1"/>
27
+ </div>
28
+ <div class="flex">
29
+ <BaseText text="PG" size="xs" color="primaryHighlight" weight="bold" />
30
+ <BaseText text="Points Given" size="xs" color="primaryHighlight" class="ml-1"/>
31
+ </div>
32
+ <div class="flex">
33
+ <BaseText text="Ind" size="xs" color="primaryHighlight" weight="bold" />
34
+ <BaseText text="Indicator (PS-PG)" size="xs" color="primaryHighlight" class="ml-1"/>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </section>
39
+
40
+ <section class="flex flex-row w-1/3 justify-end">
41
+ <CounterBox :recommended="101" :count="promoted" label="Promoted" :textColor="'quaternary'" :centerInput="true" :directInput="true"
42
+ @update:increaseCount="handleIncreaseCount"
43
+ @update:decreaseCount="handleDecreaseCount"
44
+ />
45
+ </section>
46
+
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import EventStatusBox from "../../../Molecules/Boxes/EventStatusBox/EventStatusBox.vue";
52
+ import CounterBox from "../../../Molecules/Boxes/CounterBox/CounterBox.vue";
53
+ import BaseText from "../../../Atoms/Text/BaseText.vue";
54
+ import BaseButton from "../../../Molecules/Buttons/BaseButton/BaseButton.vue";
55
+ import BaseIcon from "../../../Atoms/Icon/BaseIcon.vue";
56
+
57
+ export default {
58
+ name: 'PoolResultsHeader',
59
+ components: {BaseIcon, BaseButton, BaseText, CounterBox, EventStatusBox },
60
+ props: {
61
+ event: {
62
+ type: Object,
63
+ required: true,
64
+ validator(event) {
65
+ const requiredFields = [
66
+ 'EventName',
67
+ 'RuleSummary'
68
+ ];
69
+ const missingFields = requiredFields.filter(field => !(field in event));
70
+ if (missingFields.length) {
71
+ console.warn(`Invalid event object: Missing fields: ${missingFields.join(', ')}`);
72
+ return false;
73
+ }
74
+ return true;
75
+ },
76
+ },
77
+ numPromoted: {
78
+ type: [Number, String],
79
+ required: true,
80
+ }
81
+ },
82
+ computed: {
83
+ mode(){
84
+ return this.event.Status
85
+ },
86
+ promoted() {
87
+ return this.numPromoted.includes('%') ? parseInt(this.numPromoted.replace('%', '')) : parseInt(this.numPromoted);
88
+ }
89
+ },
90
+ methods: {
91
+ handleIncreaseCount(numPromoted) {
92
+ this.$emit('update:handleIncreaseCount', numPromoted);
93
+ },
94
+ handleDecreaseCount(numPromoted) {
95
+ this.$emit('update:handleDecreaseCount', numPromoted);
96
+ }
97
+ },
98
+ };
99
+ </script>
@@ -1,4 +1,5 @@
1
1
  import PoolSummary from './PoolSummary.vue';
2
+ import eventPersonGetPoolAssignmentEvent from "../../../../mocks/eventPersonGetPoolAssignmentEvent.js";
2
3
 
3
4
  export default {
4
5
  title: 'Organisms/Headers/PoolSummary',
@@ -8,62 +9,26 @@ export default {
8
9
  argTypes: {}
9
10
  };
10
11
 
12
+ let modifiedEvent = { ...eventPersonGetPoolAssignmentEvent, Status: 'planning' };
11
13
  export const Default = {
12
14
  args: {
13
- event: {
14
- EventId: 1,
15
- TournamentId: 8,
16
- EventName: "Longsword Event For Everyone",
17
- Date: "2024-05-03",
18
- StartTime: "12:00:16",
19
- NumberOfRings: 3,
20
- WeaponId: 1,
21
- Status: "Active",
22
- RuleSummary: "Pools -> DE -> 3rd Place Faceoff",
23
- Present: "0",
24
- Absent: "20",
25
- Removed: "1",
26
- },
15
+ event:modifiedEvent,
27
16
  mode: 'planning'
28
17
  }
29
18
  }
30
19
 
20
+ modifiedEvent = { ...eventPersonGetPoolAssignmentEvent, Status: 'preparation' };
31
21
  export const preparingMode = {
32
22
  args: {
33
- event: {
34
- EventId: 1,
35
- TournamentId: 8,
36
- EventName: "Longsword Event For Everyone",
37
- Date: "2024-05-03",
38
- StartTime: "12:00:16",
39
- NumberOfRings: 3,
40
- WeaponId: 1,
41
- Status: "Active",
42
- RuleSummary: "Pools -> DE -> 3rd Place Faceoff",
43
- Present: "0",
44
- Absent: "20",
45
- Removed: "1",
46
- },
23
+ event:modifiedEvent,
47
24
  mode: 'preparation'
48
25
  }
49
26
  }
50
27
 
28
+ modifiedEvent = { ...eventPersonGetPoolAssignmentEvent, Status: 'live' };
51
29
  export const liveMode = {
52
30
  args: {
53
- event: {
54
- EventId: 1,
55
- TournamentId: 8,
56
- EventName: "Longsword Event For Everyone",
57
- Date: "2024-05-03",
58
- StartTime: "12:00:16",
59
- NumberOfRings: 3,
60
- WeaponId: 1,
61
- Status: "Active",
62
- RuleSummary: "Pools -> DE -> 3rd Place Faceoff",
63
- Present: "0",
64
- Absent: "20",
65
- Removed: "1",
66
- },
31
+ event:modifiedEvent,
67
32
  mode: 'live'
68
33
  }
69
34
  }
@@ -16,7 +16,7 @@
16
16
  </span>
17
17
 
18
18
  </section>
19
- <section v-if="mode === 'preparation'" class="flex rounded-xl border border-dropdownSelect mt-2 px-4 pt-2 pb-4 bg-neutral w-1/3 shadow">
19
+ <section v-if="mode === 'preparation'" class="flex rounded-xl border border-dropdownSelect my-2 px-4 pt-2 pb-4 bg-neutral w-1/3 shadow">
20
20
  <div class="mt-1 w-10 mr-3">
21
21
  <BaseIcon icon-name="fa-ballot-check" size="3xl" color="quaternary" class="" />
22
22
  </div>
@@ -36,11 +36,11 @@
36
36
  <div class="w-1/3 flex flex-col">
37
37
  <div class="flex justify-between items-center w-full">
38
38
  <BaseText text="Bouts Left:" size="sm" color="quaternary" class="text-right mr-2 w-2/3" />
39
- <BaseText text="20/20" size="sm" color="primaryHighlight" class="text-left mr-2 w-1/3" />
39
+ <BaseText :text="boutsLeft" size="sm" color="primaryHighlight" class="text-left mr-2 w-1/3" />
40
40
  </div>
41
41
  <div class="flex justify-between items-center w-full mt-0.5">
42
- <BaseText text="Est. End Time:" size="sm" color="quaternary" class="text-right mr-2 w-2/3" />
43
- <BaseText text="12:45" size="sm" color="primaryHighlight" class="text-left mr-2 w-1/3" />
42
+ <BaseText text="Est. End Time:" size="sm" color="quaternary" class="text-right mr-2 min-w-40 w-2/3" />
43
+ <BaseText text="tbd" size="sm" color="primaryHighlight" class="text-left mr-2 w-1/3" />
44
44
  </div>
45
45
  </div>
46
46
  </section>
@@ -91,6 +91,11 @@ export default {
91
91
  numberOfRings() {
92
92
  return this.event.NumberOfRings || 0;
93
93
  },
94
+ boutsLeft() {
95
+ const boutsLeft = this.event.BoutsLeft || 0;
96
+ const totalBouts = this.event.TotalBouts || 0;
97
+ return `${boutsLeft}/${totalBouts}`;
98
+ }
94
99
  },
95
100
  methods: {
96
101
  handlePoolSizeChange(poolSize) {
@@ -68,7 +68,6 @@ export default {
68
68
  this.$emit('editEvent', eventId);
69
69
  },
70
70
  handleManageEvent(eventId) {
71
- console.log(`handleManageEvent: ${eventId}`);
72
71
  this.$emit('manageEvent', eventId);
73
72
  },
74
73
  handleTabMenuClick(value) {
@@ -189,7 +189,6 @@ export default {
189
189
  const updatedBout = this.activeBouts.find(b => b.BoutId === bout.BoutId);
190
190
 
191
191
  if (!updatedBout) {
192
- console.log('Bout not found in active bouts:', bout.BoutId);
193
192
  return;
194
193
  }
195
194
 
@@ -3,7 +3,6 @@
3
3
  <EditEventsTopMenu :currentTab="'Pools'" :tabs="tabs" @tabMenuClick="handleTabMenuClick"/>
4
4
  <PoolSummary :event="event" @update:poolSize="handlePoolSizeChange" @update:numberOfRings="handleNumberOfRings" @reset:pool="handlePoolReset" />
5
5
  <EditEventsTopMenu v-if="this.event.Flights > 1" :currentTab="selectedFlight" :tabs="flights" @tabMenuClick="handleFlightChange" class="mt-3"/>
6
-
7
6
  <div class="w-full flex flex-row flex-wrap justify-center" :class="this.event.Flights > 1 ? 'mt-0' : 'mt-4'">
8
7
  <div v-for="pool in filteredPools" :key="pool.Name">
9
8
  <Pool
@@ -80,9 +79,6 @@ export default {
80
79
  selectedFlight: 'Flight1'
81
80
  };
82
81
  },
83
- created() {
84
- console.log(`Pool Management mode: ${this.mode}`);
85
- },
86
82
  computed: {
87
83
  //TODO: will want a "complete" button that says "forward to results" or something.
88
84
  shouldShowButtons() {
@@ -157,7 +153,6 @@ export default {
157
153
  this.$emit('remove:fencer', person);
158
154
  },
159
155
  handleSelectPool(poolId){
160
- console.log('handleSelectPool: ', poolId)
161
156
  this.$emit('select:pool', poolId);
162
157
  }
163
158
  }
@@ -0,0 +1,31 @@
1
+ import EditEvents from './PoolResults.vue';
2
+ import getPoolResults from '../../../../mocks/getPoolResults.js';
3
+ import eventPersonGetPoolAssignmentEvent from '../../../../mocks/eventPersonGetPoolAssignmentEvent.js';
4
+
5
+ export default {
6
+ title: 'Templates/EventManagement/PoolResults',
7
+ component: EditEvents,
8
+ tags: ['autodocs'],
9
+ args: {
10
+ event: eventPersonGetPoolAssignmentEvent,
11
+ poolResults: getPoolResults.report,
12
+ numPromoted: getPoolResults.numPromoted
13
+ },
14
+ argTypes: {
15
+ event: {type: 'object'},
16
+ poolResults: {
17
+ control: {type: 'object'}
18
+ },
19
+ numPromoted: { type: Number }
20
+ }
21
+ };
22
+
23
+
24
+ export const Default = {
25
+ args: {
26
+ event: eventPersonGetPoolAssignmentEvent,
27
+ poolResults: getPoolResults.report,
28
+ numPromoted: getPoolResults.numPromoted
29
+ }
30
+ };
31
+
@@ -0,0 +1,134 @@
1
+ <template>
2
+ <section>
3
+ <EditEventsTopMenu :currentTab="'Pool Results'" :tabs="tabs" @tabMenuClick="handleTabMenuClick"/>
4
+ <PoolResultsHeader :event="event" :numPromoted="promoted"
5
+ @update:handleIncreaseCount="handleIncreaseCount"
6
+ @update:handleDecreaseCount="handleDecreaseCount"
7
+ />
8
+
9
+ <PoolResultsTable :poolResults="poolResults"
10
+ :initialCutoffIndex="initialCutoffIndex"
11
+ :numPromoted="promoted"
12
+ @update:withdraw="handleWithdraw"
13
+ @update:handleIncreaseCount="handleIncreaseCount"
14
+ @update:handleDecreaseCount="handleDecreaseCount"
15
+ />
16
+
17
+ <BaseModal
18
+ :show="showRemoveModal"
19
+ icon-name="fa-user-slash"
20
+ icon-color="alarm"
21
+ icon-background-color="alarmHighlight"
22
+ icon-border-color="red"
23
+ :header-text="`Withdraw ${withdrawPerson.DisplayName}`"
24
+ :body-text="`Confirm that you wish to withdraw ${withdrawPerson.DisplayName} from the event. This action cannot be undone.`"
25
+ button-text="Withdraw Fencer"
26
+ @update:show="closeModal"
27
+ @submit-modal="submitWithDraw"
28
+ class="bg-alarmHighlight"
29
+ />
30
+
31
+ </section>
32
+ </template>
33
+
34
+ <script>
35
+
36
+ import PoolSummary from "../../../Organisms/Headers/PoolSummary/PoolSummary.vue";
37
+ import EditEventsTopMenu from "../../Menus/EditEventsTopMenu/EditEventsTopMenu.vue";
38
+ import PoolResultsHeader from "../../../Organisms/Headers/PoolResultsHeader/PoolResultsHeader.vue";
39
+ import PoolGrid from "../../../Organisms/Containers/PoolGrid/PoolGrid.vue";
40
+ import PoolResultsTable from "../../../Organisms/Containers/PoolResults/PoolResultsTable.vue";
41
+ import BaseModal from "../../../Molecules/Modals/BaseModal/BaseModal.vue";
42
+
43
+ export default {
44
+ name: 'PoolResults',
45
+ components: {BaseModal, PoolResultsTable, PoolGrid, PoolResultsHeader, EditEventsTopMenu, PoolSummary},
46
+ props: {
47
+ event: {
48
+ type: Object,
49
+ required: true
50
+ },
51
+ poolResults: {
52
+ type: Array,
53
+ required: true
54
+ },
55
+ numPromoted: {
56
+ type: [Number, String],
57
+ required: true
58
+ }
59
+ },
60
+ data() {
61
+ return {
62
+ tabs: [
63
+ {id: 'Staff', label: 'Staff', color: 'primaryHighlight'},
64
+ {id: 'Checkin', label: 'Seeding & Checkin', color: 'primaryHighlight'},
65
+ {id: 'Pools', label: 'Pools', color: 'primaryHighlight'},
66
+ {id: 'Pool Results', label: 'Pool Results', color: 'primaryHighlight'},
67
+ {id: 'Bracket', label: 'Bracket', color: 'primaryHighlight'},
68
+ {id: 'Final', label: 'Final Results', color: 'primaryHighlight'}
69
+ ],
70
+ promoted: this.numPromoted,
71
+ initialCutoffIndex: 0,
72
+ showRemoveModal: false,
73
+ withdrawPerson: Object
74
+ }
75
+ },
76
+ mounted() {
77
+ this.calculateInitialCutoffIndex(this.getNumericValue(this.promoted))
78
+ },
79
+ methods: {
80
+ handleTabMenuClick(){
81
+ this.$emit('tab:menu-click', value);
82
+ },
83
+ handleIncreaseCount(value){
84
+ let numPercent = this.getNumericValue(value)
85
+
86
+ if (numPercent === 100) {
87
+ this.initialCutoffIndex = 500;
88
+ return
89
+ }
90
+
91
+ this.calculateInitialCutoffIndex(numPercent+10)
92
+ },
93
+ handleDecreaseCount(value){
94
+ let numPercent = this.getNumericValue(value)
95
+
96
+ if (this.poolResults.filter(p => p.Promoted).length < 5) {
97
+ return;
98
+ }
99
+
100
+ this.calculateInitialCutoffIndex(numPercent-10)
101
+ },
102
+ getNumericValue(percent) {
103
+ let numPercent;
104
+
105
+ if (typeof percent === 'string') {
106
+ numPercent = parseInt(percent.replace('%', ''));
107
+ }
108
+
109
+ if (typeof percent === 'number') {
110
+ numPercent = percent;
111
+ }
112
+
113
+ return numPercent
114
+ },
115
+ calculateInitialCutoffIndex(numPercent) {
116
+ const totalFencers = this.poolResults.length;
117
+ const promotionRate = numPercent / 100;
118
+ this.promoted = `${numPercent}%`
119
+ this.initialCutoffIndex = Math.ceil(totalFencers * promotionRate);
120
+ },
121
+ closeModal(){
122
+ this.showRemoveModal = false
123
+ this.withdrawPerson = {}
124
+ },
125
+ handleWithdraw(person){
126
+ this.showRemoveModal = true
127
+ this.withdrawPerson = person
128
+ },
129
+ submitWithDraw(){
130
+ this.showRemoveModal = false
131
+ }
132
+ }
133
+ };
134
+ </script>
@@ -53,6 +53,7 @@ module.exports = {
53
53
  winGreen: '#68e269',
54
54
  acceptedHighlight: '#E5F6F1',
55
55
  alarm: '#FD546F',
56
+ alarmHighlight: '#FED5D6',
56
57
  lossRed: '#ff7477',
57
58
  alarmText: '#F90229',
58
59
  alert: '#FFD255',