changed "Online Store" to "Dashboard"

This commit is contained in:
chark1es 2025-02-10 14:03:19 -08:00
parent 7af88c424d
commit 43fe443c52
6 changed files with 111 additions and 167 deletions

View file

@ -27,7 +27,12 @@ export class RedirectHandler {
}
private showError(message: string) {
this.contentEl.innerHTML = `<p class='text-red-500'>${message}</p>`;
this.contentEl.innerHTML = `
<p class='text-red-500 text-2xl font-medium mb-4'>${message}</p>
<a href="/" class="btn btn-primary">
Return to Home
</a>
`;
}
private async handleRedirect() {
@ -45,12 +50,14 @@ export class RedirectHandler {
}
try {
const authData = await this.pb.collection("users").authWithOAuth2Code(
const authData = await this.pb
.collection("users")
.authWithOAuth2Code(
"oidc",
code,
this.provider.codeVerifier,
window.location.origin + "/oauth2-redirect",
{ emailVisibility: false }
{ emailVisibility: false },
);
console.log("Auth successful:", authData);
@ -65,17 +72,17 @@ export class RedirectHandler {
try {
// Update last login before redirecting
await this.pb.collection("users").update(authData.record.id, {
last_login: new Date().toISOString()
last_login: new Date().toISOString(),
});
// Clean up and redirect
localStorage.removeItem("provider");
window.location.href = "/online-store";
window.location.href = "/dashboard";
} catch (err) {
console.error("Failed to update last login:", err);
// Still redirect even if last_login update fails
localStorage.removeItem("provider");
window.location.href = "/online-store";
window.location.href = "/dashboard";
}
} catch (err: any) {
console.error("Auth error:", err);

View file

@ -29,7 +29,7 @@ import pages from "../../data/pages.json";
href={page.path}
class={`uppercase rounded-full duration-300 px-[1.5vw] py-[0.2vw] text-[1.2vw] text-nowrap
${
page.name === "Online Store"
page.name === "Dashboard"
? "bg-ieee-yellow text-black hover:opacity-70"
: "text-white border-white hover:opacity-50 border-[0.1vw] font-light"
}`}

View file

@ -1,23 +0,0 @@
<div id="storeItemsGrid" class="h-full">
<div
class="card bg-base-200 shadow-xl h-full flex items-center justify-center min-h-[400px]"
>
<div
class="card-body flex flex-col items-center justify-center h-full w-full max-w-2xl mx-auto"
>
<div class="text-center w-full">
<h2 class="card-title text-3xl justify-center mb-6">
Store Coming Soon!
</h2>
<div class="space-y-4">
<p class="text-base-content/70 text-lg">
Our store is currently under development. Check back
later for IEEE UCSD merchandise! In the meantime, please
make sure your profile is up to date with your IEEE
Member ID and resume.
</p>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,37 +0,0 @@
---
interface Props {
name: string;
description: string;
price: number;
imageUrl: string;
}
const {
name,
description,
price,
imageUrl = "https://placehold.co/400x300",
} = Astro.props;
---
<div class="card bg-base-200 shadow-xl">
<figure class="px-6 pt-6">
<div class="relative w-full">
<div class="skeleton w-full aspect-[4/3] rounded-xl"></div>
<img
src={imageUrl}
alt={name}
class="rounded-xl absolute inset-0 w-full h-full object-cover opacity-0 transition-opacity duration-300"
onload="this.classList.remove('opacity-0')"
/>
</div>
</figure>
<div class="card-body">
<h2 class="card-title">{name}</h2>
<p>{description}</p>
<div class="card-actions justify-between items-center mt-2">
<span class="text-xl font-semibold">${price.toFixed(2)}</span>
<button class="btn btn-primary">Add to Cart</button>
</div>
</div>
</div>

View file

@ -20,7 +20,7 @@
"path": "/find"
},
{
"name": "Online Store",
"path": "/online-store"
"name": "Dashboard",
"path": "/dashboard"
}
]

View file

@ -3,17 +3,14 @@ import Layout from "../layouts/Layout.astro";
const title = "Authenticating...";
---
<Layout {title}>
<main class="min-h-screen flex items-center justify-center">
<div id="content" class="text-center">
<p class="text-2xl font-medium">Redirecting to store...</p>
<p class="text-2xl font-medium">Redirecting to dashboard...</p>
<div class="mt-4">
<div class="loading loading-spinner loading-lg"></div>
</div>
</div>
</main>
</Layout>
<script>
import { RedirectHandler } from "../components/auth/RedirectHandler";
new RedirectHandler();