mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-20 22:01:45 +00:00
Merge branch 'feat/system-notices' into dev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useEffect, useState, useRef } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { tripsApi } from '../api/client'
|
||||
import { tripRepo } from '../repo/tripRepo'
|
||||
import { useAuthStore } from '../store/authStore'
|
||||
@@ -689,6 +689,7 @@ export default function DashboardPage(): React.ReactElement {
|
||||
}
|
||||
|
||||
const navigate = useNavigate()
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const toast = useToast()
|
||||
const { t, locale } = useTranslation()
|
||||
const { demoMode, user } = useAuthStore()
|
||||
@@ -709,6 +710,13 @@ export default function DashboardPage(): React.ReactElement {
|
||||
return () => { document.body.style.overflow = '' }
|
||||
}, [showWidgetSettings])
|
||||
|
||||
useEffect(() => {
|
||||
if (searchParams.get('create') === '1') {
|
||||
setShowForm(true)
|
||||
setSearchParams({}, { replace: true })
|
||||
}
|
||||
}, [searchParams])
|
||||
|
||||
useEffect(() => { loadTrips() }, [])
|
||||
|
||||
const loadTrips = async () => {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { registerNoticeAction } from '../../components/SystemNotices/noticeActions.js';
|
||||
|
||||
// Opens the new-trip creation modal on DashboardPage via URL param.
|
||||
// DashboardPage reads ?create=1 on mount and calls setShowForm(true).
|
||||
registerNoticeAction('open:trip-create', ({ navigate }) => {
|
||||
navigate('/dashboard?create=1');
|
||||
});
|
||||
Reference in New Issue
Block a user