Skip to content

Commit 7767d6d

Browse files
authored
feat: Reorganize dashboard layout and add Crisis Map with user preferences (#93)
* feat: Enhance Dashboard with new Crisis Map and filter functionalities - Added a new Crisis Map section to the Dashboard, allowing users to view an interactive global map of crisis locations. - Implemented tooltips for navigation items to provide contextual information. - Introduced additional filters for country and disaster types to refine crisis data displayed on the map. - Updated the layout and styling for better user experience and accessibility. - Refactored existing components to accommodate new features and improve code organization. * feat: Implement user-specific map style preferences and enhance dashboard layout - Added functionality for users to customize their map styles for light and dark themes through a new MapStyleSettings component. - Integrated user map preferences into the backend with new API endpoints for fetching and updating preferences. - Updated the CrisisMap component to utilize user-defined styles, improving personalization. - Enhanced the Dashboard layout with a TooltipProvider for better user guidance and interaction. - Refactored existing components for improved organization and maintainability. * Fix build errors and warnings - Fix country variable declaration in location-onboarding.tsx (use const instead of let) - Remove unused loading variable in dashboard/map/page.tsx - Remove unused toggleDisasterType and availableDisasterTypes in dashboard/page.tsx - Prefix unused setter variables with underscore to indicate intentional non-use * fix: Update demo user email and picture in auth router - Changed demo user email domain from bluerelief.test to bluerelief.app for consistency. - Updated demo user picture URL to use a new avatar style for improved visual representation.
1 parent 458bc04 commit 7767d6d

File tree

23 files changed

+1994
-372
lines changed

23 files changed

+1994
-372
lines changed

.cursorrules

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,16 @@
3131

3232
### Database Migrations
3333
- ALWAYS use Alembic for database migrations
34-
- Command: `alembic revision --autogenerate -m "description"`
35-
- Apply migrations: `alembic upgrade head`
36-
- View history: `alembic history`
37-
- Current status: `alembic current`
38-
- Downgrade: `alembic downgrade <revision>`
34+
- **CRITICAL WORKFLOW:**
35+
1. FIRST: Update the SQLAlchemy models in `server/db_utils/db.py`
36+
2. SECOND: Use `./scripts/docker-dev.sh migrate-generate "description"` to auto-generate migration
37+
3. THIRD: Review the generated migration file
38+
4. FOURTH: Apply with `./scripts/docker-dev.sh migrate`
39+
- **NEVER manually create migration files** - always auto-generate them
40+
- Apply migrations: `./scripts/docker-dev.sh migrate`
41+
- View history: `./scripts/docker-dev.sh migrate-status`
42+
- Validate schema: `./scripts/docker-dev.sh migrate-validate`
43+
- Downgrade: `./scripts/docker-dev.sh migrate-downgrade <revision>`
3944

4045
### Development Setup
4146
- Use the provided `./scripts/docker-dev.sh` script for all development tasks
@@ -102,3 +107,4 @@
102107
- Do NOT suggest manual Docker commands instead of the script
103108
- Do NOT add bloated comments or placeholder TODOs
104109
- Do NOT create duplicates without evaluating existing code first
110+
- Do NOT manually create Alembic migration files - always auto-generate them using the docker-dev.sh script

.dock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dev: docker-compose.yml

client/app/dashboard/analysis/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ const ComparisonIndicator = ({
113113
return (
114114
<div className={`flex items-center gap-1 text-xs ${isImprovement ? 'text-green-600' : 'text-red-600'}`}>
115115
{isPositive ? (
116-
<Lordicon
117-
src={LORDICON_SOURCES.arrowUpRight}
116+
<Lordicon
117+
src={LORDICON_SOURCES.trendingUp}
118118
trigger="hover"
119119
size={LORDICON_SIZES.xs}
120120
colorize="currentColor"
121121
/>
122122
) : (
123123
<Lordicon
124-
src={LORDICON_SOURCES.arrowDownRight}
124+
src={LORDICON_SOURCES.trendingUp}
125125
trigger="hover"
126126
size={LORDICON_SIZES.xs}
127127
colorize="currentColor"

client/app/dashboard/data-feed/page.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client"
22

33
import { useEffect, useState } from "react"
4+
import { ArrowUpRight } from "lucide-react"
45
import { Button } from "@/components/ui/button"
56
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
67
import { Badge } from "@/components/ui/badge"
@@ -534,12 +535,7 @@ export default function DataFeedPage() {
534535
>
535536
<BlueskyIcon className="mr-2 text-[#1185fe]" size={16} />
536537
View on Bluesky
537-
<Lordicon
538-
src={LORDICON_SOURCES.externalLink}
539-
trigger="hover"
540-
size={LORDICON_SIZES.xs}
541-
colorize="currentColor"
542-
/>
538+
<ArrowUpRight className="h-3 w-3 ml-1" />
543539
</Button>
544540
)}
545541
</div>

client/app/dashboard/layout.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import { logout } from "@/lib/auth";
4646
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
4747
import { Badge } from "@/components/ui/badge";
4848
import { Kbd } from "@/components/ui/kbd";
49+
import { TooltipProvider } from "@/components/ui/tooltip";
4950
import { apiGet } from "@/lib/api-client";
5051

5152
type NavigationItem = {
@@ -54,9 +55,11 @@ type NavigationItem = {
5455
href: string;
5556
showBadge?: boolean;
5657
lordiconSrc?: string;
58+
tooltip?: string;
5759
};
5860

5961
const DashboardIcon = () => <Lordicon src="https://cdn.lordicon.com/oeotfwsx.json" trigger="hover" size={18} colorize="currentColor" />;
62+
const MapIcon = () => <Lordicon src="https://cdn.lordicon.com/oypudwea.json" trigger="hover" size={18} colorize="currentColor" />;
6063
const DataFeedIcon = () => <Lordicon src="https://cdn.lordicon.com/ulcgigyi.json" trigger="hover" size={18} colorize="currentColor" />;
6164
const AnalysisIcon = () => <Lordicon src="https://cdn.lordicon.com/btfbysou.json" trigger="hover" size={18} colorize="currentColor" />;
6265
const AlertsIcon = () => <Lordicon src="https://cdn.lordicon.com/ahxaipjb.json" trigger="hover" size={18} colorize="currentColor" />;
@@ -67,11 +70,19 @@ const mainNavigation: NavigationItem[] = [
6770
title: "Dashboard",
6871
icon: DashboardIcon,
6972
href: "/dashboard",
73+
tooltip: "View overview of all crisis data and metrics",
74+
},
75+
{
76+
title: "Crisis Map",
77+
icon: MapIcon,
78+
href: "/dashboard/map",
79+
tooltip: "Interactive global map of crisis locations",
7080
},
7181
{
7282
title: "Data Feed",
7383
icon: DataFeedIcon,
7484
href: "/dashboard/data-feed",
85+
tooltip: "Real-time feed of crisis events and updates",
7586
},
7687
];
7788

@@ -80,12 +91,14 @@ const monitoringNavigation: NavigationItem[] = [
8091
title: "Analysis",
8192
icon: AnalysisIcon,
8293
href: "/dashboard/analysis",
94+
tooltip: "Advanced analytics and crisis trends",
8395
},
8496
{
8597
title: "Alerts",
8698
icon: AlertsIcon,
8799
href: "/dashboard/alerts",
88100
showBadge: true,
101+
tooltip: "Manage notifications and alert preferences",
89102
},
90103
];
91104

@@ -94,6 +107,7 @@ const systemNavigation: NavigationItem[] = [
94107
title: "Settings",
95108
icon: SettingsIcon,
96109
href: "/dashboard/settings",
110+
tooltip: "Configure your account and preferences",
97111
},
98112
];
99113

@@ -148,7 +162,7 @@ function AppSidebar({ user }: AppSidebarProps) {
148162

149163
return (
150164
<SidebarMenuItem key={item.title}>
151-
<SidebarMenuButton asChild isActive={isActive} tooltip={item.title}>
165+
<SidebarMenuButton asChild isActive={isActive} tooltip={item.tooltip || item.title}>
152166
<Link href={item.href}>
153167
<item.icon />
154168
<span>{item.title}</span>
@@ -293,7 +307,7 @@ export default function DashboardLayout({
293307

294308
useEffect(() => {
295309
if (!loading && !isAuthenticated) {
296-
router.push("/login");
310+
router.push("/");
297311
}
298312
}, [isAuthenticated, loading, router]);
299313

@@ -337,6 +351,7 @@ export default function DashboardLayout({
337351
}
338352

339353
return (
354+
<TooltipProvider>
340355
<SidebarProvider>
341356
<AppSidebar user={user} />
342357
<SidebarInset>
@@ -362,5 +377,6 @@ export default function DashboardLayout({
362377
</div>
363378
</SidebarInset>
364379
</SidebarProvider>
380+
</TooltipProvider>
365381
);
366382
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function MapLayout({
2+
children,
3+
}: {
4+
children: React.ReactNode;
5+
}) {
6+
return <>{children}</>;
7+
}

0 commit comments

Comments
 (0)