-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Innei <i@innei.in>
- Loading branch information
Showing
30 changed files
with
376 additions
and
95 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
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,3 @@ | ||
import { Loading } from '~/components/ui/loading' | ||
|
||
export default () => <Loading useDefaultLoadingText /> |
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,4 +1,88 @@ | ||
'use client' | ||
|
||
import { useEffect } from 'react' | ||
import { Balancer } from 'react-wrap-balancer' | ||
import type { Image, PostModel } from '@mx-space/api-client' | ||
|
||
import { ReadIndicator } from '~/components/common/ReadIndicator' | ||
import { useSetHeaderMetaInfo } from '~/components/layout/header/hooks' | ||
import { Loading } from '~/components/ui/loading' | ||
import { Markdown } from '~/components/ui/markdown' | ||
import { PostActionAside } from '~/components/widgets/post/PostActionAside' | ||
import { PostMetaBar } from '~/components/widgets/post/PostMetaBar' | ||
import { SubscribeBell } from '~/components/widgets/subscribe/SubscribeBell' | ||
import { TocAside, TocAutoScroll } from '~/components/widgets/toc' | ||
import { XLogInfoForPost, XLogSummaryForPost } from '~/components/widgets/xlog' | ||
import { useCurrentPostData } from '~/hooks/data/use-post' | ||
import { noopArr } from '~/lib/noop' | ||
import { MarkdownImageRecordProvider } from '~/providers/article/MarkdownImageRecordProvider' | ||
import { LayoutRightSidePortal } from '~/providers/shared/LayoutRightSideProvider' | ||
import { WrappedElementProvider } from '~/providers/shared/WrappedElementProvider' | ||
|
||
const useHeaderMeta = (data?: PostModel | null) => { | ||
const setHeader = useSetHeaderMetaInfo() | ||
useEffect(() => { | ||
if (!data) return | ||
setHeader({ | ||
title: data.title, | ||
description: | ||
data.category.name + | ||
(data.tags.length > 0 ? ` / ${data.tags.join(', ')}` : ''), | ||
slug: `${data.category.slug}/${data.slug}`, | ||
}) | ||
}, [ | ||
data?.title, | ||
data?.category.name, | ||
data?.tags.length, | ||
data?.category.slug, | ||
data?.slug, | ||
]) | ||
} | ||
export default () => { | ||
return <div>Test</div> | ||
const data = useCurrentPostData() | ||
|
||
useHeaderMeta(data) | ||
if (!data) { | ||
return <Loading useDefaultLoadingText /> | ||
} | ||
|
||
return ( | ||
<div> | ||
<article className="prose"> | ||
<header className="mb-8"> | ||
<h1> | ||
<Balancer>{data.title}</Balancer> | ||
</h1> | ||
<div> | ||
<PostMetaBar data={data} /> | ||
</div> | ||
|
||
<XLogSummaryForPost /> | ||
</header> | ||
<WrappedElementProvider> | ||
<MarkdownImageRecordProvider | ||
images={data.images || (noopArr as Image[])} | ||
> | ||
<main className="relative"> | ||
<Markdown value={data.text} /> | ||
</main> | ||
</MarkdownImageRecordProvider> | ||
|
||
<LayoutRightSidePortal> | ||
<TocAside | ||
className="sticky top-[120px] ml-4 mt-[120px]" | ||
treeClassName="max-h-[calc(100vh-6rem-4.5rem-300px)] h-[calc(100vh-6rem-4.5rem-300px)] min-h-[120px] relative" | ||
accessory={ReadIndicator} | ||
> | ||
<PostActionAside className="translate-y-full" /> | ||
</TocAside> | ||
<TocAutoScroll /> | ||
</LayoutRightSidePortal> | ||
</WrappedElementProvider> | ||
</article> | ||
|
||
<SubscribeBell defaultType="post_c" /> | ||
<XLogInfoForPost /> | ||
</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
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 |
---|---|---|
|
@@ -85,4 +85,8 @@ | |
input[type='checkbox']:read-only { | ||
@apply cursor-not-allowed; | ||
} | ||
|
||
code { | ||
@apply font-mono; | ||
} | ||
} |
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.
456b9d5
There was a problem hiding this comment.
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:
springtide – ./
springtide-git-main-innei.vercel.app
springtide-innei.vercel.app
innei.in
springtide.vercel.app