Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions frontend/app/(auth)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import { cookies } from 'next/headers';
import { redirect } from 'next/navigation';

export default async function LoggedUserLayout({
children,
}: {
children: React.ReactNode;
}) {
const cookieStore = await cookies();
const token = cookieStore.get('token')?.value;
if (token) {
redirect('/trips');
}

return <>{children}</>;
}
7 changes: 0 additions & 7 deletions frontend/app/(root)/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import React, { useEffect, useState } from 'react';
import { useSearchParams } from 'next/navigation';
import { UserSearch } from '@/validation/userProfileSchemas';
import UserTile from '@/components/shared/UserTile';
import { getToken, logout } from '@/lib/auth';
import axiosInstance from '@/lib/axiosInstance';

const SearchPage = () => {
Expand All @@ -20,15 +19,9 @@ const SearchPage = () => {

setLoading(true);
setError(null);
const token = await getToken();
if (!token) {
logout();
return;
}
try {
const response = await axiosInstance.get(`user-info/search`, {
params: { name: query, page: 0, size: 20 },
headers: { Authorization: `Bearer ${token}` },
});
Comment on lines 22 to 25

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The Authorization header is no longer being set on the request. Ensure that the backend does not require this header, or that authentication is being handled in a different way.

setResults(response.data.content || []);
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/(root)/trips/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function Page() {

return (
<div>
<div className="flex justify-between">
<div className="flex justify-between gap-4 sm:p-0 p-2 sm:flex-row flex-col ">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using flex-row and flex-col classes with the sm: prefix to control the layout at different screen sizes, instead of sm:flex-row flex-col1.

      <div className="flex justify-between gap-4 p-2 sm:p-0 sm:flex-row flex-col">

Style Guide References

Footnotes

  1. Use responsive prefixes like sm:, md:, lg:, and xl: to control layout at different screen sizes. (link)

<Link
href="/trips/create"
className="flex items-center gap-1.5 text-body-semibold text-primary-500 hover:underline"
Expand All @@ -85,7 +85,7 @@ function Page() {
<p>Add a Trip</p>
</Link>
{trips && trips.length > 0 && (
<div className="flex flex-col items-center text-gray-700 md:flex-row gap-4">
<div className="flex items-center text-gray-700 gap-4">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The md:flex-row class has been removed. Ensure that the layout is still responsive and works as expected on larger screens.

<div className="font-semibold ">Sort By</div>
<button
className={`flex items-center gap-2 px-3 py-2 shadow-md ${
Expand Down
11 changes: 11 additions & 0 deletions frontend/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ export default function RootLayout({
<Toaster />
</section>
</Suspense>
<footer className="w-full text-center text-xs text-gray-500 py-4 border-t">
Illustration by{' '}
<a
href="https://storyset.com/city"
target="_blank"
rel="noopener noreferrer"
className="underline hover:text-blue-600"
>
Storyset
</a>
</footer>
</body>
</html>
);
Expand Down
36 changes: 36 additions & 0 deletions frontend/app/not-found.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use client';
import Link from 'next/link';
import Image from 'next/image';

export default function NotFound() {
return (
<div className="section py-6 px-6 md:px-12 border">
<div className="flex flex-col-reverse lg:flex-row items-center lg:gap-10 gap-4">
<div className="flex-1 text-center lg:text-left">
<h1 className="text-heading1-bold">Oops! Page not found.</h1>
<p className="mt-4 text-base">
The page you&#39;re looking for doesn&#39;t exist or has been moved.
<br />
Let&#39;s get you back on track.
</p>
<Link href="/">
<button className="primary-btn text-heading4-medium px-16 py-3 mt-6">
Comment on lines +16 to +17

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Button should not be nested inside Link for accessibility.

Use a Link styled as a button, or a button with navigation logic, to avoid these issues.

Go to Homepage
</button>
Comment on lines +17 to +19

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Nesting a <button> inside a <Link> is invalid HTML. The <Link> component renders an <a> tag, and <a> tags should not contain <button> elements1. Style the <Link> to look like a button instead.

          <Link
            href="/"
            className="primary-btn text-heading4-medium px-16 py-3 mt-6">
            Go to Homepage
          </Link>

Style Guide References

Footnotes

  1. <a> tags should not contain <button> elements. (link)

</Link>
</div>

<div className="flex-1 w-full max-w-md mx-auto">
<Image
src="/assets/lost-bro.png"
alt="Page Not Found"
width={600}
height={600}
className="w-full h-auto object-cover"
priority
/>
</div>
</div>
</div>
);
}
50 changes: 38 additions & 12 deletions frontend/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
import React from 'react';
'use client';
import { useEffect } from 'react';
import Link from 'next/link';
import Image from 'next/image';
import { getToken } from '@/lib/auth';
import { useRouter } from 'next/navigation';

export default function Home() {
const router = useRouter();

useEffect(() => {
const token = getToken();
if (token) {
router.push('/trips');
}
}, [router]);
Comment on lines +11 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Consider performing the redirect on the server side to avoid UI flicker. Using useEffect for redirection can cause a brief display of the original page content before redirecting. A server-side redirect would be more efficient.


return (
<div className="section py-6 px-12">
<div>
<h1 className="text-heading1-bold">Group travel, made simple.</h1>
<p className="mt-4">
Plan, vote on activities, and keep everything organized with
FareShare. From destinations to shared expenses — make every trip
effortless and unforgettable, together.
</p>
<div className="section py-6 px-6 md:px-12 border">
<div className="flex flex-col-reverse lg:flex-row items-center lg:gap-10 gap-4">
<div className="flex-1">
<h1 className="text-heading1-bold">Group travel, made simple.</h1>
<p className="mt-4">
Plan, vote on activities, and keep everything organized with
FareShare. From destinations to shared expenses — make every trip
effortless and unforgettable, together.
</p>
<button className="primary-btn text-heading4-medium px-16 py-3 mt-4">
<Link href="/sign-up">Get Started</Link>
Comment on lines +28 to +29

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Button should wrap Link for accessibility and semantics.

Nesting a Link inside a button can cause accessibility and semantic problems. Refactor to avoid placing interactive elements inside each other.

</button>
Comment on lines +28 to +30

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Nesting a <Link> inside a <button> is invalid HTML. Interactive elements like buttons should not contain other interactive elements like links1. Style the <Link> to look like a button instead.

          <Link href="/sign-up" className="primary-btn text-heading4-medium px-16 py-3 mt-4">
            Get Started
          </Link>

Style Guide References

Footnotes

  1. Interactive elements like buttons should not contain other interactive elements like links. (link)

</div>

<div className="flex-1 w-full max-w-md mx-auto">
<Image
src="/assets/trip-placeholder.png"
alt="Trip placeholder"
width={600}
height={600}
className="w-full h-auto object-cover"
priority
/>
</div>
</div>
<button className="primary-btn text-heading4-medium px-16 py-3 mt-4">
<Link href="/sign-up">Get Started</Link>
</button>
</div>
);
}
Binary file added frontend/public/assets/lost-bro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading