From e7043014a6251ac22dac640517691fe5d9018d4a Mon Sep 17 00:00:00 2001 From: Jeet Debnath Date: Mon, 23 Mar 2026 10:39:25 +0530 Subject: [PATCH] fix docker --- .claude/settings.local.json | 10 ++++++++++ src/hooks/useOnboardingTour.ts | 19 +++++++++++++++---- src/lib/api.ts | 24 ++++++++++++------------ 3 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..b0dceb4 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,10 @@ +{ + "permissions": { + "allow": [ + "Bash(docker compose:*)", + "Bash(npx tsc:*)", + "Bash(curl -s http://127.0.0.1:8000/api/users/by-email/jeet.debnath2004@gmail.com)", + "Bash(ipconfig getifaddr:*)" + ] + } +} diff --git a/src/hooks/useOnboardingTour.ts b/src/hooks/useOnboardingTour.ts index fa5e7f6..f0ccad0 100644 --- a/src/hooks/useOnboardingTour.ts +++ b/src/hooks/useOnboardingTour.ts @@ -210,16 +210,27 @@ export function useOnboardingTour() { clearPendingTourStep() driverObj.destroy() }, - onDestroyed: () => { - markOnboardingDone() - clearPendingTourStep() + onNextClick: () => { + const activeIndex = driverObj.getActiveIndex() + const steps = driverObj.getConfig().steps || [] + + // Last settings step → navigate to / + if (activeIndex === steps.length - 1) { + markOnboardingDone() + clearPendingTourStep() + driverObj.destroy() + navigate('/') + return + } + + driverObj.moveNext() }, steps: getSettingsSteps(isMobile), }) driverRef.current = driverObj setTimeout(() => driverObj.drive(), 300) - }, []) + }, [navigate]) return { startTour, continueTourOnHistory, continueTourOnSettings } } diff --git a/src/lib/api.ts b/src/lib/api.ts index ec29501..43a24ba 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -3,7 +3,7 @@ * Handles all communication with the backend API */ -const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8001' +const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8001/api' type ApiOptions = { method?: 'GET' | 'POST' | 'PUT' | 'DELETE' @@ -57,7 +57,7 @@ export async function registerUser( }, token: string ) { - return apiCall('/api/users/register', { + return apiCall('/users/register', { method: 'POST', body: userData, token, @@ -65,7 +65,7 @@ export async function registerUser( } export async function getUserByEmail(email: string, token: string) { - return apiCall(`/api/users/by-email/${email}`, { token }) + return apiCall(`/users/by-email/${email}`, { token }) } export async function updateUserProfile( @@ -73,7 +73,7 @@ export async function updateUserProfile( updates: { displayName?: string; photoURL?: string; theme?: string }, token: string ) { - return apiCall(`/api/users/${userId}`, { + return apiCall(`/users/${userId}`, { method: 'PUT', body: updates, token, @@ -82,7 +82,7 @@ export async function updateUserProfile( export async function deleteUser(userId: string, token: string) { return apiCall<{ message: string; user_deleted: number; entries_deleted: number }>( - `/api/users/${userId}`, + `/users/${userId}`, { method: 'DELETE', token, @@ -125,7 +125,7 @@ export async function createEntry( token: string ) { return apiCall<{ id: string; message: string }>( - `/api/entries/${userId}`, + `/entries/${userId}`, { method: 'POST', body: entryData, @@ -141,7 +141,7 @@ export async function getUserEntries( skip = 0 ) { return apiCall<{ entries: JournalEntry[]; total: number }>( - `/api/entries/${userId}?limit=${limit}&skip=${skip}`, + `/entries/${userId}?limit=${limit}&skip=${skip}`, { token } ) } @@ -151,7 +151,7 @@ export async function getEntry( entryId: string, token: string ) { - return apiCall(`/api/entries/${userId}/${entryId}`, { + return apiCall(`/entries/${userId}/${entryId}`, { token, }) } @@ -162,7 +162,7 @@ export async function updateEntry( updates: Partial, token: string ) { - return apiCall(`/api/entries/${userId}/${entryId}`, { + return apiCall(`/entries/${userId}/${entryId}`, { method: 'PUT', body: updates, token, @@ -174,7 +174,7 @@ export async function deleteEntry( entryId: string, token: string ) { - return apiCall(`/api/entries/${userId}/${entryId}`, { + return apiCall(`/entries/${userId}/${entryId}`, { method: 'DELETE', token, }) @@ -187,7 +187,7 @@ export async function getEntriesByDate( token: string ) { return apiCall( - `/api/entries/${userId}/date-range?startDate=${startDate}&endDate=${endDate}`, + `/entries/${userId}/date-range?startDate=${startDate}&endDate=${endDate}`, { token } ) } @@ -197,7 +197,7 @@ export async function getEntriesByDate( export async function convertUTCToIST(utcTimestamp: string) { return apiCall<{ utc: string; ist: string }>( - `/api/entries/convert-timestamp/utc-to-ist`, + `/entries/convert-timestamp/utc-to-ist`, { method: 'POST', body: { timestamp: utcTimestamp },