Skip to content

Commit 622cf3a

Browse files
committed
updated contracts pages from crowdin ai to spanish
2 parents 7319818 + fb4d0a2 commit 622cf3a

File tree

404 files changed

+967
-737266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

404 files changed

+967
-737266
lines changed

.changeset/rotten-vans-sleep.md renamed to .changeset/friendly-lamps-think.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"@thirdweb-dev/service-utils": patch
33
---
44

5-
Use a cache key that doesn't involve hashing
5+
Export usageV2 util functions

.changeset/short-carrots-smile.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/service-utils": patch
3+
---
4+
5+
[service-utils] replace client_id with project_id in usage_v2

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@
2727
},
2828
"[css]": {
2929
"editor.defaultFormatter": "biomejs.biome"
30-
}
30+
},
31+
"eslint.workingDirectories": [
32+
{ "pattern": "./packages/*/" },
33+
{ "pattern": "./apps/*/" }
34+
]
3135
}

apps/dashboard/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"@typescript-eslint/eslint-plugin": "7.14.1",
130130
"@typescript-eslint/parser": "7.14.1",
131131
"autoprefixer": "^10.4.19",
132-
"checkly": "^4.15.0",
132+
"checkly": "^4.18.0",
133133
"eslint": "8.57.0",
134134
"eslint-config-biome": "1.9.4",
135135
"eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",

apps/dashboard/src/app/team/[team_slug]/(team)/page.tsx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import { getWalletConnections } from "@/api/analytics";
22
import { type Project, getProjects } from "@/api/projects";
33
import { getTeamBySlug } from "@/api/team";
44
import { Changelog } from "components/dashboard/Changelog";
5+
import { subDays } from "date-fns";
56
import { redirect } from "next/navigation";
6-
import { TeamProjectsPage } from "./~/projects/TeamProjectsPage";
7+
import {
8+
type ProjectWithAnalytics,
9+
TeamProjectsPage,
10+
} from "./~/projects/TeamProjectsPage";
711

812
export default async function Page(props: {
913
params: Promise<{ team_slug: string }>;
@@ -16,7 +20,7 @@ export default async function Page(props: {
1620
}
1721

1822
const projects = await getProjects(params.team_slug);
19-
const projectsWithTotalWallets = await getProjectsWithTotalWallets(projects);
23+
const projectsWithTotalWallets = await getProjectsWithAnalytics(projects);
2024

2125
return (
2226
<div className="container flex grow flex-col gap-12 py-8 lg:flex-row">
@@ -34,30 +38,35 @@ export default async function Page(props: {
3438
);
3539
}
3640

37-
async function getProjectsWithTotalWallets(
41+
async function getProjectsWithAnalytics(
3842
projects: Project[],
39-
): Promise<Array<Project & { totalConnections: number }>> {
43+
): Promise<Array<ProjectWithAnalytics>> {
4044
return Promise.all(
4145
projects.map(async (p) => {
4246
try {
47+
const today = new Date();
48+
const thirtyDaysAgo = subDays(today, 30);
49+
4350
const data = await getWalletConnections({
4451
clientId: p.publishableKey,
4552
period: "all",
53+
from: thirtyDaysAgo,
54+
to: today,
4655
});
4756

48-
let totalConnections = 0;
57+
let uniqueWalletsConnected = 0;
4958
for (const d of data) {
50-
totalConnections += d.totalConnections;
59+
uniqueWalletsConnected += d.uniqueWalletsConnected;
5160
}
5261

5362
return {
5463
...p,
55-
totalConnections,
64+
monthlyActiveUsers: uniqueWalletsConnected,
5665
};
5766
} catch {
5867
return {
5968
...p,
60-
totalConnections: 0,
69+
monthlyActiveUsers: 0,
6170
};
6271
}
6372
}),

apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx

Lines changed: 52 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import type { Project } from "@/api/projects";
44
import type { Team } from "@/api/team";
55
import { ProjectAvatar } from "@/components/blocks/Avatars/ProjectAvatar";
6+
import { PaginationButtons } from "@/components/pagination-buttons";
67
import { CopyTextButton } from "@/components/ui/CopyTextButton";
78
import { Button } from "@/components/ui/button";
89
import {
@@ -33,22 +34,24 @@ import {
3334
import Link from "next/link";
3435
import { useMemo, useState } from "react";
3536

36-
type SortById = "name" | "createdAt" | "totalConnections";
37+
type SortById = "name" | "createdAt" | "monthlyActiveUsers";
3738

38-
type ProjectWithTotalConnections = Project & { totalConnections: number };
39+
export type ProjectWithAnalytics = Project & {
40+
monthlyActiveUsers: number;
41+
};
3942

4043
export function TeamProjectsPage(props: {
41-
projects: ProjectWithTotalConnections[];
44+
projects: ProjectWithAnalytics[];
4245
team: Team;
4346
}) {
4447
const { projects } = props;
4548
const [searchTerm, setSearchTerm] = useState("");
46-
const [sortBy, setSortBy] = useState<SortById>("totalConnections");
49+
const [sortBy, setSortBy] = useState<SortById>("monthlyActiveUsers");
4750
const [isCreateProjectDialogOpen, setIsCreateProjectDialogOpen] =
4851
useState(false);
4952
const router = useDashboardRouter();
5053

51-
const projectsToShow = useMemo(() => {
54+
const sortedProjects = useMemo(() => {
5255
let _projectsToShow = !searchTerm
5356
? projects
5457
: projects.filter(
@@ -68,22 +71,44 @@ export function TeamProjectsPage(props: {
6871
(a, b) =>
6972
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime(),
7073
);
71-
} else if (sortBy === "totalConnections") {
74+
} else if (sortBy === "monthlyActiveUsers") {
7275
_projectsToShow = _projectsToShow.sort(
73-
(a, b) => b.totalConnections - a.totalConnections,
76+
(a, b) => b.monthlyActiveUsers - a.monthlyActiveUsers,
7477
);
7578
}
7679

7780
return _projectsToShow;
7881
}, [searchTerm, sortBy, projects]);
7982

83+
const pageSize = 8;
84+
const [page, setPage] = useState(1);
85+
const paginatedProjects = sortedProjects.slice(
86+
(page - 1) * pageSize,
87+
page * pageSize,
88+
);
89+
90+
const showPagination = sortedProjects.length > pageSize;
91+
const totalPages = Math.ceil(sortedProjects.length / pageSize);
92+
8093
return (
8194
<div className="flex grow flex-col">
8295
{/* Filters + Add New */}
8396
<div className="flex flex-col gap-4 md:flex-row md:items-center">
84-
<SearchInput value={searchTerm} onValueChange={setSearchTerm} />
97+
<SearchInput
98+
value={searchTerm}
99+
onValueChange={(v) => {
100+
setSearchTerm(v);
101+
setPage(1);
102+
}}
103+
/>
85104
<div className="flex gap-4">
86-
<SelectBy value={sortBy} onChange={setSortBy} />
105+
<SelectBy
106+
value={sortBy}
107+
onChange={(v) => {
108+
setSortBy(v);
109+
setPage(1);
110+
}}
111+
/>
87112
<AddNewButton
88113
createProject={() => setIsCreateProjectDialogOpen(true)}
89114
teamMembersSettingsPath={`/team/${props.team.slug}/~/settings/members`}
@@ -94,7 +119,7 @@ export function TeamProjectsPage(props: {
94119
<div className="h-6" />
95120

96121
{/* Projects */}
97-
{projectsToShow.length === 0 ? (
122+
{paginatedProjects.length === 0 ? (
98123
<>
99124
{searchTerm !== "" ? (
100125
<div className="flex min-h-[450px] grow items-center justify-center rounded-lg border border-border">
@@ -120,7 +145,7 @@ export function TeamProjectsPage(props: {
120145
</>
121146
) : (
122147
<div className="grid grid-cols-1 gap-5 md:grid-cols-2">
123-
{projectsToShow.map((project) => {
148+
{paginatedProjects.map((project) => {
124149
return (
125150
<ProjectCard
126151
key={project.id}
@@ -132,6 +157,16 @@ export function TeamProjectsPage(props: {
132157
</div>
133158
)}
134159

160+
{showPagination && (
161+
<div className="py-6">
162+
<PaginationButtons
163+
activePage={page}
164+
onPageClick={setPage}
165+
totalPages={totalPages}
166+
/>
167+
</div>
168+
)}
169+
135170
<LazyCreateAPIKeyDialog
136171
open={isCreateProjectDialogOpen}
137172
onOpenChange={setIsCreateProjectDialogOpen}
@@ -148,7 +183,7 @@ export function TeamProjectsPage(props: {
148183
}
149184

150185
function ProjectCard(props: {
151-
project: ProjectWithTotalConnections;
186+
project: ProjectWithAnalytics;
152187
team_slug: string;
153188
}) {
154189
const { project, team_slug } = props;
@@ -160,7 +195,7 @@ function ProjectCard(props: {
160195
{/* TODO - set image */}
161196
<ProjectAvatar className="size-10 rounded-full" src="" />
162197

163-
<div className="flex-grow flex-col gap-1.5">
198+
<div className="flex flex-grow flex-col gap-1">
164199
<Link
165200
className="group static before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:z-0"
166201
// remove /connect when we have overview page
@@ -170,8 +205,8 @@ function ProjectCard(props: {
170205
</Link>
171206

172207
<p className="flex items-center gap-1 text-muted-foreground text-sm">
173-
<span>{project.totalConnections}</span>
174-
Total Users
208+
<span>{project.monthlyActiveUsers}</span>
209+
Monthly Active Users
175210
</p>
176211
</div>
177212

@@ -256,11 +291,11 @@ function SelectBy(props: {
256291
value: SortById;
257292
onChange: (value: SortById) => void;
258293
}) {
259-
const values: SortById[] = ["name", "createdAt", "totalConnections"];
294+
const values: SortById[] = ["name", "createdAt", "monthlyActiveUsers"];
260295
const valueToLabel: Record<SortById, string> = {
261296
name: "Name",
262297
createdAt: "Creation Date",
263-
totalConnections: "Total Users",
298+
monthlyActiveUsers: "Monthly Active Users",
264299
};
265300

266301
return (

0 commit comments

Comments
 (0)