feat: PublishedModal component

This commit is contained in:
DIYgod
2023-08-24 18:37:54 +01:00
parent b34856fa2e
commit c0d4cc133c
5 changed files with 59 additions and 79 deletions
@@ -10,12 +10,12 @@ import { useQueryClient } from "@tanstack/react-query"
import { DashboardMain } from "~/components/dashboard/DashboardMain"
import { PublishButton } from "~/components/dashboard/PublishButton"
import PublishedModal from "~/components/dashboard/PublishedModal"
import { Button } from "~/components/ui/Button"
import { FieldLabel } from "~/components/ui/FieldLabel"
import { ImageUploader } from "~/components/ui/ImageUploader"
import { Input } from "~/components/ui/Input"
import { ModalContentProps, useModalStack } from "~/components/ui/ModalStack"
import { UniLink } from "~/components/ui/UniLink"
import { useModalStack } from "~/components/ui/ModalStack"
import { initialEditorState, useEditorState } from "~/hooks/useEditorState"
import { useBeforeMounted } from "~/hooks/useSyncOnce"
import { showConfetti } from "~/lib/confetti"
@@ -433,33 +433,3 @@ const EditorExtraProperties = memo(() => {
})
EditorExtraProperties.displayName = "EditorExtraProperties"
const PublishedModal = ({
dismiss,
transactionUrl,
}: ModalContentProps<{
transactionUrl: string
}>) => {
const { t } = useTranslation("dashboard")
return (
<>
<div className="p-5">
{t(
"Your post has been securely stored on the blockchain. Now you may want to",
)}
<ul className="list-disc pl-5 mt-2 space-y-1">
<li>
<UniLink className="text-accent" href={transactionUrl}>
{t("View the transaction")}
</UniLink>
</li>
</ul>
</div>
<div className="h-16 border-t flex items-center px-5">
<Button isBlock onClick={() => dismiss()}>
{t("Got it, thanks!")}
</Button>
</div>
</>
)
}
@@ -25,12 +25,13 @@ import { useQueryClient } from "@tanstack/react-query"
import { DashboardMain } from "~/components/dashboard/DashboardMain"
import { OptionsButton } from "~/components/dashboard/OptionsButton"
import { PublishButton } from "~/components/dashboard/PublishButton"
import PublishedModal from "~/components/dashboard/PublishedModal"
import { Button } from "~/components/ui/Button"
import { EditorToolbar } from "~/components/ui/EditorToolbar"
import { FieldLabel } from "~/components/ui/FieldLabel"
import { ImageUploader } from "~/components/ui/ImageUploader"
import { Input } from "~/components/ui/Input"
import { ModalContentProps, useModalStack } from "~/components/ui/ModalStack"
import { useModalStack } from "~/components/ui/ModalStack"
import { Switch } from "~/components/ui/Switch"
import { TagInput } from "~/components/ui/TagInput"
import { UniLink } from "~/components/ui/UniLink"
@@ -986,47 +987,3 @@ const EditorAdvancedModal: FC<{
</div>
)
}
const PublishedModal = ({
dismiss,
postUrl,
transactionUrl,
twitterShareUrl,
}: ModalContentProps<{
postUrl: string
transactionUrl: string
twitterShareUrl: string
}>) => {
const { t } = useTranslation("dashboard")
return (
<>
<div className="p-5">
{t(
"Your post has been securely stored on the blockchain. Now you may want to",
)}
<ul className="list-disc pl-5 mt-2 space-y-1">
<li>
<UniLink className="text-accent" href={postUrl}>
{t("View the post")}
</UniLink>
</li>
<li>
<UniLink className="text-accent" href={transactionUrl}>
{t("View the transaction")}
</UniLink>
</li>
<li>
<UniLink className="text-accent" href={twitterShareUrl}>
{t("Share to Twitter")}
</UniLink>
</li>
</ul>
</div>
<div className="h-16 border-t flex items-center px-5">
<Button isBlock onClick={() => dismiss()}>
{t("Got it, thanks!")}
</Button>
</div>
</>
)
}
+1 -1
View File
@@ -225,7 +225,7 @@ export const PagesManager = ({ type }: { type: NoteType }) => {
{t(`New ${type.charAt(0).toUpperCase() + type.slice(1)}`)}
</span>
</Button>
{type !== "portfolio" && (
{(type === "post" || type === "page") && (
<span className="hidden sm:inline-flex">
<Tooltip
label={t("Import markdown file with front matter supported")}
@@ -0,0 +1,53 @@
import { Button } from "~/components/ui/Button"
import { ModalContentProps } from "~/components/ui/ModalStack"
import { UniLink } from "~/components/ui/UniLink"
import { useTranslation } from "~/lib/i18n/client"
export default function PublishedModal({
dismiss,
postUrl,
transactionUrl,
twitterShareUrl,
}: ModalContentProps<{
postUrl?: string
transactionUrl: string
twitterShareUrl?: string
}>) {
const { t } = useTranslation("dashboard")
return (
<>
<div className="p-5">
{t(
"Your publication has been securely stored on the blockchain. Now you may want to",
)}
<ul className="list-disc pl-5 mt-2 space-y-1">
{postUrl && (
<li>
<UniLink className="text-accent" href={postUrl}>
{t("View the post")}
</UniLink>
</li>
)}
<li>
<UniLink className="text-accent" href={transactionUrl}>
{t("View the transaction")}
</UniLink>
</li>
{twitterShareUrl && (
<li>
<UniLink className="text-accent" href={twitterShareUrl}>
{t("Share to Twitter")}
</UniLink>
</li>
)}
</ul>
</div>
<div className="h-16 border-t flex items-center px-5">
<Button isBlock onClick={() => dismiss()}>
{t("Got it, thanks!")}
</Button>
</div>
</>
)
}
+1 -1
View File
@@ -141,7 +141,7 @@
"More": "更多",
"Meet New Friends": "认识新朋友",
"Need help?": "需要帮助?",
"Your post has been securely stored on the blockchain. Now you may want to": "你的文章已经安全地存储在区块链上。现在你可能想要",
"Your publication has been securely stored on the blockchain. Now you may want to": "你的发布已经安全地存储在区块链上。现在你可能想要",
"View the post": "查看文章",
"View the transaction": "查看交易",
"Share to Twitter": "分享到 Twitter",