@asd20/ui 3.2.874 → 3.2.876
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 +1 -1
- package/src/components/molecules/Asd20Card/index.vue +2 -2
- package/src/components/molecules/Asd20ListItem/index.vue +2 -2
- package/src/components/organisms/Asd20EventModal/index.vue +3 -37
- package/src/data/events/district-events.json +28 -1
- package/src/helpers/formatEventTime.js +47 -0
- package/src/helpers/mapEventToCard.js +1 -45
package/package.json
CHANGED
|
@@ -330,9 +330,9 @@ export default {
|
|
|
330
330
|
font-weight: bold;
|
|
331
331
|
font-family: var(--website-typography__font-family-headlines);
|
|
332
332
|
display: flex;
|
|
333
|
-
align-items:
|
|
333
|
+
align-items: flex-start;
|
|
334
334
|
margin-top: space(0.5);
|
|
335
|
-
margin-bottom: 0;
|
|
335
|
+
margin-bottom: space(0.5);
|
|
336
336
|
.asd20-icon {
|
|
337
337
|
--line-color: var(--website-icon__line-color);
|
|
338
338
|
margin-left: -0.125em;
|
|
@@ -126,8 +126,8 @@ export default {
|
|
|
126
126
|
targetValue() {
|
|
127
127
|
const hostname =
|
|
128
128
|
typeof window !== 'undefined' ? window.location.host : 'www.asd20.org'
|
|
129
|
-
return (this.link.includes('http') && !this.link.includes(hostname)) ||
|
|
130
|
-
(this.to.includes('http') && !this.link.includes(hostname))
|
|
129
|
+
return (this.link && this.link.includes('http') && !this.link.includes(hostname)) ||
|
|
130
|
+
(this.to && this.to.includes('http') && !this.link.includes(hostname))
|
|
131
131
|
? '_blank'
|
|
132
132
|
: '_self'
|
|
133
133
|
},
|
|
@@ -55,12 +55,13 @@
|
|
|
55
55
|
</template>
|
|
56
56
|
|
|
57
57
|
<script>
|
|
58
|
-
import { format, parse } from 'date-fns'
|
|
59
58
|
import Asd20Modal from '../../molecules/Asd20Modal'
|
|
60
59
|
import Asd20Tag from '../../atoms/Asd20Tag'
|
|
61
60
|
import Asd20List from '../../organisms/Asd20List'
|
|
62
61
|
import Asd20ListItem from '../../molecules/Asd20ListItem'
|
|
63
62
|
import Asd20Viewport from '../../atoms/Asd20Viewport'
|
|
63
|
+
import formattedTime from '../../../helpers/formatEventTime'
|
|
64
|
+
import truncate from 'lodash-es/truncate'
|
|
64
65
|
|
|
65
66
|
export default {
|
|
66
67
|
name: 'Asd20EventModal',
|
|
@@ -80,42 +81,7 @@ export default {
|
|
|
80
81
|
return truncate(this.sanitizedSummary, { length: 75 })
|
|
81
82
|
},
|
|
82
83
|
time() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const startTime = parse(
|
|
86
|
-
this.event.start,
|
|
87
|
-
"yyyy-MM-dd'T'HH:mm:ssX",
|
|
88
|
-
new Date()
|
|
89
|
-
)
|
|
90
|
-
const endTime = parse(
|
|
91
|
-
this.event.end,
|
|
92
|
-
"yyyy-MM-dd'T'HH:mm:ssX",
|
|
93
|
-
new Date()
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
const startHour = startTime.getHours()
|
|
97
|
-
// Display 'TBD' if start time is the same as end time and falls between 11 PM and 3 AM
|
|
98
|
-
if (
|
|
99
|
-
startTime.getTime() === endTime.getTime() &&
|
|
100
|
-
(startHour >= 23 || startHour < 3)
|
|
101
|
-
) {
|
|
102
|
-
return 'TBD'
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
106
|
-
|
|
107
|
-
// Check if end time is the same as start time
|
|
108
|
-
if (startTime.getTime() === endTime.getTime()) {
|
|
109
|
-
time += '' // No end time needed if they are the same
|
|
110
|
-
} else if (this.event.endTimeUndetermined) {
|
|
111
|
-
time += `${format(endTime).replace(/:00/g, '')}`
|
|
112
|
-
} else {
|
|
113
|
-
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
114
|
-
.replace(/#/g, ' ')
|
|
115
|
-
.replace(/:00/g, '')}`
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return time
|
|
84
|
+
return this.event ? formattedTime(this.event) : null
|
|
119
85
|
},
|
|
120
86
|
},
|
|
121
87
|
methods: {
|
|
@@ -48,6 +48,33 @@
|
|
|
48
48
|
"calendarFormat": "ical",
|
|
49
49
|
"calendarColor": "#213f94"
|
|
50
50
|
},
|
|
51
|
+
{
|
|
52
|
+
"@search.score": 1,
|
|
53
|
+
"id": null,
|
|
54
|
+
"uid": "MDQwMDAwMDA4MjAwRTAwMDc0QzVCNzEwMUE4MkUwMDgwMDAwMDAwMERFRTE5NzcxNThBQ0RBMDEwMDAwMDAwMDAwMDAwMDAwMTAwMDAwMDBFOEVBMjc5NkM0MDI3RjRGODFFNzY1QzQ0M0VGMDA0Mw==",
|
|
55
|
+
"type": "event",
|
|
56
|
+
"summary": "All State Choir",
|
|
57
|
+
"description": "",
|
|
58
|
+
"location": "Denver Center for the Performing Arts (1101 13th St, Denver, CO 80204, United States)",
|
|
59
|
+
"start": "2023-01-09T17:00:00Z",
|
|
60
|
+
"end": "2023-01-11T17:30:00Z",
|
|
61
|
+
"dtstamp": "2023-01-09T17:00:00Z",
|
|
62
|
+
"class": "",
|
|
63
|
+
"priority": "",
|
|
64
|
+
"transparency": "",
|
|
65
|
+
"status": "",
|
|
66
|
+
"sequence": "",
|
|
67
|
+
"url": null,
|
|
68
|
+
"calendarId": "a0c92470-27a0-11ec-a6e3-c76d885e64a4",
|
|
69
|
+
"calendarName": "Choir",
|
|
70
|
+
"calendarOrganizationId": "bb6e9cd6-da25-9e6f-5e8d-072b9a7df4f0",
|
|
71
|
+
"calendarOrganizationTitle": "Air Academy High School",
|
|
72
|
+
"calendarCategories": [],
|
|
73
|
+
"calendarKeywords": [],
|
|
74
|
+
"calendarUrl": "https://outlook.office365.com/owa/calendar/6a1a45f079b7416f8b301747cd731778@asd20.org/93eb354f1a6b446bb533e2f40613f8a310360980508845501669/calendar.ics",
|
|
75
|
+
"calendarFormat": "ical",
|
|
76
|
+
"calendarColor": "#eb28c7"
|
|
77
|
+
},
|
|
51
78
|
{
|
|
52
79
|
"@search.score": 1,
|
|
53
80
|
"id": null,
|
|
@@ -292,4 +319,4 @@
|
|
|
292
319
|
"calendarColor": "#213f94"
|
|
293
320
|
}
|
|
294
321
|
]
|
|
295
|
-
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import format from 'date-fns/format'
|
|
2
|
+
import parse from 'date-fns/parse'
|
|
3
|
+
|
|
4
|
+
export default function formattedTime(event) {
|
|
5
|
+
if (!event) return
|
|
6
|
+
|
|
7
|
+
if (event.allDay) return 'All Day'
|
|
8
|
+
|
|
9
|
+
if (event.multiDay) {
|
|
10
|
+
return `MultiDay Event:<br/>Starts: ${format(
|
|
11
|
+
parse(event.originalStart, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
12
|
+
'<b>h:mm aa</b>, ddd, MMM DD, YYYY'
|
|
13
|
+
)
|
|
14
|
+
.replace(/#/g, ' ')
|
|
15
|
+
.replace(/:00/g, '')}<br>Ends: ${format(
|
|
16
|
+
parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
17
|
+
'<b>h:mm aa</b>, ddd, MM DD, YYYY'
|
|
18
|
+
)
|
|
19
|
+
.replace(/#/g, ' ')
|
|
20
|
+
.replace(/:00/g, '')}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const startTime = parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
24
|
+
const endTime = parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
25
|
+
const startHour = startTime.getHours()
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
startTime.getTime() === endTime.getTime() &&
|
|
29
|
+
(startHour >= 23 || startHour < 3)
|
|
30
|
+
) {
|
|
31
|
+
return 'TBD'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
35
|
+
|
|
36
|
+
if (startTime.getTime() === endTime.getTime()) {
|
|
37
|
+
time += ''
|
|
38
|
+
} else if (event.endTimeUndetermined) {
|
|
39
|
+
time += `${format(endTime).replace(/:00/g, '')}`
|
|
40
|
+
} else {
|
|
41
|
+
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
42
|
+
.replace(/#/g, ' ')
|
|
43
|
+
.replace(/:00/g, '')}`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return time
|
|
47
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import format from 'date-fns/format'
|
|
2
2
|
import parse from 'date-fns/parse'
|
|
3
|
+
import formattedTime from './formatEventTime'
|
|
3
4
|
|
|
4
5
|
// Function to sanitize the summary
|
|
5
6
|
const sanitizeSummary = summary => {
|
|
@@ -35,51 +36,6 @@ const sanitizeDescription = description => {
|
|
|
35
36
|
return description
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
const formattedTime = event => {
|
|
39
|
-
if (!event) return
|
|
40
|
-
|
|
41
|
-
if (event.allDay) return 'All Day'
|
|
42
|
-
|
|
43
|
-
if (event.multiDay) {
|
|
44
|
-
return `${format(
|
|
45
|
-
parse(event.originalStart, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
46
|
-
'<b>h:mm aa</b>, dddd, MMMM dd, yyyy'
|
|
47
|
-
)
|
|
48
|
-
.replace(/#/g, ' ')
|
|
49
|
-
.replace(/:00/g, '')}<br>ending ${format(
|
|
50
|
-
parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
|
|
51
|
-
'<b>h:mm aa</b>, dddd, MMMM dd, yyyy'
|
|
52
|
-
)
|
|
53
|
-
.replace(/#/g, ' ')
|
|
54
|
-
.replace(/:00/g, '')}`
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const startTime = parse(event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
58
|
-
const endTime = parse(event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
|
|
59
|
-
const startHour = startTime.getHours()
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
startTime.getTime() === endTime.getTime() &&
|
|
63
|
-
(startHour >= 23 || startHour < 3)
|
|
64
|
-
) {
|
|
65
|
-
return 'TBD'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
let time = `${format(startTime, '<b>h:mm aa</b>').replace(/:00/g, '')}`
|
|
69
|
-
|
|
70
|
-
if (startTime.getTime() === endTime.getTime()) {
|
|
71
|
-
time += ''
|
|
72
|
-
} else if (event.endTimeUndetermined) {
|
|
73
|
-
time += `${format(endTime).replace(/:00/g, '')}`
|
|
74
|
-
} else {
|
|
75
|
-
time += ` - ${format(endTime, '<b>h:mm aa</b>')
|
|
76
|
-
.replace(/#/g, ' ')
|
|
77
|
-
.replace(/:00/g, '')}`
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return time
|
|
81
|
-
}
|
|
82
|
-
|
|
83
39
|
export default function mapEventToCard(event) {
|
|
84
40
|
const sanitizedSummary = sanitizeSummary(event.summary)
|
|
85
41
|
const sanitizedDescription = sanitizeDescription(event.description)
|