diff --git a/.env.example b/.env.example index 2d3f8fd..26b84d3 100755 --- a/.env.example +++ b/.env.example @@ -4,8 +4,10 @@ OpenWeatherMapAPIKey= # For local dev: localhost and http://localhost # For production: e.g. kapteins-daagbok.eu and https://kapteins-daagbok.eu RP_ID=localhost -# Must match the frontend URL (Vite dev: http://localhost:5173) +# Must match the frontend URL (Vite dev: http://localhost:5173; Docker: http://localhost) ORIGIN=http://localhost:5173 +# Optional: comma-separated CORS origins (defaults to ORIGIN; dev also allows 127.0.0.1:5173) +# CORS_ORIGINS=http://localhost:5173,http://127.0.0.1:5173 # API session signing (min. 32 chars; required in production) # Generate: openssl rand -base64 48 diff --git a/client/src/App.tsx b/client/src/App.tsx index 18b444c..5beea97 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -40,19 +40,20 @@ import { getStoredDemoFirstEntryId, seedDemoLogbookIfNeeded } from './services/demoLogbook.js' -import { fetchLogbooks } from './services/logbook.js' +import { fetchLogbooks, parseCollaborationRole } from './services/logbook.js' import { ensurePushSubscriptionIfEnabled } from './services/pushNotifications.js' const PENDING_PUSH_LOGBOOK_KEY = 'pending_push_logbook_id' function App() { const { t, i18n } = useTranslation() - const { registerNavigation, requestStartAfterLogin } = useAppTour() + const { registerNavigation, requestStartAfterLogin, isActive, currentStepId } = useAppTour() const [isAuthenticated, setIsAuthenticated] = useState(false) const [activeLogbookId, setActiveLogbookId] = useState(null) const [activeLogbookTitle, setActiveLogbookTitle] = useState(null) const [activeTab, setActiveTab] = useState('logs') const [tourSelectedEntryId, setTourSelectedEntryId] = useState(null) + const [tourFeedbackOpen, setTourFeedbackOpen] = useState(false) const [demoHighlightEntryId, setDemoHighlightEntryId] = useState(null) const [online, setOnline] = useState(navigator.onLine) const [isSyncing, setIsSyncing] = useState(false) @@ -90,9 +91,11 @@ function App() { } const cachedRole = activeLogbookRecord.collaborationRole - if (cachedRole) { - setActiveAccessRole(cachedRole) - } + setActiveAccessRole( + cachedRole + ? parseCollaborationRole(cachedRole, `logbook ${activeLogbookId}`) + : 'WRITE' + ) getLogbookAccess(activeLogbookId).then((access) => { if (access) setActiveAccessRole(access.role) @@ -503,6 +506,7 @@ function App() {