@asd20/ui 3.2.851 → 3.2.853

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.851",
8
+ "version": "3.2.853",
9
9
  "private": false,
10
10
  "license": "MIT",
11
11
  "repository": {
@@ -12,6 +12,7 @@
12
12
  :loading="!Array.isArray(announcements)"
13
13
  :cards="announcementCards"
14
14
  :slidesPerView="announcementCards.length < 6 ? 3 : 4"
15
+ :hasProtectedContent="hasProtectedContent"
15
16
  cardType="Announcement"
16
17
  ></Asd20SwiperFeed>
17
18
  </intersect>
@@ -85,6 +86,8 @@ export default {
85
86
  peopleFeedProps: { type: Object, default: () => {} },
86
87
 
87
88
  cardType: { type: String, default: '' },
89
+ organizationId: { type: String, default: '' },
90
+ hasProtectedContent: { type: Boolean, default: false },
88
91
  },
89
92
 
90
93
  data: () => ({
@@ -94,16 +97,34 @@ export default {
94
97
  computed: {
95
98
  announcementCards() {
96
99
  if (!Array.isArray(this.announcements)) return []
97
- return this.announcements.map(a =>
98
- mapMessageToCard(a, {
99
- reversed: true,
100
+
101
+ // If the organization id is not the employee org:
102
+ if (this.organizationId !== '7ab6f0b0-3304-11ef-92d6-ed16a99dd422') {
103
+ return this.announcements.map(a =>
104
+ mapMessageToCard(a, {
105
+ reversed: true,
106
+ time: '',
107
+ zoom: true,
108
+ noCoverImage: true,
109
+ })
110
+ )
111
+ }
112
+
113
+ // If the organization id is the employee org:
114
+ return this.announcements.map(a => {
115
+ const isLeadership = a.categories.includes('Leadership')
116
+ const reversed = isLeadership ? false : true
117
+
118
+ return mapMessageToCard(a, {
119
+ reversed: reversed,
100
120
  time: '',
101
121
  zoom: true,
102
122
  noCoverImage: true,
103
123
  })
104
- )
124
+ })
105
125
  },
106
126
 
127
+
107
128
  storyCards() {
108
129
  if (!Array.isArray(this.stories)) return []
109
130
  return this.stories.map(s =>
@@ -3,7 +3,9 @@
3
3
  <div class="photostrip"></div>
4
4
 
5
5
  <section class="asd20-primary-header" aria-label="Primary message">
6
- <p v-if="userGivenName && userGivenName !== ''" class="greeting">Hi, {{ userGivenName }}.</p>
6
+ <client-only>
7
+ <p v-if="userGivenName && userGivenName !== ''" class="greeting">Hi, {{ userGivenName }}.</p>
8
+ </client-only>
7
9
  <asd20-messaging id="main" v-bind="firstMessage"></asd20-messaging>
8
10
  <div class="image-container">
9
11
  <img
@@ -36,16 +36,29 @@
36
36
  </div>
37
37
  </template>
38
38
  </asd20-swiper>
39
- <asd20-button
40
- v-if="link && linkLabel && (cards.length >= 10 || cardType === 'Event')"
41
- :label="linkLabel"
42
- :link="link"
43
- size="md"
44
- horizontal
45
- bordered
46
- transparent
47
- centered
48
- />
39
+ <div class="feed-buttons">
40
+ <asd20-button
41
+ v-if="link && linkLabel && (cards.length >= 10 || cardType === 'Event')"
42
+ :label="linkLabel"
43
+ :link="link"
44
+ size="md"
45
+ horizontal
46
+ bordered
47
+ transparent
48
+ centered
49
+ />
50
+ <asd20-button
51
+ class="secondary-button"
52
+ v-if="hasProtectedContent"
53
+ label="Leadership Announcements"
54
+ link="/staff-announcements?category=Leadership"
55
+ size="md"
56
+ horizontal
57
+ bordered
58
+ transparent
59
+ centered
60
+ />
61
+ </div>
49
62
  </component>
50
63
  </template>
51
64
 
@@ -73,6 +86,7 @@ export default {
73
86
  linkLabel: { type: String, default: '' },
74
87
  tag: { type: String, default: 'div' },
75
88
  cardType: { type: String, default: '' },
89
+ hasProtectedContent: { type: Boolean, default: false },
76
90
  },
77
91
 
78
92
  computed: {
@@ -168,12 +182,31 @@ export default {
168
182
  width: 100%;
169
183
  z-index: 2;
170
184
  }
185
+ .feed-buttons {
186
+ display: flex;
187
+ flex-direction: column;
188
+ }
171
189
 
172
190
  .asd20-button {
173
191
  margin: 0 0 0 space(1);
174
192
  font-size: 0.875rem !important;
175
193
  z-index: 1;
176
194
  }
195
+ .secondary-button {
196
+ font-size: 0.875rem !important;
197
+ margin-top: space(0.5);
198
+ }
199
+ }
200
+ @media (min-width: 768px) {
201
+ .asd20-swiper-feed {
202
+ .feed-buttons {
203
+ flex-direction: row;
204
+ margin-left: space(1);
205
+ }
206
+ .secondary-button {
207
+ margin: 0 0 0 space(0.5);
208
+ }
209
+ }
177
210
  }
178
211
 
179
212
  @media (min-width: 1024px) {
@@ -190,10 +223,12 @@ export default {
190
223
  // margin-left: space(1);
191
224
  width: calc(100% - #{space(2)});
192
225
  }
193
- &::v-deep .asd20-button {
194
- margin-left: space(3);
226
+ .asd20-button {
195
227
  font-size: 1rem !important;
196
228
  }
229
+ .feed-buttons {
230
+ margin-left: space(3);
231
+ }
197
232
  }
198
233
  }
199
234
  </style>
@@ -102,37 +102,10 @@
102
102
  :taggable="false"
103
103
  :value="selectedCategories"
104
104
  :items="categoryOptions"
105
- @input="$emit('update:selected-categories', $event)"
105
+ @input="onCategorySelect"
106
106
  :hideLabel="true"
107
107
  placeholder="Filter by Category"
108
108
  />
109
- <!-- <asd20-multiselect-input
110
- role="listbox"
111
- aria-label="Choose a Category to Sort By"
112
- aria-controls="joketypes"
113
- aria-autocomplete="list"
114
- aria-expanded="true"
115
- aria-activedescendant=""
116
- title="Choose a Category"
117
- label="Categories"
118
- :taggable="false"
119
- :value="selectedCategories"
120
- :items="categoryOptions"
121
- @input="$emit('update:selected-categories', $event)"
122
- />
123
- <form>
124
- <label for="multi-select">Choose a Category</label>
125
- <select
126
- v-model="selectedValue"
127
- name="categories"
128
- multiple
129
- id="multi-select"
130
- @input="$emit('update:selected-categories', $event)"
131
- >
132
- <option disabled>Choose options</option>
133
- <option v-for="(catetory, index) in categoryOptions" :value="selectedCategories">{{selectedCategories}}</option>
134
- </select>
135
- </form> -->
136
109
  </div>
137
110
  <div v-if="cards.length < 1">
138
111
  <br />
@@ -361,6 +334,7 @@ export default {
361
334
  numberToShow: 25,
362
335
  counter: 1,
363
336
  counter2: 25,
337
+ currentCategory: null,
364
338
  }
365
339
  },
366
340
  computed: {
@@ -371,16 +345,11 @@ export default {
371
345
  reversed: false,
372
346
  time: '',
373
347
  image: '',
374
- // pinned: false,
375
348
  })
376
349
  )
377
- // .map(c => ({
378
- // ...c,
379
- // link: c.link.replace('/stories', '/announcements'),
380
- // }))
381
350
  },
382
351
  categoryOptions() {
383
- // get a unique array of categories with duplicates removed
352
+ // Return array of categories
384
353
  return [
385
354
  ...new Set(
386
355
  this.cards.reduce((a, c) => a.concat(c.categories || []), []).sort()
@@ -389,13 +358,62 @@ export default {
389
358
  },
390
359
  },
391
360
  watch: {
392
- selectedCategories: function(newVal, oldVal) {
361
+ // Watch for selectedCategories changes
362
+ selectedCategories(newVal, oldVal) {
393
363
  if (newVal !== oldVal) {
394
- this.reset()
364
+ this.reset() // Reset page data when categories change
365
+ }
366
+ },
367
+ categoryOptions(newOptions) {
368
+ // Ensure $route and $route.query are defined before accessing query.category
369
+ if (this.$route && this.$route.query) {
370
+ const categoryFromQuery = this.$route.query.category
371
+ if (categoryFromQuery && newOptions.length) {
372
+ this.setCategoryFromUrl(categoryFromQuery) // Set category from URL when options are ready
373
+ }
395
374
  }
396
375
  },
397
376
  },
398
377
  methods: {
378
+ setCategoryFromUrl(category) {
379
+ // Avoid re-processing if the category is already set
380
+ if (this.currentCategory !== category) {
381
+ const matchingCategory = this.categoryOptions.find(
382
+ opt => opt === category
383
+ )
384
+ if (matchingCategory) {
385
+ this.currentCategory = category // Update the current category
386
+ this.$emit('update:selected-categories', [
387
+ { name: matchingCategory, id: matchingCategory },
388
+ ])
389
+ }
390
+ }
391
+ },
392
+ onCategorySelect(selected) {
393
+ // Ensure $router and $route are defined before using them
394
+ if (this.$router && this.$route) {
395
+ if (selected.length > 0) {
396
+ const selectedCategory = selected[0].id
397
+
398
+ // Only update if the selection has changed
399
+ if (this.currentCategory !== selectedCategory) {
400
+ this.currentCategory = selectedCategory // Track the selected category
401
+ this.$emit('update:selected-categories', selected) // Update selected categories
402
+ this.$router.replace({
403
+ query: { ...this.$route.query, category: selectedCategory },
404
+ })
405
+ }
406
+ } else {
407
+ // Handle clearing the selection
408
+ this.currentCategory = null // Reset current category
409
+ this.$emit('update:selected-categories', []) // Clear selected categories
410
+
411
+ // Remove the 'category' parameter entirely from the URL
412
+ const { category, ...remainingQuery } = this.$route.query || {} // Ensure $route.query is defined
413
+ this.$router.replace({ query: remainingQuery }) // Update the URL without the category
414
+ }
415
+ }
416
+ },
399
417
  nextSet() {
400
418
  if (
401
419
  Math.ceil(this.counter2 / this.numberToShow) <
@@ -106,6 +106,7 @@
106
106
  :events="events"
107
107
  :events-feed-props="eventsFeedProps"
108
108
  @events-in-view="$emit('events-in-view')"
109
+ :organizationId="organization.id"
109
110
  ></asd20-feeds-section>
110
111
 
111
112
  <!-- <asd20-factoids-section