Commit Graph

217 Commits

Author SHA1 Message Date
vergiLgood1 57fb1e4e46 Refactor GeoJSON seeder to insert data in smaller batches to prevent timeouts; added chunking logic and improved error handling. Update permission seeder to batch create permissions for roles and resources. Optimize unit seeder to prepare and insert unit data in bulk, enhancing performance. Adjust Supabase configuration for local development and modify migration scripts to restore GIS functions and types. 2025-05-06 21:37:28 +07:00
vergiLgood1 969d10958c refactor: streamline SQL migration scripts and enhance schema management for units and incidents 2025-05-06 15:37:07 +07:00
vergiLgood1 e891df87d0 Refactor seeding scripts to utilize generateIdWithDbCounter for unique ID generation across crime categories, incidents, and units. Implement a new utility function for generating distributed points within district areas to enhance incident location variability. Comment out unnecessary type drops and creations in SQL migration files for clarity. Add migration scripts to drop and re-add the phone field in the units table, ensuring data integrity during schema updates. 2025-05-06 01:21:04 +07:00
vergiLgood1 0747897fc7 Refactor database privileges and schema management
- Created migration scripts to manage the 'prisma' role and its privileges across various schemas including 'public', 'gis', 'auth', and 'storage'.
- Added explicit grants for all necessary tables, sequences, and functions to ensure the 'prisma' role has appropriate access.
- Implemented triggers for user management in the 'auth' schema to handle new user creation, updates, and deletions.
- Established default privileges for future objects in the specified schemas to streamline permission management.
- Updated remote schema management scripts to include grants for 'postgres' on specific tables and functions.
- Dropped and recreated types in the 'gis' schema to ensure proper structure and functionality.
2025-05-05 23:39:01 +07:00
vergiLgood1 fa7651619b feat: Enhance heatmap and timeline layers with new data handling and filtering options 2025-05-05 11:11:11 +07:00
vergiLgood1 a19e8ec32d feat: Add timeline and units layers to the map component
- Introduced a new TimelineLayer to visualize average incident times per district.
- Added UnitsLayer to display police stations and connection lines to incidents.
- Updated Layers component to conditionally render the new layers based on active controls.
- Implemented a query to fetch units data from the server.
- Created utility functions for color generation based on crime categories.
- Enhanced map interaction with popups for detailed information on incidents and units.
- Added legends for timeline and units to improve user experience.
- Refactored existing types and interfaces to accommodate new features.
2025-05-05 10:38:11 +07:00
vergiLgood1 b0db61a9ff feat: add heatmap layer and enhance clustering functionality in map layers 2025-05-05 06:47:59 +07:00
vergiLgood1 c6115adf88 feat: enhance district layer interactions and animations for improved user experience 2025-05-05 05:49:50 +07:00
vergiLgood1 078bf969bc refactor: refactor district layer 2025-05-05 05:15:05 +07:00
vergiLgood1 03a5e527d4 Refactor map layers and components for improved structure and functionality
- Removed the MapLayerManager component and integrated its functionality into the Layers component.
- Added FlyToHandler component to manage map fly-to animations and highlight incidents.
- Introduced ClusterLayer and UnclusteredPointLayer components for better handling of crime incident clustering and display.
- Updated types in map.ts to include new interfaces for district features and layer props.
- Enhanced crime data processing functions for better data management and visualization.
- Adjusted button styles in button.tsx for improved UI consistency.
2025-05-05 04:57:32 +07:00
vergiLgood1 c282d958a5 feat: add map reset functionality and improve incident popup handling 2025-05-05 03:42:32 +07:00
vergiLgood1 6327d7b886 feat: implement map fly-to functionality with custom events for improved navigation experience 2025-05-05 03:20:16 +07:00
vergiLgood1 a2f51e6837 refactor: update crime-related interfaces for consistency and clarity across components 2025-05-05 03:11:07 +07:00
vergiLgood1 2aa2e609f1 feat: enhance search functionality with crime data integration and improved suggestion handling 2025-05-05 02:16:49 +07:00
vergiLgood1 befda55e2f feat: update tooltip styles for improved visibility and consistency across components 2025-05-05 02:02:40 +07:00
vergiLgood1 50f42f532f fix: update tooltip container reference and adjust z-index for better visibility 2025-05-05 01:53:52 +07:00
vergiLgood1 8f12715072 feat: Add Sidebar Statistics Tab for crime analytics overview
- Implemented SidebarStatisticsTab component to display monthly incidents and crime overview statistics.
- Integrated StatCard components for total incidents, monthly average, and clearance rate.
- Added visualization for incidents by month with dynamic height based on incident counts.
- Included CrimeTypeCard for displaying the most common crimes with percentage breakdown.

feat: Create Additional Tooltips for enhanced map controls

- Developed AdditionalTooltips component to provide year, month, and category selection.
- Integrated MonthSelector, YearSelector, and CategorySelector for filtering options.
- Added functionality to toggle visibility of selectors.

feat: Implement Crime Tooltips for crime data controls

- Created CrimeTooltips component to manage various crime data views.
- Included tooltips for incidents, heatmap, trends, patrol areas, clusters, and timeline.

feat: Enhance Search Control with incident search capabilities

- Developed SearchTooltip component for searching incidents by various criteria.
- Implemented suggestion filtering based on selected search type (crime ID, incident ID, coordinates, description, address).
- Added functionality to display detailed information about selected incidents.

feat: Consolidate tooltips into a unified Tooltip component

- Merged CrimeTooltips, AdditionalTooltips, and SearchTooltip into a single Tooltips component.
- Streamlined props for managing active controls and selected filters.

feat: Add Map Legend for crime rate visualization

- Created MapLegend component to visually represent crime rates using color coding.
- Integrated with existing map overlay for better user experience.
2025-05-05 01:11:37 +07:00
vergiLgood1 5b57476437 feat: improved suggestions and update suggestion display based on search type 2025-05-05 00:41:13 +07:00
vergiLgood1 125b281275 fix: fix suggestion doesnt appear when handleSearchTypeSelect trigger 2025-05-05 00:19:30 +07:00
vergiLgood1 1b5fc21731 feat: enhance ActionSearchBar and TopControl with improved cursor handling and add scroll suggestions 2025-05-04 09:21:46 +07:00
vergiLgood1 d807942688 Refactor FloatingActionSearchBar to accept actions and props; remove map-navigations component; implement top-controls with search functionality; enhance crime map with fly-to incident feature; add district layer highlight effect. 2025-05-04 08:54:03 +07:00
vergiLgood1 5d13ff532b refactor: rename TopNavigation to TopControl and update related imports in CrimeMap
style: update MapLegend text color for better visibility
2025-05-04 05:18:12 +07:00
vergiLgood1 75df66a621 feat: enhance crime analytics and sidebar components with improved type definitions and additional data handling 2025-05-04 05:04:19 +07:00
vergiLgood1 0de70f9057 feat: add incident severity categorization and utility functions
- Implemented `getIncidentSeverity` function to categorize incidents based on predefined categories.
- Added `formatMonthKey` function to format month keys for display.
- Introduced `getTimeAgo` function to calculate and format time elapsed since a given timestamp.

feat: create custom hooks and components for crime analytics

- Developed `useCrimeAnalytics` hook to process and analyze crime data, providing insights such as total incidents, recent incidents, and category counts.
- Created `CrimeTypeCard`, `IncidentCard`, `StatCard`, and `SystemStatusCard` components for displaying crime statistics and incident details in the sidebar.
- Implemented `SidebarIncidentsTab` and `SidebarStatisticsTab` components to manage and display incident data and statistics.

feat: enhance sidebar functionality with info and statistics tabs

- Added `SidebarInfoTab` and `SidebarStatisticsTab` components to provide users with information about crime severity, map markers, and overall crime statistics.
- Integrated pagination functionality with `usePagination` hook to manage incident history navigation.

style: improve UI components with consistent styling and layout adjustments

- Updated card components and layout for better visual hierarchy and user experience.
- Ensured responsive design and accessibility across all new components.
2025-05-04 04:24:17 +07:00
vergiLgood1 593b198b94 feat(map): enhance CrimeSidebar with filtered crimes and incident click handling 2025-05-04 03:59:56 +07:00
vergiLgood1 7916680122 feat(map): update MapLegend component usage and enhance click handler management in DistrictLayer 2025-05-04 03:17:54 +07:00
vergiLgood1 7d01547a02 Add DistrictLayer and MapLayerManager components for enhanced map functionality
- Implemented DistrictLayer to display district information and crime data on the map.
- Added interactivity for district selection, including animations and data retrieval.
- Created MapLayerManager to manage multiple layers on the map, including district and crime layers.
- Integrated crime data processing and visualization based on user interactions.
- Ensured proper handling of map style loading and layer management.
2025-05-04 02:45:10 +07:00
vergiLgood1 4623fac52b feat: replace SmoothYearTimeline with CrimeTimelapse component and enhance timeline functionality 2025-05-03 23:51:26 +07:00
vergiLgood1 e488bad7c1 feat(map): add pitch and bearing constants for map initialization
feat(district-popup): enhance badge hover styles for crime levels

feat(map): implement year timeline control with smooth animation

feat(ui): create a reusable slider component using Radix UI

chore(package): update package.json and package-lock.json to include @radix-ui/react-slider
2025-05-03 22:58:14 +07:00
vergiLgood1 fdc0403b81 feat: enhance district layer and popup with improved data handling and logging 2025-05-03 19:54:39 +07:00
vergiLgood1 0d6f9acf66 feat: refactor crime data fetching and filtering logic in crime management components 2025-05-03 19:12:13 +07:00
vergiLgood1 91f9574285 Enhance Crime Sidebar UI and Improve Styling
- Updated CrimeSidebar component with improved layout and styling for better user experience.
- Added new icons and adjusted colors for better visibility and aesthetics.
- Enhanced tab styles to a pill format for a more modern look.
- Improved card designs for incident statistics and crime overview.
- Refactored SystemStatusCard and StatCard components to accept additional styling props.
- Removed unused ReportCard component and related styles.
- Cleaned up global CSS by removing unnecessary chart color variables.
2025-05-03 00:11:13 +07:00
vergiLgood1 428986c927 feat: add crime and district popups with detailed information and filtering capabilities
- Added `CrimePopup` component to display detailed information about individual crime incidents.
- Introduced `DistrictPopup` component to show district-level crime statistics and demographics.
- Implemented `useFilteredCrimeData` hook for filtering crime data based on selected categories.
- Created `calculateCrimeStats` utility function to compute various crime statistics from raw data.
- Updated package.json to include necessary dependencies for map and geocoder functionalities.
2025-05-02 22:20:22 +07:00
vergiLgood1 edf5013363 feat: Add CrimePopup and DistrictPopup components for displaying crime data on the map
- Implemented CrimePopup component to show detailed information about individual crime incidents.
- Implemented DistrictPopup component to provide an overview of crime statistics and demographics for selected districts.
- Added useFilteredCrimeData hook to filter crime data based on selected categories.
- Created calculateCrimeStats utility function to compute various crime statistics from raw data.
2025-05-02 22:19:54 +07:00
vergiLgood1 b564e6f330 feat(map): enhance map functionality with new controls and overlays
- Added GeolocateControl to the map for user location tracking.
- Introduced CategorySelector for filtering crime categories.
- Implemented TopNavigation for year, month, and category selection.
- Created MapSelectors for managing filters with reset functionality.
- Developed CrimeSidebar for displaying incidents, statistics, and reports.
- Added SidebarToggle for collapsing and expanding the sidebar.
- Prefetch crime data based on selected year and month.
- Updated Popover and Skeleton components for better UI experience.
- Refactored OverlayControl for improved rendering and cleanup.
- Enhanced styling and responsiveness across components.
2025-05-02 02:47:16 +07:00
vergiLgood1 897a130ff7 feat: Enhance Overlay component with customizable styles and addControl method
- Updated OverlayProps to include className and style for customization.
- Modified OverlayControl to apply custom styles and handle control addition.
- Improved rendering logic in _Overlay to pass addControl method to children.
- Refactored SelectContent to accept a container prop for better positioning.
- Cleaned up useFullscreen hook by removing unnecessary comments and improving readability.
- Updated global CSS for better styling of map popups and controls.
- Removed unused dependencies related to mapbox-gl-draw from package.json and package-lock.json.
- Added CustomControl and MonthSelector components for enhanced map functionality.
2025-05-01 21:15:31 +07:00
vergiLgood1 31f12ab88b feat: add overlay component and integrate into map controls for improved UI layout 2025-04-30 18:39:21 +07:00
vergiLgood1 2c09cb4d7c feat: implement map layer control and time slider components for enhanced crime data visualization 2025-04-28 23:45:06 +07:00
vergiLgood1 6f89892d8c feat: add map controls and sidebar components for crime data visualization
- Implemented MapControls component for selecting various crime-related metrics.
- Created MapFilterControl for filtering data by year and month.
- Developed MapSidebar to display crime statistics and district information.
- Added SidebarToggle for opening and closing the sidebar.
- Introduced SeverityIndicator to visually represent crime severity levels.
- Created TimeControls for selecting time frames for data analysis.
- Added useFullscreen hook for managing fullscreen functionality.
2025-04-28 00:14:16 +07:00
vergiLgood1 29925dc1b9 add some stuff 2025-04-27 22:41:27 +07:00
vergiLgood1 bcd71c6cad feat: enhance crime incidents seeder with year validation and import all-year summaries
- Added year validation in CrimeIncidentsSeeder to skip records with undefined year.
- Implemented importAllYearSummaries method in CrimesSeeder to import crime summaries from CSV for 2020-2024.
- Cleared existing data for units before seeding geographic data.
- Cleared locations data in role seeder before seeding roles.
- Added district summary CSV file for crime data from 2020 to 2024.
2025-04-25 16:58:32 +07:00
vergiLgood1 63b0721859 feat: add initial data seeding for resources, roles, demographics, crime incidents, and geographic data
- Created resources data structure in `resources.ts`
- Added roles data structure in `roles.ts`
- Implemented seeding for crime categories and incidents with detailed logic in `crime-category.ts` and `crime-incident.ts`
- Developed demographic data seeding logic in `demographic.ts`
- Implemented geographic data seeding from GeoJSON files in `geographic.ts`
- Added permission seeding logic in `permission.ts`
- Created resource and role seeding scripts in `resource.ts` and `role.ts`
2025-04-25 02:04:04 +07:00
vergiLgood1 410535e1d9 feat: add generateId, generateCityCode and getLatId 2025-04-15 22:47:41 +07:00
vergiLgood1 0cbcd3e636 feat: add initial data seeding for resources, roles, demographics, crime incidents, and geographic data 2025-04-15 22:47:07 +07:00
vergiLgood1 2bf335d59b refactor: ♻️ refactor crime management into small components 2025-04-15 00:31:39 +07:00
vergiLgood1 c6f803b08c feat: add crime map components and functionality
- Implemented MapLegend component to display crime rate legend.
- Created YearSelector component for selecting the year of crime data.
- Developed CrimeMap component to manage crime incidents and district data.
- Added DistrictLayer for rendering districts on the map with hover and click interactions.
- Introduced CrimeMarker for displaying crime incidents on the map.
- Built MapView component for rendering the map with various controls.
- Established utility constants for crime colors and rates.
- Defined types for crime management and map features.
2025-04-14 23:47:44 +07:00
vergiLgood1 20238994dc add geojson data 2025-04-14 23:43:09 +07:00
vergiLgood1 eade9a357a fix: correct permission query argument order in useCheckPermissionsHandler 2025-04-12 17:28:29 +07:00
vergiLgood1 e8acbf1645 Refactor user management components to use selectedUser instead of user
- Updated UserLogsTab to fetch logs for selectedUser and adjusted related state and props.
- Refactored UserOverviewTab to utilize selectedUser, including permission checks and user actions.
- Modified user-management component to pass selectedUser to UserInformationSheet.
- Enhanced use-detail-sheet handler to operate with selectedUser for user actions.
- Implemented useCheckPermissionsHandler to manage user permissions based on current user.
- Added new components: ActionRow, DangerAction, InfoRow, ProviderInfo, Section for better UI structure.
- Introduced constants for user roles and updated role model to include IUserRoles type.
- Updated global styles to include new color variables for better theming.
- Improved utility function getFullName to handle null or undefined values.
2025-04-12 17:18:36 +07:00
vergiLgood1 0c663753f6 refactor: consolidate permission checking logic and update related components 2025-04-12 13:56:49 +07:00