Skip to content

Commit de3e0fa

Browse files
committed
chore: run prettier fix and ignore .next outputs
1 parent 2e6c93a commit de3e0fa

File tree

11 files changed

+97
-34
lines changed

11 files changed

+97
-34
lines changed

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
**/gen
33
**/node_modules
44
**/dist
5+
**/.next
56
**/.expo
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist/
22
src/generated/
3+
**/.next/

packages/rest-api-sdk/examples/customer-admin-panel/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ yarn dev
2121
```
2222

2323
Visit:
24+
2425
- http://localhost:3000/

packages/rest-api-sdk/examples/customer-admin-panel/app/flags/AppEnvForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ export default function AppEnvForm({
3131
>
3232
<label style={{ display: "grid", gap: 6 }}>
3333
<span>App</span>
34-
<select name="appId" defaultValue={selectedAppId} style={{ padding: 8 }}>
34+
<select
35+
name="appId"
36+
defaultValue={selectedAppId}
37+
style={{ padding: 8 }}
38+
>
3539
{apps.map((app) => (
3640
<option key={app.id} value={app.id}>
3741
{app.name}

packages/rest-api-sdk/examples/customer-admin-panel/app/flags/EntityFlagsFilterForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ export default function EntityFlagsFilterForm({
4141
>
4242
<label style={{ display: "grid", gap: 6 }}>
4343
<span>App</span>
44-
<select name="appId" defaultValue={selectedAppId} style={{ padding: 8 }}>
44+
<select
45+
name="appId"
46+
defaultValue={selectedAppId}
47+
style={{ padding: 8 }}
48+
>
4549
{apps.map((app) => (
4650
<option key={app.id} value={app.id}>
4751
{app.name}

packages/rest-api-sdk/examples/customer-admin-panel/app/flags/company/page.tsx

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export default async function CompanyFlagsPage({ searchParams }: PageProps) {
4343

4444
const flags =
4545
selectedAppId && selectedEnvId && companyId
46-
? (await fetchCompanyFlags(selectedAppId, selectedEnvId, companyId)).data ?? []
46+
? ((await fetchCompanyFlags(selectedAppId, selectedEnvId, companyId))
47+
.data ?? [])
4748
: [];
4849

4950
async function updateCompanyFlagAction(formData: FormData) {
@@ -57,7 +58,11 @@ export default async function CompanyFlagsPage({ searchParams }: PageProps) {
5758

5859
await toggleCompanyFlag(appId, envId, nextCompanyId, flagKey, nextValue);
5960

60-
const query = new URLSearchParams({ appId, envId, companyId: nextCompanyId });
61+
const query = new URLSearchParams({
62+
appId,
63+
envId,
64+
companyId: nextCompanyId,
65+
});
6166
revalidatePath("/flags/company");
6267
redirect(`/flags/company?${query.toString()}`);
6368
}
@@ -94,23 +99,44 @@ export default async function CompanyFlagsPage({ searchParams }: PageProps) {
9499
</thead>
95100
<tbody>
96101
{flags.map((flag) => {
97-
const isInherited = flag.value && flag.specificTargetValue === null;
102+
const isInherited =
103+
flag.value && flag.specificTargetValue === null;
98104

99105
return (
100106
<tr key={flag.id} style={{ borderTop: "1px solid #ddd" }}>
101107
<td style={{ padding: 8 }}>{flag.name}</td>
102108
<td style={{ padding: 8 }}>{flag.key}</td>
103109
<td style={{ padding: 8 }}>
104-
{flag.value ? (isInherited ? "Yes (implicitly)" : "Yes") : "No"}
110+
{flag.value
111+
? isInherited
112+
? "Yes (implicitly)"
113+
: "Yes"
114+
: "No"}
105115
</td>
106116
<td style={{ padding: 8 }}>
107117
{!isInherited && (
108118
<form action={updateCompanyFlagAction}>
109-
<input type="hidden" name="appId" value={selectedAppId} />
110-
<input type="hidden" name="envId" value={selectedEnvId} />
111-
<input type="hidden" name="companyId" value={companyId} />
119+
<input
120+
type="hidden"
121+
name="appId"
122+
value={selectedAppId}
123+
/>
124+
<input
125+
type="hidden"
126+
name="envId"
127+
value={selectedEnvId}
128+
/>
129+
<input
130+
type="hidden"
131+
name="companyId"
132+
value={companyId}
133+
/>
112134
<input type="hidden" name="flagKey" value={flag.key} />
113-
<input type="hidden" name="nextValue" value={String(!flag.value)} />
135+
<input
136+
type="hidden"
137+
name="nextValue"
138+
value={String(!flag.value)}
139+
/>
114140
<button type="submit">
115141
{flag.value ? "Turn off" : "Turn on"}
116142
</button>

packages/rest-api-sdk/examples/customer-admin-panel/app/flags/page.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export default async function FlagsPage({ searchParams }: PageProps) {
3131
const selectedEnvId =
3232
envs.find((env) => env.id === requestedEnvId)?.id ?? envs[0]?.id ?? "";
3333

34-
const flags = selectedAppId ? (await listFlags(selectedAppId)).data ?? [] : [];
34+
const flags = selectedAppId
35+
? ((await listFlags(selectedAppId)).data ?? [])
36+
: [];
3537

3638
return (
3739
<main style={{ maxWidth: 900, margin: "40px auto", padding: 16 }}>
@@ -54,7 +56,12 @@ export default async function FlagsPage({ searchParams }: PageProps) {
5456
<input type="hidden" name="envId" value={selectedEnvId} />
5557
<label style={{ display: "grid", gap: 6, flex: 1 }}>
5658
<span>User ID</span>
57-
<input name="userId" placeholder="User ID" style={{ padding: 8 }} required />
59+
<input
60+
name="userId"
61+
placeholder="User ID"
62+
style={{ padding: 8 }}
63+
required
64+
/>
5865
</label>
5966
<button type="submit" disabled={!selectedAppId || !selectedEnvId}>
6067
Go to user flags

packages/rest-api-sdk/examples/customer-admin-panel/app/flags/user/page.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import Link from "next/link";
22
import { redirect } from "next/navigation";
33
import { revalidatePath } from "next/cache";
44
import EntityFlagsFilterForm from "../EntityFlagsFilterForm";
5-
import { fetchUserFlags, listApps, listEnvironments, toggleUserFlag } from "../actions";
5+
import {
6+
fetchUserFlags,
7+
listApps,
8+
listEnvironments,
9+
toggleUserFlag,
10+
} from "../actions";
611

712
export const dynamic = "force-dynamic";
813

@@ -38,7 +43,8 @@ export default async function UserFlagsPage({ searchParams }: PageProps) {
3843

3944
const flags =
4045
selectedAppId && selectedEnvId && userId
41-
? (await fetchUserFlags(selectedAppId, selectedEnvId, userId)).data ?? []
46+
? ((await fetchUserFlags(selectedAppId, selectedEnvId, userId)).data ??
47+
[])
4248
: [];
4349

4450
async function updateUserFlagAction(formData: FormData) {
@@ -89,23 +95,40 @@ export default async function UserFlagsPage({ searchParams }: PageProps) {
8995
</thead>
9096
<tbody>
9197
{flags.map((flag) => {
92-
const isInherited = flag.value && flag.specificTargetValue === null;
98+
const isInherited =
99+
flag.value && flag.specificTargetValue === null;
93100

94101
return (
95102
<tr key={flag.id} style={{ borderTop: "1px solid #ddd" }}>
96103
<td style={{ padding: 8 }}>{flag.name}</td>
97104
<td style={{ padding: 8 }}>{flag.key}</td>
98105
<td style={{ padding: 8 }}>
99-
{flag.value ? (isInherited ? "Yes (implicitly)" : "Yes") : "No"}
106+
{flag.value
107+
? isInherited
108+
? "Yes (implicitly)"
109+
: "Yes"
110+
: "No"}
100111
</td>
101112
<td style={{ padding: 8 }}>
102113
{!isInherited && (
103114
<form action={updateUserFlagAction}>
104-
<input type="hidden" name="appId" value={selectedAppId} />
105-
<input type="hidden" name="envId" value={selectedEnvId} />
115+
<input
116+
type="hidden"
117+
name="appId"
118+
value={selectedAppId}
119+
/>
120+
<input
121+
type="hidden"
122+
name="envId"
123+
value={selectedEnvId}
124+
/>
106125
<input type="hidden" name="userId" value={userId} />
107126
<input type="hidden" name="flagKey" value={flag.key} />
108-
<input type="hidden" name="nextValue" value={String(!flag.value)} />
127+
<input
128+
type="hidden"
129+
name="nextValue"
130+
value={String(!flag.value)}
131+
/>
109132
<button type="submit">
110133
{flag.value ? "Turn off" : "Turn on"}
111134
</button>

packages/rest-api-sdk/examples/customer-admin-panel/app/globals.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
:root {
22
color-scheme: light;
3-
font-family: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
3+
font-family:
4+
"Inter",
5+
"SF Pro Text",
6+
system-ui,
7+
-apple-system,
8+
sans-serif;
49
line-height: 1.5;
510
background: #f7f7f8;
611
color: #111827;

packages/rest-api-sdk/examples/customer-admin-panel/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import "./globals.css";
22

33
export const metadata = {
44
title: "Customer Admin Panel",
5-
description: "Customer admin panel example app powered by the Reflag REST API SDK",
5+
description:
6+
"Customer admin panel example app powered by the Reflag REST API SDK",
67
};
78

89
export default function RootLayout({

0 commit comments

Comments
 (0)