dashbaord

This commit is contained in:
Jake Kasper
2025-09-04 09:07:49 -05:00
parent c9729130fe
commit 552aaead59
3 changed files with 20 additions and 10 deletions

View File

@@ -1,14 +1,9 @@
import React from 'react';
import { Navigate } from 'react-router-dom';
const ApplicationPlan = () => {
return (
<div className="p-6">
<h1 className="text-2xl font-bold text-gray-900 mb-6">Plan Application</h1>
<div className="card">
<p className="text-gray-600">Application planning coming soon...</p>
</div>
</div>
);
// Redirect legacy route to the Applications page with the plan modal open
return <Navigate to="/applications?new=plan" replace />;
};
export default ApplicationPlan;
export default ApplicationPlan;

View File

@@ -1,4 +1,5 @@
import React, { useState, useEffect } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import {
PlusIcon,
MapPinIcon,
@@ -22,6 +23,8 @@ import ApplicationViewModal from '../../components/Applications/ApplicationViewM
import toast from 'react-hot-toast';
const Applications = () => {
const location = useLocation();
const navigate = useNavigate();
const [showPlanForm, setShowPlanForm] = useState(false);
const [applications, setApplications] = useState([]);
const [loading, setLoading] = useState(true);
@@ -57,6 +60,18 @@ const Applications = () => {
fetchPlanningData();
}, []);
// Open plan modal based on query param (?new=plan)
useEffect(() => {
const params = new URLSearchParams(location.search);
const shouldOpen = params.get('new') === 'plan';
if (shouldOpen && !showPlanForm) {
setShowPlanForm(true);
// Clean URL so refresh doesn't keep reopening
navigate('/applications', { replace: true });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [location.search]);
const fetchApplications = async () => {
try {
const response = await applicationsAPI.getPlans();

View File

@@ -35,7 +35,7 @@ const Dashboard = () => {
},
{
name: 'Plan Application',
href: '/applications/plan',
href: '/applications?new=plan',
icon: CalendarDaysIcon,
description: 'Schedule a treatment',
color: 'bg-green-500',