little bit of ui clean up and fixing the platform labels/keys
This commit is contained in:
@@ -71,7 +71,8 @@ export default function AdminPlatformsPage() {
|
||||
}
|
||||
|
||||
async function onDelete(p: Platform) {
|
||||
if (!window.confirm(`Delete platform "${p.key}"? This cannot be undone.`)) return;
|
||||
if (!window.confirm(`Delete platform "${p.key}"? This cannot be undone.`))
|
||||
return;
|
||||
|
||||
try {
|
||||
setSaving(true);
|
||||
@@ -107,7 +108,8 @@ export default function AdminPlatformsPage() {
|
||||
const update: UpdatePlatformDto = {};
|
||||
if (key !== selected.key) update.key = key;
|
||||
if (label !== selected.label) update.label = label;
|
||||
if ((form.isActive ?? true) !== selected.isActive) update.isActive = form.isActive;
|
||||
if ((form.isActive ?? true) !== selected.isActive)
|
||||
update.isActive = form.isActive;
|
||||
|
||||
await updatePlatform(getAuthHeaders(), selected.id, update);
|
||||
}
|
||||
@@ -164,7 +166,9 @@ export default function AdminPlatformsPage() {
|
||||
<th className="border-b border-zinc-900 px-3 py-2">Key</th>
|
||||
<th className="border-b border-zinc-900 px-3 py-2">Label</th>
|
||||
<th className="border-b border-zinc-900 px-3 py-2">Active</th>
|
||||
<th className="border-b border-zinc-900 px-3 py-2 text-right">Actions</th>
|
||||
<th className="border-b border-zinc-900 px-3 py-2 text-right">
|
||||
Actions
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -245,7 +249,15 @@ export default function AdminPlatformsPage() {
|
||||
</label>
|
||||
<input
|
||||
value={form.key}
|
||||
onChange={(e) => setForm((s) => ({ ...s, key: e.target.value }))}
|
||||
onChange={(e) =>
|
||||
setForm((s) => ({
|
||||
...s,
|
||||
key: e.target.value
|
||||
.toUpperCase()
|
||||
.replace(/\s+/g, "") // remove spaces
|
||||
.replace(/-/g, ""),
|
||||
}))
|
||||
}
|
||||
className="w-full rounded-md border border-zinc-800 bg-zinc-900 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-500 focus:border-amber-400/80 focus:outline-none focus:ring-1 focus:ring-amber-400"
|
||||
placeholder="AR15"
|
||||
required
|
||||
@@ -258,7 +270,9 @@ export default function AdminPlatformsPage() {
|
||||
</label>
|
||||
<input
|
||||
value={form.label}
|
||||
onChange={(e) => setForm((s) => ({ ...s, label: e.target.value }))}
|
||||
onChange={(e) =>
|
||||
setForm((s) => ({ ...s, label: e.target.value }))
|
||||
}
|
||||
className="w-full rounded-md border border-zinc-800 bg-zinc-900 px-3 py-2 text-sm text-zinc-100 placeholder-zinc-500 focus:border-amber-400/80 focus:outline-none focus:ring-1 focus:ring-amber-400"
|
||||
placeholder="AR-15"
|
||||
required
|
||||
@@ -269,7 +283,9 @@ export default function AdminPlatformsPage() {
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={!!form.isActive}
|
||||
onChange={(e) => setForm((s) => ({ ...s, isActive: e.target.checked }))}
|
||||
onChange={(e) =>
|
||||
setForm((s) => ({ ...s, isActive: e.target.checked }))
|
||||
}
|
||||
className="h-4 w-4 rounded border-zinc-700 bg-zinc-900 text-amber-400"
|
||||
/>
|
||||
Active
|
||||
@@ -289,7 +305,11 @@ export default function AdminPlatformsPage() {
|
||||
className="flex-1 rounded-md bg-emerald-600 px-4 py-2 text-xs font-medium text-white hover:bg-emerald-500 disabled:opacity-50"
|
||||
disabled={saving}
|
||||
>
|
||||
{saving ? "Saving…" : modalMode === "create" ? "Create" : "Update"}
|
||||
{saving
|
||||
? "Saving…"
|
||||
: modalMode === "create"
|
||||
? "Create"
|
||||
: "Update"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user