|
|
@@ -14,13 +14,16 @@ export const getInitialState = (): State => {
|
|
|
dayNum < 10 ? `0${dayNum}` : dayNum
|
|
|
}`;
|
|
|
return {
|
|
|
+ sector: null,
|
|
|
year: now.getFullYear().toString(),
|
|
|
from: day,
|
|
|
to: day,
|
|
|
};
|
|
|
};
|
|
|
|
|
|
+// Sector = Station
|
|
|
export type State = {
|
|
|
+ sector: string | null;
|
|
|
to: string;
|
|
|
from: string;
|
|
|
year: string;
|
|
|
@@ -31,6 +34,11 @@ const fixYear = (year: string, dateString: string) =>
|
|
|
|
|
|
const reducer: Reducer<State, Action> = (state, action) => {
|
|
|
switch (action.type) {
|
|
|
+ case "SET_SECTOR":
|
|
|
+ return {
|
|
|
+ ...state,
|
|
|
+ sector: action.sector!,
|
|
|
+ };
|
|
|
case "SET_TO_CONTROL":
|
|
|
return {
|
|
|
...state,
|