feat: Add Leaflet map integration and project coordinates handling
- Updated package.json to include dependencies for Leaflet and Playwright testing. - Added new images for Leaflet markers and layers. - Created scripts for generating test data with project coordinates. - Enhanced ProjectViewPage to display project coordinates and integrated ProjectMap component. - Modified ProjectForm to include coordinates input field. - Implemented CustomWMTSMap and EnhancedLeafletMap components for improved map functionality. - Created ProjectMap component to dynamically render project location on the map. - Added mapLayers configuration for various base layers including Polish Geoportal. - Implemented WMTS capabilities handling for dynamic layer loading. - Updated database initialization to include coordinates column in projects table. - Modified project creation and update functions to handle coordinates. - Added utility functions for formatting project status and deadlines.
This commit is contained in:
40
src/lib/utils.js
Normal file
40
src/lib/utils.js
Normal file
@@ -0,0 +1,40 @@
|
||||
// Test utilities for deadline and status formatting
|
||||
export const getDeadlineVariant = (days) => {
|
||||
if (days < 0) return "danger";
|
||||
if (days <= 7) return "warning";
|
||||
return "success";
|
||||
};
|
||||
|
||||
export const formatProjectStatus = (status) => {
|
||||
switch (status) {
|
||||
case "registered":
|
||||
return "Zarejestrowany";
|
||||
case "in_progress_design":
|
||||
return "W realizacji (projektowanie)";
|
||||
case "in_progress_construction":
|
||||
return "W realizacji (realizacja)";
|
||||
case "fulfilled":
|
||||
return "Zakończony";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
export const formatProjectType = (type) => {
|
||||
switch (type) {
|
||||
case "design":
|
||||
return "Projektowanie";
|
||||
case "construction":
|
||||
return "Realizacja";
|
||||
case "design+construction":
|
||||
return "Projektowanie + Realizacja";
|
||||
default:
|
||||
return "-";
|
||||
}
|
||||
};
|
||||
|
||||
export const getDeadlineText = (daysRemaining) => {
|
||||
if (daysRemaining === 0) return "Due Today";
|
||||
if (daysRemaining > 0) return `${daysRemaining} days left`;
|
||||
return `${Math.abs(daysRemaining)} days overdue`;
|
||||
};
|
||||
Reference in New Issue
Block a user