@lukoweb/apitogo 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +37 -147
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +1 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "
|
|
12
|
-
import { Playground, type PlaygroundContentProps } from "./Playground.js";
|
|
13
|
-
|
|
14
|
-
export type PlaygroundDialogProps = PropsWithChildren<PlaygroundContentProps>;
|
|
15
|
-
|
|
16
|
-
const PlaygroundDialog = (props: PlaygroundDialogProps) => {
|
|
17
|
-
const [open, setOpen] = useState(false);
|
|
18
|
-
const { isAuthEnabled, login, signup, isPending, isAuthenticated } =
|
|
19
|
-
useAuth();
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Dialog onOpenChange={(open) => setOpen(open)}>
|
|
23
|
-
<DialogTrigger asChild>
|
|
24
|
-
{props.children ?? (
|
|
25
|
-
<Button variant="ghost" size="icon-xs" className="group">
|
|
26
|
-
<PlayIcon
|
|
27
|
-
className="fill-muted-foreground group-hover:fill-foreground transition"
|
|
28
|
-
size={16}
|
|
29
|
-
strokeWidth={1.5}
|
|
30
|
-
/>
|
|
31
|
-
</Button>
|
|
32
|
-
)}
|
|
33
|
-
</DialogTrigger>
|
|
34
|
-
|
|
35
|
-
<DialogContent
|
|
36
|
-
className="max-w-screen-xl! w-full overflow-hidden p-0"
|
|
37
|
-
aria-describedby={undefined}
|
|
38
|
-
showCloseButton={true}
|
|
39
|
-
>
|
|
40
|
-
<VisuallyHidden>
|
|
41
|
-
<DialogTitle>Playground</DialogTitle>
|
|
42
|
-
</VisuallyHidden>
|
|
43
|
-
{open && (
|
|
44
|
-
<Playground
|
|
45
|
-
requiresLogin={isAuthEnabled && !isAuthenticated && !isPending}
|
|
46
|
-
onLogin={() => login()}
|
|
47
|
-
onSignUp={() => signup()}
|
|
48
|
-
{...props}
|
|
49
|
-
/>
|
|
50
|
-
)}
|
|
51
|
-
</DialogContent>
|
|
52
|
-
</Dialog>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export { PlaygroundDialog };
|
|
1
|
+
import { useAuth } from "@lukoweb/apitogo/hooks";
|
|
2
|
+
import { Button } from "@lukoweb/apitogo/ui/Button.js";
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogTitle,
|
|
7
|
+
DialogTrigger,
|
|
8
|
+
} from "@lukoweb/apitogo/ui/Dialog.js";
|
|
9
|
+
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
10
|
+
import { PlayIcon } from "lucide-react";
|
|
11
|
+
import { type PropsWithChildren, useState } from "react";
|
|
12
|
+
import { Playground, type PlaygroundContentProps } from "./Playground.js";
|
|
13
|
+
|
|
14
|
+
export type PlaygroundDialogProps = PropsWithChildren<PlaygroundContentProps>;
|
|
15
|
+
|
|
16
|
+
const PlaygroundDialog = (props: PlaygroundDialogProps) => {
|
|
17
|
+
const [open, setOpen] = useState(false);
|
|
18
|
+
const { isAuthEnabled, login, signup, isPending, isAuthenticated } =
|
|
19
|
+
useAuth();
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Dialog onOpenChange={(open) => setOpen(open)}>
|
|
23
|
+
<DialogTrigger asChild>
|
|
24
|
+
{props.children ?? (
|
|
25
|
+
<Button variant="ghost" size="icon-xs" className="group">
|
|
26
|
+
<PlayIcon
|
|
27
|
+
className="fill-muted-foreground group-hover:fill-foreground transition"
|
|
28
|
+
size={16}
|
|
29
|
+
strokeWidth={1.5}
|
|
30
|
+
/>
|
|
31
|
+
</Button>
|
|
32
|
+
)}
|
|
33
|
+
</DialogTrigger>
|
|
34
|
+
|
|
35
|
+
<DialogContent
|
|
36
|
+
className="max-w-screen-xl! w-full overflow-hidden p-0"
|
|
37
|
+
aria-describedby={undefined}
|
|
38
|
+
showCloseButton={true}
|
|
39
|
+
>
|
|
40
|
+
<VisuallyHidden>
|
|
41
|
+
<DialogTitle>Playground</DialogTitle>
|
|
42
|
+
</VisuallyHidden>
|
|
43
|
+
{open && (
|
|
44
|
+
<Playground
|
|
45
|
+
requiresLogin={isAuthEnabled && !isAuthenticated && !isPending}
|
|
46
|
+
onLogin={() => login()}
|
|
47
|
+
onSignUp={() => signup()}
|
|
48
|
+
{...props}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
</DialogContent>
|
|
52
|
+
</Dialog>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export { PlaygroundDialog };
|
|
@@ -1,148 +1,151 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
control
|
|
25
|
-
schemaQueryParams
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
{
|
|
96
|
-
{requiredFields[i]
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
manager.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
1
|
+
import { Checkbox } from "@lukoweb/apitogo/ui/Checkbox.js";
|
|
2
|
+
import {
|
|
3
|
+
Collapsible,
|
|
4
|
+
CollapsibleContent,
|
|
5
|
+
} from "@lukoweb/apitogo/ui/Collapsible.js";
|
|
6
|
+
import { Unlink2Icon } from "lucide-react";
|
|
7
|
+
import { type Control, useFormContext } from "react-hook-form";
|
|
8
|
+
import { Autocomplete } from "../../../components/Autocomplete.js";
|
|
9
|
+
import { MultiSelect } from "../../../components/MultiSelect.js";
|
|
10
|
+
import {
|
|
11
|
+
CollapsibleHeader,
|
|
12
|
+
CollapsibleHeaderTrigger,
|
|
13
|
+
} from "./CollapsibleHeader.js";
|
|
14
|
+
import ParamsGrid, {
|
|
15
|
+
ParamsGridInput,
|
|
16
|
+
ParamsGridItem,
|
|
17
|
+
ParamsGridRemoveButton,
|
|
18
|
+
} from "./ParamsGrid.js";
|
|
19
|
+
import type { PlaygroundForm, QueryParam } from "./Playground.js";
|
|
20
|
+
import { useKeyValueFieldManager } from "./request-panel/useKeyValueFieldManager.js";
|
|
21
|
+
import { parseArrayParamValue } from "./serializeQueryParams.js";
|
|
22
|
+
|
|
23
|
+
export const QueryParams = ({
|
|
24
|
+
control,
|
|
25
|
+
schemaQueryParams,
|
|
26
|
+
}: {
|
|
27
|
+
control: Control<PlaygroundForm>;
|
|
28
|
+
schemaQueryParams: QueryParam[];
|
|
29
|
+
}) => {
|
|
30
|
+
const { watch } = useFormContext<PlaygroundForm>();
|
|
31
|
+
const watchedQueryParams = watch("queryParams");
|
|
32
|
+
|
|
33
|
+
const manager = useKeyValueFieldManager<PlaygroundForm, "queryParams">({
|
|
34
|
+
control,
|
|
35
|
+
name: "queryParams",
|
|
36
|
+
defaultValue: { name: "", value: "", active: false },
|
|
37
|
+
shouldSetActive: (item) => {
|
|
38
|
+
const schemaParam = schemaQueryParams.find((p) => p.name === item.name);
|
|
39
|
+
if (schemaParam) {
|
|
40
|
+
const isRequired = schemaParam.isRequired ?? false;
|
|
41
|
+
const hasValue = Boolean(item.value);
|
|
42
|
+
return isRequired || hasValue;
|
|
43
|
+
}
|
|
44
|
+
return Boolean(item.name || item.value);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const requiredFields = schemaQueryParams.map((param) =>
|
|
49
|
+
Boolean(param.isRequired),
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const hasSchemaParams = schemaQueryParams.length > 0;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Collapsible defaultOpen>
|
|
56
|
+
<CollapsibleHeaderTrigger>
|
|
57
|
+
<Unlink2Icon size={16} />
|
|
58
|
+
<CollapsibleHeader>Query Parameters</CollapsibleHeader>
|
|
59
|
+
</CollapsibleHeaderTrigger>
|
|
60
|
+
<CollapsibleContent className="CollapsibleContent">
|
|
61
|
+
<ParamsGrid>
|
|
62
|
+
{manager.fields.map((field, i) => {
|
|
63
|
+
const currentParam = schemaQueryParams.find(
|
|
64
|
+
(param) => param.name === watchedQueryParams.at(i)?.name,
|
|
65
|
+
);
|
|
66
|
+
const hasEnum = currentParam?.enum && currentParam.enum.length > 0;
|
|
67
|
+
const isArrayEnum = currentParam?.type === "array" && hasEnum;
|
|
68
|
+
const nameInputProps = manager.getNameInputProps(i);
|
|
69
|
+
const valueInputProps = manager.getValueInputProps(i);
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<ParamsGridItem key={field.id}>
|
|
73
|
+
<Checkbox {...manager.getCheckboxProps(i)} />
|
|
74
|
+
{!requiredFields[i] ? (
|
|
75
|
+
hasSchemaParams ? (
|
|
76
|
+
<ParamsGridInput asChild>
|
|
77
|
+
<Autocomplete
|
|
78
|
+
{...nameInputProps}
|
|
79
|
+
value={String(manager.getValue(i, "name"))}
|
|
80
|
+
placeholder="Name"
|
|
81
|
+
options={schemaQueryParams.map((param) => param.name)}
|
|
82
|
+
onChange={(v) => manager.setValue(i, "name", v)}
|
|
83
|
+
onSelect={(v) =>
|
|
84
|
+
manager.setValue(i, "name", v, { focus: "next" })
|
|
85
|
+
}
|
|
86
|
+
/>
|
|
87
|
+
</ParamsGridInput>
|
|
88
|
+
) : (
|
|
89
|
+
<ParamsGridInput {...nameInputProps} placeholder="Name" />
|
|
90
|
+
)
|
|
91
|
+
) : (
|
|
92
|
+
<ParamsGridInput asChild>
|
|
93
|
+
<label
|
|
94
|
+
className="flex items-center cursor-pointer gap-1"
|
|
95
|
+
htmlFor={`queryParams.${i}.active`}
|
|
96
|
+
title={requiredFields[i] ? "Required field" : undefined}
|
|
97
|
+
>
|
|
98
|
+
{watchedQueryParams[i]?.name}
|
|
99
|
+
{requiredFields[i] && <span> *</span>}
|
|
100
|
+
</label>
|
|
101
|
+
</ParamsGridInput>
|
|
102
|
+
)}
|
|
103
|
+
<div className="flex justify-between items-center">
|
|
104
|
+
{isArrayEnum ? (
|
|
105
|
+
<ParamsGridInput asChild>
|
|
106
|
+
<MultiSelect
|
|
107
|
+
options={currentParam.enum ?? []}
|
|
108
|
+
value={parseArrayParamValue(
|
|
109
|
+
String(manager.getValue(i, "value")),
|
|
110
|
+
)}
|
|
111
|
+
onChange={(values) => {
|
|
112
|
+
manager.setValue(
|
|
113
|
+
i,
|
|
114
|
+
"value",
|
|
115
|
+
values.length > 0 ? JSON.stringify(values) : "",
|
|
116
|
+
);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
</ParamsGridInput>
|
|
120
|
+
) : !hasEnum ? (
|
|
121
|
+
<ParamsGridInput
|
|
122
|
+
placeholder="Value"
|
|
123
|
+
aria-label="Query parameter value"
|
|
124
|
+
{...valueInputProps}
|
|
125
|
+
/>
|
|
126
|
+
) : (
|
|
127
|
+
<ParamsGridInput asChild>
|
|
128
|
+
<Autocomplete
|
|
129
|
+
{...valueInputProps}
|
|
130
|
+
value={String(manager.getValue(i, "value"))}
|
|
131
|
+
shouldFilter={false}
|
|
132
|
+
options={currentParam.enum ?? []}
|
|
133
|
+
onChange={(v) => manager.setValue(i, "value", v)}
|
|
134
|
+
onSelect={(v) =>
|
|
135
|
+
manager.setValue(i, "value", v, { focus: "next" })
|
|
136
|
+
}
|
|
137
|
+
/>
|
|
138
|
+
</ParamsGridInput>
|
|
139
|
+
)}
|
|
140
|
+
<ParamsGridRemoveButton
|
|
141
|
+
{...manager.getRemoveButtonProps(i)}
|
|
142
|
+
/>
|
|
143
|
+
</div>
|
|
144
|
+
</ParamsGridItem>
|
|
145
|
+
);
|
|
146
|
+
})}
|
|
147
|
+
</ParamsGrid>
|
|
148
|
+
</CollapsibleContent>
|
|
149
|
+
</Collapsible>
|
|
150
|
+
);
|
|
151
|
+
};
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from "@lukoweb/apitogo/ui/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const RequestLoginDialog = ({
|
|
14
|
-
open,
|
|
15
|
-
setOpen,
|
|
16
|
-
onSignUp,
|
|
17
|
-
onLogin,
|
|
18
|
-
onSkip,
|
|
19
|
-
}: {
|
|
20
|
-
open: boolean;
|
|
21
|
-
onSignUp?: () => void;
|
|
22
|
-
onLogin?: () => void;
|
|
23
|
-
setOpen: (open: boolean) => void;
|
|
24
|
-
onSkip?: (rememberSkip: boolean) => void;
|
|
25
|
-
}) => {
|
|
26
|
-
const [rememberSkip, setRememberSkip] = useState(false);
|
|
27
|
-
|
|
28
|
-
const handleSkip = () => {
|
|
29
|
-
onSkip?.(rememberSkip);
|
|
30
|
-
setOpen(false);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Dialog open={open} onOpenChange={setOpen}>
|
|
35
|
-
<DialogContent>
|
|
36
|
-
<DialogTitle>Welcome to the Playground!</DialogTitle>
|
|
37
|
-
<DialogDescription>
|
|
38
|
-
The Playground is a tool for developers to test and explore our APIs.
|
|
39
|
-
To use the Playground, you need to login.
|
|
40
|
-
</DialogDescription>
|
|
41
|
-
<Label className="flex items-center gap-2 font-normal">
|
|
42
|
-
<Checkbox
|
|
43
|
-
checked={rememberSkip}
|
|
44
|
-
onCheckedChange={(checked) => setRememberSkip(checked === true)}
|
|
45
|
-
/>
|
|
46
|
-
Don't show this again
|
|
47
|
-
</Label>
|
|
48
|
-
<DialogFooter className="flex gap-2 sm:justify-between">
|
|
49
|
-
<Button type="button" variant="outline" onClick={handleSkip}>
|
|
50
|
-
Skip
|
|
51
|
-
</Button>
|
|
52
|
-
<div className="flex gap-2">
|
|
53
|
-
{onSignUp && (
|
|
54
|
-
<Button type="button" variant="outline" onClick={onSignUp}>
|
|
55
|
-
Sign Up
|
|
56
|
-
</Button>
|
|
57
|
-
)}
|
|
58
|
-
{onLogin && (
|
|
59
|
-
<Button type="button" variant="default" onClick={onLogin}>
|
|
60
|
-
Login
|
|
61
|
-
</Button>
|
|
62
|
-
)}
|
|
63
|
-
</div>
|
|
64
|
-
</DialogFooter>
|
|
65
|
-
</DialogContent>
|
|
66
|
-
</Dialog>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default RequestLoginDialog;
|
|
1
|
+
import { Button } from "@lukoweb/apitogo/ui/Button.js";
|
|
2
|
+
import { Checkbox } from "@lukoweb/apitogo/ui/Checkbox.js";
|
|
3
|
+
import {
|
|
4
|
+
Dialog,
|
|
5
|
+
DialogContent,
|
|
6
|
+
DialogDescription,
|
|
7
|
+
DialogFooter,
|
|
8
|
+
DialogTitle,
|
|
9
|
+
} from "@lukoweb/apitogo/ui/Dialog.js";
|
|
10
|
+
import { Label } from "@lukoweb/apitogo/ui/Label.js";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
|
|
13
|
+
const RequestLoginDialog = ({
|
|
14
|
+
open,
|
|
15
|
+
setOpen,
|
|
16
|
+
onSignUp,
|
|
17
|
+
onLogin,
|
|
18
|
+
onSkip,
|
|
19
|
+
}: {
|
|
20
|
+
open: boolean;
|
|
21
|
+
onSignUp?: () => void;
|
|
22
|
+
onLogin?: () => void;
|
|
23
|
+
setOpen: (open: boolean) => void;
|
|
24
|
+
onSkip?: (rememberSkip: boolean) => void;
|
|
25
|
+
}) => {
|
|
26
|
+
const [rememberSkip, setRememberSkip] = useState(false);
|
|
27
|
+
|
|
28
|
+
const handleSkip = () => {
|
|
29
|
+
onSkip?.(rememberSkip);
|
|
30
|
+
setOpen(false);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
35
|
+
<DialogContent>
|
|
36
|
+
<DialogTitle>Welcome to the Playground!</DialogTitle>
|
|
37
|
+
<DialogDescription>
|
|
38
|
+
The Playground is a tool for developers to test and explore our APIs.
|
|
39
|
+
To use the Playground, you need to login.
|
|
40
|
+
</DialogDescription>
|
|
41
|
+
<Label className="flex items-center gap-2 font-normal">
|
|
42
|
+
<Checkbox
|
|
43
|
+
checked={rememberSkip}
|
|
44
|
+
onCheckedChange={(checked) => setRememberSkip(checked === true)}
|
|
45
|
+
/>
|
|
46
|
+
Don't show this again
|
|
47
|
+
</Label>
|
|
48
|
+
<DialogFooter className="flex gap-2 sm:justify-between">
|
|
49
|
+
<Button type="button" variant="outline" onClick={handleSkip}>
|
|
50
|
+
Skip
|
|
51
|
+
</Button>
|
|
52
|
+
<div className="flex gap-2">
|
|
53
|
+
{onSignUp && (
|
|
54
|
+
<Button type="button" variant="outline" onClick={onSignUp}>
|
|
55
|
+
Sign Up
|
|
56
|
+
</Button>
|
|
57
|
+
)}
|
|
58
|
+
{onLogin && (
|
|
59
|
+
<Button type="button" variant="default" onClick={onLogin}>
|
|
60
|
+
Login
|
|
61
|
+
</Button>
|
|
62
|
+
)}
|
|
63
|
+
</div>
|
|
64
|
+
</DialogFooter>
|
|
65
|
+
</DialogContent>
|
|
66
|
+
</Dialog>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export default RequestLoginDialog;
|