From fcbca7ae1c5668722b84a32e66ce8a590580bb87 Mon Sep 17 00:00:00 2001 From: Sam Carlton Date: Fri, 29 Apr 2022 13:30:54 -0500 Subject: [PATCH] Add last-updated to default listing template --- src/components/default-listing.astro | 5 +++ .../listing-parts/last-updated.astro | 31 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 src/components/listing-parts/last-updated.astro diff --git a/src/components/default-listing.astro b/src/components/default-listing.astro index f1e1178..a0faffa 100644 --- a/src/components/default-listing.astro +++ b/src/components/default-listing.astro @@ -10,6 +10,7 @@ import RelatedLinks from '~/src/components/listing-parts/related-links.astro' import Devices from '~/src/components/listing-parts/devices.astro' import RelatedVideos from '~/src/components/listing-parts/related-videos.astro' import Bundles from '~/src/components/listing-parts/bundles.astro' +import LastUpdated from '~/src/components/listing-parts/last-updated.astro' import AllUpdatesSubscribe from '~/components/all-updates-subscribe.vue' @@ -65,4 +66,8 @@ const details = new ListingDetails( listing ) listing={ listing } /> + + diff --git a/src/components/listing-parts/last-updated.astro b/src/components/listing-parts/last-updated.astro new file mode 100644 index 0000000..a2c2a23 --- /dev/null +++ b/src/components/listing-parts/last-updated.astro @@ -0,0 +1,31 @@ +--- +import { makeLastUpdatedFriendly } from '~/helpers/parse-date.js' + +const { + listing +} = Astro.props + +console.log( 'listing.lastUpdated', listing.lastUpdated ) + +const lastUpdatedFriendly = makeLastUpdatedFriendly( listing.lastUpdated ) + +--- +
+ { lastUpdatedFriendly !== null && +
+ +
+ } + + Report Update +
+