@kyro-cms/admin 0.3.2 → 0.3.5
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/EditorClient-XEUOVAAC.js +466 -0
- package/dist/EditorClient-XEUOVAAC.js.map +1 -0
- package/dist/EditorClient-YLCGVDXY.cjs +468 -0
- package/dist/EditorClient-YLCGVDXY.cjs.map +1 -0
- package/dist/chunk-7KPIUCGT.js +384 -0
- package/dist/chunk-7KPIUCGT.js.map +1 -0
- package/dist/chunk-GOACG6R7.cjs +473 -0
- package/dist/chunk-GOACG6R7.cjs.map +1 -0
- package/dist/index.cjs +14861 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +1661 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +563 -0
- package/dist/index.js +14784 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -19
- package/src/components/ActionBar.tsx +7 -43
- package/src/components/Admin.tsx +138 -277
- package/src/components/ApiKeysManager.tsx +428 -419
- package/src/components/AuditLogsPage.tsx +35 -39
- package/src/components/AuthBridge.tsx +51 -0
- package/src/components/AutoForm.tsx +495 -1230
- package/src/components/BrandingHub.tsx +18 -19
- package/src/components/BulkActionsBar.tsx +1 -1
- package/src/components/CreateView.tsx +22 -36
- package/src/components/Dashboard.tsx +60 -84
- package/src/components/DetailView.tsx +113 -91
- package/src/components/DeveloperCenter.tsx +200 -198
- package/src/components/FieldRenderer.tsx +206 -0
- package/src/components/GraphQLPlayground.tsx +340 -480
- package/src/components/ListView.tsx +828 -254
- package/src/components/LoginPage.tsx +3 -4
- package/src/components/MarketplaceManager.tsx +254 -0
- package/src/components/MediaGallery.tsx +856 -1192
- package/src/components/PluginsManager.tsx +277 -0
- package/src/components/RestPlayground.tsx +398 -560
- package/src/components/SessionsManager.tsx +211 -0
- package/src/components/Sidebar.astro +179 -151
- package/src/components/ThemeProvider.tsx +7 -161
- package/src/components/UserManagement.tsx +162 -146
- package/src/components/UserMenu.tsx +110 -0
- package/src/components/WebhookManager.tsx +305 -367
- package/src/components/blocks/AccordionBlock.tsx +4 -4
- package/src/components/blocks/ArrayBlock.tsx +3 -3
- package/src/components/blocks/BlockEditModal.tsx +8 -8
- package/src/components/blocks/BlockWrapper.tsx +61 -0
- package/src/components/blocks/ButtonBlock.tsx +4 -4
- package/src/components/blocks/ChildBlocksTree.tsx +23 -25
- package/src/components/blocks/CodeBlock.tsx +15 -15
- package/src/components/blocks/ColumnsBlock.tsx +6 -44
- package/src/components/blocks/DividerBlock.tsx +3 -3
- package/src/components/blocks/FileBlock.tsx +4 -4
- package/src/components/blocks/HeadingBlock.tsx +6 -38
- package/src/components/blocks/HeroBlock.tsx +4 -4
- package/src/components/blocks/ImageBlock.tsx +4 -4
- package/src/components/blocks/LinkBlock.tsx +4 -4
- package/src/components/blocks/ListBlock.tsx +3 -3
- package/src/components/blocks/ParagraphBlock.tsx +12 -42
- package/src/components/blocks/RelationshipBlock.tsx +4 -4
- package/src/components/blocks/RichTextBlock.tsx +4 -4
- package/src/components/blocks/VStackBlock.tsx +5 -37
- package/src/components/blocks/VideoBlock.tsx +4 -4
- package/src/components/blocks/types.ts +11 -0
- package/src/components/fields/AccordionField.tsx +1 -1
- package/src/components/fields/ArrayField.tsx +2 -2
- package/src/components/fields/ArrayLayout.tsx +93 -0
- package/src/components/fields/BlocksField.tsx +122 -111
- package/src/components/fields/ButtonField.tsx +1 -1
- package/src/components/fields/CheckboxField.tsx +14 -15
- package/src/components/fields/ChildrenField.tsx +2 -2
- package/src/components/fields/CodeField.tsx +3 -3
- package/src/components/fields/ColumnsField.tsx +2 -2
- package/src/components/fields/DateField.tsx +13 -26
- package/src/components/fields/EditorClient.tsx +26 -28
- package/src/components/fields/FieldLayout.tsx +52 -0
- package/src/components/fields/GroupLayout.tsx +35 -0
- package/src/components/fields/JSONField.tsx +7 -7
- package/src/components/fields/LinkField.tsx +1 -1
- package/src/components/fields/MarkdownField.tsx +1 -1
- package/src/components/fields/NumberField.tsx +13 -26
- package/src/components/fields/PortableTextField.tsx +4 -4
- package/src/components/fields/PortableTextRenderer.tsx +1 -1
- package/src/components/fields/RelationshipBlockField.tsx +31 -23
- package/src/components/fields/RelationshipField.tsx +14 -14
- package/src/components/fields/SelectField.tsx +17 -26
- package/src/components/fields/TabsLayout.tsx +69 -0
- package/src/components/fields/TextField.tsx +85 -38
- package/src/components/fields/UploadField.tsx +71 -41
- package/src/components/fields/VideoField.tsx +1 -1
- package/src/components/fields/extensions/blockComponents.tsx +2 -2
- package/src/components/fields/extensions/blocksStore.ts +207 -193
- package/src/components/fields/types.ts +22 -0
- package/src/components/layout/Layout.tsx +1 -1
- package/src/components/ui/ActionMenu.tsx +63 -0
- package/src/components/ui/Badge.tsx +59 -5
- package/src/components/ui/BlockDrawer.tsx +4 -5
- package/src/components/ui/CommandPalette.tsx +58 -36
- package/src/components/ui/CommandPaletteWrapper.tsx +18 -17
- package/src/components/ui/Dropdown.tsx +18 -16
- package/src/components/ui/EmptyState.tsx +25 -0
- package/src/components/ui/GlobalModal.tsx +49 -0
- package/src/components/ui/IconButton.tsx +44 -0
- package/src/components/ui/Modal.tsx +19 -20
- package/src/components/ui/PageHeader.tsx +158 -0
- package/src/components/ui/Pagination.tsx +61 -0
- package/src/components/ui/PromptModal.tsx +1 -1
- package/src/components/ui/SearchInput.tsx +57 -0
- package/src/components/ui/SeoPreview.tsx +31 -0
- package/src/components/ui/SessionModal.tsx +0 -0
- package/src/components/ui/SlidePanel.tsx +2 -0
- package/src/components/ui/Toast.tsx +65 -122
- package/src/components/ui/Toaster.tsx +18 -0
- package/src/components/ui/icons.tsx +112 -0
- package/src/components/users/UserDetail.tsx +290 -0
- package/src/components/users/UserForm.tsx +242 -0
- package/src/components/users/UsersList.tsx +338 -0
- package/src/env.d.ts +13 -13
- package/src/fields/index.ts +2 -1
- package/src/global.d.ts +7 -0
- package/src/hooks/data.ts +2 -9
- package/src/hooks/useAsyncData.ts +36 -0
- package/src/hooks/useAutoFormState.ts +527 -0
- package/src/hooks/useSelection.ts +49 -0
- package/src/hooks/useSession.ts +0 -0
- package/src/index.ts +11 -1
- package/src/integration.ts +86 -11
- package/src/kyro-cms.d.ts +209 -0
- package/src/layouts/AdminLayout.astro +128 -11
- package/src/layouts/AuthLayout.astro +21 -5
- package/src/lib/api.ts +175 -55
- package/src/lib/autoform-store.ts +435 -0
- package/src/lib/config.ts +82 -34
- package/src/lib/createRegistry.ts +29 -0
- package/src/lib/default-kyro-config.ts +4 -0
- package/src/lib/globals.ts +50 -0
- package/src/lib/media-utils.ts +18 -0
- package/src/lib/object-utils.ts +77 -0
- package/src/lib/paths.ts +61 -0
- package/src/lib/stores/index.ts +370 -0
- package/src/lib/types.ts +43 -0
- package/src/lib/useResourceManager.ts +105 -0
- package/src/pages/403.astro +67 -0
- package/src/pages/[collection]/[id].astro +14 -180
- package/src/pages/[collection]/index.astro +11 -6
- package/src/pages/api-explorer.astro +173 -0
- package/src/pages/audit/index.astro +2 -0
- package/src/pages/auth/login.astro +122 -0
- package/src/pages/auth/register.astro +167 -0
- package/src/pages/graphql-explorer.astro +59 -0
- package/src/pages/{admin/graphql.astro → graphql.astro} +51 -17
- package/src/pages/index.astro +577 -0
- package/src/pages/index_ALT.astro +3 -0
- package/src/pages/keys.astro +11 -0
- package/src/pages/marketplace.astro +11 -0
- package/src/pages/media.astro +3 -0
- package/src/pages/plugins.astro +8 -0
- package/src/pages/preview/[collection]/[id].astro +188 -123
- package/src/pages/rest-playground.astro +62 -0
- package/src/pages/roles/index.astro +183 -76
- package/src/pages/sessions.astro +8 -0
- package/src/pages/settings/[slug].astro +92 -114
- package/src/pages/settings/index.astro +5 -3
- package/src/pages/users/[id].astro +25 -154
- package/src/pages/users/index.astro +19 -130
- package/src/pages/users/new.astro +9 -86
- package/src/pages/webhooks.astro +11 -0
- package/src/routes.ts +80 -0
- package/src/styles/main.css +119 -79
- package/src/theme/tokens.ts +1 -0
- package/src/vite-env.d.ts +14 -0
- package/src/collections/auth/index.ts +0 -155
- package/src/collections/portfolio/index.ts +0 -343
- package/src/components/ApiExplorer.tsx +0 -325
- package/src/components/EnhancedListView.tsx +0 -889
- package/src/components/GraphQLExplorer.tsx +0 -675
- package/src/components/Icons.tsx +0 -23
- package/src/components/StatusBadge.tsx +0 -76
- package/src/lib/MediaService.ts +0 -541
- package/src/lib/auth/sqlite-adapter.ts +0 -319
- package/src/lib/dataStore.ts +0 -226
- package/src/lib/db/adapter.ts +0 -54
- package/src/lib/db/drizzle-mysql-adapter.ts +0 -194
- package/src/lib/db/drizzle-mysql-auth-adapter.ts +0 -327
- package/src/lib/db/drizzle-postgres-adapter.ts +0 -202
- package/src/lib/db/drizzle-postgres-auth-adapter.ts +0 -304
- package/src/lib/db/drizzle-sqlite-adapter.ts +0 -227
- package/src/lib/db/drizzle-sqlite-auth-adapter.ts +0 -548
- package/src/lib/db/index.ts +0 -449
- package/src/lib/db/mongodb-adapter.ts +0 -207
- package/src/lib/db/mongodb-auth-adapter.ts +0 -305
- package/src/lib/db/schema/mysql-auth.ts +0 -113
- package/src/lib/db/schema/mysql-content.ts +0 -20
- package/src/lib/db/schema/postgres-auth.ts +0 -116
- package/src/lib/db/schema/postgres-content.ts +0 -35
- package/src/lib/db/schema/postgres-media.ts +0 -52
- package/src/lib/db/schema/postgres-settings.ts +0 -11
- package/src/lib/db/schema/sqlite-auth.ts +0 -112
- package/src/lib/db/schema/sqlite-content.ts +0 -20
- package/src/lib/db/version-adapter.ts +0 -248
- package/src/lib/graphql/index.ts +0 -1
- package/src/lib/graphql/schema.ts +0 -443
- package/src/lib/rate-limit.ts +0 -267
- package/src/lib/storage.ts +0 -374
- package/src/lib/store.ts +0 -85
- package/src/middleware.ts +0 -177
- package/src/pages/admin/api-explorer.astro +0 -98
- package/src/pages/admin/graphql-explorer.astro +0 -40
- package/src/pages/admin/index.astro +0 -286
- package/src/pages/admin/keys.astro +0 -8
- package/src/pages/admin/rest-playground.astro +0 -44
- package/src/pages/admin/webhooks.astro +0 -8
- package/src/pages/api/[collection]/[id]/publish.ts +0 -52
- package/src/pages/api/[collection]/[id]/unpublish.ts +0 -42
- package/src/pages/api/[collection]/[id]/versions.ts +0 -66
- package/src/pages/api/[collection]/[id].ts +0 -213
- package/src/pages/api/[collection]/index.ts +0 -209
- package/src/pages/api/auth/[id].ts +0 -121
- package/src/pages/api/auth/audit-logs.ts +0 -57
- package/src/pages/api/auth/login.ts +0 -211
- package/src/pages/api/auth/logout.ts +0 -66
- package/src/pages/api/auth/me.ts +0 -36
- package/src/pages/api/auth/refresh.ts +0 -119
- package/src/pages/api/auth/register.ts +0 -188
- package/src/pages/api/auth/users.ts +0 -97
- package/src/pages/api/collections.ts +0 -59
- package/src/pages/api/globals/[slug].ts +0 -42
- package/src/pages/api/graphql.ts +0 -90
- package/src/pages/api/health.ts +0 -426
- package/src/pages/api/keys/[id].ts +0 -26
- package/src/pages/api/keys/index.ts +0 -75
- package/src/pages/api/media/[id].ts +0 -309
- package/src/pages/api/media/folders.ts +0 -609
- package/src/pages/api/media/index.ts +0 -146
- package/src/pages/api/media/resize.ts +0 -267
- package/src/pages/api/search.ts +0 -82
- package/src/pages/api/slug-availability.ts +0 -70
- package/src/pages/api/storage-config.ts +0 -20
- package/src/pages/api/storage-status.ts +0 -206
- package/src/pages/api/upload.ts +0 -334
- package/src/pages/api/webhooks/index.ts +0 -71
- package/src/pages/login.astro +0 -82
- package/src/pages/register.astro +0 -102
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
import AuthLayout from "../../layouts/AuthLayout.astro";
|
|
3
|
+
|
|
4
|
+
import { adminPath, apiPath } from "../../lib/paths";
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<AuthLayout title="Create Account">
|
|
8
|
+
<div class="surface-tile p-8 w-full" style="max-width: 420px;">
|
|
9
|
+
<div class="text-center mb-8">
|
|
10
|
+
<h1
|
|
11
|
+
class="text-2xl font-bold tracking-tight text-[var(--kyro-text-primary)]"
|
|
12
|
+
>
|
|
13
|
+
Create your account
|
|
14
|
+
</h1>
|
|
15
|
+
<p class="text-sm text-[var(--kyro-text-secondary)] mt-2">
|
|
16
|
+
Get started with Kyro CMS
|
|
17
|
+
</p>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<form id="register-form" class="space-y-5">
|
|
21
|
+
<div>
|
|
22
|
+
<label
|
|
23
|
+
for="email"
|
|
24
|
+
class="block text-sm font-medium text-[var(--kyro-text-primary)] mb-2"
|
|
25
|
+
>Email</label
|
|
26
|
+
>
|
|
27
|
+
<input
|
|
28
|
+
type="email"
|
|
29
|
+
id="email"
|
|
30
|
+
name="email"
|
|
31
|
+
required
|
|
32
|
+
class="w-full px-4 py-3 border border-[var(--kyro-border)] bg-[var(--kyro-input-bg)] rounded-xl text-sm font-medium focus:outline-none focus:ring-2 focus:ring-[var(--kyro-sidebar-active)] focus:border-[var(--kyro-sidebar-active)] text-[var(--kyro-text-primary)]"
|
|
33
|
+
placeholder="admin@example.com"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<div>
|
|
38
|
+
<label
|
|
39
|
+
for="password"
|
|
40
|
+
class="block text-sm font-medium text-[var(--kyro-text-primary)] mb-2"
|
|
41
|
+
>Password</label
|
|
42
|
+
>
|
|
43
|
+
<input
|
|
44
|
+
type="password"
|
|
45
|
+
id="password"
|
|
46
|
+
name="password"
|
|
47
|
+
required
|
|
48
|
+
minlength="8"
|
|
49
|
+
class="w-full px-4 py-3 border border-[var(--kyro-border)] bg-[var(--kyro-input-bg)] rounded-xl text-sm font-medium focus:outline-none focus:ring-2 focus:ring-[var(--kyro-sidebar-active)] focus:border-[var(--kyro-sidebar-active)] text-[var(--kyro-text-primary)]"
|
|
50
|
+
placeholder="Minimum 8 characters"
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div>
|
|
55
|
+
<label
|
|
56
|
+
for="confirmPassword"
|
|
57
|
+
class="block text-sm font-medium text-[var(--kyro-text-primary)] mb-2"
|
|
58
|
+
>Confirm Password</label
|
|
59
|
+
>
|
|
60
|
+
<input
|
|
61
|
+
type="password"
|
|
62
|
+
id="confirmPassword"
|
|
63
|
+
name="confirmPassword"
|
|
64
|
+
required
|
|
65
|
+
minlength="8"
|
|
66
|
+
class="w-full px-4 py-3 border border-[var(--kyro-border)] bg-[var(--kyro-input-bg)] rounded-xl text-sm font-medium focus:outline-none focus:ring-2 focus:ring-[var(--kyro-sidebar-active)] focus:border-[var(--kyro-sidebar-active)] text-[var(--kyro-text-primary)]"
|
|
67
|
+
placeholder="Confirm your password"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div id="form-message" class="hidden p-3 rounded-xl text-sm font-bold">
|
|
72
|
+
</div>
|
|
73
|
+
|
|
74
|
+
<button
|
|
75
|
+
type="submit"
|
|
76
|
+
class="w-full py-3 bg-[var(--kyro-sidebar-active)] text-[var(--kyro-sidebar-text-active)] rounded-xl text-sm font-bold hover:opacity-90 transition-colors shadow-lg"
|
|
77
|
+
>
|
|
78
|
+
Create Account
|
|
79
|
+
</button>
|
|
80
|
+
</form>
|
|
81
|
+
|
|
82
|
+
<p class="text-center text-sm text-[var(--kyro-text-secondary)] mt-6">
|
|
83
|
+
Already have an account? <a
|
|
84
|
+
href={`${adminPath}/login`}
|
|
85
|
+
class="font-medium text-[var(--kyro-text-primary)] hover:underline"
|
|
86
|
+
>Sign in</a
|
|
87
|
+
>
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<script is:inline define:vars={{ apiPath, adminPath }}>
|
|
92
|
+
document
|
|
93
|
+
.getElementById("register-form")
|
|
94
|
+
?.addEventListener("submit", async (e) => {
|
|
95
|
+
e.preventDefault();
|
|
96
|
+
const form = e.target;
|
|
97
|
+
const message = document.getElementById("form-message");
|
|
98
|
+
const button = form.querySelector('button[type="submit"]');
|
|
99
|
+
|
|
100
|
+
const email = form.email.value;
|
|
101
|
+
const password = form.password.value;
|
|
102
|
+
const confirmPassword = form.confirmPassword.value;
|
|
103
|
+
|
|
104
|
+
if (password !== confirmPassword) {
|
|
105
|
+
message.textContent = "Passwords do not match";
|
|
106
|
+
message.className =
|
|
107
|
+
"block p-3 rounded-xl text-sm font-regular bg-red-50 text-red-600";
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (password.length < 8) {
|
|
112
|
+
message.textContent = "Password must be at least 8 characters";
|
|
113
|
+
message.className =
|
|
114
|
+
"block p-3 rounded-xl text-sm font-regular bg-red-50 text-red-600";
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
button.disabled = true;
|
|
119
|
+
button.textContent = "Creating account...";
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const res = await fetch(apiPath + "/auth/register", {
|
|
123
|
+
method: "POST",
|
|
124
|
+
headers: { "Content-Type": "application/json" },
|
|
125
|
+
body: JSON.stringify({ email, password, confirmPassword }),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const data = await res.json();
|
|
129
|
+
|
|
130
|
+
if (res.ok && data.success && data.user) {
|
|
131
|
+
// Cookies set server-side via Set-Cookie headers
|
|
132
|
+
// Store user in memory only (not localStorage)
|
|
133
|
+
window.__kyroAuth = { user: data.user, verified: true };
|
|
134
|
+
message.textContent = data.isFirstUser
|
|
135
|
+
? "Super admin account created!"
|
|
136
|
+
: "Account created successfully!";
|
|
137
|
+
message.className =
|
|
138
|
+
"block p-3 rounded-xl text-sm font-regular bg-green-50 text-green-600";
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
window.location.href = adminPath;
|
|
141
|
+
}, 1000);
|
|
142
|
+
} else if (res.ok && data.success) {
|
|
143
|
+
// Email verification required
|
|
144
|
+
message.textContent =
|
|
145
|
+
data.message || "Please check your email to verify your account.";
|
|
146
|
+
message.className =
|
|
147
|
+
"block p-3 rounded-xl text-sm font-regular bg-green-50 text-green-600";
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
window.location.href = adminPath + "/login";
|
|
150
|
+
}, 2000);
|
|
151
|
+
} else {
|
|
152
|
+
message.textContent = data.error || "Registration failed";
|
|
153
|
+
message.className =
|
|
154
|
+
"block p-3 rounded-xl text-sm font-regular bg-red-50 text-red-600";
|
|
155
|
+
button.disabled = false;
|
|
156
|
+
button.textContent = "Create Account";
|
|
157
|
+
}
|
|
158
|
+
} catch (err) {
|
|
159
|
+
message.textContent = "Connection error";
|
|
160
|
+
message.className =
|
|
161
|
+
"block p-3 rounded-xl text-sm font-regular bg-red-50 text-red-600";
|
|
162
|
+
button.disabled = false;
|
|
163
|
+
button.textContent = "Create Account";
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
</script>
|
|
167
|
+
</AuthLayout>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
import AdminLayout from "../layouts/AdminLayout.astro";
|
|
3
|
+
import { GraphQLPlayground } from "../components/GraphQLPlayground";
|
|
4
|
+
|
|
5
|
+
import { adminPath, apiPath } from "../lib/paths";
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<AdminLayout title="GraphQL Explorer">
|
|
9
|
+
<div class="flex-1 overflow-hidden">
|
|
10
|
+
<!-- Header -->
|
|
11
|
+
<div class="mb-6 surface-tile">
|
|
12
|
+
<div class="flex items-center justify-between mb-4">
|
|
13
|
+
<div>
|
|
14
|
+
<h1
|
|
15
|
+
class="text-xl font-bold tracking-tighter text-[var(--kyro-text-primary)]"
|
|
16
|
+
>
|
|
17
|
+
GraphQL Explorer
|
|
18
|
+
</h1>
|
|
19
|
+
<p
|
|
20
|
+
class="text-[var(--kyro-text-secondary)] font-bold mt-2 text-sm tracking-wider"
|
|
21
|
+
>
|
|
22
|
+
Schema documentation and type explorer
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex items-center gap-4">
|
|
26
|
+
<a
|
|
27
|
+
href={`${adminPath}/graphql`}
|
|
28
|
+
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-primary)] rounded-lg font-bold text-sm hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
29
|
+
>
|
|
30
|
+
<svg
|
|
31
|
+
class="w-4 h-4"
|
|
32
|
+
fill="none"
|
|
33
|
+
stroke="currentColor"
|
|
34
|
+
viewBox="0 0 24 24"
|
|
35
|
+
>
|
|
36
|
+
<path
|
|
37
|
+
stroke-linecap="round"
|
|
38
|
+
stroke-linejoin="round"
|
|
39
|
+
stroke-width="2"
|
|
40
|
+
d="M13 10V3L4 14h7v7l9-11h-7z"></path>
|
|
41
|
+
</svg>
|
|
42
|
+
Playground
|
|
43
|
+
</a>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<!-- Explorer Container -->
|
|
49
|
+
<div class="h-[calc(100vh-200px)] surface-tile overflow-hidden">
|
|
50
|
+
<div class="surface-tile h-full overflow-hidden">
|
|
51
|
+
<GraphQLPlayground
|
|
52
|
+
client:load
|
|
53
|
+
endpoint={`${apiPath}/graphql`}
|
|
54
|
+
initialShowDocs={true}
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</AdminLayout>
|
|
@@ -1,46 +1,76 @@
|
|
|
1
1
|
---
|
|
2
|
-
import AdminLayout from
|
|
3
|
-
import { GraphQLPlayground } from
|
|
2
|
+
import AdminLayout from "../layouts/AdminLayout.astro";
|
|
3
|
+
import { GraphQLPlayground } from "../components/GraphQLPlayground";
|
|
4
|
+
|
|
5
|
+
import { adminPath, apiPath } from "../lib/paths";
|
|
4
6
|
|
|
5
7
|
const url = Astro.request.url;
|
|
6
8
|
const params = new URL(url).searchParams;
|
|
7
|
-
const initialQuery = params.get(
|
|
9
|
+
const initialQuery = params.get("query") || "";
|
|
8
10
|
---
|
|
9
11
|
|
|
10
12
|
<AdminLayout title="GraphQL Playground">
|
|
11
|
-
<div class="flex-1 overflow-hidden
|
|
13
|
+
<div class="flex-1 overflow-hidden">
|
|
12
14
|
<!-- Header -->
|
|
13
|
-
<div class="mb-6">
|
|
15
|
+
<div class="mb-6 surface-tile">
|
|
14
16
|
<div class="flex items-center justify-between mb-4">
|
|
15
17
|
<div>
|
|
16
|
-
<h1
|
|
18
|
+
<h1
|
|
19
|
+
class="text-xl font-bold tracking-tighter text-[var(--kyro-text-primary)]"
|
|
20
|
+
>
|
|
17
21
|
GraphQL Playground
|
|
18
22
|
</h1>
|
|
19
|
-
<p
|
|
23
|
+
<p
|
|
24
|
+
class="text-[var(--kyro-text-secondary)] font-bold mt-2 text-sm tracking-wider"
|
|
25
|
+
>
|
|
20
26
|
Interactive GraphQL query editor and explorer
|
|
21
27
|
</p>
|
|
22
28
|
</div>
|
|
23
29
|
<div class="flex items-center gap-4">
|
|
24
30
|
<a
|
|
25
|
-
href=
|
|
31
|
+
href={`${adminPath}/graphql-explorer`}
|
|
26
32
|
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-primary)] rounded-lg font-bold text-sm hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
27
33
|
>
|
|
28
|
-
<svg
|
|
29
|
-
|
|
34
|
+
<svg
|
|
35
|
+
class="w-4 h-4"
|
|
36
|
+
fill="none"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
viewBox="0 0 24 24"
|
|
39
|
+
>
|
|
40
|
+
<path
|
|
41
|
+
stroke-linecap="round"
|
|
42
|
+
stroke-linejoin="round"
|
|
43
|
+
stroke-width="2"
|
|
44
|
+
d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
|
|
45
|
+
></path>
|
|
30
46
|
</svg>
|
|
31
47
|
Explorer
|
|
32
48
|
</a>
|
|
33
|
-
<div
|
|
49
|
+
<div
|
|
50
|
+
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] rounded-lg border border-[var(--kyro-border)]"
|
|
51
|
+
>
|
|
34
52
|
<div class="w-2 h-2 rounded-full bg-green-500"></div>
|
|
35
|
-
<span class="text-sm font-
|
|
53
|
+
<span class="text-sm font-medium text-[var(--kyro-text-primary)]"
|
|
54
|
+
>API Active</span
|
|
55
|
+
>
|
|
36
56
|
</div>
|
|
37
57
|
<a
|
|
38
|
-
href=
|
|
58
|
+
href={`${apiPath}/graphql`}
|
|
39
59
|
target="_blank"
|
|
40
60
|
class="flex items-center gap-2 px-4 py-2 bg-[var(--kyro-surface-accent)] text-[var(--kyro-text-primary)] rounded-lg font-bold text-sm hover:bg-[var(--kyro-surface)] transition-all border border-[var(--kyro-border)]"
|
|
41
61
|
>
|
|
42
|
-
<svg
|
|
43
|
-
|
|
62
|
+
<svg
|
|
63
|
+
class="w-4 h-4"
|
|
64
|
+
fill="none"
|
|
65
|
+
stroke="currentColor"
|
|
66
|
+
viewBox="0 0 24 24"
|
|
67
|
+
>
|
|
68
|
+
<path
|
|
69
|
+
stroke-linecap="round"
|
|
70
|
+
stroke-linejoin="round"
|
|
71
|
+
stroke-width="2"
|
|
72
|
+
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
73
|
+
></path>
|
|
44
74
|
</svg>
|
|
45
75
|
Open Endpoint
|
|
46
76
|
</a>
|
|
@@ -77,8 +107,12 @@ const initialQuery = params.get('query') || '';
|
|
|
77
107
|
</div>
|
|
78
108
|
|
|
79
109
|
<!-- GraphQL Playground Container -->
|
|
80
|
-
<div class="h-[calc(100vh-280px)] overflow-hidden">
|
|
81
|
-
<GraphQLPlayground
|
|
110
|
+
<div class="h-[calc(100vh-280px)] overflow-hidden surface-tile">
|
|
111
|
+
<GraphQLPlayground
|
|
112
|
+
client:load
|
|
113
|
+
endpoint={`${apiPath}/graphql`}
|
|
114
|
+
initialQuery={initialQuery}
|
|
115
|
+
/>
|
|
82
116
|
</div>
|
|
83
117
|
</div>
|
|
84
118
|
|