Improved user interface translations and clarity in Simplified
This commit is contained in:
@@ -6,7 +6,7 @@ import { ScrapeMeta } from "@prisma/client";
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts";
|
||||
|
||||
import { isLink, nFormatter, removeUrlSuffix, timeAgo } from "@/lib/utils";
|
||||
import { isLink, nFormatter, removeUrlSuffix } from "@/lib/utils";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
ChartTooltip,
|
||||
ChartTooltipContent,
|
||||
} from "@/components/ui/chart";
|
||||
import { TimeAgoIntl } from "@/components/shared/time-ago";
|
||||
|
||||
const chartConfig = {
|
||||
request: {
|
||||
@@ -102,23 +103,21 @@ export function DailyPVUVChart({ data }: { data: ScrapeMeta[] }) {
|
||||
(a, b) => new Date(a.updatedAt).getTime() - new Date(b.updatedAt).getTime(),
|
||||
);
|
||||
const latestEntry = sort_data[sort_data.length - 1];
|
||||
const latestDate = timeAgo(latestEntry.updatedAt);
|
||||
const latestFrom = latestEntry.type;
|
||||
|
||||
const t = useTranslations("Components");
|
||||
|
||||
const lastRequestInfo = t.rich("last-request-info", {
|
||||
location: latestFrom,
|
||||
timeAgo: () => <TimeAgoIntl date={latestEntry.updatedAt} />,
|
||||
});
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
||||
<div className="flex flex-1 flex-col justify-center gap-1 px-5 py-4">
|
||||
<CardTitle>{t("Total Requests of APIs in Last 30 Days")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Last request from {latestFrom} api about {latestDate}", {
|
||||
latestFrom,
|
||||
latestDate,
|
||||
})}
|
||||
.
|
||||
</CardDescription>
|
||||
<CardDescription>{lastRequestInfo}</CardDescription>
|
||||
</div>
|
||||
<div className="flex">
|
||||
{["request", "ip"].map((key) => {
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
getRegionName,
|
||||
} from "@/lib/contries";
|
||||
import { DATE_DIMENSION_ENUMS } from "@/lib/enums";
|
||||
import { isLink, removeUrlSuffix, timeAgo } from "@/lib/utils";
|
||||
import { isLink, removeUrlSuffix } from "@/lib/utils";
|
||||
import { useElementSize } from "@/hooks/use-element-size";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -45,6 +45,7 @@ import {
|
||||
} from "@/components/ui/select";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { Icons } from "@/components/shared/icons";
|
||||
import { TimeAgoIntl } from "@/components/shared/time-ago";
|
||||
|
||||
const chartConfig = {
|
||||
pv: {
|
||||
@@ -187,7 +188,6 @@ export function DailyPVUVChart({
|
||||
const dataTotal = calculateUVAndPV(data);
|
||||
|
||||
const latestEntry = data[data.length - 1];
|
||||
const latestDate = timeAgo(latestEntry.updatedAt);
|
||||
const latestFrom = [
|
||||
latestEntry.city ? decodeURIComponent(latestEntry.city) : "",
|
||||
latestEntry.country ? `(${getCountryName(latestEntry.country)})` : "",
|
||||
@@ -241,18 +241,17 @@ export function DailyPVUVChart({
|
||||
const regionStats = generateStatsList(data, "region");
|
||||
const isBotStats = generateStatsList(data, "isBot");
|
||||
|
||||
const lastVisitorInfo = t.rich("last-visitor-info", {
|
||||
location: latestFrom,
|
||||
timeAgo: () => <TimeAgoIntl date={latestEntry.updatedAt} />,
|
||||
});
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
||||
<div className="flex flex-1 flex-col justify-center gap-1 px-6 py-2 sm:py-3">
|
||||
<CardTitle>{t("Link Analytics")}</CardTitle>
|
||||
<CardDescription>
|
||||
{t("Last visitor from {latestFrom} about {latestDate}", {
|
||||
latestFrom,
|
||||
latestDate,
|
||||
})}
|
||||
.
|
||||
</CardDescription>
|
||||
<CardDescription>{lastVisitorInfo}</CardDescription>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<Select
|
||||
|
||||
@@ -203,6 +203,7 @@
|
||||
"Users": "Users",
|
||||
"Total Requests of APIs in Last 30 Days": "Total Requests of APIs in Last 30 Days",
|
||||
"Last request from {latestFrom} api about {latestDate}": "Last request from {latestFrom} api about {latestDate}",
|
||||
"last-request-info": "Last request from {location} about <timeAgo></timeAgo>",
|
||||
"Requests": "Requests",
|
||||
"IP": "IP",
|
||||
"Date": "Date",
|
||||
@@ -216,6 +217,7 @@
|
||||
"Sends": "Sends",
|
||||
"Link Analytics": "Link Analytics",
|
||||
"Last visitor from {latestFrom} about {latestDate}": "Last visitor from {latestFrom} about {latestDate}",
|
||||
"last-visitor-info": "Last visitor from {location} about <timeAgo></timeAgo>",
|
||||
"Views": "Views",
|
||||
"Visits": "Visits",
|
||||
"Referrers": "Referrers",
|
||||
|
||||
@@ -203,6 +203,7 @@
|
||||
"Users": "用户",
|
||||
"Total Requests of APIs in Last 30 Days": "过去 30 天的 API 请求总量",
|
||||
"Last request from {latestFrom} api about {latestDate}": "最近的请求来自 {latestFrom} 的 API 于 {latestDate}",
|
||||
"last-request-info": "最近的请求来自 {location} 于 <timeAgo></timeAgo>",
|
||||
"Requests": "请求量",
|
||||
"IP": "IP 数",
|
||||
"Date": "日期",
|
||||
@@ -216,6 +217,7 @@
|
||||
"Sends": "发件箱",
|
||||
"Link Analytics": "访客分析",
|
||||
"Last visitor from {latestFrom} about {latestDate}": "最近的访客来自 {latestFrom} 于 {latestDate}",
|
||||
"last-visitor-info": "最后访问者来自 {location} 于 <timeAgo></timeAgo>",
|
||||
"Views": "浏览量",
|
||||
"Visits": "访问次数",
|
||||
"Referrers": "来源域名",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
|
||||
<url><loc>https://wr.do/api/feature</loc><lastmod>2025-06-05T08:23:35.523Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/robots.txt</loc><lastmod>2025-06-05T08:23:35.524Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/manifest.json</loc><lastmod>2025-06-05T08:23:35.524Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/opengraph-image.jpg</loc><lastmod>2025-06-05T08:23:35.524Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/api/feature</loc><lastmod>2025-06-07T14:03:50.540Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/robots.txt</loc><lastmod>2025-06-07T14:03:50.541Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/manifest.json</loc><lastmod>2025-06-07T14:03:50.541Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
<url><loc>https://wr.do/opengraph-image.jpg</loc><lastmod>2025-06-07T14:03:50.541Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
|
||||
</urlset>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user