Merge pull request #28 from dsec-hub/hotfix/mobile-admin

fixed mobile responsiveness, unit is not optional when posting
This commit is contained in:
RythonDev 2026-09-09 17:35:40 +08:00 committed by GitHub
commit 97c26806eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 11 deletions

View file

@ -488,7 +488,7 @@ function notesCreate(
const user = requireAuth(db, args.token);
const topicId = args.topicId?.trim() ?? "";
const unitId = args.unitId?.trim() ?? "";
if (!topicId && !unitId) throw new Error("Select a topic or a unit");
if (!unitId) throw new Error("Select a unit");
const id = newId();
const now = Date.now();
db.exec("BEGIN");
@ -597,7 +597,7 @@ function questionsCreate(
const user = requireAuth(db, args.token);
const topicId = args.topicId?.trim() ?? "";
const unitId = args.unitId?.trim() ?? "";
if (!topicId && !unitId) throw new Error("Select a topic or a unit");
if (!unitId) throw new Error("Select a unit");
const id = newId();
const now = Date.now();
db.exec("BEGIN");

View file

@ -471,14 +471,18 @@
</a>
{/if}
{:else}
<div class="border-rule flex items-end justify-between gap-4 border-b pb-6">
<div
class="border-rule flex flex-col gap-4 border-b pb-6 sm:flex-row sm:items-end sm:justify-between"
>
<div>
<p class="kicker">Admin</p>
<h1 class="text-ink mt-2 font-serif text-4xl font-medium">Dashboard</h1>
</div>
<div class="flex gap-2">
<div class="flex flex-wrap gap-2" role="tablist" aria-label="Admin sections">
<button
type="button"
role="tab"
aria-selected={tab === "overview"}
class="chip {tab === 'overview' ? 'chip-active' : ''}"
onclick={() => (tab = "overview")}
>
@ -486,6 +490,8 @@
</button>
<button
type="button"
role="tab"
aria-selected={tab === "units"}
class="chip {tab === 'units' ? 'chip-active' : ''}"
onclick={() => (tab = "units")}
>
@ -493,6 +499,8 @@
</button>
<button
type="button"
role="tab"
aria-selected={tab === "accounts"}
class="chip {tab === 'accounts' ? 'chip-active' : ''}"
onclick={() => (tab = "accounts")}
>
@ -500,6 +508,8 @@
</button>
<button
type="button"
role="tab"
aria-selected={tab === "notes"}
class="chip {tab === 'notes' ? 'chip-active' : ''}"
onclick={() => (tab = "notes")}
>
@ -556,7 +566,7 @@
<div class="mt-6 flex items-end gap-3 overflow-x-auto pb-2">
{#each stats.weeks as week}
<div class="flex min-w-[72px] flex-1 flex-col items-center gap-1">
<div class="flex min-w-18 flex-1 flex-col items-center gap-1">
<div class="flex h-32 w-full items-end justify-center gap-1">
<div
class="bg-primary w-1/3 max-w-6"

View file

@ -78,8 +78,8 @@
return;
}
const hasUnit = useCustomUnit ? !!customUnit.trim() : !!selectedUnitId;
if (!selectedTopicId && !hasUnit) {
error = "Please select a topic or a unit";
if (!hasUnit) {
error = "Please select a unit";
return;
}
@ -160,7 +160,6 @@
</div>
<div>
<p class="text-muted mb-3 text-xs">Choose at least one topic or unit.</p>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
<div>
<label for="topic" class="kicker mb-2 block">Topic (optional)</label>
@ -202,6 +201,7 @@
bind:value={customUnit}
placeholder="e.g., SIT384"
class="field mt-2"
required
/>
{/if}
</div>

View file

@ -78,8 +78,8 @@
return;
}
const hasUnit = useCustomUnit ? !!customUnit.trim() : !!selectedUnitId;
if (!selectedTopicId && !hasUnit) {
error = "Please select a topic or a unit";
if (!hasUnit) {
error = "Please select a unit";
return;
}
@ -162,7 +162,6 @@
</div>
<div>
<p class="text-muted mb-3 text-xs">Choose at least one topic or unit.</p>
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
<div>
<label for="topic" class="kicker mb-2 block">Topic (optional)</label>
@ -204,6 +203,7 @@
bind:value={customUnit}
placeholder="e.g., SIT384"
class="field mt-2"
required
/>
{/if}
</div>