feat: import i18n and logo

This commit is contained in:
DIYgod 2023-03-09 14:25:14 +00:00
parent 07a2336450
commit 71949b6393
No known key found for this signature in database
6 changed files with 40 additions and 10 deletions

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="208" height="128" viewBox="0 0 208 128"><rect width="198" height="118" x="5" y="5" ry="10" stroke="#000" stroke-width="10" fill="none"/><path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"/></svg>

After

Width:  |  Height:  |  Size: 282 B

View File

@ -0,0 +1,11 @@
<svg viewBox="0 0 144 185"
xmlns="http://www.w3.org/2000/svg" class="_1sjywpl0 _1sjywpl1 bc5nciic bc5nci190 bc5nci4jc">
<path d="M0 71.6129C0 32.0622 32.0622 0 71.6129 0C111.164 0 143.226 32.0622 143.226 71.6129V174.118C143.226 180.128 138.354 185 132.343 185H10.8824C4.87222 185 0 180.128 0 174.118V71.6129Z" fill="url(#markGradient)"></path>
<path clip-rule="evenodd" d="M134.717 176.111V71.8216C134.717 36.8684 106.465 8.53326 71.6129 8.53326C36.7613 8.53326 8.50846 36.8684 8.50846 71.8216V176.111C8.50846 176.308 8.66719 176.467 8.86298 176.467H134.363C134.559 176.467 134.717 176.308 134.717 176.111ZM71.6129 0C32.0622 0 0 32.1556 0 71.8216V176.111C0 181.02 3.96809 185 8.86298 185H134.363C139.258 185 143.226 181.02 143.226 176.111V71.8216C143.226 32.1556 111.164 0 71.6129 0Z" fill="rgb(0, 122, 255)" fill-rule="evenodd"></path>
<defs>
<linearGradient gradientUnits="userSpaceOnUse" id="markGradient" x1="18.435" x2="143.747" y1="10.6666" y2="209.447">
<stop offset="0.265625" stop-color="#fff"></stop>
<stop offset="0.734375" stop-color="rgb(0, 122, 255)"></stop>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -139,5 +139,11 @@
"Learn more": "了解更多",
"Ended": "已结束",
"Upcoming": "即将开始",
"Ongoing": "进行中"
"Ongoing": "进行中",
"Import from Markdown files": "从 Markdown 文件导入",
"Import from Mirror.xyz": "从 Mirror.xyz 导入",
"Select Markdown Files": "选择 Markdown 文件",
"No files chosen": "未选择文件",
"No entries": "无条目",
"Preview your Mirror.xyz entries": "预览你的 Mirror.xyz 条目"
}

View File

@ -8,6 +8,7 @@ import { useTranslation, Trans } from "next-i18next"
import { getServerSideProps as getLayoutServerSideProps } from "~/components/dashboard/DashboardLayout.server"
import { GetServerSideProps } from "next"
import { serverSidePropsHandler } from "~/lib/server-side-props"
import { Image } from "~/components/ui/Image"
export const getServerSideProps: GetServerSideProps = serverSidePropsHandler(
async (ctx) => {
@ -32,10 +33,12 @@ export default function ImportPage() {
{
name: "Markdown files",
path: "/markdown",
icon: "markdown.svg",
},
{
name: "Mirror.xyz",
path: "/mirror",
icon: "mirror.xyz.svg",
},
]
@ -44,11 +47,20 @@ export default function ImportPage() {
<div className="min-w-[270px] max-w-screen-lg flex flex-col space-y-4">
{options.map((option) => (
<UniLink
className="prose p-6 bg-slate-100 rounded-lg relative"
className="prose p-6 bg-slate-100 rounded-lg relative flex items-center"
key={option.name}
href={router.asPath + option.path}
>
Import from {option.name}
<span className="w-8 h-8 mr-4">
<Image
fill
src={`/assets/${option.icon}`}
alt={option.name}
></Image>
</span>
<span className="font-medium">
{t(`Import from ${option.name}`)}
</span>
</UniLink>
))}
</div>

View File

@ -95,7 +95,7 @@ export default function ImportMarkdownPage() {
<div className="min-w-[270px] max-w-screen-lg flex flex-col space-y-4">
<Input
className="py-1"
label={`Select Markdown Files`}
label={t(`Select Markdown Files`) || ""}
id="notes"
type="file"
accept=".md"
@ -103,13 +103,13 @@ export default function ImportMarkdownPage() {
{...form.register("files", {})}
/>
<div>
<div className="form-label">Preview</div>
<div className="form-label">{t("Preview")}</div>
{notes?.length ? (
notes?.map((note) => (
<ImportPreview key={note.title} note={note} />
))
) : (
<div className="text-gray-500">No files chosen</div>
<div className="text-gray-500">{t("No files chosen")}</div>
)}
</div>
<div>

View File

@ -8,9 +8,7 @@ import { getServerSideProps as getLayoutServerSideProps } from "~/components/das
import { GetServerSideProps } from "next"
import { serverSidePropsHandler } from "~/lib/server-side-props"
import { useForm } from "react-hook-form"
import { Input } from "~/components/ui/Input"
import { Button } from "~/components/ui/Button"
import { readFiles } from "~/lib/read-files"
import { getSiteLink } from "~/lib/helpers"
import type { NoteMetadata } from "crossbell.js"
import { ImportPreview } from "~/components/dashboard/ImportPreview"
@ -88,13 +86,15 @@ export default function ImportMarkdownPage() {
<form onSubmit={handleSubmit}>
<div className="min-w-[270px] max-w-screen-lg flex flex-col space-y-4">
<div>
<div className="form-label">Preview your entries on Mirror.xyz</div>
<div className="form-label">
{t("Preview your Mirror.xyz entries")}
</div>
{notes?.length ? (
notes?.map((note: NoteMetadata) => (
<ImportPreview key={note.title} note={note} />
))
) : (
<div className="text-gray-500">No files chosen</div>
<div className="text-gray-500">{t("No entries")}</div>
)}
</div>
<div>