Skip to content

Commit 15c5312

Browse files
committed
feat(awareness-service): trim application form and dark-theme the portal
- An access application now collects only platform name, website URL and description; contact email and requested-ontologies fields are dropped. - Restyle the entire portal (layout, login, apply, dashboard, admin, dead-letters) with a dark theme.
1 parent 2f96ac5 commit 15c5312

8 files changed

Lines changed: 131 additions & 158 deletions

File tree

services/awareness-service/api/src/controllers/ApplicationController.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,25 +41,22 @@ export function applicationRouter(): Router {
4141
.json({ error: "consumer is already approved" });
4242
}
4343

44-
const { name, contactEmail, justification, webhookBaseUrl } =
45-
req.body ?? {};
46-
const requestedOntologies = Array.isArray(
47-
req.body?.requestedOntologies,
48-
)
49-
? req.body.requestedOntologies.filter(
50-
(o: unknown): o is string => typeof o === "string",
51-
)
52-
: [];
44+
// An application is just: name, website URL and description.
45+
const { name, websiteUrl, description } = req.body ?? {};
46+
if (!name || !websiteUrl || !description) {
47+
return res.status(400).json({
48+
error: "name, websiteUrl and description are required",
49+
});
50+
}
5351

5452
if (!consumer) {
5553
consumer = consumerRepo.create({
5654
ename: req.ename!,
5755
status: "pending",
5856
});
5957
}
60-
consumer.name = name ?? consumer.name;
61-
consumer.contactEmail = contactEmail ?? consumer.contactEmail;
62-
consumer.webhookBaseUrl = webhookBaseUrl ?? consumer.webhookBaseUrl;
58+
consumer.name = name;
59+
consumer.webhookBaseUrl = websiteUrl;
6360
consumer.status = "pending";
6461
await consumerRepo.save(consumer);
6562

@@ -70,8 +67,8 @@ export function applicationRouter(): Router {
7067
if (!application) {
7168
application = appRepo.create({ consumerId: consumer.id });
7269
}
73-
application.justification = justification ?? null;
74-
application.requestedOntologies = requestedOntologies;
70+
application.justification = description;
71+
application.requestedOntologies = [];
7572
application.status = "pending";
7673
await appRepo.save(application);
7774

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
@import "tailwindcss";
22

3+
html {
4+
color-scheme: dark;
5+
}
6+
37
body {
48
font-family:
59
Inter,
610
system-ui,
711
-apple-system,
812
sans-serif;
9-
background: #f8fafc;
10-
color: #111827;
13+
background: #0b0d12;
14+
color: #e5e7eb;
1115
}

services/awareness-service/portal/src/routes/+layout.svelte

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
</script>
99

1010
<div class="min-h-screen">
11-
<header class="border-b border-gray-200 bg-white">
11+
<header class="border-b border-white/10 bg-[#0e1118]">
1212
<nav class="mx-auto flex max-w-5xl items-center gap-6 px-6 py-4">
13-
<a href="/" class="text-lg font-semibold text-gray-900">
14-
Awareness<span class="text-indigo-600">Service</span>
13+
<a href="/" class="text-lg font-semibold text-white">
14+
Awareness<span class="text-indigo-400">Service</span>
1515
</a>
1616
<div class="flex-1"></div>
1717
{#if loggedIn}
18-
<a href="/dashboard" class="text-sm text-gray-600 hover:text-gray-900">Dashboard</a>
19-
<a href="/apply" class="text-sm text-gray-600 hover:text-gray-900">Apply</a>
18+
<a href="/dashboard" class="text-sm text-gray-400 hover:text-white">Dashboard</a>
19+
<a href="/apply" class="text-sm text-gray-400 hover:text-white">Apply</a>
2020
{#if isAdmin}
21-
<a href="/admin" class="text-sm text-gray-600 hover:text-gray-900">Admin</a>
21+
<a href="/admin" class="text-sm text-gray-400 hover:text-white">Admin</a>
2222
{/if}
2323
<button
24-
class="text-sm text-gray-600 hover:text-gray-900"
24+
class="text-sm text-gray-400 hover:text-white"
2525
onclick={logout}
2626
>
2727
Log out

services/awareness-service/portal/src/routes/+page.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,34 +47,35 @@
4747
</script>
4848

4949
<section class="mx-auto max-w-xl text-center">
50-
<h1 class="text-3xl font-bold text-gray-900">Awareness as a Service</h1>
51-
<p class="mt-3 text-gray-600">
50+
<h1 class="text-3xl font-bold text-white">Awareness as a Service</h1>
51+
<p class="mt-3 text-gray-400">
5252
Query MetaEnvelope awareness packets and register webhook subscriptions
5353
scoped by ontology and eVault. Sign in with your W3DS identity to apply
5454
for access.
5555
</p>
5656

5757
{#if error}
58-
<p class="mt-4 rounded bg-red-50 px-4 py-2 text-sm text-red-700">{error}</p>
58+
<p class="mt-4 rounded bg-red-500/10 px-4 py-2 text-sm text-red-300">{error}</p>
5959
{/if}
6060

6161
{#if !uri}
6262
<button
63-
class="mt-8 rounded-lg bg-indigo-600 px-6 py-3 font-medium text-white hover:bg-indigo-700"
63+
class="mt-8 rounded-lg bg-indigo-600 px-6 py-3 font-medium text-white hover:bg-indigo-500"
6464
onclick={startLogin}
6565
>
6666
Sign in with W3DS
6767
</button>
6868
{:else}
6969
<div class="mt-8 flex flex-col items-center gap-4">
70-
<p class="text-sm text-gray-600">
70+
<p class="text-sm text-gray-400">
7171
Scan with your eID wallet to sign in.
7272
</p>
73-
<div class="rounded-lg bg-white p-4 shadow">
73+
<!-- QR keeps a white plate for scanner contrast -->
74+
<div class="rounded-lg bg-white p-4 shadow-lg">
7475
<QrCode value={uri} size={220} />
7576
</div>
7677
{#if polling}
77-
<p class="text-sm text-gray-400">Waiting for signature…</p>
78+
<p class="text-sm text-gray-500">Waiting for signature…</p>
7879
{/if}
7980
</div>
8081
{/if}

services/awareness-service/portal/src/routes/admin/+page.svelte

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
id: string;
1010
status: string;
1111
justification: string | null;
12-
requestedOntologies: string[];
1312
consumer?: {
1413
ename: string;
1514
name: string | null;
16-
contactEmail: string | null;
1715
webhookBaseUrl: string | null;
1816
};
1917
}
@@ -66,61 +64,62 @@
6664

6765
<section>
6866
<div class="flex items-center justify-between">
69-
<h1 class="text-2xl font-bold text-gray-900">Pending applications</h1>
70-
<a href="/admin/dead-letters" class="text-sm text-indigo-600 hover:underline">
67+
<h1 class="text-2xl font-bold text-white">Pending applications</h1>
68+
<a href="/admin/dead-letters" class="text-sm text-indigo-400 hover:underline">
7169
Dead letters →
7270
</a>
7371
</div>
7472

7573
{#if notAdmin}
76-
<p class="mt-6 rounded bg-amber-50 px-4 py-3 text-sm text-amber-700">
74+
<p class="mt-6 rounded bg-amber-500/10 px-4 py-3 text-sm text-amber-300">
7775
Your eName is not in the admin allowlist.
7876
</p>
7977
{:else if error}
80-
<p class="mt-4 rounded bg-red-50 px-4 py-2 text-sm text-red-700">{error}</p>
78+
<p class="mt-4 rounded bg-red-500/10 px-4 py-2 text-sm text-red-300">{error}</p>
8179
{:else if loading}
82-
<p class="mt-4 text-gray-500">Loading…</p>
80+
<p class="mt-4 text-gray-400">Loading…</p>
8381
{:else}
8482
<ul class="mt-6 space-y-4">
8583
{#each applications as app (app.id)}
86-
<li class="rounded-lg border border-gray-200 bg-white p-5">
87-
<div class="flex items-start justify-between">
84+
<li class="rounded-lg border border-white/10 bg-[#13161d] p-5">
85+
<div class="flex items-start justify-between gap-4">
8886
<div>
89-
<p class="font-semibold text-gray-900">
87+
<p class="font-semibold text-white">
9088
{app.consumer?.name ?? app.consumer?.ename}
9189
</p>
9290
<p class="text-sm text-gray-500">{app.consumer?.ename}</p>
93-
<p class="text-sm text-gray-500">
94-
{app.consumer?.contactEmail ?? "no email"} ·
95-
{app.consumer?.webhookBaseUrl ?? "no webhook URL"}
96-
</p>
91+
{#if app.consumer?.webhookBaseUrl}
92+
<a
93+
href={app.consumer.webhookBaseUrl}
94+
target="_blank"
95+
rel="noopener"
96+
class="text-sm text-indigo-400 hover:underline"
97+
>
98+
{app.consumer.webhookBaseUrl}
99+
</a>
100+
{/if}
97101
</div>
98102
<div class="flex gap-2">
99103
<button
100-
class="rounded bg-green-600 px-3 py-1.5 text-sm text-white"
104+
class="rounded bg-green-600 px-3 py-1.5 text-sm text-white hover:bg-green-500"
101105
onclick={() => review(app.id, "approve")}
102106
>
103107
Approve
104108
</button>
105109
<button
106-
class="rounded bg-red-600 px-3 py-1.5 text-sm text-white"
110+
class="rounded bg-red-600 px-3 py-1.5 text-sm text-white hover:bg-red-500"
107111
onclick={() => review(app.id, "reject")}
108112
>
109113
Reject
110114
</button>
111115
</div>
112116
</div>
113117
{#if app.justification}
114-
<p class="mt-3 text-sm text-gray-700">{app.justification}</p>
115-
{/if}
116-
{#if app.requestedOntologies.length}
117-
<p class="mt-2 text-xs text-gray-500">
118-
Requested: {app.requestedOntologies.join(", ")}
119-
</p>
118+
<p class="mt-3 text-sm text-gray-300">{app.justification}</p>
120119
{/if}
121120
</li>
122121
{:else}
123-
<li class="text-gray-400">No pending applications.</li>
122+
<li class="text-gray-500">No pending applications.</li>
124123
{/each}
125124
</ul>
126125
{/if}

services/awareness-service/portal/src/routes/admin/dead-letters/+page.svelte

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,39 @@
6363
</script>
6464

6565
<section>
66-
<h1 class="text-2xl font-bold text-gray-900">Dead-lettered deliveries</h1>
67-
<p class="mt-2 text-sm text-gray-600">
66+
<h1 class="text-2xl font-bold text-white">Dead-lettered deliveries</h1>
67+
<p class="mt-2 text-sm text-gray-400">
6868
Deliveries that exhausted every retry attempt. Replay re-queues them.
6969
</p>
7070

7171
{#if notAdmin}
72-
<p class="mt-6 rounded bg-amber-50 px-4 py-3 text-sm text-amber-700">
72+
<p class="mt-6 rounded bg-amber-500/10 px-4 py-3 text-sm text-amber-300">
7373
Your eName is not in the admin allowlist.
7474
</p>
7575
{:else if error}
76-
<p class="mt-4 rounded bg-red-50 px-4 py-2 text-sm text-red-700">{error}</p>
76+
<p class="mt-4 rounded bg-red-500/10 px-4 py-2 text-sm text-red-300">{error}</p>
7777
{:else if loading}
78-
<p class="mt-4 text-gray-500">Loading…</p>
78+
<p class="mt-4 text-gray-400">Loading…</p>
7979
{:else}
8080
<ul class="mt-6 space-y-3">
8181
{#each deadLetters as dl (dl.id)}
82-
<li class="rounded-lg border border-gray-200 bg-white p-4 text-sm">
83-
<div class="flex items-start justify-between">
82+
<li class="rounded-lg border border-white/10 bg-[#13161d] p-4 text-sm">
83+
<div class="flex items-start justify-between gap-4">
8484
<div>
85-
<p class="font-mono text-gray-700">{dl.targetUrl}</p>
85+
<p class="font-mono text-gray-200">{dl.targetUrl}</p>
8686
<p class="text-gray-500">
8787
packet {dl.packetId} · {dl.totalAttempts} attempts ·
8888
status {dl.lastResponseStatus ?? "n/a"}
8989
</p>
9090
{#if dl.lastError}
91-
<p class="mt-1 text-red-600">{dl.lastError}</p>
91+
<p class="mt-1 text-red-400">{dl.lastError}</p>
9292
{/if}
9393
</div>
9494
{#if dl.resolved}
95-
<span class="text-green-600">resolved</span>
95+
<span class="text-green-400">resolved</span>
9696
{:else}
9797
<button
98-
class="rounded bg-indigo-600 px-3 py-1.5 text-white"
98+
class="rounded bg-indigo-600 px-3 py-1.5 text-white hover:bg-indigo-500"
9999
onclick={() => replay(dl.id)}
100100
>
101101
Replay
@@ -104,7 +104,7 @@
104104
</div>
105105
</li>
106106
{:else}
107-
<li class="text-gray-400">No dead letters.</li>
107+
<li class="text-gray-500">No dead letters.</li>
108108
{/each}
109109
</ul>
110110
{/if}

0 commit comments

Comments
 (0)