@@ -20,6 +20,7 @@ import * as schema from "@/db/schema";
20
20
import { eq , desc , and } from "drizzle-orm" ;
21
21
import db from "@/db" ;
22
22
import { parseMetadata } from "@/services/metadata" ;
23
+ import { formatRecord } from "@/lib/record" ;
23
24
24
25
export async function RecordDetail ( { clerkOrganizationId, id } : { clerkOrganizationId : string ; id : string } ) {
25
26
const record = await db . query . records . findFirst ( {
@@ -53,7 +54,7 @@ export async function RecordDetail({ clerkOrganizationId, id }: { clerkOrganizat
53
54
< div >
54
55
< Header >
55
56
< HeaderContent >
56
- < HeaderPrimary className = { cn ( record . deletedAt && "line-through" ) } > { record . name } </ HeaderPrimary >
57
+ < HeaderPrimary className = { cn ( record . deletedAt && "line-through" ) } > { formatRecord ( record ) } </ HeaderPrimary >
57
58
< HeaderSecondary > { record . entity } </ HeaderSecondary >
58
59
</ HeaderContent >
59
60
< HeaderActions className = "flex items-center gap-4" >
@@ -188,29 +189,33 @@ export async function RecordDetail({ clerkOrganizationId, id }: { clerkOrganizat
188
189
</ >
189
190
) }
190
191
< Separator className = "my-2" />
191
- < Section >
192
- < SectionTitle > Content</ SectionTitle >
193
- < SectionContent className = "grid gap-3" >
194
- < dl className = "grid gap-3" >
195
- { record . externalUrls && record . externalUrls . length > 0 && (
196
- < div className = "grid grid-cols-2 gap-4" >
197
- < dt className = "text-stone-500 dark:text-zinc-500" > External Links</ dt >
198
- < dd >
199
- { record . externalUrls . map ( ( url , index ) => (
200
- < Button key = { index } asChild variant = "link" className = "text-md -mx-4 -my-2 font-normal" >
201
- < Link href = { url } target = "_blank" rel = "noopener noreferrer" >
202
- { formatLink ( url ) } < ExternalLink className = "h-4 w-4" />
203
- </ Link >
204
- </ Button >
205
- ) ) }
206
- </ dd >
207
- </ div >
208
- ) }
209
- </ dl >
210
- < Code > { record . text } </ Code >
211
- { record . imageUrls . length > 0 ? < RecordImages imageUrls = { record . imageUrls } /> : null }
212
- </ SectionContent >
213
- </ Section >
192
+ { record . externalUrls . length > 0 ||
193
+ record . text ||
194
+ ( record . imageUrls . length > 0 && (
195
+ < Section >
196
+ < SectionTitle > Content</ SectionTitle >
197
+ < SectionContent className = "grid gap-3" >
198
+ < dl className = "grid gap-3" >
199
+ { record . externalUrls . length > 0 && (
200
+ < div className = "grid grid-cols-2 gap-4" >
201
+ < dt className = "text-stone-500 dark:text-zinc-500" > External Links</ dt >
202
+ < dd >
203
+ { record . externalUrls . map ( ( url , index ) => (
204
+ < Button key = { index } asChild variant = "link" className = "text-md -mx-4 -my-2 font-normal" >
205
+ < Link href = { url } target = "_blank" rel = "noopener noreferrer" >
206
+ { formatLink ( url ) } < ExternalLink className = "h-4 w-4" />
207
+ </ Link >
208
+ </ Button >
209
+ ) ) }
210
+ </ dd >
211
+ </ div >
212
+ ) }
213
+ </ dl >
214
+ { record . text && < Code > { record . text } </ Code > }
215
+ { record . imageUrls . length > 0 ? < RecordImages imageUrls = { record . imageUrls } /> : null }
216
+ </ SectionContent >
217
+ </ Section >
218
+ ) ) }
214
219
{ record . moderations . length > 0 && (
215
220
< >
216
221
< Separator className = "my-2" />
0 commit comments