Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts
.env
/proposal
/proposal

# git worktrees
.worktrees/
13 changes: 0 additions & 13 deletions app/components/widgets/MapStory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -564,19 +564,6 @@ export default function MapStory() {
setViewState(newViewState);
};

/**
* Applies constraints to the view state, preventing panning outside defined bounds
* and zooming out too much.
*/
const applyViewStateConstraints = useCallback((viewState: ViewState): ViewState => {
return {
...viewState,
longitude: Math.min(MAP_BOUNDS[1][0], Math.max(MAP_BOUNDS[0][0], viewState.longitude)),
latitude: Math.min(MAP_BOUNDS[1][1], Math.max(MAP_BOUNDS[0][1], viewState.latitude)),
zoom: Math.max(MIN_ZOOM, viewState.zoom),
};
}, []); // No dependencies as MAP_BOUNDS and MIN_ZOOM are constant

// Determine the available metrics based on the currently selected data source.
const availableMetrics = DataSourceMetrics[selectedDataSource] || [];

Expand Down
2 changes: 1 addition & 1 deletion app/components/workers/dataProcessor.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ self.onmessage = (event: MessageEvent<any>) => {
console.log('[Worker] Message received from main thread:', event.data); // Optional logging
const { geojsonFeatures, filteredData, selectedMetric, dataSource, isPerCapita, populationData } = event.data;

if (!geojsonFeatures || !filteredData || !selectedMetric || !dataSource === undefined) { // Check dataSource presence
if (!geojsonFeatures || !filteredData || !selectedMetric || dataSource === undefined) { // Check dataSource presence
console.error('[Worker] Invalid data received.');
self.postMessage({ error: 'Invalid data received by worker' }); // Send error back
return;
Expand Down
7 changes: 0 additions & 7 deletions lib/features/filters/filterSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export interface FilterState {
yearRange: [number, number];
selectedMetric: string; // Use string for flexibility
rankedCounties: { name: string; value: number; rank: number }[];
selectedCounty: string;
selectedDataSource: DataSourceType; // Add selected data source
isPerCapita: boolean; // Add per capita toggle state
selectedCounties: string[]; // Add selected counties for filtering
Expand Down Expand Up @@ -126,7 +125,6 @@ const initialState: FilterState = {
yearRange: [2017, 2023], // Default range, will be updated
selectedMetric: DataSourceMetrics['arrest'][0], // Default metric for 'arrest' source
rankedCounties: [],
selectedCounty: '',
selectedDataSource: 'arrest', // Default to the arrest source
isPerCapita: true, // Default to true
selectedCounties: [], // Initialize selected counties as empty array
Expand Down Expand Up @@ -394,9 +392,6 @@ export const filterSlice = createSlice({
setRankedCounties: (state, action: PayloadAction<{ name: string; value: number; rank: number }[]>) => {
state.rankedCounties = action.payload;
},
setSelectedCounty: (state, action: PayloadAction<string>) => {
state.selectedCounty = action.payload;
},
setCsvData: (state, action: PayloadAction<CsvRow[]>) => {
// Store data in the current selected source slot
state.csvDataSources[state.selectedDataSource] = action.payload;
Expand Down Expand Up @@ -498,7 +493,6 @@ export const filterSlice = createSlice({

// Reset UI state for new source
state.rankedCounties = [];
state.selectedCounty = '';

// Update year range if we have data for this source
if (newSourceData.length > 0) {
Expand Down Expand Up @@ -586,7 +580,6 @@ export const filterSlice = createSlice({

export const {
setRankedCounties,
setSelectedCounty,
setCsvData,
toggleFilter,
setYear,
Expand Down