-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
214 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./wave-view-details"; | ||
export * from "./wave-view-discussion"; |
46 changes: 46 additions & 0 deletions
46
src/app/waves/[author]/[permlink]/_components/wave-view-details.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"use client"; | ||
|
||
import { WavesListItemHeader } from "@/app/waves/_components/waves-list-item-header"; | ||
import { renderPostBody } from "@ecency/render-helper"; | ||
import { useRenderWaveBody, WaveActions, WaveForm } from "@/features/waves"; | ||
import { motion } from "framer-motion"; | ||
import { WaveEntry } from "@/entities"; | ||
import React, { useRef } from "react"; | ||
import useMount from "react-use/lib/useMount"; | ||
|
||
interface Props { | ||
entry: WaveEntry; | ||
} | ||
|
||
export function WaveViewDetails({ entry }: Props) { | ||
const renderAreaRef = useRef<HTMLDivElement>(null); | ||
const renderBody = useRenderWaveBody(renderAreaRef, entry, {}); | ||
|
||
useMount(() => renderBody()); | ||
const status = "default"; | ||
|
||
return ( | ||
<motion.div | ||
initial={{ opacity: 0, scale: 0.95 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
className="relative rounded-2xl bg-white dark:bg-dark-200 cursor-pointer" | ||
> | ||
<WavesListItemHeader entry={entry} hasParent={false} pure={false} status={status} /> | ||
<div | ||
className="p-4 thread-render" | ||
ref={renderAreaRef} | ||
dangerouslySetInnerHTML={{ __html: renderPostBody(entry!) }} | ||
/> | ||
<WaveActions | ||
status={status} | ||
entry={entry} | ||
onEntryView={() => {}} | ||
hasParent={false} | ||
pure={false} | ||
onEdit={() => {}} | ||
/> | ||
<div className="border-t border-[--border-color]"></div> | ||
<WaveForm entry={undefined} replySource={entry} /> | ||
</motion.div> | ||
); | ||
} |
24 changes: 24 additions & 0 deletions
24
src/app/waves/[author]/[permlink]/_components/wave-view-discussion.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client"; | ||
|
||
import { WaveEntry } from "@/entities"; | ||
import { WavesListItem } from "@/app/waves/_components"; | ||
import { useWaveDiscussionsList } from "@/features/waves"; | ||
|
||
interface Props { | ||
entry: WaveEntry; | ||
} | ||
|
||
export function WaveViewDiscussion({ entry }: Props) { | ||
const data = useWaveDiscussionsList(entry); | ||
|
||
return ( | ||
<div> | ||
<div className="p-4 text-sm font-semibold opacity-50">Replies</div> | ||
<div> | ||
{data?.map((item, i) => ( | ||
<WavesListItem key={item.post_id} item={item as WaveEntry} i={i} /> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
"use client"; | ||
|
||
import { WavesListItem } from "@/app/waves/_components"; | ||
import { EcencyEntriesCacheManagement } from "@/core/caches"; | ||
import { notFound } from "next/navigation"; | ||
import { WaveViewDetails, WaveViewDiscussion } from "@/app/waves/[author]/[permlink]/_components"; | ||
import { WaveEntry } from "@/entities"; | ||
import { dehydrate, HydrationBoundary } from "@tanstack/react-query"; | ||
import { getQueryClient } from "@/core/react-query"; | ||
|
||
interface Props { | ||
params: { | ||
params: Promise<{ | ||
author: string; | ||
permlink: string; | ||
}; | ||
}>; | ||
} | ||
|
||
export default function WaveViewPage({ params: { author, permlink } }: Props) { | ||
const { data } = EcencyEntriesCacheManagement.getEntryQueryByPath( | ||
export default async function WaveViewPage({ params }: Props) { | ||
const { author, permlink } = await params; | ||
|
||
const data = (await EcencyEntriesCacheManagement.getEntryQueryByPath( | ||
author, | ||
permlink | ||
).useClientQuery(); | ||
).prefetch()) as WaveEntry; | ||
|
||
if (!data) { | ||
return notFound(); | ||
} | ||
|
||
return <div>{data && <WavesListItem item={data as WaveEntry} i={0} />}</div>; | ||
return ( | ||
<HydrationBoundary state={dehydrate(getQueryClient())}> | ||
<div className="flex flex-col gap-4 lg:gap-6 xl:gap-8"> | ||
<WaveViewDetails entry={data} /> | ||
<WaveViewDiscussion entry={data} /> | ||
</div> | ||
</HydrationBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.