Skip to content

Commit

Permalink
Merge branch 'main' into sean/app
Browse files Browse the repository at this point in the history
  • Loading branch information
SheepTester authored Jan 10, 2025
2 parents 8f5de0e + 40d98c2 commit e3b7ec5
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 38 deletions.
Binary file modified client/public/assets/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions client/public/assets/icons/person.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion client/src/app/api/updateUser/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import config from '@/lib/config';
import type { UserPatches, PatchUserRequest } from '@/lib/types/apiRequests';
import type { UpdateCurrentUserReponse } from '@/lib/types/apiResponses';
import { getCookie } from '@/lib/services/CookieService';
import { getCookie, setCookie } from '@/lib/services/CookieService';
import { CookieType } from '@/lib/types/enums';
import { NextResponse, NextRequest } from 'next/server';
import axios, { AxiosError } from 'axios';
Expand Down Expand Up @@ -29,6 +29,7 @@ export async function PATCH(request: NextRequest) {
const user: UserPatches = body.user;

const updatedUser = await updateCurrentUserProfile(authToken, user);
await setCookie(CookieType.USER, JSON.stringify(updatedUser.user));

return NextResponse.json(updatedUser);
} catch (error) {
Expand Down
12 changes: 10 additions & 2 deletions client/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import 'react-toastify/dist/ReactToastify.css';
import type { Metadata } from 'next';
import { DM_Sans } from 'next/font/google';
import { ToastContainer } from 'react-toastify';
import { getCookie } from '@/lib/services/CookieService';
import { CookieType } from '@/lib/types/enums';
import { PrivateProfile } from '@/lib/types/apiResponses';

const dmSans = DM_Sans({ subsets: ['latin'], weight: ['200', '400', '500', '600', '700'] });

Expand All @@ -13,12 +16,17 @@ export const metadata: Metadata = {
description: "ACM at UCSD's annual hackathon",
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
export default async function RootLayout({ children }: { children: React.ReactNode }) {
let user: PrivateProfile | undefined;
try {
user = JSON.parse(await getCookie(CookieType.USER));
} catch {}

return (
<html lang="en">
<body className={dmSans.className}>
<ToastContainer />
<Navbar />
<Navbar user={user} />
{children}
<Footer />
</body>
Expand Down
4 changes: 4 additions & 0 deletions client/src/app/login/page.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@

max-width: 646px;
width: 100%;

.loginCard {
backdrop-filter: blur(5px);
}
}
2 changes: 1 addition & 1 deletion client/src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function LoginPage() {
return (
<main className={styles.main}>
<div className={`${styles.login}`}>
<Card gap={1}>
<Card gap={1} className={styles.loginCard}>
<Heading centered>Log In</Heading>
{error ? (
<Alert marginBottom={0}>
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Dropdown/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
letter-spacing: 0.5px;

option {
background-color: vars.$card-bg;
background-color: vars.$black;
}
}

Expand All @@ -45,7 +45,7 @@
}

.contents {
background-color: vars.$card-bg;
background-color: vars.$black;
border-radius: 8px;
box-shadow:
0px 1px 2px 0px rgba(0, 0, 0, 0.3),
Expand Down
85 changes: 55 additions & 30 deletions client/src/components/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import Link from 'next/link';
import MenuIcon from '@mui/icons-material/Menu';
import CloseIcon from '@mui/icons-material/Close';
import { SwipeableDrawer } from '@mui/material';
import { PrivateProfile } from '@/lib/types/apiResponses';
import PersonIcon from '@/../public/assets/icons/person.svg';

interface LinkMetadata {
name: string;
Expand All @@ -21,7 +23,11 @@ const links: LinkMetadata[] = [

const MOBILE_BREAKPOINT = 870; // Matches $breakpoint-md from vars.scss

export default function Navbar() {
interface NavbarProps {
user?: PrivateProfile;
}
export default function Navbar({ user }: NavbarProps) {
console.log(user);
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);

const onLinkClick = () => {
Expand Down Expand Up @@ -51,37 +57,56 @@ export default function Navbar() {
hacks
</Typography>
</Link>
<Typography variant="body/large" className={styles.desktopLinks}>
{links.map(link => (
<Link href={link.href} className={styles.link} onClick={onLinkClick} key={link.name}>
{link.name}
</Link>
))}
</Typography>
<div className={styles.flex} />
<div className={styles.mobileIcons}>
<div className={`${styles.menuIcon} ${mobileMenuOpen ? '' : styles.hidden}`}>
<CloseIcon onClick={() => setMobileMenuOpen(false)} />
</div>
<div className={`${styles.menuIcon} ${mobileMenuOpen ? styles.hidden : ''}`}>
<MenuIcon onClick={() => setMobileMenuOpen(true)} />
</div>
</div>
{user ? (
<>
<Typography variant="body/large" className={styles.desktopLinks}>
{links.map(link => (
<Link
href={link.href}
className={styles.link}
onClick={onLinkClick}
key={link.name}
>
{link.name}
</Link>
))}
</Typography>
<div className={styles.flex} />
<Typography variant="body/large" className={styles.desktopLinks}>
<Link href="/profile" className={styles.link} onClick={onLinkClick}>
<PersonIcon aria-hidden /> {user.firstName} {user.lastName}
</Link>
</Typography>
<div className={styles.mobileIcons}>
<div className={`${styles.menuIcon} ${mobileMenuOpen ? '' : styles.hidden}`}>
<CloseIcon onClick={() => setMobileMenuOpen(false)} />
</div>
<div className={`${styles.menuIcon} ${mobileMenuOpen ? styles.hidden : ''}`}>
<MenuIcon onClick={() => setMobileMenuOpen(true)} />
</div>
</div>
</>
) : null}
</div>
<SwipeableDrawer
anchor="top"
open={mobileMenuOpen}
onClose={() => setMobileMenuOpen(false)}
onOpen={() => setMobileMenuOpen(true)}
>
<div className={styles.mobileMenu}>
{links.map(link => (
<Link href={link.href} className={styles.link} onClick={onLinkClick} key={link.name}>
{link.name}
{user ? (
<SwipeableDrawer
anchor="top"
open={mobileMenuOpen}
onClose={() => setMobileMenuOpen(false)}
onOpen={() => setMobileMenuOpen(true)}
>
<div className={styles.mobileMenu}>
{links.map(link => (
<Link href={link.href} className={styles.link} onClick={onLinkClick} key={link.name}>
{link.name}
</Link>
))}
<Link href="/profile" className={styles.link} onClick={onLinkClick}>
<PersonIcon aria-hidden /> {user.firstName} {user.lastName}
</Link>
))}
</div>
</SwipeableDrawer>
</div>
</SwipeableDrawer>
) : null}
</>
);
}
3 changes: 3 additions & 0 deletions client/src/components/Navbar/style.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
}

.link {
display: flex;
align-items: center;
gap: 1rem;
text-decoration: none;
color: vars.$white;

Expand Down
4 changes: 2 additions & 2 deletions client/src/styles/vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ $yellow: #ecdf98;
$white: #ffffff;
$neutral: #a1acbd;

$card-bg: #37393e;
$card-stroke: #525252;
$card-bg: rgba(255, 255, 255, 0.05);
$card-stroke: rgba(255, 255, 255, 0.15);

$btn-text: #000000;
$btn-primary: #a5e0fb;
Expand Down

0 comments on commit e3b7ec5

Please sign in to comment.