@dcrackel/hematournamentui 1.0.22 → 1.0.23

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 (74) hide show
  1. package/.eslintrc.js +18 -18
  2. package/.gitattributes +2 -2
  3. package/.prettierignore +1 -1
  4. package/.storybook/main.js +18 -18
  5. package/.storybook/mockRoutes.js +9 -9
  6. package/.storybook/preview-head.html +3 -3
  7. package/.storybook/preview.js +17 -17
  8. package/LICENSE +21 -21
  9. package/README.md +83 -83
  10. package/dist/HemaTouranmentUI-lib.es.js +7060 -6920
  11. package/dist/HemaTouranmentUI-lib.umd.js +27 -27
  12. package/dist/style.css +1 -1
  13. package/index.html +12 -12
  14. package/package.json +58 -58
  15. package/postcss.config.js +6 -6
  16. package/prettier.config.js +10 -10
  17. package/src/index.js +25 -25
  18. package/src/main.js +2 -2
  19. package/src/mocks/fileMock.js +1 -1
  20. package/src/mocks/tournamentMock.js +34 -34
  21. package/src/stories/Atoms/Icon/BaseIcon.stories.js +54 -54
  22. package/src/stories/Atoms/Icon/BaseIcon.test.js +91 -91
  23. package/src/stories/Atoms/Icon/BaseIcon.vue +48 -48
  24. package/src/stories/Atoms/Input/BaseInput.stories.js +29 -28
  25. package/src/stories/Atoms/Input/BaseInput.test.js +87 -87
  26. package/src/stories/Atoms/Input/BaseInput.vue +85 -73
  27. package/src/stories/Atoms/RadioGroup/BaseRadioGroup.stories.js +31 -31
  28. package/src/stories/Atoms/RadioGroup/BaseRadioGroup.test.js +49 -49
  29. package/src/stories/Atoms/RadioGroup/BaseRadioGroup.vue +49 -49
  30. package/src/stories/Atoms/Tag/BaseTag.stories.js +29 -29
  31. package/src/stories/Atoms/Tag/BaseTag.test.js +42 -42
  32. package/src/stories/Atoms/Tag/BaseTag.vue +57 -57
  33. package/src/stories/Atoms/Text/BaseText.stories.js +77 -77
  34. package/src/stories/Atoms/Text/BaseText.test.js +172 -172
  35. package/src/stories/Atoms/Text/BaseText.vue +170 -170
  36. package/src/stories/Configure.mdx +320 -320
  37. package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.stories.js +41 -41
  38. package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.test.js +80 -80
  39. package/src/stories/Molecules/Breadcrumb/Admin/Breadcrumb.vue +31 -31
  40. package/src/stories/Molecules/Button/BaseButton.stories.js +93 -76
  41. package/src/stories/Molecules/Button/BaseButton.test.js +147 -147
  42. package/src/stories/Molecules/Button/BaseButton.vue +116 -125
  43. package/src/stories/Molecules/Cards/Detail/TournamentCardDetail.stories.js +33 -33
  44. package/src/stories/Molecules/Cards/Detail/TournamentCardDetail.vue +38 -38
  45. package/src/stories/Molecules/Cards/Header/TournamentCardHeader.stories.js +48 -48
  46. package/src/stories/Molecules/Cards/Header/TournamentCardHeader.vue +40 -40
  47. package/src/stories/Molecules/Filters/FilterAndSortBar/FilterAndSortBar.stories.js +36 -36
  48. package/src/stories/Molecules/Filters/FilterAndSortBar/FilterAndSortBar.vue +49 -49
  49. package/src/stories/Molecules/Filters/FilterUpcomingPast/FilterUpcomingPast.stories.js +32 -32
  50. package/src/stories/Molecules/Filters/FilterUpcomingPast/FilterUpcomingPast.vue +46 -46
  51. package/src/stories/Organisms/AddressAutocomplete/AddressAutocomplete.stories.js +25 -25
  52. package/src/stories/Organisms/AddressAutocomplete/AddressAutocomplete.vue +51 -51
  53. package/src/stories/Organisms/DatePicker/DatePicker.stories.js +25 -25
  54. package/src/stories/Organisms/DatePicker/DatePicker.vue +62 -62
  55. package/src/stories/Organisms/DropDown/DropDownMenu.stories.js +34 -34
  56. package/src/stories/Organisms/DropDown/DropDownMenu.vue +51 -51
  57. package/src/stories/Organisms/Grid/GridContainer.stories.js +47 -47
  58. package/src/stories/Organisms/Grid/GridContainer.vue +108 -108
  59. package/src/stories/Organisms/ImageCropper/ImageCropper.stories.js +28 -28
  60. package/src/stories/Organisms/ImageCropper/ImageCropper.vue +86 -86
  61. package/src/stories/Organisms/TextBoxEditor/TextBoxEditor.stories.js +28 -28
  62. package/src/stories/Organisms/TextBoxEditor/TextBoxEditor.vue +97 -97
  63. package/src/stories/Organisms/TournamentCard/TournamentCard.stories.js +37 -37
  64. package/src/stories/Organisms/TournamentCard/TournamentCard.vue +35 -35
  65. package/src/stories/Templates/Forms/AddTournamentPageOne/AddTournamentPageOne.stories.js +25 -25
  66. package/src/stories/Templates/Forms/AddTournamentPageOne/AddTournamentPageOne.vue +138 -137
  67. package/src/stories/Templates/Forms/AddTournamentPageTwo/AddTournamentPageTwo.stories.js +35 -0
  68. package/src/stories/Templates/Forms/AddTournamentPageTwo/AddTournamentPageTwo.vue +121 -0
  69. package/src/stories/Templates/Menu/Admin/AdminLeftMenu.stories.js +28 -28
  70. package/src/stories/Templates/Menu/Admin/AdminLeftMenu.vue +57 -57
  71. package/tailwind/output.css +1247 -1212
  72. package/tailwind/tailwind.css +4 -4
  73. package/tailwind.config.js +50 -50
  74. package/vite.config.js +23 -23
@@ -1,137 +1,138 @@
1
- <template>
2
- <div class="border border-dropdownSelect rounded-lg p-9 bg-neutral">
3
- <div class="w-full flex flex-row justify-center">
4
- <BaseText data-testid="text-step" :color="'quaternary'" :size="'sm'" :text="'Step 1 out of 2'" :weight="'normal'" />
5
- </div>
6
- <div class="w-full flex flex-row justify-center my-4">
7
- <BaseText data-testid="text-add-tournament" :color="'primaryHighlight'" :size="'2xl'" :text="'Add Tournament'" :weight="'normal'" />
8
- </div>
9
- <div class="w-full flex flex-row justify-center my-4">
10
- <ImageCropper :personID="1" />
11
- </div>
12
-
13
- <div class="w-full flex flex-row justify-center">
14
- <section class="w-96">
15
- <div class="flex flex-col mb-3">
16
- <BaseText data-testid="text-tournament-name" color="primary" :size="'sm'" :text="'Tournament Name'" :weight="'normal'" class="mb-1" :invalid="validation.name" />
17
- <BaseInput placeholder="Enter Tournemnt Name" type="formInput" :value="tournament.name" :invalid="validation.name" @update:value="value => tournament.name = value"/>
18
- </div>
19
- <div class="flex flex-col mb-3">
20
- <BaseText data-testid="text-address" :color="'primaryHighlight'" :size="'sm'" :text="'Address'" :weight="'normal'" class="mb-1" :invalid="validation.address" />
21
- <AddressAutocomplete :address="tournament.address" :invalid="validation.address" @update:address="handleAddressUpdate" />
22
- </div>
23
- <div class="flex flex-row mb-3">
24
- <div class="w-3/4 mr-1">
25
- <BaseText data-testid="text-start-date" :color="'primaryHighlight'" :size="'sm'" :text="'Start Date'" :weight="'normal'" class="mb-1" :invalid="validation.startDate" />
26
- <DatePicker :setDate="tournament.startDate" @update:selectedDate="handleDateUpdate" :invalid="validation.startDate" />
27
- </div>
28
- <div class="w-1/4 ml-1">
29
- <BaseText data-testid="text-total-days" :color="'primaryHighlight'" :size="'sm'" :text="'Total Days'" :weight="'normal'" class="mb-1" :invalid="validation.totalDays" />
30
- <BaseInput :placeholder="`${1}`" type="formInput" :value="`${tournament.totalDays}`" :invalid="validation.totalDays" />
31
- </div>
32
- </div>
33
- <div class="flex flex-col mb-3">
34
- <BaseText data-testid="text-description" :color="'primaryHighlight'" :size="'sm'" :text="'Description'" :weight="'normal'" class="mb-1" :invalid="validation.description" />
35
- <TextBoxEditor :invalid="validation.description" @update:editorContent="handleEditorUpdate" />
36
- </div>
37
- <div class="flex flex-col pb-4">
38
- <BaseText data-testid="text-visibility" :color="'primaryHighlight'" :size="'sm'" :text="'Tournament Visibility'" :weight="'normal'" class="mb-2" :invalid="validation.visibility" />
39
- <BaseRadioGroup :items="visibilityItems" :invalid="validation.visibility" @update:value="value => tournament.visibility = value" />
40
- </div>
41
- <div>
42
- <BaseButton label="Continue" type="continue" color="neutral" size="sm" @click="handleSubmit()" class="w-full" />
43
- </div>
44
- </section>
45
- </div>
46
- </div>
47
- </template>
48
-
49
- <script>
50
- import BaseText from "../../../Atoms/Text/BaseText.vue";
51
- import ImageCropper from "../../../Organisms/ImageCropper/ImageCropper.vue";
52
- import BaseInput from "../../../Atoms/Input/BaseInput.vue";
53
- import AddressAutocomplete from "../../../Organisms/AddressAutocomplete/AddressAutocomplete.vue";
54
- import DatePicker from "../../../Organisms/DatePicker/DatePicker.vue";
55
- import TextBoxEditor from "../../../Organisms/TextBoxEditor/TextBoxEditor.vue";
56
- import BaseRadioGroup from "../../../Atoms/RadioGroup/BaseRadioGroup.vue";
57
- import BaseButton from "../../../Molecules/Button/BaseButton.vue";
58
-
59
- export default {
60
- name: 'AddTournamentPageOne',
61
- components: {
62
- BaseText,
63
- BaseInput,
64
- ImageCropper,
65
- AddressAutocomplete,
66
- DatePicker,
67
- TextBoxEditor,
68
- BaseRadioGroup,
69
- BaseButton
70
- },
71
- props: {},
72
- data() {
73
- return {
74
- tournament: {
75
- name: '',
76
- imageLink: '',
77
- address: '',
78
- coordinates: '',
79
- startDate: '',
80
- totalDays: 1,
81
- description: '',
82
- visibility: ''
83
- },
84
- validation: {
85
- name: false,
86
- imageLink: false,
87
- address: false,
88
- coordinates: false,
89
- startDate: false,
90
- totalDays: false,
91
- description: false,
92
- visibility: false
93
- },
94
- visibilityItems: [
95
- { label: 'Open', value: 'open', description: 'Viewable To Everyone' },
96
- { label: 'Club', value: 'club', description: 'Viewable Only to Members of Your Club'},
97
- { label: 'Private', value: 'private', description: 'Only Viewable by you' },
98
- ],
99
- }
100
- },
101
- methods: {
102
- handleSubmit() {
103
- console.log('submitting form');
104
- this.setAllValidationStates(false);
105
- console.log(this.tournament);
106
-
107
- if (this.tournament.name === '') this.validation.name = true;
108
- if (this.tournament.coordinates === '') this.validation.address = true;
109
- if (this.tournament.startDate === '') this.validation.startDate = true;
110
- if (this.tournament.totalDays === '') this.validation.totalDays = true;
111
- if (this.tournament.description === '') this.validation.description = true;
112
- if (this.tournament.visibility === '') this.validation.visibility = true;
113
-
114
- },
115
- setAllValidationStates(state) {
116
- Object.keys(this.validation).forEach(key => {
117
- this.validation[key] = state;
118
- });
119
- },
120
- handleAddressUpdate(updatedAddress) {
121
- this.tournament.address = updatedAddress.address;
122
- this.tournament.coordinates = updatedAddress.coordinates;
123
- },
124
- handleDateUpdate(newDate) {
125
- this.tournament.startDate = newDate;
126
- },
127
- handleEditorUpdate(newContent) {
128
- this.tournament.description = newContent;
129
- }
130
- },
131
- computed: {
132
- isFormValid() {
133
- return Object.values(this.validation).every(v => v);
134
- }
135
- }
136
- }
137
- </script>
1
+ <template>
2
+ <div class="border border-dropdownSelect rounded-lg p-9 bg-neutral">
3
+ <div class="w-full flex flex-row justify-center">
4
+ <BaseText data-testid="text-step" :color="'quaternary'" :size="'sm'" :text="'Step 1 out of 2'" :weight="'normal'" />
5
+ </div>
6
+ <div class="w-full flex flex-row justify-center my-4">
7
+ <BaseText data-testid="text-add-tournamnet" :color="'primaryHighlight'" :size="'2xl'" :text="'Add Tournament'" :weight="'normal'" />
8
+ </div>
9
+ <div class="w-full flex flex-row justify-center my-4">
10
+ <ImageCropper :personID="1" />
11
+ </div>
12
+
13
+ <div class="w-full flex flex-row justify-center">
14
+ <section class="w-96">
15
+ <div class="flex flex-col mb-3">
16
+ <BaseText data-testid="text-tournament-name" color="primary" :size="'sm'" :text="'Tournament Name'" :weight="'normal'" class="mb-1" :invalid="validation.name" />
17
+ <BaseInput placeholder="Enter Tournament Name" type="formInput" :value="tournament.name" :invalid="validation.name" @update:value="value => tournament.name = value"/>
18
+ </div>
19
+ <div class="flex flex-col mb-3">
20
+ <BaseText data-testid="text-address" :color="'primaryHighlight'" :size="'sm'" :text="'Address'" :weight="'normal'" class="mb-1" :invalid="validation.address" />
21
+ <AddressAutocomplete :address="tournament.address" :invalid="validation.address" @update:address="handleAddressUpdate" />
22
+ </div>
23
+ <div class="flex flex-row mb-3">
24
+ <div class="w-3/4 mr-1">
25
+ <BaseText data-testid="text-start-date" :color="'primaryHighlight'" :size="'sm'" :text="'Start Date'" :weight="'normal'" class="mb-1" :invalid="validation.startDate" />
26
+ <DatePicker :setDate="tournament.startDate" @update:selectedDate="handleDateUpdate" :invalid="validation.startDate" />
27
+ </div>
28
+ <div class="w-1/4 ml-1">
29
+ <BaseText data-testid="text-total-days" :color="'primaryHighlight'" :size="'sm'" :text="'Total Days'" :weight="'normal'" class="mb-1" :invalid="validation.totalDays" />
30
+ <BaseInput :placeholder="`${1}`" type="formInput" :value="`${tournament.totalDays}`" :invalid="validation.totalDays" />
31
+ </div>
32
+ </div>
33
+ <div class="flex flex-col mb-3">
34
+ <BaseText data-testid="text-description" :color="'primaryHighlight'" :size="'sm'" :text="'Description'" :weight="'normal'" class="mb-1" :invalid="validation.description" />
35
+ <TextBoxEditor :invalid="validation.description" @update:editorContent="handleEditorUpdate" />
36
+ </div>
37
+ <div class="flex flex-col pb-4">
38
+ <BaseText data-testid="text-visibility" :color="'primaryHighlight'" :size="'sm'" :text="'Tournament Visibility'" :weight="'normal'" class="mb-2" :invalid="validation.visibility" />
39
+ <BaseRadioGroup :items="visibilityItems" :invalid="validation.visibility" @update:value="value => tournament.visibility = value" />
40
+ </div>
41
+ <div>
42
+ <BaseButton label="Continue" type="secondary" color="neutral" size="sm" @click="handleSubmit()" class="w-full" />
43
+ </div>
44
+ </section>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ import BaseText from "../../../Atoms/Text/BaseText.vue";
51
+ import ImageCropper from "../../../Organisms/ImageCropper/ImageCropper.vue";
52
+ import BaseInput from "../../../Atoms/Input/BaseInput.vue";
53
+ import AddressAutocomplete from "../../../Organisms/AddressAutocomplete/AddressAutocomplete.vue";
54
+ import DatePicker from "../../../Organisms/DatePicker/DatePicker.vue";
55
+ import TextBoxEditor from "../../../Organisms/TextBoxEditor/TextBoxEditor.vue";
56
+ import BaseRadioGroup from "../../../Atoms/RadioGroup/BaseRadioGroup.vue";
57
+ import BaseButton from "../../../Molecules/Button/BaseButton.vue";
58
+
59
+ export default {
60
+ name: 'AddTournamentPageOne',
61
+ components: {
62
+ BaseText,
63
+ BaseInput,
64
+ ImageCropper,
65
+ AddressAutocomplete,
66
+ DatePicker,
67
+ TextBoxEditor,
68
+ BaseRadioGroup,
69
+ BaseButton
70
+ },
71
+ props: {},
72
+ data() {
73
+ return {
74
+ tournament: {
75
+ name: '',
76
+ imageLink: '',
77
+ address: '',
78
+ coordinates: '',
79
+ startDate: '',
80
+ totalDays: 1,
81
+ description: '',
82
+ visibility: '',
83
+ externalLinks: Array
84
+ },
85
+ validation: {
86
+ name: false,
87
+ imageLink: false,
88
+ address: false,
89
+ coordinates: false,
90
+ startDate: false,
91
+ totalDays: false,
92
+ description: false,
93
+ visibility: false
94
+ },
95
+ visibilityItems: [
96
+ { label: 'Open', value: 'open', description: 'Viewable To Everyone' },
97
+ { label: 'Club', value: 'club', description: 'Viewable Only to Members of Your Club'},
98
+ { label: 'Private', value: 'private', description: 'Only Viewable by you' },
99
+ ],
100
+ }
101
+ },
102
+ methods: {
103
+ handleSubmit() {
104
+ console.log('submitting form');
105
+ this.setAllValidationStates(false);
106
+ console.log(this.tournament);
107
+
108
+ if (this.tournament.name === '') this.validation.name = true;
109
+ if (this.tournament.coordinates === '') this.validation.address = true;
110
+ if (this.tournament.startDate === '') this.validation.startDate = true;
111
+ if (this.tournament.totalDays === '') this.validation.totalDays = true;
112
+ if (this.tournament.description === '') this.validation.description = true;
113
+ if (this.tournament.visibility === '') this.validation.visibility = true;
114
+
115
+ },
116
+ setAllValidationStates(state) {
117
+ Object.keys(this.validation).forEach(key => {
118
+ this.validation[key] = state;
119
+ });
120
+ },
121
+ handleAddressUpdate(updatedAddress) {
122
+ this.tournament.address = updatedAddress.address;
123
+ this.tournament.coordinates = updatedAddress.coordinates;
124
+ },
125
+ handleDateUpdate(newDate) {
126
+ this.tournament.startDate = newDate;
127
+ },
128
+ handleEditorUpdate(newContent) {
129
+ this.tournament.description = newContent;
130
+ }
131
+ },
132
+ computed: {
133
+ isFormValid() {
134
+ return Object.values(this.validation).every(v => v);
135
+ }
136
+ }
137
+ }
138
+ </script>
@@ -0,0 +1,35 @@
1
+ import AddTournamentPageTwo from './AddTournamentPageTwo.vue';
2
+ export default {
3
+ title: 'Templates/Forms/AddTournamentForm/PageTwo',
4
+ component: AddTournamentPageTwo,
5
+ tags: ['autodocs'],
6
+ argTypes: {}
7
+ };
8
+
9
+ const Template = args => ({
10
+ components: { AddTournamentPageTwo },
11
+ setup() {
12
+ return {
13
+ args: {
14
+ }
15
+ };
16
+ },
17
+ methods: {
18
+ }
19
+ });
20
+
21
+ export const Default = {
22
+ args: {
23
+ tournament: {
24
+ name: 'Ultimate',
25
+ imageLink: '',
26
+ address: '123 Winchester St',
27
+ coordinates: '',
28
+ startDate: '',
29
+ totalDays: 1,
30
+ description: '',
31
+ visibility: '',
32
+ externalLinks: []
33
+ },
34
+ }
35
+ };
@@ -0,0 +1,121 @@
1
+ <template>
2
+ <div class="border border-dropdownSelect rounded-lg p-9 bg-neutral">
3
+ <div class="w-full flex flex-row justify-center">
4
+ <BaseText :color="'quaternary'" :size="'sm'" :text="'Step 2 out of 4'" :weight="'normal'"
5
+ data-testid="text-step"/>
6
+ </div>
7
+
8
+ <div class="w-full flex flex-row justify-center">
9
+ <section class="w-96">
10
+ <div class="w-full flex flex-row justify-center text-center my-4">
11
+ <BaseText :color="'primaryHighlight'" :size="'2xl'" :text="'Do you want Ferrotas to host your tournament?'"
12
+ :weight="'normal'" data-testid="text-ferrotas-to-host"/>
13
+ </div>
14
+ <div class="w-full flex flex-col mb-3">
15
+ <BaseText :color="'quaternary'" :size="'sm'" :text="'If you select \'No\', your tournament will be featured on our main ' +
16
+ 'calendar. This will include a direct link to your tournament\'s webpage, ' +
17
+ 'making it easy for participants to find all the relevant information on ' +
18
+ 'your own site.'"
19
+ :weight="'normal'" data-testid="text-select-no"/>
20
+ <br>
21
+ <BaseText :color="'quaternary'" :size="'sm'" :text="'By selecting \'Yes\', you\'ll gain access to our comprehensive Ferrotas ' +
22
+ 'platform. This allows you to manage and conduct your tournament directly ' +
23
+ 'through our system, offering a seamless and integrated experience.'"
24
+ :weight="'normal'" data-testid="text-select-yes"/>
25
+ <br>
26
+ <BaseText :color="'quaternary'" :size="'sm'" :text="'Need Assistance? Our support team is always ready to help. Contact us ' +
27
+ 'for any queries or guidance you need.'"
28
+ :weight="'normal'" data-testid="text-need-help"/>
29
+ </div>
30
+ <div class="flex flex-row justify-center">
31
+ <!-- Yes needs to lead to another page that asks "Do you want Ferrotas to handle registration?" -->
32
+ <BaseButton class="w-1/2 mr-1" color="neutral" label="Yes" selected=selected size="sm" type="square"
33
+ @click="handleHosting()"/>
34
+ <BaseButton class="w-1/2 ml-1" color="neutral" label="No" size="sm" type="square" @click="toggleLinkInput()"/>
35
+ </div>
36
+ <section v-if="linkInputVisible" class="flex flex-col mb-3">
37
+ <BaseText :color="'quaternary'" :size="'sm'" :text="'Add links to external sites such as Facebook events'"
38
+ :weight="'normal'" class="mb-1" data-testid="text-need-help"/>
39
+ <div v-for="(newLink, index) in localTournament.externalLinks" :key="index" class="flex flex-row w-full">
40
+ <BaseInput :value="newLink.url" @input="updateLink(index, $event)" :invalid="!newLink.valid" class="pb-2 w-full"
41
+ icon-name="fa-dash" placeholder="https://link1.com/yourevent"
42
+ @update:iconClick="removeLink(newLink.url)" />
43
+ <BaseIcon color="primary" icon-name="fa-circle-xmark" size="xl" iconStyle="fa-solid" data-testid="base-icon" class="mt-1.5 -ml-7 hover:text-primaryHighlight"/>
44
+ </div>
45
+ <BaseButton class="w-full mt-3" color="neutral" label="Add New Link" size="sm" type="primary"
46
+ @click="addExternalLink()"/>
47
+ </section>
48
+ <div>
49
+ <BaseButton color="neutral" label="Continue" size="sm" type="secondary" @click="handleSubmit()"/>
50
+ </div>
51
+
52
+ </section>
53
+ </div>
54
+ </div>
55
+ </template>
56
+
57
+
58
+ <script>
59
+ import BaseText from "../../../Atoms/Text/BaseText.vue";
60
+ import BaseButton from "../../../Molecules/Button/BaseButton.vue";
61
+ import BaseInput from "../../../Atoms/Input/BaseInput.vue";
62
+ import BaseIcon from "../../../Atoms/Icon/BaseIcon.vue";
63
+
64
+ export default {
65
+ name: 'AddTournamentPageTwo',
66
+ components: {
67
+ BaseIcon,
68
+ BaseText,
69
+ BaseButton,
70
+ BaseInput
71
+ },
72
+ props: {tournament: Object},
73
+ data() {
74
+ return {
75
+ ferrotasToHost: false,
76
+ linkInputVisible: false,
77
+ localTournament: JSON.parse(JSON.stringify(this.tournament))
78
+ }
79
+ },
80
+ created() {
81
+ if (this.localTournament.externalLinks.length === 0) {
82
+ this.localTournament.externalLinks = [{url: '', valid: true}]
83
+ }
84
+ },
85
+ methods: {
86
+ updateLink(index, event) {
87
+ const newUrl = event.target.value;
88
+ this.localTournament.externalLinks[index].url = newUrl;
89
+ this.localTournament.externalLinks[index].valid = this.isValidUrl(newUrl);
90
+ },
91
+ handleHosting() {
92
+ this.ferrotasToHost = !this.ferrotasToHost;
93
+ },
94
+ toggleLinkInput() {
95
+ this.linkInputVisible = !this.linkInputVisible;
96
+ },
97
+ addExternalLink() {
98
+ this.localTournament.externalLinks.push({ url: '', valid: true });
99
+ },
100
+ removeLink(urlToRemove) {
101
+ this.localTournament.externalLinks = this.localTournament.externalLinks.filter(link => link.url !== urlToRemove);
102
+ },
103
+ handleSubmit() {
104
+ console.log('submitting ferrotas hosting');
105
+ if (this.areAllLinksValid()) {
106
+ console.log(this.localTournament)
107
+ this.$emit('submit', this.localTournament);
108
+ }
109
+ },
110
+ isValidUrl(url) {
111
+ const regex = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?$/;
112
+ return regex.test(url);
113
+ },
114
+ areAllLinksValid() {
115
+ return this.localTournament.externalLinks.every(link => link.valid);
116
+ },
117
+ },
118
+
119
+ }
120
+
121
+ </script>
@@ -1,28 +1,28 @@
1
- import AdminLeftMenu from './AdminLeftMenu.vue';
2
-
3
- export default {
4
- title: 'Templates/Admin/AdminLeftMenu',
5
- component: AdminLeftMenu,
6
- tags: ['autodocs']
7
- };
8
- const Template = args => ({
9
- components: { AdminLeftMenu },
10
- setup() {
11
- return { args };
12
- },
13
- methods: {
14
- onMenuClick(index) {
15
- alert(`Button ${index + 1} clicked!`);
16
- }
17
- }
18
- });
19
-
20
- export const Default = {
21
- args: {
22
- items: [
23
- { text: 'Home', link: '/' },
24
- { text: 'Category', link: '/category' },
25
- { text: 'Product', link: '' }
26
- ]
27
- }
28
- };
1
+ import AdminLeftMenu from './AdminLeftMenu.vue';
2
+
3
+ export default {
4
+ title: 'Templates/Admin/AdminLeftMenu',
5
+ component: AdminLeftMenu,
6
+ tags: ['autodocs']
7
+ };
8
+ const Template = args => ({
9
+ components: { AdminLeftMenu },
10
+ setup() {
11
+ return { args };
12
+ },
13
+ methods: {
14
+ onMenuClick(index) {
15
+ alert(`Button ${index + 1} clicked!`);
16
+ }
17
+ }
18
+ });
19
+
20
+ export const Default = {
21
+ args: {
22
+ items: [
23
+ { text: 'Home', link: '/' },
24
+ { text: 'Category', link: '/category' },
25
+ { text: 'Product', link: '' }
26
+ ]
27
+ }
28
+ };
@@ -1,57 +1,57 @@
1
- <template>
2
- <div class="bg-secondary w-64 h-screen flex flex-col justify-between">
3
- <section class="h-28 border-b border-neutral">
4
- <div class="flex flex-col justify-center h-28">
5
- <div class="ml-8">
6
- <img class="w-32" src="https://ferrotas.com/assets/ferrotas-white-small-720502db.png" alt="logo"/>
7
- </div>
8
- </div>
9
- </section>
10
- <section class="flex flex-col p-2 h-full">
11
- <BaseButton
12
- v-for="button in buttons"
13
- :label="button.label"
14
- iconClass="fa-solid fa-trophy text-white"
15
- type="admin"
16
- hover="admin"
17
- @click="handleButtonClick(button)"
18
- />
19
- </section>
20
- <section class="flex flex-col justify-end p-2 flex-grow">
21
- <div class="border-t border-neutral pt-2">
22
- <BaseButton
23
- iconClass="fa-solid fa-circle-user text-textSecondary"
24
- label="Account"
25
- type="adminSecondary"
26
- @click="handleButtonClick(button)"
27
- />
28
- <BaseButton
29
- iconClass="fa-solid fa-right-to-bracket fa-rotate-180 text-textSecondary"
30
- label="Log Out"
31
- type="adminSecondary"
32
- @click="handleButtonClick(button)"
33
- />
34
- </div>
35
- </section>
36
- </div>
37
- </template>
38
-
39
- <script>
40
- import BaseButton from "../../../Molecules/Button/BaseButton.vue";
41
-
42
- export default {
43
- name: 'AdminLeftMenu',
44
- components: { BaseButton },
45
- props: {
46
- buttons: {
47
- type: Array,
48
- default: () => []
49
- }
50
- },
51
- methods: {
52
- handleButtonClick(button) {
53
- this.$emit('button-click', button);
54
- }
55
- }
56
- };
57
- </script>
1
+ <template>
2
+ <div class="bg-secondary w-64 h-screen flex flex-col justify-between">
3
+ <section class="h-28 border-b border-neutral">
4
+ <div class="flex flex-col justify-center h-28">
5
+ <div class="ml-8">
6
+ <img class="w-32" src="https://ferrotas.com/assets/ferrotas-white-small-720502db.png" alt="logo"/>
7
+ </div>
8
+ </div>
9
+ </section>
10
+ <section class="flex flex-col p-2 h-full">
11
+ <BaseButton
12
+ v-for="button in buttons"
13
+ :label="button.label"
14
+ iconClass="fa-solid fa-trophy text-white"
15
+ type="admin"
16
+ hover="admin"
17
+ @click="handleButtonClick(button)"
18
+ />
19
+ </section>
20
+ <section class="flex flex-col justify-end p-2 flex-grow">
21
+ <div class="border-t border-neutral pt-2">
22
+ <BaseButton
23
+ iconClass="fa-solid fa-circle-user text-textSecondary"
24
+ label="Account"
25
+ type="adminSecondary"
26
+ @click="handleButtonClick(button)"
27
+ />
28
+ <BaseButton
29
+ iconClass="fa-solid fa-right-to-bracket fa-rotate-180 text-textSecondary"
30
+ label="Log Out"
31
+ type="adminSecondary"
32
+ @click="handleButtonClick(button)"
33
+ />
34
+ </div>
35
+ </section>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ import BaseButton from "../../../Molecules/Button/BaseButton.vue";
41
+
42
+ export default {
43
+ name: 'AdminLeftMenu',
44
+ components: { BaseButton },
45
+ props: {
46
+ buttons: {
47
+ type: Array,
48
+ default: () => []
49
+ }
50
+ },
51
+ methods: {
52
+ handleButtonClick(button) {
53
+ this.$emit('button-click', button);
54
+ }
55
+ }
56
+ };
57
+ </script>