Build and type fixes
This commit is contained in:
parent
d5bd58ac3e
commit
656f3fbe71
64 changed files with 1878 additions and 1501 deletions
|
|
@ -1,7 +1,16 @@
|
|||
import { FC, createContext, useContext, useReducer, useState } from "react";
|
||||
import {
|
||||
FC,
|
||||
createContext,
|
||||
useContext,
|
||||
useReducer,
|
||||
useState,
|
||||
PropsWithChildren,
|
||||
} from "react";
|
||||
import { colors, typography } from "styles/theme";
|
||||
|
||||
const basePath = process.env.GITLAB_CI ? "/link/link-stack/apps/leafcutter" : "";
|
||||
const basePath = process.env.GITLAB_CI
|
||||
? "/link/link-stack/apps/leafcutter"
|
||||
: "";
|
||||
const imageURL = (image: any) =>
|
||||
typeof image === "string" ? `${basePath}${image}` : `${basePath}${image.src}`;
|
||||
|
||||
|
|
@ -9,16 +18,16 @@ const AppContext = createContext({
|
|||
colors,
|
||||
typography,
|
||||
imageURL,
|
||||
query: null,
|
||||
updateQuery: null,
|
||||
updateQueryType: null,
|
||||
replaceQuery: null,
|
||||
clearQuery: null,
|
||||
query: null as any,
|
||||
updateQuery: null as any,
|
||||
updateQueryType: null as any,
|
||||
replaceQuery: null as any,
|
||||
clearQuery: null as any,
|
||||
foundCount: 0,
|
||||
setFoundCount: null,
|
||||
setFoundCount: null as any,
|
||||
});
|
||||
|
||||
export const AppProvider: FC = ({ children }) => {
|
||||
export const AppProvider: FC<PropsWithChildren> = ({ children }) => {
|
||||
const initialState = {
|
||||
incidentType: {
|
||||
display: "Incident Type",
|
||||
|
|
@ -82,7 +91,10 @@ export const AppProvider: FC = ({ children }) => {
|
|||
},
|
||||
};
|
||||
const reducer = (state: any, action: any) => {
|
||||
const key = action.payload ? Object.keys(action.payload)[0] : null;
|
||||
const key = action.payload?.[0];
|
||||
if (!key) {
|
||||
throw new Error("Unknown key");
|
||||
}
|
||||
const newState = { ...state };
|
||||
switch (action.type) {
|
||||
case "UPDATE":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue