mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge pull request #6978 from Ocelot-Social-Community/6976-optimize-post-teaser-date
feat(webapp): redesign post teaser date
This commit is contained in:
commit
92040d6e8d
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<ds-text class="date-time-range" align="left" color="soft" :size="size">
|
<ds-text class="date-time-range" align="left" color="soft" :size="size">
|
||||||
<div>
|
<div class="date-time-row">
|
||||||
<div>
|
<div>
|
||||||
<base-icon name="calendar" data-test="calendar" />
|
<base-icon name="calendar" data-test="calendar" />
|
||||||
{{ getStartDateString }}
|
{{ getStartDateString }}
|
||||||
@ -14,8 +14,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="!isSameDayLocal">
|
<template v-if="!isSameDayLocal">
|
||||||
—
|
<base-icon name="arrow-down" />
|
||||||
<div>
|
<div class="ds-flex date-time-row">
|
||||||
<div>
|
<div>
|
||||||
<base-icon name="calendar" data-test="calendar" />
|
<base-icon name="calendar" data-test="calendar" />
|
||||||
{{ getEndDateString }}
|
{{ getEndDateString }}
|
||||||
@ -69,11 +69,7 @@ export default {
|
|||||||
return !this.endDateAsDate || isSameYear(this.endDateAsDate, this.startDateAsDate)
|
return !this.endDateAsDate || isSameYear(this.endDateAsDate, this.startDateAsDate)
|
||||||
},
|
},
|
||||||
getStartDateString() {
|
getStartDateString() {
|
||||||
let startDateFormat = this.$t('components.dateTimeRange.yearMonthDay')
|
return format(this.startDateAsDate, this.$t('components.dateTimeRange.yearMonthDay'))
|
||||||
if (!this.isSameDayLocal && this.isSameYearLocal) {
|
|
||||||
startDateFormat = this.$t('components.dateTimeRange.monthDay')
|
|
||||||
}
|
|
||||||
return format(this.startDateAsDate, startDateFormat)
|
|
||||||
},
|
},
|
||||||
getStartTimeString() {
|
getStartTimeString() {
|
||||||
return format(new Date(this.startDate), this.$t('components.dateTimeRange.hourMinute'))
|
return format(new Date(this.startDate), this.$t('components.dateTimeRange.hourMinute'))
|
||||||
@ -95,7 +91,12 @@ export default {
|
|||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.date-time-range {
|
.date-time-range {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
flex-direction: column;
|
||||||
gap: 2px;
|
gap: 2px;
|
||||||
|
|
||||||
|
.date-time-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<client-only>
|
<client-only>
|
||||||
<div class="post-user-row">
|
<div class="post-user-row">
|
||||||
<user-teaser :user="post.author" :group="post.group" :date-time="post.createdAt" />
|
<user-teaser :user="post.author" :group="post.group" />
|
||||||
<hc-ribbon
|
<hc-ribbon
|
||||||
:class="[isPinned ? '--pinned' : '', post.image ? 'post-ribbon-w-img' : 'post-ribbon']"
|
:class="[isPinned ? '--pinned' : '', post.image ? 'post-ribbon-w-img' : 'post-ribbon']"
|
||||||
:text="ribbonText"
|
:text="ribbonText"
|
||||||
@ -25,25 +25,27 @@
|
|||||||
</div>
|
</div>
|
||||||
</client-only>
|
</client-only>
|
||||||
<h2 class="title hyphenate-text">{{ post.title }}</h2>
|
<h2 class="title hyphenate-text">{{ post.title }}</h2>
|
||||||
<ds-space
|
<client-only>
|
||||||
v-if="post && post.postType[0] === 'Event'"
|
<ds-space
|
||||||
margin-bottom="small"
|
v-if="post && post.postType[0] === 'Event'"
|
||||||
style="padding: 5px"
|
margin-bottom="small"
|
||||||
>
|
style="padding: 5px"
|
||||||
<location-teaser
|
>
|
||||||
class="event-info"
|
<location-teaser
|
||||||
size="small"
|
class="event-info"
|
||||||
:venue="post.eventVenue"
|
size="base"
|
||||||
:locationName="post.eventLocationName"
|
:venue="post.eventVenue"
|
||||||
:isOnline="post.eventIsOnline"
|
:locationName="post.eventLocationName"
|
||||||
/>
|
:isOnline="post.eventIsOnline"
|
||||||
<date-time-range
|
/>
|
||||||
class="event-info"
|
<date-time-range
|
||||||
size="small"
|
class="event-info"
|
||||||
:startDate="post.eventStart"
|
size="base"
|
||||||
:endDate="post.eventEnd"
|
:startDate="post.eventStart"
|
||||||
/>
|
:endDate="post.eventEnd"
|
||||||
</ds-space>
|
/>
|
||||||
|
</ds-space>
|
||||||
|
</client-only>
|
||||||
<!-- TODO: replace editor content with tiptap render view -->
|
<!-- TODO: replace editor content with tiptap render view -->
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
<div class="content hyphenate-text" v-html="excerpt" />
|
<div class="content hyphenate-text" v-html="excerpt" />
|
||||||
@ -98,6 +100,14 @@
|
|||||||
/>
|
/>
|
||||||
</client-only>
|
</client-only>
|
||||||
</footer>
|
</footer>
|
||||||
|
<client-only>
|
||||||
|
<div class="date-row" v-if="post.createdAt">
|
||||||
|
<span class="text">
|
||||||
|
<relative-date-time :date-time="post.createdAt" />
|
||||||
|
<slot name="dateTime"></slot>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</client-only>
|
||||||
</base-card>
|
</base-card>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</template>
|
</template>
|
||||||
@ -109,6 +119,7 @@ import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon'
|
|||||||
import DateTimeRange from '~/components/DateTimeRange/DateTimeRange'
|
import DateTimeRange from '~/components/DateTimeRange/DateTimeRange'
|
||||||
import HcRibbon from '~/components/Ribbon'
|
import HcRibbon from '~/components/Ribbon'
|
||||||
import LocationTeaser from '~/components/LocationTeaser/LocationTeaser'
|
import LocationTeaser from '~/components/LocationTeaser/LocationTeaser'
|
||||||
|
import RelativeDateTime from '~/components/RelativeDateTime'
|
||||||
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
import UserTeaser from '~/components/UserTeaser/UserTeaser'
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import PostMutations from '~/graphql/PostMutations'
|
import PostMutations from '~/graphql/PostMutations'
|
||||||
@ -123,6 +134,7 @@ export default {
|
|||||||
DateTimeRange,
|
DateTimeRange,
|
||||||
HcRibbon,
|
HcRibbon,
|
||||||
LocationTeaser,
|
LocationTeaser,
|
||||||
|
RelativeDateTime,
|
||||||
UserTeaser,
|
UserTeaser,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -251,6 +263,7 @@ export default {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
padding-bottom: $space-x-small;
|
||||||
|
|
||||||
> .hero-image {
|
> .hero-image {
|
||||||
border-top-left-radius: 5px;
|
border-top-left-radius: 5px;
|
||||||
@ -266,12 +279,6 @@ export default {
|
|||||||
margin-bottom: $space-small;
|
margin-bottom: $space-small;
|
||||||
}
|
}
|
||||||
|
|
||||||
& .event-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
> .footer {
|
> .footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
@ -301,5 +308,21 @@ export default {
|
|||||||
.user-teaser {
|
.user-teaser {
|
||||||
margin-bottom: $space-small;
|
margin-bottom: $space-small;
|
||||||
}
|
}
|
||||||
|
> .date-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: $space-small;
|
||||||
|
> .text {
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: $text-color-soft;
|
||||||
|
font-size: $font-size-small;
|
||||||
|
|
||||||
|
> .ds-text {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -14,12 +14,12 @@
|
|||||||
<nuxt-link v-if="linkToProfile" :to="userLink">
|
<nuxt-link v-if="linkToProfile" :to="userLink">
|
||||||
<span class="text">
|
<span class="text">
|
||||||
<span class="slug">{{ userSlug }}</span>
|
<span class="slug">{{ userSlug }}</span>
|
||||||
<span v-if="!userOnly" class="name">{{ userName }}</span>
|
<span class="name">{{ userName }}</span>
|
||||||
</span>
|
</span>
|
||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
<span v-else class="text">
|
<span v-else class="text">
|
||||||
<span class="slug">{{ userSlug }}</span>
|
<span class="slug">{{ userSlug }}</span>
|
||||||
<span v-if="!userOnly" class="name">{{ userName }}</span>
|
<span class="name">{{ userName }}</span>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="wide"> </span>
|
<span v-if="wide"> </span>
|
||||||
<span v-if="group">
|
<span v-if="group">
|
||||||
@ -34,12 +34,11 @@
|
|||||||
</nuxt-link>
|
</nuxt-link>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span v-if="!userOnly" class="text">
|
<span v-if="!userOnly && dateTime" class="text">
|
||||||
<base-icon name="clock" />
|
<base-icon name="clock" />
|
||||||
<relative-date-time :date-time="dateTime" />
|
<relative-date-time :date-time="dateTime" />
|
||||||
<slot name="dateTime"></slot>
|
<slot name="dateTime"></slot>
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="text">{{ userName }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -405,12 +405,6 @@ export default {
|
|||||||
filter: blur($blur-radius);
|
filter: blur($blur-radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
& .event-info {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blur-toggle {
|
.blur-toggle {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user