Skip to content

Commit 4565f19

Browse files
authored
Copyable admin area table fields and autofocus search (#2280)
1 parent 0796df2 commit 4565f19

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

apps/webapp/app/routes/admin._index.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { redirect } from "@remix-run/server-runtime";
55
import { typedjson, useTypedLoaderData } from "remix-typedjson";
66
import { z } from "zod";
77
import { Button, LinkButton } from "~/components/primitives/Buttons";
8+
import { CopyableText } from "~/components/primitives/CopyableText";
89
import { Header1 } from "~/components/primitives/Headers";
910
import { Input } from "~/components/primitives/Input";
1011
import { PaginationControls } from "~/components/primitives/Pagination";
@@ -69,13 +70,14 @@ export default function AdminDashboardRoute() {
6970
<Form className="flex items-center gap-2">
7071
<Input
7172
placeholder="Search users or orgs"
72-
variant="small"
73+
variant="medium"
7374
icon={MagnifyingGlassIcon}
7475
fullWidth={true}
7576
name="search"
7677
defaultValue={filters.search}
78+
autoFocus
7779
/>
78-
<Button type="submit" variant="tertiary/small">
80+
<Button type="submit" variant="secondary/medium">
7981
Search
8082
</Button>
8183
</Form>
@@ -101,7 +103,9 @@ export default function AdminDashboardRoute() {
101103
users.map((user) => {
102104
return (
103105
<TableRow key={user.id}>
104-
<TableCell>{user.email}</TableCell>
106+
<TableCell>
107+
<CopyableText value={user.email} />
108+
</TableCell>
105109
<TableCell>
106110
{user.orgMemberships.map((org) => (
107111
<LinkButton
@@ -124,8 +128,12 @@ export default function AdminDashboardRoute() {
124128
{user.displayName}
125129
</a>
126130
</TableCell>
127-
<TableCell>{user.id}</TableCell>
128-
<TableCell>{user.createdAt.toISOString()}</TableCell>
131+
<TableCell>
132+
<CopyableText value={user.id} />
133+
</TableCell>
134+
<TableCell>
135+
<CopyableText value={user.createdAt.toISOString()} />
136+
</TableCell>
129137
<TableCell>{user.admin ? "✅" : ""}</TableCell>
130138
<TableCell isSticky={true}>
131139
<Form method="post" reloadDocument>

apps/webapp/app/routes/admin.orgs.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { LoaderFunctionArgs } from "@remix-run/server-runtime";
44
import { redirect, typedjson, useTypedLoaderData } from "remix-typedjson";
55
import { z } from "zod";
66
import { Button, LinkButton } from "~/components/primitives/Buttons";
7+
import { CopyableText } from "~/components/primitives/CopyableText";
78
import { Input } from "~/components/primitives/Input";
89
import { PaginationControls } from "~/components/primitives/Pagination";
910
import { Paragraph } from "~/components/primitives/Paragraph";
@@ -54,13 +55,14 @@ export default function AdminDashboardRoute() {
5455
<Form className="flex items-center gap-2">
5556
<Input
5657
placeholder="Search users or orgs"
57-
variant="small"
58+
variant="medium"
5859
icon={MagnifyingGlassIcon}
5960
fullWidth={true}
6061
name="search"
6162
defaultValue={filters.search}
63+
autoFocus
6264
/>
63-
<Button type="submit" variant="tertiary/small">
65+
<Button type="submit" variant="secondary/medium">
6466
Search
6567
</Button>
6668
</Form>
@@ -87,20 +89,26 @@ export default function AdminDashboardRoute() {
8789
organizations.map((org) => {
8890
return (
8991
<TableRow key={org.id}>
90-
<TableCell>{org.title}</TableCell>
91-
<TableCell>{org.slug}</TableCell>
92+
<TableCell>
93+
<CopyableText value={org.title} />
94+
</TableCell>
95+
<TableCell>
96+
<CopyableText value={org.slug} />
97+
</TableCell>
9298
<TableCell>
9399
{org.members.map((member) => (
94100
<LinkButton
95101
key={member.user.email}
96102
variant="minimal/small"
97103
to={`/admin?search=${encodeURIComponent(member.user.email)}`}
98104
>
99-
{member.user.email}
105+
<CopyableText value={member.user.email} />
100106
</LinkButton>
101107
))}
102108
</TableCell>
103-
<TableCell>{org.id}</TableCell>
109+
<TableCell>
110+
<CopyableText value={org.id} />
111+
</TableCell>
104112
<TableCell>{org.v2Enabled ? "✅" : ""}</TableCell>
105113
<TableCell>{org.v3Enabled ? "✅" : ""}</TableCell>
106114
<TableCell>{org.deletedAt ? "☠️" : ""}</TableCell>

0 commit comments

Comments
 (0)