@asd20/ui 3.2.811 → 3.2.813
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/package.json
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
<asd20-district-logo link="https://www.asd20.org" />
|
|
27
27
|
</h1>
|
|
28
|
-
<span class="version" v-if="version && !zoomed" v-html="version"></span>
|
|
28
|
+
<!-- <span class="version" v-if="version && !zoomed" v-html="version"></span> -->
|
|
29
29
|
<slot />
|
|
30
30
|
</header>
|
|
31
31
|
</template>
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<asd20-modal
|
|
3
3
|
v-if="event"
|
|
4
4
|
:open="open"
|
|
5
|
-
:title="
|
|
6
|
-
`${event.calendarOrganizationTitle || event.calendarLocation} Event`
|
|
7
|
-
"
|
|
5
|
+
:title="`${event.calendarOrganizationTitle || event.calendarLocation} Event`"
|
|
8
6
|
icon="calendar-alt"
|
|
9
7
|
dismissable
|
|
10
8
|
class="asd20-event-modal"
|
|
@@ -19,11 +17,11 @@
|
|
|
19
17
|
<div class="bottom">{{ event.month }}</div>
|
|
20
18
|
<small>{{ event.year }}</small>
|
|
21
19
|
</div>
|
|
22
|
-
<h2 class="name">{{
|
|
20
|
+
<h2 class="name">{{ sanitizedSummary }}</h2>
|
|
23
21
|
</header>
|
|
24
22
|
<Asd20List class="description">
|
|
25
23
|
<Asd20ListItem
|
|
26
|
-
v-if="time"
|
|
24
|
+
v-if="time !== null"
|
|
27
25
|
icon="hours-alt"
|
|
28
26
|
icon-size="lg"
|
|
29
27
|
label="Time"
|
|
@@ -37,9 +35,9 @@
|
|
|
37
35
|
:description="event.location"
|
|
38
36
|
/>
|
|
39
37
|
<Asd20ListItem
|
|
40
|
-
v-if="
|
|
38
|
+
v-if="sanitizedDescription"
|
|
41
39
|
label="Description"
|
|
42
|
-
:description="
|
|
40
|
+
:description="sanitizedDescription"
|
|
43
41
|
/>
|
|
44
42
|
</Asd20List>
|
|
45
43
|
<div class="tags">
|
|
@@ -55,18 +53,12 @@
|
|
|
55
53
|
</template>
|
|
56
54
|
|
|
57
55
|
<script>
|
|
58
|
-
// import parse from 'date-fns/parse'
|
|
59
|
-
// import Vue from 'vue'
|
|
60
|
-
|
|
61
|
-
import { truncate } from 'lodash-es'
|
|
62
56
|
import { format, parse } from 'date-fns'
|
|
63
57
|
import Asd20Modal from '../../molecules/Asd20Modal'
|
|
64
58
|
import Asd20Tag from '../../atoms/Asd20Tag'
|
|
65
59
|
import Asd20List from '../../organisms/Asd20List'
|
|
66
60
|
import Asd20ListItem from '../../molecules/Asd20ListItem'
|
|
67
61
|
import Asd20Viewport from '../../atoms/Asd20Viewport'
|
|
68
|
-
// import VScrollLock from 'v-scroll-lock'
|
|
69
|
-
// Vue.use(VScrollLock)
|
|
70
62
|
|
|
71
63
|
export default {
|
|
72
64
|
name: 'Asd20EventModal',
|
|
@@ -76,34 +68,81 @@ export default {
|
|
|
76
68
|
open: { type: Boolean, default: false },
|
|
77
69
|
},
|
|
78
70
|
computed: {
|
|
71
|
+
sanitizedSummary() {
|
|
72
|
+
return this.sanitizeSummary(this.event.summary)
|
|
73
|
+
},
|
|
74
|
+
sanitizedDescription() {
|
|
75
|
+
return this.sanitizeDescription(this.event.description)
|
|
76
|
+
},
|
|
79
77
|
title() {
|
|
80
|
-
return truncate(this.
|
|
78
|
+
return truncate(this.sanitizedSummary, { length: 75 })
|
|
81
79
|
},
|
|
82
|
-
|
|
83
80
|
time() {
|
|
84
|
-
if (!this.event) return
|
|
81
|
+
if (!this.event) return null
|
|
85
82
|
|
|
86
|
-
|
|
83
|
+
const startTime = parse(
|
|
84
|
+
this.event.start,
|
|
85
|
+
"yyyy-MM-dd'T'HH:mm:ssX",
|
|
86
|
+
new Date()
|
|
87
|
+
)
|
|
88
|
+
const endTime = parse(
|
|
89
|
+
this.event.end,
|
|
90
|
+
"yyyy-MM-dd'T'HH:mm:ssX",
|
|
91
|
+
new Date()
|
|
92
|
+
)
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
)}`
|
|
94
|
+
const startHour = startTime.getHours()
|
|
95
|
+
// Display 'TBD' if start time is the same as end time and falls between 11 PM and 3 AM
|
|
96
|
+
if (
|
|
97
|
+
startTime.getTime() === endTime.getTime() &&
|
|
98
|
+
(startHour >= 23 || startHour < 3)
|
|
99
|
+
) {
|
|
100
|
+
return 'TBD'
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
let time = `${format(
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
104
|
+
|
|
105
|
+
// Check if end time is the same as start time
|
|
106
|
+
if (startTime.getTime() === endTime.getTime()) {
|
|
107
|
+
time += '' // No end time needed if they are the same
|
|
108
|
+
} else if (this.event.endTimeUndetermined) {
|
|
109
|
+
time += `${format(endTime).replace(/:00/g, '')}`
|
|
101
110
|
} else {
|
|
102
|
-
time += ` - ${format(
|
|
111
|
+
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
112
|
+
.replace(/#/g, ' ')
|
|
113
|
+
.replace(/:00/g, '')}`
|
|
103
114
|
}
|
|
115
|
+
|
|
104
116
|
return time
|
|
105
117
|
},
|
|
106
118
|
},
|
|
119
|
+
methods: {
|
|
120
|
+
// specifically for rSchool events that have extraneous school names in the summary
|
|
121
|
+
sanitizeSummary(summary) {
|
|
122
|
+
if (!summary) return summary
|
|
123
|
+
const pattern = /vs\.[^>]*>Multiple Schools/
|
|
124
|
+
return summary.replace(pattern, 'vs. Multiple Schools')
|
|
125
|
+
},
|
|
126
|
+
// Function to sanitize the description
|
|
127
|
+
sanitizeDescription(description) {
|
|
128
|
+
if (!description) return description
|
|
129
|
+
|
|
130
|
+
// Remove text between the ">" backwards to the first "." or ":" and replace '>Multiple Schools' with '.'
|
|
131
|
+
description = description.replace(/([.:][^>]*?)>([^>]*Multiple Schools)/, '$1.')
|
|
132
|
+
|
|
133
|
+
// Separate capital letters preceded by lowercase letters with ', '
|
|
134
|
+
description = description.replace(/([a-z])([A-Z])/g, '$1, $2')
|
|
135
|
+
|
|
136
|
+
// Remove unmatched quotes between "." or ":" and ">"
|
|
137
|
+
const quotePattern = /[.:][^>]*['"][^'"]*$|[^'"]*['"][^>]*['"]>Multiple Schools/g
|
|
138
|
+
description = description.replace(quotePattern, match => {
|
|
139
|
+
const quotes = match.match(/['"]/g) || []
|
|
140
|
+
return quotes.length % 2 !== 0 ? match.replace(/['"]/g, '') : match
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
return description
|
|
144
|
+
},
|
|
145
|
+
},
|
|
107
146
|
}
|
|
108
147
|
</script>
|
|
109
148
|
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
"id": null,
|
|
81
81
|
"uid": "MDQwMDAwMDA4MjAwRTAwMDc0QzVCNzEwMUE4MkUwMDgwMDAwMDAwMEVGRDJDOEZCQ0RFN0Q4MDEwMDAwMDAwMDAwMDAwMDAwMTAwMDAwMDBDMUEwRTM5NTYwQTRGMjQzOEQyN0MzRjAxQzdGRkQ4QQ==",
|
|
82
82
|
"type": "event",
|
|
83
|
-
"summary": "
|
|
84
|
-
"description": "
|
|
83
|
+
"summary": "Boys Varsity vs. CoronadoDohertyLibertyMullenPalmer RidgePine CreekPueblo WestRampartRock CanyonThunderRidge'>Multiple Schools (Home)",
|
|
84
|
+
"description": "Type: Kadet Kickoff Tournament Opponent: CoronadoDohertyLibertyMullenPalmer RidgePine CreekPueblo WestRampartRock CanyonThunderRidge'>Multiple Schools Comments: Confirmed",
|
|
85
85
|
"location": "AAHS Media Center",
|
|
86
86
|
"start": "2023-01-19T08:20:00Z",
|
|
87
87
|
"end": "2023-01-19T08:20:00Z",
|
|
@@ -1,60 +1,34 @@
|
|
|
1
|
-
// import format from 'date-fns/format'
|
|
2
|
-
// import parse from 'date-fns/parse'
|
|
3
|
-
|
|
4
|
-
// const formattedTime = event => {
|
|
5
|
-
// if (!event) return
|
|
6
|
-
|
|
7
|
-
// if (event.allDay) return 'All Day'
|
|
8
|
-
|
|
9
|
-
// if (event.multiDay) {
|
|
10
|
-
// return `${format(
|
|
11
|
-
// parse(event.originalStart),
|
|
12
|
-
// '<b>h:mm aa</b>, dddd, MMMM DD, YYYY'
|
|
13
|
-
// )
|
|
14
|
-
// .replace(/#/g, ' ')
|
|
15
|
-
// .replace(/:00/g, '')}<br>ending ${format(
|
|
16
|
-
// parse(event.end),
|
|
17
|
-
// '<b>h:mm aa</b>, dddd, MMMM DD, YYYY'
|
|
18
|
-
// )
|
|
19
|
-
// .replace(/#/g, ' ')
|
|
20
|
-
// .replace(/:00/g, '')}`
|
|
21
|
-
// }
|
|
22
|
-
|
|
23
|
-
// let time = `${format(parse(event.start), '<b>h:mm aa</b>').replace(
|
|
24
|
-
// /:00/g,
|
|
25
|
-
// ''
|
|
26
|
-
// )}`
|
|
27
|
-
// if (event.endTimeUndetermined) {
|
|
28
|
-
// time += `${format(parse(event.end)).replace(/:00/g, '')}`
|
|
29
|
-
// } else {
|
|
30
|
-
// time += ` - ${format(parse(event.end), '<b>h:mm aa</b>')
|
|
31
|
-
// .replace(/#/g, ' ')
|
|
32
|
-
// .replace(/:00/g, '')}`
|
|
33
|
-
// }
|
|
34
|
-
// return time
|
|
35
|
-
// }
|
|
36
|
-
|
|
37
|
-
// export default function mapEventToCard(event) {
|
|
38
|
-
// return {
|
|
39
|
-
// title: event.summary,
|
|
40
|
-
// // subtitle: 'Some subtitle goes here',
|
|
41
|
-
// description: event.description,
|
|
42
|
-
// categories: event.calendarCategories.concat([event.calendarName]),
|
|
43
|
-
// date: format(event.start),
|
|
44
|
-
// time: formattedTime(event),
|
|
45
|
-
// weekday: event.weekday,
|
|
46
|
-
// day: event.day,
|
|
47
|
-
// month: event.month,
|
|
48
|
-
// year: event.year,
|
|
49
|
-
// emphasizedDate: true,
|
|
50
|
-
// location: event.location || event.calendarLocation,
|
|
51
|
-
// isFeatured: event.isFeatured || event.isDistrictFeatured,
|
|
52
|
-
// }
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
1
|
import format from 'date-fns/format'
|
|
56
2
|
import parse from 'date-fns/parse'
|
|
57
3
|
|
|
4
|
+
// Function to sanitize the summary
|
|
5
|
+
const sanitizeSummary = summary => {
|
|
6
|
+
if (!summary) return summary
|
|
7
|
+
|
|
8
|
+
const pattern = /vs\.[^>]*>Multiple Schools/
|
|
9
|
+
return summary.replace(pattern, 'vs. Multiple Schools')
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Function to sanitize the description
|
|
13
|
+
const sanitizeDescription = description => {
|
|
14
|
+
if (!description) return description
|
|
15
|
+
|
|
16
|
+
// Remove text between the ">" backwards to the first "." or ":"
|
|
17
|
+
description = description.replace(/([.:][^>]*?)>([^>]*Multiple Schools)/, '$1>$2')
|
|
18
|
+
|
|
19
|
+
// Separate capital letters preceded by lowercase letters with ', '
|
|
20
|
+
description = description.replace(/([a-z])([A-Z])/g, '$1, $2')
|
|
21
|
+
|
|
22
|
+
// Remove unmatched quotes between "." or ":" and ">"
|
|
23
|
+
const quotePattern = /[.:][^>]*['"][^'"]*$|[^'"]*['"][^>]*['"]>Multiple Schools/g
|
|
24
|
+
description = description.replace(quotePattern, match => {
|
|
25
|
+
const quotes = match.match(/['"]/g) || []
|
|
26
|
+
return quotes.length % 2 !== 0 ? match.replace(/['"]/g, '') : match
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return description
|
|
30
|
+
}
|
|
31
|
+
|
|
58
32
|
const formattedTime = event => {
|
|
59
33
|
if (!event) return
|
|
60
34
|
|
|
@@ -76,17 +50,16 @@ const formattedTime = event => {
|
|
|
76
50
|
|
|
77
51
|
const startTime = parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
78
52
|
const endTime = parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
79
|
-
// if start and end time are the same AND the start time is between 11pm and 3am, then set the start time as TBD and do not include an end time
|
|
80
53
|
const startHour = startTime.getHours()
|
|
54
|
+
|
|
81
55
|
if (startTime.getTime() === endTime.getTime() && (startHour >= 23 || startHour < 3)) {
|
|
82
56
|
return 'TBD'
|
|
83
57
|
}
|
|
84
58
|
|
|
85
59
|
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
86
60
|
|
|
87
|
-
// Check if end time is the same as start time
|
|
88
61
|
if (startTime.getTime() === endTime.getTime()) {
|
|
89
|
-
time += ''
|
|
62
|
+
time += ''
|
|
90
63
|
} else if (event.endTimeUndetermined) {
|
|
91
64
|
time += `${format(endTime).replace(/:00/g, '')}`
|
|
92
65
|
} else {
|
|
@@ -99,10 +72,12 @@ const formattedTime = event => {
|
|
|
99
72
|
}
|
|
100
73
|
|
|
101
74
|
export default function mapEventToCard(event) {
|
|
75
|
+
const sanitizedSummary = sanitizeSummary(event.summary)
|
|
76
|
+
const sanitizedDescription = sanitizeDescription(event.description)
|
|
77
|
+
|
|
102
78
|
return {
|
|
103
|
-
title:
|
|
104
|
-
|
|
105
|
-
description: event.description,
|
|
79
|
+
title: sanitizedSummary,
|
|
80
|
+
description: sanitizedDescription,
|
|
106
81
|
categories: event.calendarCategories.concat([event.calendarName]),
|
|
107
82
|
date: format(parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())),
|
|
108
83
|
time: formattedTime(event),
|
|
@@ -115,4 +90,3 @@ export default function mapEventToCard(event) {
|
|
|
115
90
|
isFeatured: event.isFeatured || event.isDistrictFeatured,
|
|
116
91
|
}
|
|
117
92
|
}
|
|
118
|
-
|