Skip to content

Commit

Permalink
fix: Apps-2922 remove time stamp on homepage (#637)
Browse files Browse the repository at this point in the history
* test: trying to recreate

* fix: time on ucla homepage

* chore: cleanup debugging mess, add test

* fix: prevent datecreated in default

* fix: undefined theme case

* fix: computed method for theme logic

* fix: closing tag

---------

Co-authored-by: Jess Divers <[email protected]>
Co-authored-by: JenDiamond <[email protected]>
  • Loading branch information
3 people authored and pghorpade committed Oct 22, 2024
1 parent fb44c71 commit 6420cf1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib-components/CardMeta.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ const parsedTime = computed(() => {
if (props.startDate && props.sectionHandle === 'event')
return formatTimes(props.startDate, props.endDate)
// legacy behavior returns nothing when sectionHandle is not 'event',
// so check theme is set AND we are not showing ftvaEventSeries data to avoid returning nothing
else if (props.startDate && (props.sectionHandle !== 'ftvaEventSeries' && theme?.value !== undefined))
// so check theme is set to ftva AND we are not showing ftvaEventSeries data to avoid returning nothing
else if (props.startDate && (props.sectionHandle !== 'ftvaEventSeries' && theme?.value === 'ftva'))
return props.endDate ? formatTimes(props.startDate, props.endDate) : formatTimes(props.startDate, props.startDate)
// in all other cases incl. if it is ftvaEventSeries, return nothing
else if (props.startDate && (props.sectionHandle === 'ftvaEventSeries'))
Expand Down
6 changes: 5 additions & 1 deletion src/lib-components/SectionTeaserCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ const theme = useTheme()
const classes = computed(() => {
return ['section-teaser-card', theme?.value || '']
})
const currentTheme = computed(() => {
return theme?.value || ''
})
</script>
<template>
Expand All @@ -50,7 +54,7 @@ const classes = computed(() => {
:byline-two="item.bylineTwo"
:section-handle="item.sectionHandle"
:ongoing="item.ongoing"
:date-created="item.postDate"
:date-created="currentTheme === 'ftva' ? item.postDate : ''"
class="card"
/>
</ul>
Expand Down
54 changes: 54 additions & 0 deletions src/stories/SectionWrapper.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,60 @@ export function Default() {
}
}

// Mocks UCLA Library Home page News section data
const mockDefaultHome = [{
sectionHandle: 'news',
title: 'La Bpo',
text: '<p>La Niña is an oceanic and atmospheric phenomenon that is the colder counterpart of El Niño, as part of the broader El Niño–Southern Oscillation climate pattern.</p>',
to: 'https://www.library.ucla.edu',
ongoing: false,
externalResourceUrl: null,
category: 'Featured, Collections',
startDate: '2023-02-07T15:54:00-08:00',
endDate: '2023-02-07T15:54:00-08:00',
postDate: '2023-02-07T15:54:00-08:00',
}, {
sectionHandle: 'news',
title: 'La Bpo',
text: '<p>La Niña is an oceanic and atmospheric phenomenon that is the colder counterpart of El Niño, as part of the broader El Niño–Southern Oscillation climate pattern.</p>',
to: 'https://www.library.ucla.edu',
ongoing: false,
externalResourceUrl: null,
category: 'Featured, Collections',
startDate: '2023-02-07T15:54:00-08:00',
endDate: '2023-02-07T15:54:00-08:00',
postDate: '2023-02-07T15:54:00-08:00',
}, {
sectionHandle: 'news',
title: 'La Bpo',
text: '<p>La Niña is an oceanic and atmospheric phenomenon that is the colder counterpart of El Niño, as part of the broader El Niño–Southern Oscillation climate pattern.</p>',
to: 'https://www.library.ucla.edu',
ongoing: false,
startDate: '2023-02-07T15:54:00-08:00',
endDate: '2023-02-07T15:54:00-08:00',
postDate: '2022-06-21T12:39:00-07:00'
}]
export function DefaultHome() {
return {
data() {
return {
mockDefaultHome
}
},
provide() {
return {
theme: computed(() => ''), // default theme
}
},
components: { SectionWrapper, SectionTeaserCard },
template: `
<section-wrapper>
<section-teaser-card :items="mockDefaultHome" />
</section-wrapper>
`,
}
}

export function NoMeta() {
return {
data() {
Expand Down

0 comments on commit 6420cf1

Please sign in to comment.