diff --git a/app/(protected)/admin/domains/domain-list.tsx b/app/(protected)/admin/domains/domain-list.tsx index 1439dfb..8b39a49 100644 --- a/app/(protected)/admin/domains/domain-list.tsx +++ b/app/(protected)/admin/domains/domain-list.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import Link from "next/link"; import { User } from "@prisma/client"; import { PenLine, RefreshCwIcon } from "lucide-react"; +import { useTranslations } from "next-intl"; import { toast } from "sonner"; import useSWR, { useSWRConfig } from "swr"; @@ -70,6 +71,7 @@ function TableColumnSekleton() { export default function DomainList({ user, action }: DomainListProps) { const { isMobile } = useMediaQuery(); + const t = useTranslations("List"); const [isShowForm, setShowForm] = useState(false); const [formType, setFormType] = useState("add"); const [currentEditDomain, setCurrentEditDomain] = diff --git a/app/(protected)/dashboard/loading.tsx b/app/(protected)/dashboard/loading.tsx index 83d2a91..5c3dae6 100644 --- a/app/(protected)/dashboard/loading.tsx +++ b/app/(protected)/dashboard/loading.tsx @@ -1,10 +1,8 @@ import { Skeleton } from "@/components/ui/skeleton"; -import { DashboardHeader } from "@/components/dashboard/header"; export default function DashboardLoading() { return ( <> -
diff --git a/app/(protected)/dashboard/page.tsx b/app/(protected)/dashboard/page.tsx index 7fdf9ee..8dff14a 100644 --- a/app/(protected)/dashboard/page.tsx +++ b/app/(protected)/dashboard/page.tsx @@ -13,11 +13,9 @@ import { DashboardInfoCard, HeroCard, } from "@/components/dashboard/dashboard-info-card"; -import { DashboardHeader } from "@/components/dashboard/header"; import { ErrorBoundary } from "@/components/shared/error-boundary"; import UserRecordsList from "./records/record-list"; -import LiveLog from "./urls/live-logs"; import UserUrlsList from "./urls/url-list"; export const metadata = constructMetadata({ @@ -87,10 +85,6 @@ async function DnsRecordsCardSection({ ); } -async function LiveLogSection() { - return ; -} - async function UserUrlsListSection({ user, }: { @@ -148,7 +142,7 @@ export default async function DashboardPage() { return ( <> - + {/* */}
(null); const [currentPage, setCurrentPage] = useState(1); const [pageSize, setPageSize] = useState(10); - const [tab, setTab] = useState("app"); const isAdmin = action.includes("/admin"); + const t = useTranslations("List"); + const { mutate } = useSWRConfig(); const { data, isLoading } = useSWR<{ @@ -144,30 +146,30 @@ export default function UserRecordsList({ user, action }: RecordListProps) { {isAdmin ? ( - Total Subdomains:{" "} + {t("Total Subdomains")}:{" "} {data && data.total} ) : (
- Subdomains + {t("Subdomain List")} - Please read the{" "} + {t("Please read the")}{" "} - Legitimacy review + {t("legitimacy review")} {" "} - before using. See{" "} + {t("before using")}. {t("See")}{" "} - examples + {t("examples")} {" "} - for more usage. + {t("for more usage")}.
)} @@ -194,7 +196,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { }} > - Add Record + {t("Add Record")}
@@ -203,28 +205,28 @@ export default function UserRecordsList({ user, action }: RecordListProps) { - Type + {t("Type")} - Name + {t("Name")} - Content + {t("Content")} - TTL + {t("TTL")} - Status + {t("Status")} - User + {t("User")} - Updated + {t("Updated")} - Actions + {t("Actions")} @@ -279,7 +281,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { /> ) : ( - Pending + {t("Pending")} )} {record.active !== 1 && ( @@ -291,16 +293,21 @@ export default function UserRecordsList({ user, action }: RecordListProps) { {record.active === 0 && (
    -
  • The target is currently inaccessible.
  • - Please check the target and try again. + {t("The target is currently inaccessible")}.
  • - If the target is not activated within 3 - days,
    - the administrator will{" "} + {t("Please check the target and try again")} + . +
  • +
  • + {t( + "If the target is not activated within 3 days", + )} + ,
    + {t("the administrator will")}{" "} - delete this record + {t("delete this record")} .
  • @@ -309,8 +316,10 @@ export default function UserRecordsList({ user, action }: RecordListProps) { {record.active === 2 && (
    • - The record is currently pending for admin - approval. + {t( + "The record is currently pending for admin approval", + )} + .
    )} @@ -347,7 +356,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { setShowForm(!isShowForm); }} > -

    Edit

    +

    {t("Edit")}

    ) : record.active === 2 && @@ -364,7 +373,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { setShowForm(!isShowForm); }} > -

    Review

    +

    {t("Review")}

    ) : ( "--" @@ -375,7 +384,9 @@ export default function UserRecordsList({ user, action }: RecordListProps) { ) : ( - No Subdomain + + {t("No Subdomains")} + You don't have any subdomain yet. Start creating record. @@ -398,7 +409,7 @@ export default function UserRecordsList({ user, action }: RecordListProps) { diff --git a/app/(protected)/dashboard/scrape/page.tsx b/app/(protected)/dashboard/scrape/page.tsx index 826b4ef..1b49427 100644 --- a/app/(protected)/dashboard/scrape/page.tsx +++ b/app/(protected)/dashboard/scrape/page.tsx @@ -28,19 +28,19 @@ export default async function DashboardPage() {
    @@ -48,13 +48,13 @@ export default async function DashboardPage() {
    diff --git a/app/(protected)/dashboard/urls/url-list.tsx b/app/(protected)/dashboard/urls/url-list.tsx index 30a8596..bd485ef 100644 --- a/app/(protected)/dashboard/urls/url-list.tsx +++ b/app/(protected)/dashboard/urls/url-list.tsx @@ -187,7 +187,7 @@ export default function UserUrlsList({ user, action }: UrlListProps) { const rendeEmpty = () => ( - No urls + {t("No urls")} You don't have any url yet. Start creating url. diff --git a/components/dashboard/dashboard-info-card.tsx b/components/dashboard/dashboard-info-card.tsx index 4f48634..db401bf 100644 --- a/components/dashboard/dashboard-info-card.tsx +++ b/components/dashboard/dashboard-info-card.tsx @@ -1,5 +1,5 @@ import Link from "next/link"; -import { Link as LinkIcon } from "lucide-react"; +import { useTranslations } from "next-intl"; import { nFormatter } from "@/lib/utils"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; @@ -72,6 +72,7 @@ export async function DashboardInfoCard({ link: string; icon?: keyof typeof Icons; }) { + const t = useTranslations("Components"); const Icon = Icons[icon || "arrowRight"]; return ( @@ -81,7 +82,7 @@ export async function DashboardInfoCard({ className="font-semibold text-slate-500 duration-500 group-hover:text-blue-500 group-hover:underline" href={link} > - {title} + {t(title)} @@ -94,12 +95,15 @@ export async function DashboardInfoCard({ {total !== undefined && (

    - / {nFormatter(limit)} (monthly) + / {nFormatter(limit)}{" "} + ({t("monthly")})

    )}
    )} -

    total: {total}

    +

    + {t("total")}: {total} +

    ); @@ -114,6 +118,7 @@ export function HeroCard({ monthTotal: number; limit: number; }) { + const t = useTranslations("Components"); return (
    @@ -121,7 +126,7 @@ export function HeroCard({ href="/emails" className="text-lg font-bold duration-500 group-hover:text-blue-500 group-hover:underline" > - Email box + {t("Email box")}
    @@ -134,12 +139,15 @@ export function HeroCard({ {total !== undefined && (

    - / {nFormatter(limit)} (monthly) + / {nFormatter(limit)}{" "} + ({t("monthly")})

    )}
    )} -

    total: {total}

    +

    + {t("total")}: {total} +

); @@ -157,6 +165,7 @@ export async function StaticInfoCard({ icon?: keyof typeof Icons; }) { const Icon = Icons[icon || "arrowRight"]; + const t = useTranslations("Components"); return ( @@ -165,13 +174,13 @@ export async function StaticInfoCard({ className="font-semibold text-slate-500 duration-500 group-hover:text-blue-500 group-hover:underline" href={link} > - {title} + {t(title)} -

{desc}

+ {desc &&

{t(desc)}

}
); diff --git a/components/forms/record-form.tsx b/components/forms/record-form.tsx index f226b45..ae888f6 100644 --- a/components/forms/record-form.tsx +++ b/components/forms/record-form.tsx @@ -3,6 +3,7 @@ import { Dispatch, SetStateAction, useState, useTransition } from "react"; import { zodResolver } from "@hookform/resolvers/zod"; import { User } from "@prisma/client"; +import { useTranslations } from "next-intl"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import useSWR from "swr"; @@ -61,9 +62,11 @@ export function RecordForm({ const [currentZoneName, setCurrentZoneName] = useState( initData?.zone_name || "wr.do", ); - const [email, setEmail] = useState(user.email); + const [email, setEmail] = useState(initData?.user.email || user.email); const isAdmin = action.indexOf("admin") > -1; + const t = useTranslations("List"); + const { handleSubmit, register, @@ -204,24 +207,26 @@ export function RecordForm({ return (
- {type === "add" ? "Create" : "Edit"} record + {type === "add" ? t("Create record") : t("Edit record")}
{siteConfig.enableSubdomainApply && (
    -
  • The administrator has enabled application mode.
  • +
  • {t("The administrator has enabled application mode")}.
  • - After submission, you need to wait for administrator approval before - the record takes effect. + {t( + "After submission, you need to wait for administrator approval before the record takes effect", + )} + .
)}
{isAdmin && (
- +
setEmail(e.target.value)} + disabled={type === "edit"} />
@@ -248,12 +254,12 @@ export function RecordForm({ {siteConfig.enableSubdomainApply && (