Skip to content

Commit

Permalink
feat: copy profile email
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Dec 17, 2024
1 parent ead7b3a commit 1e12588
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions apps/renderer/src/modules/profile/profile-setting-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { toast } from "sonner"
import { z } from "zod"

import { setWhoami, useWhoami } from "~/atoms/user"
import { CopyButton } from "~/components/ui/code-highlighter"
import { toastFetchError } from "~/lib/error-parser"

const formSchema = z.object({
Expand Down Expand Up @@ -89,29 +90,15 @@ export const ProfileSettingForm = ({
<form onSubmit={form.handleSubmit(onSubmit)} className={cn("mt-4 space-y-4", className)}>
<div className="space-y-2">
<Label>{t("profile.email.label")}</Label>
<p className="flex gap-2 text-sm text-muted-foreground">
{user?.email}
<span className={cn(user?.emailVerified ? "text-green-500" : "text-red-500")}>
{user?.emailVerified ? t("profile.email.verified") : t("profile.email.unverified")}
</span>
</p>
{!user?.emailVerified && (
<Button
variant="outline"
type="button"
isLoading={verifyEmailMutation.isPending}
onClick={() => {
verifyEmailMutation.mutate()
}}
>
{t("profile.email.send_verification")}
</Button>
)}
</div>
<div className="space-y-2">
<Label>{t("profile.email.label")}</Label>
<p className="flex gap-2 text-sm text-muted-foreground">
<p className="group flex gap-2 text-sm text-muted-foreground">
{user?.email}

{user?.email && (
<CopyButton
value={user.email}
className="size-5 p-1 opacity-0 duration-300 group-hover:opacity-100"
/>
)}
<span className={cn(user?.emailVerified ? "text-green-500" : "text-red-500")}>
{user?.emailVerified ? t("profile.email.verified") : t("profile.email.unverified")}
</span>
Expand Down

0 comments on commit 1e12588

Please sign in to comment.