Homepage Improvements
This commit is contained in:
@@ -187,7 +187,7 @@ describe('DocumentsMobileScreen', () => {
|
||||
const openButtons = screen.getAllByText('Open');
|
||||
await user.click(openButtons[0]);
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/documents/doc-1');
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/garage/documents/doc-1');
|
||||
});
|
||||
|
||||
it('should navigate to correct document for each Open button', async () => {
|
||||
@@ -197,10 +197,10 @@ describe('DocumentsMobileScreen', () => {
|
||||
const openButtons = screen.getAllByText('Open');
|
||||
|
||||
await user.click(openButtons[0]);
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/documents/doc-1');
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/garage/documents/doc-1');
|
||||
|
||||
await user.click(openButtons[1]);
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/documents/doc-2');
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/garage/documents/doc-2');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -406,4 +406,4 @@ describe('DocumentsMobileScreen', () => {
|
||||
expect(uploadButtons).toHaveLength(mockDocuments.length);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -185,7 +185,7 @@ export const DocumentsMobileScreen: React.FC = () => {
|
||||
<div className="text-xs text-slate-500">{doc.document_type} • {vehicleLabel}</div>
|
||||
</div>
|
||||
<div className="flex gap-2 items-center">
|
||||
<Button onClick={() => navigate(`/documents/${doc.id}`)}>Open</Button>
|
||||
<Button onClick={() => navigate(`/garage/documents/${doc.id}`)}>Open</Button>
|
||||
<Button onClick={() => triggerUpload(doc.id)}>Upload</Button>
|
||||
{upload.isPending && currentId === doc.id && (
|
||||
<span className="text-xs text-slate-500">{upload.progress}%</span>
|
||||
|
||||
@@ -64,7 +64,7 @@ export const DocumentDetailPage: React.FC = () => {
|
||||
<p className="text-slate-600 mb-6">Please log in to view this document</p>
|
||||
<div className="space-x-3">
|
||||
<Button onClick={() => loginWithRedirect()}>Login to Continue</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/documents')}>Back to Documents</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/garage/documents')}>Back to Documents</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -88,7 +88,7 @@ export const DocumentDetailPage: React.FC = () => {
|
||||
<p className="text-slate-600 mb-6">Your session has expired. Please log in again to continue.</p>
|
||||
<div className="space-x-3">
|
||||
<Button onClick={() => loginWithRedirect()}>Login Again</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/documents')}>Back to Documents</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/garage/documents')}>Back to Documents</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -112,7 +112,7 @@ export const DocumentDetailPage: React.FC = () => {
|
||||
<p className="text-slate-600 mb-6">The document you're looking for could not be found.</p>
|
||||
<div className="space-x-3">
|
||||
<Button onClick={() => window.location.reload()}>Retry</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/documents')}>Back to Documents</Button>
|
||||
<Button variant="secondary" onClick={() => navigate('/garage/documents')}>Back to Documents</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -127,7 +127,7 @@ export const DocumentDetailPage: React.FC = () => {
|
||||
<div className="p-8 text-center">
|
||||
<h3 className="text-lg font-semibold text-slate-800 mb-2">Document Not Found</h3>
|
||||
<p className="text-slate-600 mb-6">The document you're looking for does not exist.</p>
|
||||
<Button onClick={() => navigate('/documents')}>Back to Documents</Button>
|
||||
<Button onClick={() => navigate('/garage/documents')}>Back to Documents</Button>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -115,7 +115,7 @@ export const DocumentsPage: React.FC = () => {
|
||||
</div>
|
||||
<h3 className="text-lg font-semibold text-slate-800 mb-2">No Documents Yet</h3>
|
||||
<p className="text-slate-600 mb-6">You haven't added any documents yet. Documents will appear here once you create them.</p>
|
||||
<Button onClick={() => navigate('/vehicles')}>
|
||||
<Button onClick={() => navigate('/garage/vehicles')}>
|
||||
Go to Vehicles
|
||||
</Button>
|
||||
</div>
|
||||
@@ -131,7 +131,7 @@ export const DocumentsPage: React.FC = () => {
|
||||
<div className="text-sm text-slate-500">Type: {doc.document_type}</div>
|
||||
<div className="text-sm text-slate-500">Vehicle: {doc.vehicle_id}</div>
|
||||
<div className="flex gap-2 pt-2">
|
||||
<Button onClick={() => navigate(`/documents/${doc.id}`)}>Open</Button>
|
||||
<Button onClick={() => navigate(`/garage/documents/${doc.id}`)}>Open</Button>
|
||||
<Button variant="danger" onClick={() => removeDoc.mutate(doc.id)}>Delete</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -129,7 +129,7 @@ export const VehicleDetailPage: React.FC = () => {
|
||||
}, [id]);
|
||||
|
||||
const handleBack = () => {
|
||||
navigate('/vehicles');
|
||||
navigate('/garage/vehicles');
|
||||
};
|
||||
|
||||
const handleEdit = () => {
|
||||
|
||||
@@ -53,7 +53,7 @@ export const VehiclesPage: React.FC = () => {
|
||||
startTransition(() => {
|
||||
const vehicle = optimisticVehicles.find(v => v.id === id);
|
||||
setSelectedVehicle(vehicle || null);
|
||||
navigate(`/vehicles/${id}`);
|
||||
navigate(`/garage/vehicles/${id}`);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -191,4 +191,4 @@ export const VehiclesPage: React.FC = () => {
|
||||
</Box>
|
||||
</VehicleListSuspense>
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user