feat: add support email
This will help humans whether they have billing questions or otherwise.
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Check, Copy } from "lucide-react";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
interface CopyableEmailProps {
|
||||||
|
email: string;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CopyableEmail({ email, className }: CopyableEmailProps) {
|
||||||
|
const [copied, setCopied] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!copied) return;
|
||||||
|
const id = setTimeout(() => setCopied(false), 1500);
|
||||||
|
return () => clearTimeout(id);
|
||||||
|
}, [copied]);
|
||||||
|
|
||||||
|
const handleCopy = async (e: React.MouseEvent) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText(email);
|
||||||
|
setCopied(true);
|
||||||
|
toast.success("Email copied");
|
||||||
|
} catch {
|
||||||
|
toast.error("Failed to copy email");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={handleCopy}
|
||||||
|
aria-label={`Copy ${email}`}
|
||||||
|
className={cn(
|
||||||
|
"hover:bg-accent inline-flex items-center gap-1.5 rounded-md px-2 py-1 font-mono text-sm transition-colors",
|
||||||
|
className,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<span>{email}</span>
|
||||||
|
{copied ? (
|
||||||
|
<Check className="text-muted-foreground size-3.5" />
|
||||||
|
) : (
|
||||||
|
<Copy className="text-muted-foreground size-3.5" />
|
||||||
|
)}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -7,7 +7,9 @@ import { Label } from "@/components/ui/label";
|
|||||||
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { Muted } from "@/components/ui/typography";
|
import { Muted } from "@/components/ui/typography";
|
||||||
|
import { CopyableEmail } from "@/components/copyable-email";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
|
import { SUPPORT_EMAIL } from "@/lib/constants";
|
||||||
import {
|
import {
|
||||||
useCreateCheckoutSession,
|
useCreateCheckoutSession,
|
||||||
useCreatePortalSession,
|
useCreatePortalSession,
|
||||||
@@ -309,6 +311,18 @@ export function BillingSection({ networkId }: { networkId: string }) {
|
|||||||
<>
|
<>
|
||||||
<Separator className="mx-4" />
|
<Separator className="mx-4" />
|
||||||
<AdminBillingControls networkId={networkId} />
|
<AdminBillingControls networkId={networkId} />
|
||||||
|
<Separator className="mx-4" />
|
||||||
|
<InfoRow
|
||||||
|
label={
|
||||||
|
<span className="flex flex-col">
|
||||||
|
<span>Billing support</span>
|
||||||
|
<span className="text-muted-foreground text-xs">
|
||||||
|
Invoices, receipts, or plan changes
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
}
|
||||||
|
value={<CopyableEmail email={SUPPORT_EMAIL} />}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { ChevronRight, LogOut, User, Info, Shield, Mail, Mic } from "lucide-react";
|
import { ChevronRight, LogOut, User, Info, Shield, Mail, Mic, LifeBuoy } from "lucide-react";
|
||||||
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
@@ -8,8 +8,10 @@ import { WindowControls } from "@/components/window-controls";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Muted } from "@/components/ui/typography";
|
import { Muted } from "@/components/ui/typography";
|
||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
|
import { CopyableEmail } from "@/components/copyable-email";
|
||||||
import { useAuthStore } from "@/stores/auth-store";
|
import { useAuthStore } from "@/stores/auth-store";
|
||||||
import { apiClient } from "@/api/client";
|
import { apiClient } from "@/api/client";
|
||||||
|
import { SUPPORT_EMAIL } from "@/lib/constants";
|
||||||
import { ArrowLeft } from "lucide-react";
|
import { ArrowLeft } from "lucide-react";
|
||||||
|
|
||||||
interface SettingsRowProps {
|
interface SettingsRowProps {
|
||||||
@@ -165,6 +167,23 @@ export default function SettingsPage() {
|
|||||||
|
|
||||||
<Separator className="mt-4" />
|
<Separator className="mt-4" />
|
||||||
|
|
||||||
|
<SettingsGroup title="Contact us">
|
||||||
|
<div className="flex w-full items-center gap-3 px-4 py-3">
|
||||||
|
<span className="text-muted-foreground flex size-5 items-center justify-center">
|
||||||
|
<LifeBuoy className="size-4" />
|
||||||
|
</span>
|
||||||
|
<div className="min-w-0 flex-1">
|
||||||
|
<p className="text-sm font-medium">Email support</p>
|
||||||
|
<Muted className="text-xs">
|
||||||
|
Questions, feedback, or bug reports
|
||||||
|
</Muted>
|
||||||
|
</div>
|
||||||
|
<CopyableEmail email={SUPPORT_EMAIL} />
|
||||||
|
</div>
|
||||||
|
</SettingsGroup>
|
||||||
|
|
||||||
|
<Separator className="mt-4" />
|
||||||
|
|
||||||
<div className="py-4">
|
<div className="py-4">
|
||||||
<SettingsRow
|
<SettingsRow
|
||||||
icon={<LogOut className="size-4" />}
|
icon={<LogOut className="size-4" />}
|
||||||
|
|||||||
@@ -3,3 +3,5 @@ export const MAX_ATTACHMENT_SIZE_BYTES = 25 * 1024 * 1024;
|
|||||||
|
|
||||||
/** Maximum number of file attachments per particle. */
|
/** Maximum number of file attachments per particle. */
|
||||||
export const MAX_ATTACHMENTS = 10;
|
export const MAX_ATTACHMENTS = 10;
|
||||||
|
|
||||||
|
export const SUPPORT_EMAIL = "[email protected]";
|
||||||
|
|||||||
Reference in New Issue
Block a user