@asd20/ui 3.2.812 → 3.2.814

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
@@ -5,7 +5,7 @@
5
5
  "*.scss",
6
6
  "*.vue"
7
7
  ],
8
- "version": "3.2.812",
8
+ "version": "3.2.814",
9
9
  "private": false,
10
10
  "license": "MIT",
11
11
  "repository": {
@@ -7,7 +7,7 @@
7
7
  :style="{ '--accent-color': event.calendarColor }"
8
8
  >
9
9
  <span class="title"
10
- ><span>{{ event.summary }}</span></span
10
+ ><span>{{ sanitizedSummary }}</span></span
11
11
  >
12
12
  <span class="time">{{ start }}{{ end }}</span>
13
13
  <span class="start-time">{{ startTime }}</span>
@@ -36,20 +36,43 @@ export default {
36
36
  this.event.allday || this.event.multiDay,
37
37
  }
38
38
  },
39
-
40
39
  startTime() {
41
- return format(parse(this.event.start), 'h:mm aa')
40
+ return format(
41
+ parse(this.event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
42
+ 'h:mm aa'
43
+ )
42
44
  },
43
45
  start() {
44
- return format(parse(this.event.start), 'h:mm aa, MMMM DD YYYY')
46
+ return format(
47
+ parse(this.event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
48
+ 'h:mm aa, MMMM DD YYYY'
49
+ )
45
50
  },
46
51
  end() {
47
- return ' to ' + format(parse(this.event.end), 'h:mm aa, MMMM DD YYYY')
52
+ return (
53
+ ' to ' +
54
+ format(
55
+ parse(this.event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date()),
56
+ 'h:mm aa, MMMM DD YYYY'
57
+ )
58
+ )
59
+ },
60
+ sanitizedSummary() {
61
+ return this.sanitizeSummary(this.event.summary)
62
+ },
63
+ },
64
+ methods: {
65
+ // specifically for rSchool events that have extraneous school names in the summary
66
+ sanitizeSummary(summary) {
67
+ if (!summary) return summary
68
+ const pattern = /vs\.[^>]*>Multiple Schools/
69
+ return summary.replace(pattern, 'vs. Multiple Schools')
48
70
  },
49
71
  },
50
72
  }
51
73
  </script>
52
74
 
75
+
53
76
  <style lang="scss" scoped>
54
77
  @import '../../../design/_mixins.scss';
55
78
  @import '../../../design/_variables.scss';
@@ -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>
@@ -17,7 +17,7 @@
17
17
  <div class="bottom">{{ event.month }}</div>
18
18
  <small>{{ event.year }}</small>
19
19
  </div>
20
- <h2 class="name">{{ event.summary }}</h2>
20
+ <h2 class="name">{{ sanitizedSummary }}</h2>
21
21
  </header>
22
22
  <Asd20List class="description">
23
23
  <Asd20ListItem
@@ -35,9 +35,9 @@
35
35
  :description="event.location"
36
36
  />
37
37
  <Asd20ListItem
38
- v-if="event.description"
38
+ v-if="sanitizedDescription"
39
39
  label="Description"
40
- :description="event.description"
40
+ :description="sanitizedDescription"
41
41
  />
42
42
  </Asd20List>
43
43
  <div class="tags">
@@ -68,19 +68,35 @@ export default {
68
68
  open: { type: Boolean, default: false },
69
69
  },
70
70
  computed: {
71
+ sanitizedSummary() {
72
+ return this.sanitizeSummary(this.event.summary)
73
+ },
74
+ sanitizedDescription() {
75
+ return this.sanitizeDescription(this.event.description)
76
+ },
71
77
  title() {
72
- return truncate(this.event.summary, { length: 75 })
78
+ return truncate(this.sanitizedSummary, { length: 75 })
73
79
  },
74
-
75
80
  time() {
76
81
  if (!this.event) return null
77
82
 
78
- const startTime = parse(this.event.start, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
79
- const endTime = parse(this.event.end, "yyyy-MM-dd'T'HH:mm:ssX", new Date())
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
+ )
80
93
 
81
94
  const startHour = startTime.getHours()
82
95
  // Display 'TBD' if start time is the same as end time and falls between 11 PM and 3 AM
83
- if (startTime.getTime() === endTime.getTime() && (startHour >= 23 || startHour < 3)) {
96
+ if (
97
+ startTime.getTime() === endTime.getTime() &&
98
+ (startHour >= 23 || startHour < 3)
99
+ ) {
84
100
  return 'TBD'
85
101
  }
86
102
 
@@ -100,10 +116,36 @@ export default {
100
116
  return time
101
117
  },
102
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
+ },
103
146
  }
104
147
  </script>
105
148
 
106
-
107
149
  <style lang="scss" scoped>
108
150
  @import '../../../design/_mixins.scss';
109
151
  @import '../../../design/_variables.scss';
@@ -80,8 +80,8 @@
80
80
  "id": null,
81
81
  "uid": "MDQwMDAwMDA4MjAwRTAwMDc0QzVCNzEwMUE4MkUwMDgwMDAwMDAwMEVGRDJDOEZCQ0RFN0Q4MDEwMDAwMDAwMDAwMDAwMDAwMTAwMDAwMDBDMUEwRTM5NTYwQTRGMjQzOEQyN0MzRjAxQzdGRkQ4QQ==",
82
82
  "type": "event",
83
- "summary": "Parent Council - College Info Meeting",
84
- "description": "Admissions officers from several local and regional colleges/universities will be in attendance sharing information about their schools.",
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, '&nbsp;')
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, '&nbsp;')
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, '&nbsp;')
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 += '' // No end time needed if they are the same
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: event.summary,
104
- // subtitle: 'Some subtitle goes here',
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
-