Skip to content

Commit

Permalink
fix: summary component in preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Aug 20, 2023
1 parent 9dc5536 commit 28c37bb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 80 deletions.
13 changes: 7 additions & 6 deletions src/app/preview/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ export default function PreviewPage() {
const search = location.search
const searchParams = new URLSearchParams(search)

let targinOrigin = searchParams.get('origin')
let targetOrigin = searchParams.get('origin')

if (!targinOrigin) {
if (!targetOrigin) {
return
}
targinOrigin = decodeURIComponent(targinOrigin)
window.opener.postMessage('Preview Page Ready', targinOrigin)
targetOrigin = decodeURIComponent(targetOrigin)
window.opener.postMessage('Preview Page Ready', targetOrigin)

const handler = debounce((e) => {
if (e.origin !== targinOrigin) {
if (e.origin !== targetOrigin) {
return
}

Expand All @@ -93,7 +93,6 @@ export default function PreviewPage() {

const previewData = useAtomValue(previewDataAtom)

// console.log(previewData)
if (!previewData) {
return null
}
Expand Down Expand Up @@ -166,6 +165,8 @@ const NotePreview = () => {
next: undefined,
data: {
...data,

created: new Date().toISOString(),
images: data.images ?? [],
count: data.count ?? {
read: 0,
Expand Down
5 changes: 3 additions & 2 deletions src/components/widgets/peek/NotePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import { queries } from '~/queries/definition'

import { NoteHideIfSecret, NoteMetaBar, NoteRootBanner } from '../note'
import { BanCopyWrapper } from '../shared/BanCopyWrapper'
import { SummarySwitcher } from '../shared/SummarySwitcher'
import { XLogSummary } from '../xlog'
import { getCidForBaseModel } from '../xlog/utils'

interface NotePreviewProps {
noteId: number
Expand Down Expand Up @@ -56,7 +57,7 @@ export const NotePreview: FC<NotePreviewProps> = (props) => {
</header>

<NoteHideIfSecret>
<SummarySwitcher data={data.data} />
<XLogSummary cid={getCidForBaseModel(data)} />
<WrappedElementProvider>
<BanCopyWrapper>
<NoteMarkdownImageRecordProvider>
Expand Down
8 changes: 3 additions & 5 deletions src/components/widgets/peek/PostPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { WrappedElementProvider } from '~/providers/shared/WrappedElementProvide
import { queries } from '~/queries/definition'

import { PostOutdate } from '../post'
import { SummarySwitcher } from '../shared/SummarySwitcher'
import { XLogSummary } from '../xlog'
import { getCidForBaseModel } from '../xlog/utils'

interface PostPreviewProps {
category: string
Expand All @@ -43,11 +44,8 @@ export const PostPreview: FC<PostPreviewProps> = (props) => {
<h1 className="text-center">
<Balancer>{data.title}</Balancer>
</h1>

<PostMetaBarInternal className="mb-8 justify-center" />

<SummarySwitcher data={data} />

<XLogSummary cid={getCidForBaseModel(data)} />
<PostOutdate />
</header>
<WrappedElementProvider>
Expand Down
2 changes: 2 additions & 0 deletions src/components/widgets/shared/SummarySwitcher.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { memo } from 'react'
import type { FC } from 'react'
import type { AiSummaryProps } from '../ai/Summary'
Expand Down
67 changes: 0 additions & 67 deletions src/components/widgets/xlog/XLogSummaryRSC.tsx

This file was deleted.

1 comment on commit 28c37bb

@vercel
Copy link

@vercel vercel bot commented on 28c37bb Aug 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-innei.vercel.app
springtide.vercel.app
innei.in
shiro-git-main-innei.vercel.app

Please sign in to comment.