-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: results grid and station selection
Ref: #187
- Loading branch information
Showing
9 changed files
with
249 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"noopener", | ||
"noreferrer", | ||
"oidc", | ||
"Oids", | ||
"overscan", | ||
"packagejson", | ||
"sgid", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { createContext, useContext, useState } from 'react'; | ||
|
||
type SelectionContextType = { | ||
selectedStationIds: Set<string>; | ||
setSelectedStationIds: React.Dispatch<React.SetStateAction<Set<string>>>; | ||
}; | ||
|
||
const SelectionContext = createContext<SelectionContextType>({ | ||
selectedStationIds: new Set(), | ||
setSelectedStationIds: () => {}, | ||
}); | ||
|
||
export function SelectionProvider({ children }: { children: React.ReactNode }) { | ||
const [selectedStationIds, setSelectedStationIds] = useState<Set<string>>(new Set()); | ||
|
||
return ( | ||
<SelectionContext.Provider value={{ selectedStationIds, setSelectedStationIds }}> | ||
{children} | ||
</SelectionContext.Provider> | ||
); | ||
} | ||
|
||
export function useSelection() { | ||
console.log('useSelection'); | ||
const context = useContext(SelectionContext); | ||
|
||
if (!context) { | ||
throw new Error('useSelection must be used within a SelectionProvider'); | ||
} | ||
|
||
return context; | ||
} |
Oops, something went wrong.