File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { memo } from "react";
7
7
import Quote from "@/components/Shared/Embed/Quote" ;
8
8
import Markup from "@/components/Shared/Markup" ;
9
9
import Attachments from "@/components/Shared/Post/Attachments" ;
10
+ import Event from "@/components/Shared/Post/Event" ;
10
11
import Oembed from "@/components/Shared/Post/Oembed" ;
11
12
import PostLink from "@/components/Shared/Post/PostLink" ;
12
13
import Video from "@/components/Shared/Post/Video" ;
@@ -51,6 +52,7 @@ const PostBody = ({
51
52
const showLive = metadata . __typename === "LivestreamMetadata" ;
52
53
// Show attachments if it's there
53
54
const showAttachments = filteredAttachments . length > 0 || filteredAsset ;
55
+ const showEvent = metadata . __typename === "EventMetadata" ;
54
56
// Show sharing link
55
57
const showSharingLink = metadata . __typename === "LinkMetadata" ;
56
58
const showOembed =
@@ -90,6 +92,7 @@ const PostBody = ({
90
92
) : null }
91
93
{ showOembed ? < Oembed url = { urls [ 0 ] } /> : null }
92
94
{ showSharingLink ? < Oembed url = { metadata . sharingLink } /> : null }
95
+ { showEvent ? < Event metadata = { metadata } /> : null }
93
96
{ targetPost . quoteOf ? < Quote post = { targetPost . quoteOf } /> : null }
94
97
</ div >
95
98
) ;
Original file line number Diff line number Diff line change
1
+ import type { EventMetadataFragment } from "@hey/indexer" ;
2
+ import dayjs from "dayjs" ;
3
+ import { Card , H6 } from "@/components/Shared/UI" ;
4
+ import stopEventPropagation from "@/helpers/stopEventPropagation" ;
5
+
6
+ interface EventProps {
7
+ metadata : EventMetadataFragment ;
8
+ }
9
+
10
+ const Event = ( { metadata } : EventProps ) => {
11
+ const handleClick = ( event : React . MouseEvent < HTMLAnchorElement > ) => {
12
+ stopEventPropagation ( event ) ;
13
+ } ;
14
+
15
+ return (
16
+ < Card className = "mt-3 space-y-1 p-3" forceRounded >
17
+ { metadata . title ? < H6 > { metadata . title } </ H6 > : null }
18
+ < div className = "text-gray-500 text-sm dark:text-gray-400" >
19
+ { dayjs ( metadata . startsAt ) . format ( "MMM D, YYYY h:mm A" ) } -{ " " }
20
+ { dayjs ( metadata . endsAt ) . format ( "MMM D, YYYY h:mm A" ) }
21
+ </ div >
22
+ { metadata . location ?. physical ? (
23
+ < div className = "text-gray-500 text-sm dark:text-gray-400" >
24
+ { metadata . location . physical }
25
+ </ div >
26
+ ) : null }
27
+ { metadata . location ?. virtual ? (
28
+ < a
29
+ className = "block text-indigo-500 text-sm"
30
+ href = { metadata . location . virtual }
31
+ onClick = { handleClick }
32
+ rel = "noreferrer noopener"
33
+ target = "_blank"
34
+ >
35
+ { metadata . location . virtual }
36
+ </ a >
37
+ ) : null }
38
+ </ Card >
39
+ ) ;
40
+ } ;
41
+
42
+ export default Event ;
You can’t perform that action at this time.
0 commit comments