Skip to content

Commit 23c0b19

Browse files
committed
modifying the login page for the strabo integration
1 parent b45d7dd commit 23c0b19

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
all:
22
docker build -t rockd_website:latest .
3-
docker run --rm -it -p 5500:5500 --name rockd_website --env-file .env rockd_website:latest
3+
docker run --rm -it -p 3000:3000 --name rockd_website --env-file .env rockd_website:latest
44

55

66
TAG := hub.opensciencegrid.org/macrostrat/rockd-website:$(VERSION)

pages/login/+Page.client.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ function LoginForm() {
2525
});
2626
const [error, setError] = useState<string | null>(null);
2727
const [loggedIn, setLoggedIn] = useState(false);
28+
const [logs, setLogs] = useState<string[]>([]);
2829
const [linkStraboResponse, setLinkStraboResponse] = useState<any>(null);
2930
const [jParam, setJParam] = useState<string | null>(null);
31+
const addLog = (msg) => setLogs((prev) => [...prev, msg]);
32+
3033
useEffect(() => {
3134
const params = new URLSearchParams(window.location.search);
3235
const j = params.get("j");
@@ -66,7 +69,7 @@ function LoginForm() {
6669
}
6770
);
6871
const linkStraboBody = await linkStrabo.json();
69-
console.log("Link Strabospot!", linkStraboBody);
72+
addLog(`Saving to Rockd database: ${JSON.stringify(linkStraboBody)}`);
7073
setLinkStraboResponse(linkStraboBody);
7174
}
7275
setLoggedIn(true);
@@ -101,7 +104,9 @@ function LoginForm() {
101104
}
102105
);
103106
const straboResponse = await rockdJWTToStrabo.json();
104-
console.log("Strabo Response:", straboResponse);
107+
addLog(
108+
`Rockd token sent to Strabospot: ${JSON.stringify(straboResponse)}`
109+
);
105110
} catch (err) {
106111
console.error("Failed to send Rockd JWT to Strabo:", err);
107112
}
@@ -112,11 +117,20 @@ function LoginForm() {
112117

113118
if (loggedIn) {
114119
return h("div", { className: "login-page" }, [
120+
h("img", {
121+
src: "https://storage.macrostrat.org/assets/rockd/main-page/rockd_transparent.png",
122+
alt: "Rockd logo",
123+
className: "rockd-logo",
124+
}),
115125
h(Callout, {
116126
title: "Login Successful",
117127
intent: Intent.SUCCESS,
118128
className: "login-info",
119129
}),
130+
h("div", { className: "login-logs" }, [
131+
h("h4", "Debug logs"),
132+
h("pre", logs.map((l) => `${l}\n`).join("")),
133+
]),
120134
h(
121135
Button,
122136
{ intent: Intent.DANGER, onClick: () => setLoggedIn(false) },
@@ -125,6 +139,11 @@ function LoginForm() {
125139
]);
126140
} else {
127141
return h("div", { className: "login-page" }, [
142+
h("img", {
143+
src: "https://storage.macrostrat.org/assets/rockd/main-page/rockd_transparent.png",
144+
alt: "Rockd logo",
145+
className: "rockd-logo",
146+
}),
128147
h("h2", "Login"),
129148
error &&
130149
h(Callout, {

pages/login/main.sass

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,35 @@ body.bp5-dark
6060
margin: 0
6161
text-align: center
6262

63+
.login-logs
64+
margin-top: 1rem
65+
padding: 0.5rem 0.75rem
66+
border: 1px solid rgba(0, 0, 0, 0.27)
67+
border-radius: 4px
68+
background: rgba(0, 0, 0, 0.27)
69+
70+
max-height: 150px // <-- constrain height
71+
overflow-y: auto // <-- vertical scrollbar when needed
72+
73+
pre
74+
margin: 0
75+
white-space: pre-wrap // wrap long JWTs/JSON
76+
word-break: break-word
77+
font-family: monospace
78+
font-size: 11px
79+
80+
.rockd-logo
81+
display: block
82+
max-width: 240px
83+
margin: 0 auto 1.5rem
84+
85+
6386
.login-form
6487
display: flex
6588
flex-direction: column
6689
gap: 1rem
6790

91+
6892
.bp5-input
6993
font-size: 1rem
7094
padding: 0.75rem

0 commit comments

Comments
 (0)