ui(admin): add "working" React admin ui

This commit is contained in:
Matthew Penner 2022-12-15 19:06:14 -07:00
parent d1c7494933
commit 5402584508
No known key found for this signature in database
199 changed files with 13387 additions and 151 deletions

View file

@ -0,0 +1,29 @@
import type { Action } from 'easy-peasy';
import { action } from 'easy-peasy';
interface AdminLocationStore {
selectedLocations: number[];
setSelectedLocations: Action<AdminLocationStore, number[]>;
appendSelectedLocation: Action<AdminLocationStore, number>;
removeSelectedLocation: Action<AdminLocationStore, number>;
}
const locations: AdminLocationStore = {
selectedLocations: [],
setSelectedLocations: action((state, payload) => {
state.selectedLocations = payload;
}),
appendSelectedLocation: action((state, payload) => {
state.selectedLocations = state.selectedLocations.filter(id => id !== payload).concat(payload);
}),
removeSelectedLocation: action((state, payload) => {
state.selectedLocations = state.selectedLocations.filter(id => id !== payload);
}),
};
export type { AdminLocationStore };
export default locations;