1+ import React from 'react'
12import { Container } from '~/components/ui/container'
23import { PageHeader } from '~/components/ui/page-header'
34import { Image , Zoom } from '~/components/ui/image'
@@ -40,7 +41,7 @@ interface Resource {
4041}
4142
4243async function fetchPublicMoment ( ) : Promise < Moment [ ] > {
43- const url = `${ SITE_METADATA . momentApi } /api/v1/memos?visibility=PUBLIC`
44+ const url = `${ SITE_METADATA . memosApi } /api/v1/memos?visibility=PUBLIC`
4445 if ( ! url ) return [ ]
4546 const res = await fetch ( url , { next : { revalidate : 60 } } )
4647 if ( ! res . ok ) return [ ]
@@ -56,13 +57,13 @@ function getResourceUrl(resource: Resource): string | null {
5657 // resource.name like: "resources/7JoNrgZzCgvtWeLVyjMpT6"
5758 const id = resource . name ?. split ( '/' ) ?. [ 1 ]
5859 if ( ! id ) return null
59- return `${ SITE_METADATA . momentApi } /file/${ resource . name } /${ resource . filename } `
60+ return `${ SITE_METADATA . memosApi } /file/${ resource . name } /${ resource . filename } `
6061}
6162
6263export default async function MomentPage ( ) {
6364 const moments = await fetchPublicMoment ( )
6465
65- if ( ! SITE_METADATA . momentApi ) {
66+ if ( ! SITE_METADATA . memosApi ) {
6667 return (
6768 < Container className = "py-6" >
6869 < PageHeader
@@ -246,7 +247,11 @@ function renderContent(moment: Moment) {
246247 )
247248 }
248249 if ( node . type === 'LINE_BREAK' ) {
249- return idx !== 0 && moment . nodes ?. [ idx - 1 ] . type === 'LINE_BREAK' ? < br key = { idx } /> : < > </ >
250+ return idx !== 0 && moment . nodes ?. [ idx - 1 ] . type === 'LINE_BREAK' ? (
251+ < br key = { `br_${ idx } ` } />
252+ ) : (
253+ < React . Fragment key = { `empty_${ idx } ` } > </ React . Fragment >
254+ )
250255 }
251256 return null
252257 } )
0 commit comments