ui(admin): add allocation table, implement allocation creator

This commit is contained in:
Matthew Penner 2021-09-12 19:40:10 -06:00
parent 6b746440fc
commit 3c01dbbcc5
No known key found for this signature in database
GPG key ID: 030E4AB751DC756F
14 changed files with 397 additions and 87 deletions

View file

@ -0,0 +1,27 @@
import { action, Action } from 'easy-peasy';
export interface AdminAllocationStore {
selectedAllocations: number[];
setSelectedAllocations: Action<AdminAllocationStore, number[]>;
appendSelectedAllocation: Action<AdminAllocationStore, number>;
removeSelectedAllocation: Action<AdminAllocationStore, number>;
}
const allocations: AdminAllocationStore = {
selectedAllocations: [],
setSelectedAllocations: action((state, payload) => {
state.selectedAllocations = payload;
}),
appendSelectedAllocation: action((state, payload) => {
state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload).concat(payload);
}),
removeSelectedAllocation: action((state, payload) => {
state.selectedAllocations = state.selectedAllocations.filter(id => id !== payload);
}),
};
export default allocations;