diff --git a/webapp/components/DateTimeRange/DateTimeRange.vue b/webapp/components/DateTimeRange/DateTimeRange.vue new file mode 100644 index 000000000..de9b442c5 --- /dev/null +++ b/webapp/components/DateTimeRange/DateTimeRange.vue @@ -0,0 +1,101 @@ + + + + + + {{ getStartDateString }} + + + + {{ + getStartTimeString + + (this.endDateAsDate && isSameDayLocal ? '—' + getEndTimeString : '') + }} + + + + — + + + + {{ getEndDateString }} + + + + {{ getEndTimeString }} + + + + + + + + + diff --git a/webapp/components/LocationTeaser/LocationTeaser.vue b/webapp/components/LocationTeaser/LocationTeaser.vue new file mode 100644 index 000000000..ede0457ab --- /dev/null +++ b/webapp/components/LocationTeaser/LocationTeaser.vue @@ -0,0 +1,52 @@ + + + + {{ venue }} + — + + {{ locationName }} + + + {{ $t('post.viewEvent.eventIsOnline') }} + + + + + + + diff --git a/webapp/components/PostTeaser/PostTeaser.vue b/webapp/components/PostTeaser/PostTeaser.vue index 604fb121f..d852d9e23 100644 --- a/webapp/components/PostTeaser/PostTeaser.vue +++ b/webapp/components/PostTeaser/PostTeaser.vue @@ -11,7 +11,6 @@ }" :highlight="isPinned" > - @@ -31,25 +30,19 @@ margin-bottom="small" style="padding: 5px" > - - - - - - {{ $t('post.viewEvent.eventIsOnline') }} - - - {{ post.eventLocationName }} - - - - - - - {{ getEventDateString }} - - - + + @@ -113,12 +106,13 @@ import Category from '~/components/Category' import ContentMenu from '~/components/ContentMenu/ContentMenu' import CounterIcon from '~/components/_new/generic/CounterIcon/CounterIcon' +import DateTimeRange from '~/components/DateTimeRange/DateTimeRange' import HcRibbon from '~/components/Ribbon' +import LocationTeaser from '~/components/LocationTeaser/LocationTeaser' import UserTeaser from '~/components/UserTeaser/UserTeaser' import { mapGetters } from 'vuex' import PostMutations from '~/graphql/PostMutations' import { postMenuModalsData, deletePostMutation } from '~/components/utils/PostHelpers' -import { format } from 'date-fns' export default { name: 'PostTeaser', @@ -126,7 +120,9 @@ export default { Category, ContentMenu, CounterIcon, + DateTimeRange, HcRibbon, + LocationTeaser, UserTeaser, }, props: { @@ -185,15 +181,6 @@ export default { if (this.post.postType[0] === 'Event') return this.$t('post.event') return this.$t('post.name') }, - getEventDateString() { - if (this.post.eventEnd) { - const eventStart = format(new Date(this.post.eventStart), 'dd.MM.') - const eventEnd = format(new Date(this.post.eventEnd), 'dd.MM.yyyy') - return `${eventStart} - ${eventEnd}` - } else { - return format(new Date(this.post.eventStart), 'dd.MM.yyyy') - } - }, }, methods: { async deletePostCallback() { @@ -228,6 +215,7 @@ export default { }, } +