Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google auth working #29

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Local Netlify folder
.netlify
11 changes: 0 additions & 11 deletions .vercel/README.txt

This file was deleted.

1 change: 0 additions & 1 deletion .vercel/project.json

This file was deleted.

13 changes: 6 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />
<title> Ride NITT | Car Pool like never before </title>
<meta name="description" content="Ride NITT is a carpooling platform for the students of NIT Trichy." />
<meta name="keywords" content="Ride NITT, NIT Trichy, Carpooling, NIT Trichy Carpooling" />

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" sizes="192x192" href="/logo-192.png">
<link rel="icon" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" sizes="16x16" href="/favicon-16x16.png">
<meta name="image" content="/logo-192.png">
<link rel="icon" sizes="192x192" href="/logo192.png">
<link rel="icon" sizes="32x32" href="/logo32.png">
<link rel="icon" sizes="16x16" href="/logo16.png">
<meta name="image" content="/logo192.png">

<meta property="og:title" content="Ride NITT | Car Pool like never before" />
<meta property="og:description" content="Ride NITT is a carpooling platform for the students of NIT Trichy." />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://ride-tc.vercel.app" />
<meta property="og:image" content="/logo-192.png" />
<meta property="og:url" content="https://ride-nitt.vercel.app" />
<meta property="og:image" content="/logo192.png" />
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"ts-node": "^10.9.2",
"typescript": "~5.6.2",
"typescript-eslint": "^8.18.2",
"vite": "^6.0.5",
"vite-plugin-pwa": "^0.21.1"
"vite": "^6.0.5"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "4.6.1"
Expand Down
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
9 changes: 6 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="theme-color" content="#008955" />
<meta name="apple-mobile-web-app-title" content="Ride NITT">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta
name="description"
content="Web site created using create-react-app"
content="Ride NITT is a carpooling platform for the students of NIT Trich by the Technical Club of NIT Trichy"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
Expand All @@ -24,7 +27,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>Ride NITT</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file added public/logo16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 11 additions & 6 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Ride NITT | Carpool like never before",
"name": "Ride NITT",
"description": "Ride NITT is a carpooling platform for the students of NIT Trich by the Technical Club of NIT Trichy",
"theme_color": "#008955",
"icons": [
{
"src": "favicon.ico",
Expand All @@ -18,8 +20,11 @@
"sizes": "512x512"
}
],
"apple-touch-icon": {
"src": "logo192.png",
"sizes": "192x192",
"type": "image/png"
},
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
"display": "standalone"
}
3 changes: 1 addition & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,10 @@ const CustomRouter = () => {
<Route path="/profile" element={<ProfileComponent />} />
<Route path="/notifications" element={<Notifications />} />
<Route path="/my-rides" element={<MyRides />} />
<Route path="*" element={<NotFound />} />
</Route>
</>
)}

<Route path="*" element={authLoading ? null : <NotFound />} />
</Routes>
</BrowserRouter >
);
Expand Down
14 changes: 7 additions & 7 deletions src/Components/DateTimeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function DateTimeModal({
<button
key={day}
onClick={() => setSelectedDate(day)}
disabled={todayMonth === currentMonth && todayYear === currentYear && day < todayDate}
disabled={todayMonth === currentMonth && todayYear === currentYear && day+1 < todayDate}
className={`
rounded-full w-8 h-8 mx-auto flex items-center justify-center disabled:text-gray-300 text-gray-700
${selectedDate === day ? "bg-green-600 text-white" : ""}
Expand All @@ -160,7 +160,7 @@ export function DateTimeModal({
<h3 className="text-gray-500">Ride Start Time</h3>
<div className="flex gap-4">
<select
className="relative w-1/5 px-2 py-1 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={startHour}
onChange={(e) => handleHourChange("start", Number(e.target.value))}
>
Expand All @@ -171,7 +171,7 @@ export function DateTimeModal({
))}
</select>
<select
className="w-1/4 p-2 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={startMinute}
onChange={(e) => handleMinuteChange("start", Number(e.target.value))}
>
Expand All @@ -182,7 +182,7 @@ export function DateTimeModal({
))}
</select>
<select
className="w-1/4 p-2 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={startAmPm}
onChange={(e) => handleAmPmChange("start", e.target.value as any)}
>
Expand All @@ -200,7 +200,7 @@ export function DateTimeModal({
<h3 className="text-gray-500">Ride End Time</h3>
<div className="flex gap-4">
<select
className="w-1/4 p-2 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={endHour}
onChange={(e) => handleHourChange("end", Number(e.target.value))}
>
Expand All @@ -211,7 +211,7 @@ export function DateTimeModal({
))}
</select>
<select
className="w-1/4 p-2 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={endMinute}
onChange={(e) => handleMinuteChange("end", Number(e.target.value))}
>
Expand All @@ -222,7 +222,7 @@ export function DateTimeModal({
))}
</select>
<select
className="w-1/4 p-2 border-2 border-gray-300 rounded-full"
className="minimal w-[72px] p-2 border-2 border-gray-300 rounded-full"
value={endAmPm}
onChange={(e) => handleAmPmChange("end", e.target.value as any)}
>
Expand Down
19 changes: 2 additions & 17 deletions src/Components/LocationForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useState } from "react";
import { Calendar, Clock, HelpCircle } from "lucide-react";
import { Calendar, Clock } from "lucide-react";
import { DateTimeModal } from "./DateTimeModal";
import axios from "axios";
import { toast } from "react-toastify";
Expand Down Expand Up @@ -121,23 +121,8 @@ export default function ShareRide() {
className="relative w-full min-h-screen p-6 sm:p-6"
style={{ background: "linear-gradient(180deg, #FFFFFF 0%, rgba(0, 204, 136, 0.75) 100%)" }}
>
{/* Search Bar */}
<div className="flex items-center gap-2 mb-6">
<div className="flex-1 relative">
<input
type="text"
placeholder="Search"
className="w-full h-10 pl-4 pr-10 rounded-full border-2 border-black focus:outline-none"
/>

<div className="absolute right-3 top-1/2 transform -translate-y-1/2">
<HelpCircle className="w-6 h-6 text-green-600" />
</div>
</div>
</div>

{/* Title */}
<h1 className="text-3xl sm:text-4xl md:text-5xl font-bold text-[#008955] mb-0.75">Share & Ride</h1>
<h1 className="mt-8 text-3xl sm:text-4xl md:text-5xl font-bold text-[#008955] mb-0.75">Share & Ride</h1>
<p className="text-xl sm:text-2xl md:text-3xl mb-3 ">Post your ride!</p>

{/* White Card */}
Expand Down
11 changes: 4 additions & 7 deletions src/Components/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ export default function Select({
Label: React.FC<{ children: React.ReactNode }>
}) {
return (
<div className='relative group flex items-center border-2 border-black rounded-2xl bg-[#E2F5ED]'>
<button onBlur={e => {
e.stopPropagation()
e.preventDefault()
}} className='p-3 peer rounded-2xl w-full text-left'>
<div className='relative dropdown dropdown-top flex items-center border-2 border-black rounded-2xl bg-[#E2F5ED]'>
<div tabIndex={0} role='button' className='p-3 peer rounded-2xl w-full text-left'>
<Label>{value}</Label>
</button>
</div>

{/* TODO: Support tab navigation */}
<ul tabIndex={0} className={`flex-col max-h-40 overflow-y-auto absolute -top-2 -translate-y-full inset-x-0 bg-neutral-200 rounded-lg border-solid border-2 border-black hidden peer-focus:flex focus:flex group-active:flex`}>
<ul tabIndex={0} className={`dropdown-content flex-col max-h-40 w-full overflow-y-auto bg-neutral-200 rounded-lg border-solid border-2 border-black flex`}>
{items.map((item) => (
<li
tabIndex={0}
Expand Down
35 changes: 17 additions & 18 deletions src/Pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,31 @@ const Login: React.FC = () => {

return (
<div className="gradient-background h-screen px-6 pt-20">
<div className="w-full max-w-sm">
<div className="w-full max-w-sm mx-auto">
<h2 className="text-black text-2xl md:text-3xl font-semibold text-left">
Hop In!
</h2>
<h2 className="text-black text-2xl md:text-3xl font-semibold text-left">
Smarter Rides Start Here.
</h2>

<img
width={300} height={300}
src="/Images/login-image.png"
alt="Login"
className="mt-6 w-[85vw] sm:w-[50vw] md:w-[40vw] lg:w-[30vw] max-w-[350px] max-h-[220px] md:max-h-[260px] lg:max-h-[280px] object-contain"
/>

{/* Not Link to force refresh page */}
<a
href="/auth/google"
className="disabled:opacity-50 mt-6 px-6 py-3 flex items-center justify-center gap-4 bg-[#008955] text-white font-semibold rounded-lg text-lg w-full max-w-sm hover:bg-[#007144] transition border border-black"
>
<FaGoogle />
Continue with Google
</a>
</div>

<div className="mt-6"></div>

<img
width={300} height={300}
src="/Images/login-image.png"
alt="Login"
className="w-[85%] sm:w-[50%] md:w-[40%] lg:w-[30%] max-w-[350px] max-h-[220px] md:max-h-[260px] lg:max-h-[280px] object-contain"
/>

{/* Not Link to force refresh page */}
<a
href="/auth/google"
className="disabled:opacity-50 mt-6 px-6 py-3 flex items-center justify-center gap-4 bg-[#008955] text-white font-semibold rounded-lg text-lg w-full max-w-sm hover:bg-[#007144] transition border border-black"
>
<FaGoogle />
Continue with Google
</a>
</div>
);
};
Expand Down
9 changes: 6 additions & 3 deletions src/Pages/Requests/Components/ReceivedRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default function ReceivedRequest({
const ed = new Date(ride.latestDeparture)

const handleAccept = (inviteId: string) => {
setLoading(true)

axios.post(`/api/invites/${inviteId}/accept`)
.then(() => {
toast.success('Request accepted')
Expand All @@ -31,6 +33,7 @@ export default function ReceivedRequest({
console.error(err)
toast.error(err.response.data?.error ?? 'Failed to accept request')
})
.finally(() => setLoading(false))
}

const handleDecline = (inviteId: string, reason: string) => {
Expand Down Expand Up @@ -154,15 +157,15 @@ export default function ReceivedRequest({

{invite.status === 'PENDING' ? (
<div className='mt-2 text-xs'>
<button className='mr-2 w-20 p-1 border-2 border-green-600 bg-green-600 text-white rounded-lg font-semibold' onClick={() => handleAccept(invite.id)}>
<button disabled={loading} className='disabled:opacity-50 mr-2 w-20 p-1 border-2 border-green-600 bg-green-600 text-white rounded-lg font-semibold' onClick={() => handleAccept(invite.id)}>
Accept
</button>
<button className='w-20 p-1 border-2 border-red-600 bg-red-100 text-neutral-800 rounded-lg font-semibold' onClick={() => setDeclineInvitePromptId(invite.id)}>
<button disabled={loading} className='disabled:opacity-50 w-20 p-1 border-2 border-red-600 bg-red-100 text-neutral-800 rounded-lg font-semibold' onClick={() => setDeclineInvitePromptId(invite.id)}>
Decline
</button>
</div>
) : invite.status === 'ACCEPTED' ? (
<button className='mt-2 w-20 text-xs p-1 border-2 border-red-600 bg-red-100 text-neutral-800 rounded-lg font-semibold' onClick={() => setDeclineInvitePromptId(invite.id)}>
<button disabled={loading} className='disabled:opacity-50 mt-2 w-20 text-xs p-1 border-2 border-red-600 bg-red-100 text-neutral-800 rounded-lg font-semibold' onClick={() => setDeclineInvitePromptId(invite.id)}>
Remove
</button>
) : (
Expand Down
2 changes: 1 addition & 1 deletion src/Pages/Requests/Components/SentRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function SentRequest({
return (
<li className='p-2 border-2 border-green-700 rounded-xl'>
<RideDetailsModal currentUserId={user?.id} ride={ride} open={detailsModalOpen} onClose={() => setDetailsModalOpen(false)} />

{leavePromptOpen && (
<Prompt
label="Reason for leaving"
Expand Down
Loading