feat: optimize new user guide
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
import { Input } from "~/components/ui/input"
|
||||
import { useCurrentModal } from "~/components/ui/modal"
|
||||
import { getFetchErrorMessage } from "~/lib/error-parser"
|
||||
import { cn } from "~/lib/utils"
|
||||
import confettiUrl from "~/lottie/confetti.lottie?url"
|
||||
import { auth } from "~/queries/auth"
|
||||
import { useInvitationMutation } from "~/queries/invitations"
|
||||
@@ -26,7 +27,13 @@ const formSchema = z.object({
|
||||
code: z.string().min(1),
|
||||
})
|
||||
const absoluteConfettiUrl = new URL(confettiUrl, import.meta.url).href
|
||||
export const ActivationModalContent = () => {
|
||||
export const ActivationModalContent = ({
|
||||
className,
|
||||
hideDescription,
|
||||
}: {
|
||||
className?: string
|
||||
hideDescription?: boolean
|
||||
}) => {
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
})
|
||||
@@ -64,14 +71,16 @@ export const ActivationModalContent = () => {
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
className="w-[512px] max-w-full overflow-hidden px-0.5"
|
||||
className={cn("w-[512px] max-w-full overflow-hidden px-0.5", className)}
|
||||
>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="code"
|
||||
render={({ field }) => (
|
||||
<FormItem className="flex flex-col items-center gap-2 md:block">
|
||||
<FormLabel className="!text-foreground">{t("activation.description")}</FormLabel>
|
||||
{!hideDescription && (
|
||||
<FormLabel className="!text-foreground">{t("activation.description")}</FormLabel>
|
||||
)}
|
||||
<FormControl>
|
||||
<Input
|
||||
className="font-mono placeholder:font-default"
|
||||
|
||||
@@ -2,12 +2,18 @@ import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { useAuthQuery } from "~/hooks/common"
|
||||
import { isASCII } from "~/lib/utils"
|
||||
import { cn, isASCII } from "~/lib/utils"
|
||||
import { Queries } from "~/queries"
|
||||
|
||||
import { RecommendationCard } from "./recommendations-card"
|
||||
|
||||
export function Recommendations() {
|
||||
export function Recommendations({
|
||||
hideTitle,
|
||||
className,
|
||||
}: {
|
||||
hideTitle?: boolean
|
||||
className?: string
|
||||
}) {
|
||||
const rsshubPopular = useAuthQuery(
|
||||
Queries.discover.rsshubCategory({
|
||||
category: "popular",
|
||||
@@ -56,10 +62,10 @@ export function Recommendations() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="mt-8">
|
||||
<div className="text-center text-lg font-bold">{t("discover.popular")}</div>
|
||||
<div className={cn(!hideTitle && "mt-8")}>
|
||||
{!hideTitle && <div className="text-center text-lg font-bold">{t("discover.popular")}</div>}
|
||||
|
||||
<div className="mt-4 grid grid-cols-3 gap-4 px-3">
|
||||
<div className={cn("mt-4 grid grid-cols-3 gap-4 px-3", className)}>
|
||||
{keys.map((key) => (
|
||||
<RecommendationCard key={key} data={data[key]} routePrefix={key} />
|
||||
))}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { atom } from "jotai"
|
||||
|
||||
import { createAtomHooks } from "~/lib/jotai"
|
||||
|
||||
export const [
|
||||
,
|
||||
useHaveUsedOtherRSSReaderAtom,
|
||||
useHaveUsedOtherRSSReader,
|
||||
,
|
||||
getHaveUsedOtherRSSReader,
|
||||
setHaveUsedOtherRSSReader,
|
||||
] = createAtomHooks(atom(false))
|
||||
@@ -12,16 +12,15 @@ import { mountLottie } from "~/components/ui/lottie-container"
|
||||
import { Markdown } from "~/components/ui/markdown/Markdown"
|
||||
import { useI18n } from "~/hooks/common"
|
||||
import confettiUrl from "~/lottie/confetti.lottie?url"
|
||||
import { MyWalletSection } from "~/modules/power/my-wallet-section"
|
||||
import { settings } from "~/queries/settings"
|
||||
|
||||
import { ActivationModalContent } from "../activation/ActivationModalContent"
|
||||
import { DiscoverImport } from "../discover/import"
|
||||
import { ProfileSettingForm } from "../profile/profile-setting-form"
|
||||
import { settingSyncQueue } from "../settings/helper/sync-queue"
|
||||
import { LanguageSelector } from "../settings/tabs/general"
|
||||
import { useHaveUsedOtherRSSReader } from "./atoms"
|
||||
import { BehaviorGuide } from "./steps/behavior"
|
||||
import { TrendingFeeds } from "./steps/feeds"
|
||||
import { Introduction } from "./steps/introduction"
|
||||
import { RookieCheck } from "./steps/rookie"
|
||||
import { RSSHubGuide } from "./steps/rsshub"
|
||||
|
||||
const containerWidth = 600
|
||||
@@ -51,7 +50,7 @@ function Intro() {
|
||||
return (
|
||||
<div className="w-[50ch] space-y-4 text-balance text-center">
|
||||
<Logo className="mx-auto size-20" />
|
||||
<p className="mt-5 text-xl font-semibold">{t("new_user_guide.intro.title")}</p>
|
||||
<p className="mt-5 text-xl font-bold">{t("new_user_guide.intro.title")}</p>
|
||||
<p className="text-lg">{t("new_user_guide.intro.description")}</p>
|
||||
<LanguageSelector containerClassName="px-16" contentClassName="z-10" />
|
||||
</div>
|
||||
@@ -73,90 +72,67 @@ export function GuideModalContent({ onClose }: { onClose: () => void }) {
|
||||
const t = useI18n()
|
||||
const [step, setStep] = useState(0)
|
||||
const [direction, setDirection] = useState(1)
|
||||
const haveUsedOtherRSSReader = useHaveUsedOtherRSSReader()
|
||||
|
||||
const guideSteps = useMemo(
|
||||
() =>
|
||||
[
|
||||
{
|
||||
icon: "i-mgc-grid-cute-re",
|
||||
title: "Features",
|
||||
content: createElement(Introduction, {
|
||||
features: [
|
||||
{
|
||||
icon: "i-mgc-magic-2-cute-re",
|
||||
title: t.settings("titles.actions"),
|
||||
description: t.app("new_user_guide.step.features.actions.description"),
|
||||
},
|
||||
{
|
||||
icon: "i-mgc-department-cute-re",
|
||||
title: t.settings("titles.integration"),
|
||||
description: t.app("new_user_guide.step.features.integration.description"),
|
||||
},
|
||||
{
|
||||
icon: "i-mgc-rada-cute-re",
|
||||
title: t.settings("titles.lists"),
|
||||
description: t.settings("lists.info"),
|
||||
},
|
||||
{
|
||||
icon: "i-mgc-hotkey-cute-re",
|
||||
title: t.settings("titles.shortcuts"),
|
||||
description: (
|
||||
<p>
|
||||
{t.app("new_user_guide.step.features.shortcuts.description1")}{" "}
|
||||
<Trans
|
||||
i18nKey="new_user_guide.step.features.shortcuts.description2"
|
||||
components={{
|
||||
kbd: <Kbd>H</Kbd>,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
),
|
||||
},
|
||||
],
|
||||
}),
|
||||
title: t.app("new_user_guide.step.migrate.profile"),
|
||||
content: <ProfileSettingForm className="w-[500px]" buttonClassName="text-center !mt-8" />,
|
||||
icon: "i-mgc-user-setting-cute-re",
|
||||
},
|
||||
{
|
||||
title: "Power",
|
||||
icon: "i-mgc-power",
|
||||
content: (
|
||||
<Markdown className="max-w-xl">
|
||||
{t.app("new_user_guide.step.power.description")}
|
||||
</Markdown>
|
||||
),
|
||||
title: t.app("new_user_guide.step.activation.title"),
|
||||
description: t.app("new_user_guide.step.activation.description"),
|
||||
content: <ActivationModalContent className="w-[500px]" hideDescription />,
|
||||
icon: "i-mgc-love-cute-re",
|
||||
},
|
||||
{
|
||||
title: t.app("new_user_guide.step.start_question.title"),
|
||||
content: createElement(RookieCheck),
|
||||
icon: "i-mgc-question-cute-re",
|
||||
title: t.app("new_user_guide.step.migrate.wallet"),
|
||||
content: <MyWalletSection className="w-[600px]" />,
|
||||
icon: <i className="i-mgc-power text-accent" />,
|
||||
},
|
||||
haveUsedOtherRSSReader && {
|
||||
title: t.app("new_user_guide.step.behavior.title"),
|
||||
{
|
||||
title: t.app("new_user_guide.step.behavior.unread_question.content"),
|
||||
description: t.app("new_user_guide.step.behavior.unread_question.description"),
|
||||
content: createElement(BehaviorGuide),
|
||||
icon: tw`i-mingcute-cursor-3-line`,
|
||||
icon: tw`i-mgc-cursor-3-cute-re`,
|
||||
},
|
||||
{
|
||||
title: t.app("new_user_guide.step.migrate.title"),
|
||||
content: createElement(DiscoverImport),
|
||||
icon: "i-mgc-file-import-cute-re",
|
||||
},
|
||||
{
|
||||
title: t.app("new_user_guide.step.rsshub.title"),
|
||||
description: t.app("new_user_guide.step.rsshub.info"),
|
||||
content: createElement(RSSHubGuide),
|
||||
icon: <img src={RSSHubIcon} className="size-[22px]" />,
|
||||
},
|
||||
haveUsedOtherRSSReader
|
||||
? {
|
||||
title: t.app("new_user_guide.step.import.title"),
|
||||
content: createElement(DiscoverImport),
|
||||
icon: "i-mingcute-file-import-line",
|
||||
}
|
||||
: {
|
||||
title: t.app("new_user_guide.step.trending.title"),
|
||||
content: createElement(TrendingFeeds),
|
||||
icon: "i-mgc-trending-up-cute-re",
|
||||
},
|
||||
{
|
||||
title: t.app("new_user_guide.step.shortcuts.title"),
|
||||
content: (
|
||||
<div className="w-[400px] space-y-2">
|
||||
<p>{t.app("new_user_guide.step.shortcuts.description1")}</p>
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="new_user_guide.step.shortcuts.description2"
|
||||
components={{
|
||||
kbd: <Kbd>H</Kbd>,
|
||||
}}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
),
|
||||
icon: "i-mgc-hotkey-cute-re",
|
||||
},
|
||||
].filter((i) => !!i) as {
|
||||
title: string
|
||||
icon: React.ReactNode
|
||||
content: FunctionComponentElement<object>
|
||||
description?: string
|
||||
}[],
|
||||
[haveUsedOtherRSSReader, t],
|
||||
[t],
|
||||
)
|
||||
|
||||
const totalSteps = useMemo(() => guideSteps.length, [guideSteps])
|
||||
@@ -179,20 +155,9 @@ export function GuideModalContent({ onClose }: { onClose: () => void }) {
|
||||
return (
|
||||
<m.div
|
||||
layout
|
||||
className="relative flex flex-col items-center justify-center overflow-hidden rounded-xl border bg-theme-background"
|
||||
className="relative flex min-h-[80%] w-4/5 flex-col items-center justify-center overflow-hidden rounded-xl bg-theme-background shadow-xl"
|
||||
>
|
||||
{!!title && (
|
||||
<h1 className="absolute left-6 top-4 flex items-center gap-2 text-xl font-bold">
|
||||
{typeof guideSteps[step - 1].icon === "string" ? (
|
||||
<i className={clsx(guideSteps[step - 1].icon, "size-[22px]")} />
|
||||
) : (
|
||||
guideSteps[step - 1].icon
|
||||
)}
|
||||
{title}
|
||||
</h1>
|
||||
)}
|
||||
|
||||
<div className="relative mx-auto flex w-full max-w-3xl items-center">
|
||||
<div className="center relative mx-auto w-full">
|
||||
<AnimatePresence initial={false} custom={direction} mode="popLayout">
|
||||
<m.div
|
||||
key={step - 1}
|
||||
@@ -205,8 +170,27 @@ export function GuideModalContent({ onClose }: { onClose: () => void }) {
|
||||
x: { type: "spring", stiffness: 300, damping: 30 },
|
||||
opacity: { duration: 0.1 },
|
||||
}}
|
||||
className="mt-20 px-6 pb-24"
|
||||
className="mt-12 px-20 pb-24"
|
||||
>
|
||||
{!!title && (
|
||||
<div className="mb-6">
|
||||
<h1 className="mb-2 flex w-full items-center justify-center gap-2 text-xl font-bold">
|
||||
{typeof guideSteps[step - 1].icon === "string" ? (
|
||||
<i className={clsx(guideSteps[step - 1].icon, "size-[22px]")} />
|
||||
) : (
|
||||
guideSteps[step - 1].icon
|
||||
)}
|
||||
{title}
|
||||
</h1>
|
||||
{!!guideSteps[step - 1].description && (
|
||||
<div className="text-center text-sm text-theme-vibrancyFg">
|
||||
<Markdown className="max-w-full text-sm">
|
||||
{guideSteps[step - 1].description!}
|
||||
</Markdown>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{status === "initial" ? (
|
||||
<Intro />
|
||||
) : status === "active" ? (
|
||||
@@ -225,7 +209,7 @@ export function GuideModalContent({ onClose }: { onClose: () => void }) {
|
||||
))}
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
{step !== 0 && step <= totalSteps && (
|
||||
{step !== 0 && (
|
||||
<Button
|
||||
onClick={() => {
|
||||
if (step > 0) {
|
||||
|
||||
@@ -4,22 +4,37 @@ import { useTranslation } from "react-i18next"
|
||||
import { setGeneralSetting } from "~/atoms/settings/general"
|
||||
import { Radio, RadioGroup } from "~/components/ui/radio-group"
|
||||
|
||||
type Behavior = "default" | "disabled" | ""
|
||||
type Behavior = "radical" | "balanced" | "conservative"
|
||||
|
||||
export function BehaviorGuide() {
|
||||
const [value, setValue] = useState<Behavior>("")
|
||||
const [value, setValue] = useState<Behavior>("balanced")
|
||||
const { t } = useTranslation("app")
|
||||
|
||||
const updateSettings = (behavior: Behavior) => {
|
||||
setGeneralSetting("hoverMarkUnread", behavior === "default")
|
||||
setGeneralSetting("scrollMarkUnread", behavior === "default")
|
||||
switch (behavior) {
|
||||
case "radical": {
|
||||
setGeneralSetting("hoverMarkUnread", true)
|
||||
setGeneralSetting("scrollMarkUnread", true)
|
||||
setGeneralSetting("renderMarkUnread", true)
|
||||
break
|
||||
}
|
||||
case "balanced": {
|
||||
setGeneralSetting("hoverMarkUnread", true)
|
||||
setGeneralSetting("scrollMarkUnread", true)
|
||||
setGeneralSetting("renderMarkUnread", false)
|
||||
break
|
||||
}
|
||||
case "conservative": {
|
||||
setGeneralSetting("hoverMarkUnread", false)
|
||||
setGeneralSetting("scrollMarkUnread", false)
|
||||
setGeneralSetting("renderMarkUnread", false)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="mb-6 text-xl font-semibold">
|
||||
{t("new_user_guide.step.behavior.unread_question.content")}
|
||||
</h2>
|
||||
<div className="space-y-8">
|
||||
<div className="flex flex-col gap-4">
|
||||
<RadioGroup
|
||||
value={value}
|
||||
@@ -29,14 +44,19 @@ export function BehaviorGuide() {
|
||||
}}
|
||||
>
|
||||
<Radio
|
||||
wrapperClassName="border rounded-lg p-4 has-[:checked]:bg-theme-accent-50 has-[:checked]:text-theme-accent-900 has-[:checked]:border-theme-accent-200"
|
||||
wrapperClassName="border rounded-lg p-3 has-[:checked]:bg-theme-accent has-[:checked]:text-white transition-colors"
|
||||
label={t("new_user_guide.step.behavior.unread_question.option1")}
|
||||
value="default"
|
||||
value="radical"
|
||||
/>
|
||||
<Radio
|
||||
wrapperClassName="border rounded-lg p-4 has-[:checked]:bg-theme-accent-50 has-[:checked]:text-theme-accent-900 has-[:checked]:border-theme-accent-200"
|
||||
wrapperClassName="border rounded-lg p-3 has-[:checked]:bg-theme-accent has-[:checked]:text-white transition-colors"
|
||||
label={t("new_user_guide.step.behavior.unread_question.option2")}
|
||||
value="disabled"
|
||||
value="balanced"
|
||||
/>
|
||||
<Radio
|
||||
wrapperClassName="border rounded-lg p-3 has-[:checked]:bg-theme-accent has-[:checked]:text-white transition-colors"
|
||||
label={t("new_user_guide.step.behavior.unread_question.option3")}
|
||||
value="conservative"
|
||||
/>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import { Markdown } from "~/components/ui/markdown/Markdown"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
type Feature = {
|
||||
title: string
|
||||
icon: string
|
||||
description: React.ReactNode
|
||||
}
|
||||
|
||||
export function Introduction({ features }: { features: Feature[] }) {
|
||||
return (
|
||||
<div className="grid grid-cols-2">
|
||||
{features.map((feature, index) => (
|
||||
<div
|
||||
key={feature.title}
|
||||
className={cn(
|
||||
"border-dashed border-border p-2",
|
||||
index === 0
|
||||
? "border-b border-r"
|
||||
: index === 1
|
||||
? "border-b"
|
||||
: index === 2
|
||||
? "border-r"
|
||||
: "",
|
||||
)}
|
||||
>
|
||||
<div className="flex flex-col items-center space-y-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<i className={cn(feature.icon, "size-[22px]")} />
|
||||
<h3 className="text-lg font-semibold">{feature.title}</h3>
|
||||
</div>
|
||||
{typeof feature.description === "string" ? (
|
||||
<Markdown>{feature.description}</Markdown>
|
||||
) : (
|
||||
<div>{feature.description}</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { Radio, RadioGroup } from "~/components/ui/radio-group"
|
||||
|
||||
import { useHaveUsedOtherRSSReaderAtom } from "../atoms"
|
||||
|
||||
export function RookieCheck() {
|
||||
const [value, setValue] = useHaveUsedOtherRSSReaderAtom()
|
||||
const { t } = useTranslation("app")
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<h2 className="mb-6 text-xl font-semibold">
|
||||
{t("new_user_guide.step.start_question.content")}
|
||||
</h2>
|
||||
<div className="flex flex-col gap-4">
|
||||
<RadioGroup
|
||||
value={value ? "yes" : "no"}
|
||||
onValueChange={(value) => {
|
||||
setValue(value === "yes")
|
||||
}}
|
||||
>
|
||||
<Radio
|
||||
wrapperClassName="border rounded-lg p-4 has-[:checked]:bg-theme-accent-50 has-[:checked]:text-theme-accent-900 has-[:checked]:border-theme-accent-200"
|
||||
label={t("new_user_guide.step.start_question.option1")}
|
||||
value="yes"
|
||||
/>
|
||||
<Radio
|
||||
wrapperClassName="border rounded-lg p-4 has-[:checked]:bg-theme-accent-50 has-[:checked]:text-theme-accent-900 has-[:checked]:border-theme-accent-200"
|
||||
label={t("new_user_guide.step.start_question.option2")}
|
||||
value="no"
|
||||
/>
|
||||
</RadioGroup>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,27 +1,9 @@
|
||||
import { useMemo } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { Markdown } from "~/components/ui/markdown/Markdown"
|
||||
import { ScrollArea } from "~/components/ui/scroll-area"
|
||||
import { useAuthQuery } from "~/hooks/common"
|
||||
import { isASCII } from "~/lib/utils"
|
||||
import { RecommendationCard } from "~/modules/discover/recommendations-card"
|
||||
import { Recommendations } from "~/modules/discover/recommendations"
|
||||
import { Queries } from "~/queries"
|
||||
|
||||
const pickedRoutes = new Set([
|
||||
"weibo",
|
||||
"bilibili",
|
||||
"twitter",
|
||||
"telegram",
|
||||
"youtube",
|
||||
"github",
|
||||
"pixiv",
|
||||
"jike",
|
||||
"xiaoyuzhou",
|
||||
])
|
||||
|
||||
export function RSSHubGuide() {
|
||||
const { t } = useTranslation("app")
|
||||
|
||||
const rsshubPopular = useAuthQuery(
|
||||
Queries.discover.rsshubCategory({
|
||||
category: "popular",
|
||||
@@ -35,31 +17,6 @@ export function RSSHubGuide() {
|
||||
|
||||
const { data } = rsshubPopular
|
||||
|
||||
const keys = useMemo(() => {
|
||||
if (data) {
|
||||
return Object.keys(data).sort((a, b) => {
|
||||
const aname = data[a].name
|
||||
const bname = data[b].name
|
||||
|
||||
const aRouteName = data[a].routes[Object.keys(data[a].routes)[0]].name
|
||||
const bRouteName = data[b].routes[Object.keys(data[b].routes)[0]].name
|
||||
|
||||
const ia = isASCII(aname) && isASCII(aRouteName)
|
||||
const ib = isASCII(bname) && isASCII(bRouteName)
|
||||
|
||||
if (ia && ib) {
|
||||
return aname.toLowerCase() < bname.toLowerCase() ? -1 : 1
|
||||
} else if (ia || ib) {
|
||||
return ia > ib ? -1 : 1
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
})
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}, [data])
|
||||
|
||||
if (rsshubPopular.isLoading) {
|
||||
return null
|
||||
}
|
||||
@@ -69,15 +26,10 @@ export function RSSHubGuide() {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-[610px] w-[630px] space-y-3">
|
||||
<Markdown className="text-balance text-sm">{t("new_user_guide.step.rsshub.info")}</Markdown>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
{keys
|
||||
.filter((key) => pickedRoutes.has(key))
|
||||
.map((key) => (
|
||||
<RecommendationCard key={key} data={data[key]} routePrefix={key} />
|
||||
))}
|
||||
<ScrollArea.ScrollArea viewportClassName="h-[450px]">
|
||||
<div className="space-y-3">
|
||||
<Recommendations hideTitle className="grid-cols-4" />
|
||||
</div>
|
||||
</div>
|
||||
</ScrollArea.ScrollArea>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ import { CreateWallet } from "./create-wallet"
|
||||
import { useRewardDescriptionModal } from "./reward-description-modal"
|
||||
import { WithdrawButton } from "./withdraw"
|
||||
|
||||
export const MyWalletSection = () => {
|
||||
export const MyWalletSection = ({ className }: { className?: string }) => {
|
||||
const { t } = useTranslation("settings")
|
||||
const wallet = useWallet()
|
||||
const myWallet = wallet.data?.[0]
|
||||
@@ -53,121 +53,119 @@ export const MyWalletSection = () => {
|
||||
return <CreateWallet />
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<div className="text-sm">
|
||||
<i className="i-mgc-power mr-0.5 size-3.5 translate-y-px text-accent" />
|
||||
<Trans
|
||||
i18nKey="wallet.power.description2"
|
||||
ns="settings"
|
||||
values={{ blockchainName: "VSL" }}
|
||||
components={{
|
||||
Link: (
|
||||
<a
|
||||
className="underline"
|
||||
target="_blank"
|
||||
href={`${getBlockchainExplorerUrl()}/token/0xE06Af68F0c9e819513a6CD083EF6848E76C28CD8`}
|
||||
rel="noreferrer noopener"
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<SettingSectionTitle margin="compact" title={t("wallet.address.title")} />
|
||||
<div className="group flex items-center gap-2 text-sm">
|
||||
<a
|
||||
href={`${getBlockchainExplorerUrl()}/address/${myWallet.address}`}
|
||||
target="_blank"
|
||||
className="underline"
|
||||
>
|
||||
{myWallet.address}
|
||||
</a>
|
||||
<CopyButton
|
||||
value={myWallet.address!}
|
||||
className="p-1 opacity-0 duration-200 group-hover:opacity-100 [&_i]:size-2.5"
|
||||
/>
|
||||
</div>
|
||||
<SettingSectionTitle title={t("wallet.balance.title")} margin="compact" />
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Balance className="text-xl font-bold text-accent">
|
||||
{BigInt(myWallet.powerToken || 0n)}
|
||||
</Balance>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => refreshMutation.mutate()}
|
||||
disabled={refreshMutation.isPending}
|
||||
>
|
||||
<i
|
||||
className={cn(
|
||||
"i-mgc-refresh-2-cute-re",
|
||||
refreshMutation.isPending && "animate-spin",
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
<Tooltip>
|
||||
<TooltipTrigger className="mt-1 block">
|
||||
<div className="flex flex-row items-center gap-x-2 text-xs">
|
||||
<span className="flex items-center gap-1 text-left">
|
||||
{t("wallet.balance.withdrawable")} <i className="i-mgc-question-cute-re" />
|
||||
</span>
|
||||
<Balance className="center text-[12px] font-medium">
|
||||
{myWallet.cashablePowerToken}
|
||||
</Balance>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipPortal>
|
||||
<TooltipContent align="start" className="z-[999]">
|
||||
<p>{t("wallet.balance.withdrawableTooltip")}</p>
|
||||
</TooltipContent>
|
||||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
<div className={cn(className)}>
|
||||
<div className="text-sm">
|
||||
<i className="i-mgc-power mr-0.5 size-3.5 translate-y-px text-accent" />
|
||||
<Trans
|
||||
i18nKey="wallet.power.description2"
|
||||
ns="settings"
|
||||
values={{ blockchainName: "VSL" }}
|
||||
components={{
|
||||
Link: (
|
||||
<a
|
||||
className="underline"
|
||||
target="_blank"
|
||||
href={`${getBlockchainExplorerUrl()}/token/0xE06Af68F0c9e819513a6CD083EF6848E76C28CD8`}
|
||||
rel="noreferrer noopener"
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<SettingSectionTitle margin="compact" title={t("wallet.address.title")} />
|
||||
<div className="group flex items-center gap-2 text-sm">
|
||||
<a
|
||||
href={`${getBlockchainExplorerUrl()}/address/${myWallet.address}`}
|
||||
target="_blank"
|
||||
className="underline"
|
||||
>
|
||||
{myWallet.address}
|
||||
</a>
|
||||
<CopyButton
|
||||
value={myWallet.address!}
|
||||
className="p-1 opacity-0 duration-200 group-hover:opacity-100 [&_i]:size-2.5"
|
||||
/>
|
||||
</div>
|
||||
<SettingSectionTitle title={t("wallet.balance.title")} margin="compact" />
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Balance className="text-xl font-bold text-accent">
|
||||
{BigInt(myWallet.powerToken || 0n)}
|
||||
</Balance>
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={() => refreshMutation.mutate()}
|
||||
disabled={refreshMutation.isPending}
|
||||
>
|
||||
<i
|
||||
className={cn(
|
||||
"i-mgc-refresh-2-cute-re",
|
||||
refreshMutation.isPending && "animate-spin",
|
||||
)}
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<WithdrawButton />
|
||||
</div>
|
||||
</div>
|
||||
<Divider className="my-8" />
|
||||
<SettingSectionTitle title={t("wallet.balance.dailyReward")} margin="compact" />
|
||||
{serverConfigs?.DISABLE_PERSONAL_DAILY_POWER && (
|
||||
<div className="my-2 text-[15px] leading-tight text-orange-500">
|
||||
{t("wallet.power.rewardDescription3")}
|
||||
</div>
|
||||
)}
|
||||
<div className="my-1 text-sm">{t("wallet.power.rewardDescription")}</div>
|
||||
<div className="my-1 text-sm">
|
||||
<Trans
|
||||
i18nKey="wallet.power.rewardDescription2"
|
||||
ns="settings"
|
||||
values={{ blockchainName: "VSL" }}
|
||||
components={{
|
||||
Balance: (
|
||||
<Balance
|
||||
className="align-sub"
|
||||
withSuffix
|
||||
value={BigInt(myWallet.todayDailyPower || 0n)}
|
||||
>
|
||||
{BigInt(myWallet.todayDailyPower || 0n)}
|
||||
<Tooltip>
|
||||
<TooltipTrigger className="mt-1 block">
|
||||
<div className="flex flex-row items-center gap-x-2 text-xs">
|
||||
<span className="flex items-center gap-1 text-left">
|
||||
{t("wallet.balance.withdrawable")} <i className="i-mgc-question-cute-re" />
|
||||
</span>
|
||||
<Balance className="center text-[12px] font-medium">
|
||||
{myWallet.cashablePowerToken}
|
||||
</Balance>
|
||||
),
|
||||
Link: <Button onClick={rewardDescriptionModal} variant="text" />,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipPortal>
|
||||
<TooltipContent align="start" className="z-[999]">
|
||||
<p>{t("wallet.balance.withdrawableTooltip")}</p>
|
||||
</TooltipContent>
|
||||
</TooltipPortal>
|
||||
</Tooltip>
|
||||
</div>
|
||||
<div className="my-2 flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="space-y-1">
|
||||
<Level level={myWallet.level?.level || 0} />
|
||||
<ActivityPoints points={myWallet.level?.prevActivityPoints || 0} />
|
||||
</div>
|
||||
<i className="i-mgc-right-cute-li text-3xl" />
|
||||
<Balance withSuffix>{BigInt(myWallet.todayDailyPower || 0n)}</Balance>
|
||||
</div>
|
||||
<ClaimDailyReward />
|
||||
<div className="flex gap-2">
|
||||
<WithdrawButton />
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
<Divider className="my-8" />
|
||||
<SettingSectionTitle title={t("wallet.balance.dailyReward")} margin="compact" />
|
||||
{serverConfigs?.DISABLE_PERSONAL_DAILY_POWER && (
|
||||
<div className="my-2 text-[15px] leading-tight text-orange-500">
|
||||
{t("wallet.power.rewardDescription3")}
|
||||
</div>
|
||||
)}
|
||||
<div className="my-1 text-sm">{t("wallet.power.rewardDescription")}</div>
|
||||
<div className="my-1 text-sm">
|
||||
<Trans
|
||||
i18nKey="wallet.power.rewardDescription2"
|
||||
ns="settings"
|
||||
values={{ blockchainName: "VSL" }}
|
||||
components={{
|
||||
Balance: (
|
||||
<Balance
|
||||
className="align-sub"
|
||||
withSuffix
|
||||
value={BigInt(myWallet.todayDailyPower || 0n)}
|
||||
>
|
||||
{BigInt(myWallet.todayDailyPower || 0n)}
|
||||
</Balance>
|
||||
),
|
||||
Link: <Button onClick={rewardDescriptionModal} variant="text" />,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="my-2 flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="space-y-1">
|
||||
<Level level={myWallet.level?.level || 0} />
|
||||
<ActivityPoints points={myWallet.level?.prevActivityPoints || 0} />
|
||||
</div>
|
||||
<i className="i-mgc-right-cute-li text-3xl" />
|
||||
<Balance withSuffix>{BigInt(myWallet.todayDailyPower || 0n)}</Balance>
|
||||
</div>
|
||||
<ClaimDailyReward />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
import { Input } from "~/components/ui/input"
|
||||
import { apiClient } from "~/lib/api-fetch"
|
||||
import { toastFetchError } from "~/lib/error-parser"
|
||||
import { cn } from "~/lib/utils"
|
||||
|
||||
const formSchema = z.object({
|
||||
handle: z.string().max(50),
|
||||
@@ -27,7 +28,13 @@ const formSchema = z.object({
|
||||
image: z.string().url(),
|
||||
})
|
||||
|
||||
export const ProfileSettingForm = () => {
|
||||
export const ProfileSettingForm = ({
|
||||
className,
|
||||
buttonClassName,
|
||||
}: {
|
||||
className?: string
|
||||
buttonClassName?: string
|
||||
}) => {
|
||||
const { t } = useTranslation("settings")
|
||||
const user = useWhoami()
|
||||
|
||||
@@ -64,7 +71,7 @@ export const ProfileSettingForm = () => {
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="mt-4 space-y-4">
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className={cn("mt-4 space-y-4", className)}>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="handle"
|
||||
@@ -117,7 +124,7 @@ export const ProfileSettingForm = () => {
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="text-right">
|
||||
<div className={cn("text-right", buttonClassName)}>
|
||||
<Button type="submit" isLoading={updateMutation.isPending}>
|
||||
{t("profile.submit")}
|
||||
</Button>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"><path fill="#fff" fill-opacity=".01" d="M24 0v24H0V0z"/><path stroke="#10161F" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.167 6.172 4.752 4.757m7.072 1.415 1.414-1.415M8.995 5V3m-4 6h-2m1.758 4.243 1.414-1.414m10.854 2.835-.91.383c-.371.156-.557.234-.695.373-.139.139-.217.324-.373.695l-.382.909c-.707 1.679-1.06 2.518-1.726 2.517-.665-.001-1.002-.81-1.675-2.429a34.465 34.465 0 0 1-1.766-5.472c-.273-1.178-.409-1.766-.017-2.158.392-.393.981-.256 2.159.016 1.875.434 3.7 1.028 5.473 1.766 1.618.673 2.427 1.01 2.428 1.675.002.666-.837 1.019-2.516 1.725"/></svg>
|
||||
|
After Width: | Height: | Size: 663 B |
+19
-10
@@ -181,23 +181,33 @@
|
||||
"new_user_guide.intro.title": "Welcome to Follow!",
|
||||
"new_user_guide.outro.description": "You have completed the guide. Enjoy your journey!",
|
||||
"new_user_guide.outro.title": "You're all set!",
|
||||
"new_user_guide.step.activation.description": "Don't worry, you can continue to use Follow without an invitation code.",
|
||||
"new_user_guide.step.activation.title": "Activate your account",
|
||||
"new_user_guide.step.automation.description": "- Follow leverages advanced AI to assist your operations.\n- Action rules allow you to automate various actions on sources that meet specific conditions.\n- Integrations allow you to save entries to other services.",
|
||||
"new_user_guide.step.behavior.title": "Behavior",
|
||||
"new_user_guide.step.behavior.unread_question.content": "How do you feel about unread entries?",
|
||||
"new_user_guide.step.behavior.unread_question.option1": "I don't really care about unread.",
|
||||
"new_user_guide.step.behavior.unread_question.option2": "I want to completely control the unread status.",
|
||||
"new_user_guide.step.behavior.unread_question.content": "Select how you would like to mark as read.",
|
||||
"new_user_guide.step.behavior.unread_question.description": "Don't worry, you can also change it later in the preferences.",
|
||||
"new_user_guide.step.behavior.unread_question.option1": "Radical: Automatically marked as read when displayed.",
|
||||
"new_user_guide.step.behavior.unread_question.option2": "Balanced: Automatically marked as read when hovered over or scrolled out of view.",
|
||||
"new_user_guide.step.behavior.unread_question.option3": "Conservative: Marked as read only when clicked.",
|
||||
"new_user_guide.step.features.actions.description": "Action rules allow you to perform different actions for different feeds.\n- Using AI to summarize or translate.\n- Configure how to read entries.\n- Enable notifications for new entries or silence them.\n- Rewrite or block specific entries.\n- Send new entries to a webhook address.",
|
||||
"new_user_guide.step.features.integration.description": "Integrations allow you to save entries to other services. Currently supported services are:\n- Eagle\n- Readwise\n- Instapaper\n- Obsidian",
|
||||
"new_user_guide.step.features.shortcuts.description1": "Shortcut keys can help you operate Follow more conveniently and efficiently.",
|
||||
"new_user_guide.step.features.shortcuts.description2": "You can quickly view all shortcut keys by pressing <kbd />.",
|
||||
"new_user_guide.step.import.title": "Import",
|
||||
"new_user_guide.step.power.description": "- Power is an ERC-20 token on the VSL blockchain.\n- 20 free Power can be claimed every day.\n- Power can be used to tip feeds on Follow, claim your feeds to receive tips.",
|
||||
"new_user_guide.step.rsshub.info": "[RSSHub](https://docs.rsshub.app) is the world's largest RSS Network, and Follow is deeply integrated with it. You can subscribe to RSSHub's routes in Follow by filling in the required parameters.",
|
||||
"new_user_guide.step.rsshub.title": "RSSHub",
|
||||
"new_user_guide.step.migrate.profile": "Setup your profile",
|
||||
"new_user_guide.step.migrate.title": "Migrate from OPML file",
|
||||
"new_user_guide.step.migrate.wallet": "Check your wallet",
|
||||
"new_user_guide.step.power.description": "Follow uses blockchain technology as an incentive mechanism for active users and outstanding creators. Users can obtain more services and benefits by holding and using Power Token. Creators can obtain more rewards by providing high-quality content and services.",
|
||||
"new_user_guide.step.rsshub.info": "Everything is RSSible. Our [RSSHub](https://github.com/DIYgod/RSSHub) community, comprising over 1,000 developers, has spent six years adapting nearly a thousand websites to provide almost all the content you need. This includes platforms like X (Twitter), Instagram, PlayStation, Spotify, Telegram, YouTube, and more. You can also write your own scripts to adapt additional websites.",
|
||||
"new_user_guide.step.rsshub.title": "Subscribe from RSSHub",
|
||||
"new_user_guide.step.shortcuts.description1": "Shortcut keys allow you to use Follow more conveniently and efficiently.",
|
||||
"new_user_guide.step.shortcuts.description2": "Press <kbd /> to quickly view all shortcut keys at any time.",
|
||||
"new_user_guide.step.shortcuts.title": "Shortcuts",
|
||||
"new_user_guide.step.start_question.content": "Have you used other RSS readers before?",
|
||||
"new_user_guide.step.start_question.option1": "Yes, I have used other RSS readers.",
|
||||
"new_user_guide.step.start_question.option2": "No, this is my first time using an RSS reader.",
|
||||
"new_user_guide.step.start_question.title": "Question",
|
||||
"new_user_guide.step.trending.title": "Popular Feeds",
|
||||
"new_user_guide.step.views.description": "Follow uses different views for various types of content to offer an experience equal to or better than the original platform",
|
||||
"new_user_guide.step.views.title": "Views",
|
||||
"notify.unSupportDisplay": "Some websites can't be displayed here. Download desktop app to view it.",
|
||||
"notify.unSupportWidth": "{{app_name}} is not yet supported on mobile devices",
|
||||
"notify.unSupportWidth_1": "Your device width is <b>{{width}}</b>, which is less than the minimum supported width {{minWidth}}.",
|
||||
@@ -230,7 +240,6 @@
|
||||
"search.placeholder": "Search...",
|
||||
"search.result_count_local_mode": "(Local mode)",
|
||||
"search.tooltip.local_search": "This search covers locally available data. Try a Refetch to include the latest data.",
|
||||
"shortcuts.guide.title": "Shortcuts Guideline",
|
||||
"sidebar.add_more_feeds": "Add more feeds",
|
||||
"sidebar.category_remove_dialog.cancel": "Cancel",
|
||||
"sidebar.category_remove_dialog.continue": "Continue",
|
||||
|
||||
Reference in New Issue
Block a user