@kyro-cms/admin 0.9.3 → 0.9.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.
@@ -1,173 +0,0 @@
1
- ---
2
- import AdminLayout from "../layouts/AdminLayout.astro";
3
- import { ApiExplorer } from "../components/ApiExplorer";
4
-
5
- import { adminPath, apiPath } from "../lib/paths";
6
-
7
- const collectionsResponse = await fetch(
8
- `${Astro.url.origin}${apiPath}/collections`,
9
- );
10
- const collectionsData = await collectionsResponse.json();
11
- const collections = collectionsData.collections || [];
12
- ---
13
-
14
- <AdminLayout title="API Explorer">
15
- <div class="flex-1 overflow-hidden">
16
- <!-- Header -->
17
- <div class="mb-6 surface-tile">
18
- <div class="flex items-center justify-between mb-4">
19
- <div>
20
- <h1
21
- class="text-xl font-bold tracking-tighter text-[var(--kyro-text-primary)]"
22
- >
23
- API Explorer
24
- </h1>
25
- <p
26
- class="text-[var(--kyro-text-secondary)] font-bold mt-2 text-sm tracking-wider"
27
- >
28
- Test and explore REST API endpoints interactively
29
- </p>
30
- </div>
31
- <div class="flex items-center gap-3">
32
- <a
33
- href={`${adminPath}/rest-playground`}
34
- 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)]"
35
- >
36
- <svg
37
- class="w-4 h-4"
38
- fill="none"
39
- stroke="currentColor"
40
- viewBox="0 0 24 24"
41
- >
42
- <path
43
- stroke-linecap="round"
44
- stroke-linejoin="round"
45
- stroke-width="2"
46
- d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"
47
- ></path>
48
- </svg>
49
- Playground
50
- </a>
51
- <a
52
- href={`${apiPath}/collections`}
53
- target="_blank"
54
- 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)]"
55
- >
56
- <svg
57
- class="w-4 h-4"
58
- fill="none"
59
- stroke="currentColor"
60
- viewBox="0 0 24 24"
61
- >
62
- <path
63
- stroke-linecap="round"
64
- stroke-linejoin="round"
65
- stroke-width="2"
66
- d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
67
- ></path>
68
- </svg>
69
- Collections JSON
70
- </a>
71
- </div>
72
- </div>
73
-
74
- <!-- HTTP Methods Legend -->
75
- <div class="flex items-center gap-4 text-xs">
76
- <span class="text-[var(--kyro-text-muted)]">Methods:</span>
77
- <span class="px-2 py-1 bg-green-500/10 text-green-600 rounded font-bold"
78
- >GET</span
79
- >
80
- <span class="px-2 py-1 bg-blue-500/10 text-blue-600 rounded font-bold"
81
- >POST</span
82
- >
83
- <span
84
- class="px-2 py-1 bg-yellow-500/10 text-yellow-600 rounded font-bold"
85
- >PATCH</span
86
- >
87
- <span class="px-2 py-1 bg-red-500/10 text-red-600 rounded font-bold"
88
- >DELETE</span
89
- >
90
- </div>
91
- </div>
92
-
93
- <!-- Explorer Component -->
94
- <div class="surface-tile overflow-hidden p-6">
95
- <ApiExplorer client:load collections={collections} />
96
- </div>
97
-
98
- <!-- Quick Reference -->
99
- <div class="mt-6 surface-tile p-6">
100
- <h2 class="text-xl font-bold text-[var(--kyro-text-primary)] mb-4">
101
- Quick Reference
102
- </h2>
103
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 text-sm">
104
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
105
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
106
- List All
107
- </h3>
108
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
109
- >GET {apiPath}/:collection</code
110
- >
111
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
112
- Returns all documents with pagination
113
- </p>
114
- </div>
115
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
116
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
117
- Get One
118
- </h3>
119
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
120
- >GET {apiPath}/:collection/:id</code
121
- >
122
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
123
- Returns a single document by ID
124
- </p>
125
- </div>
126
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
127
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
128
- Create
129
- </h3>
130
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
131
- >POST {apiPath}/:collection</code
132
- >
133
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
134
- Creates a new document
135
- </p>
136
- </div>
137
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
138
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
139
- Update
140
- </h3>
141
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
142
- >PATCH {apiPath}/:collection/:id</code
143
- >
144
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
145
- Updates an existing document
146
- </p>
147
- </div>
148
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
149
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
150
- Delete
151
- </h3>
152
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
153
- >DELETE {apiPath}/:collection/:id</code
154
- >
155
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
156
- Deletes a document
157
- </p>
158
- </div>
159
- <div class="bg-[var(--kyro-surface-accent)] rounded-lg p-4">
160
- <h3 class="font-medium text-[var(--kyro-text-primary)] mb-2">
161
- Pagination
162
- </h3>
163
- <code class="text-xs text-[var(--kyro-text-secondary)] block"
164
- >?page=1&amp;limit=10</code
165
- >
166
- <p class="text-xs text-[var(--kyro-text-muted)] mt-2">
167
- Add query params for pagination
168
- </p>
169
- </div>
170
- </div>
171
- </div>
172
- </div>
173
- </AdminLayout>