Skip to content

feat(frontend): sign in with Google and read the hotel from /auth/me - #156

Merged
Jrodrigo06 merged 6 commits into
mainfrom
auth-me-hotel
Nov 27, 2026
Merged

Jrodrigo06 merged 6 commits into
mainfrom
auth-me-hotel

Conversation

@Jrodrigo06

@Jrodrigo06 Jrodrigo06 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

What

The frontend reads the signed-in user and their hotel from GET /auth/me instead of VITE_HOTEL_ID. Signed-out visitors land on a sign-in page built from the Figma "Log in" frame, with Google as the only way in.

Why

Every screen needs to know whose hotel it is showing, and the backend already has Google sign-in and /auth/me.

How to check

  • just dev --neon and just frontend, then open http://localhost:5173/calendar signed out: you land on /sign-in.
  • Continue with Google. With no hotel linked you see "No hotel linked to your account". After cli link-user <email> <hotel_id> the calendar loads with the hotel's name and city.
  • Sign out returns to /sign-in. just frontend --mocks signs you in as a mock user.

Screenshots

Sign-in page

Sign-in page

Top bar with the hotel and city from /auth/me

Top bar with the hotel and city from /auth/me

Notes

  • Not included:
    • Sign-in error line: the backend callback doesn't redirect back on failure yet.
    • Email/password sign-in.
    • Designs for the loading, no-hotel and error screens: they use the shared state components.
    • Upload data and Settings in the sidebar: hidden until those screens exist.
    • Primary button colour: waiting on a decision.
  • Commit 1's message mentions "107 rooms". refactor: clean up the backend: one product, fewer moving parts, one code style #155 removed total_rooms later, and the code doesn't use it.

AuthProvider asks GET /auth/me once and shares { user, hotels, hotel,
status, retry } through useAuth(). hotel is the first of hotels: one hotel
per user for now. status is loading, authed, anon (a 401), no-hotel or
error. /auth/me doesn't redirect on 401 like other calls, so signed out can
be told apart from failed. The mock returns Beresford, Dublin, 107 rooms.
Every page inside the app shell waits for /auth/me. Loading shows the
shared LoadingState centred on the screen, signed out goes to /sign-in
(saving the page to come back to), no hotel shows EmptyState with "No
hotel linked to your account" and a sign out button, and an error shows
ErrorState with Try again. These states have no Figma design yet.
SignOutButton posts /auth/logout, then loads /sign-in fresh.
The calendar and the top bar read the signed-in user's hotel from
useAuth(). The top bar shows the hotel's city when it has one.
VITE_HOTEL_ID is gone, and so is getHotel, whose only caller was the top
bar.
The other screens are placeholders, so the sidebar lists Calendar alone;
their routes stay in App.jsx. Sign out sits at the bottom and posts
/auth/logout.
Two panels from the Figma "Log in" frame: the brand panel (logo, headline,
subline, © 2026 Foresight) and the form panel ("Welcome back" and one
"Continue with Google" link to the API's /auth/google/login). The design's
email, password, "Forgot password?" and "Create an account" aren't built:
Google is the only sign-in. The subline names events only, since weather
and flights are out of the model (0055, 0050). The gradient's three
off-scale stops are tokens in index.css, and the logo mark, circles and
button icon are Figma's SVGs.
@Jrodrigo06
Jrodrigo06 merged commit 78598d7 into main Nov 27, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants