2021-04-23 13:50:55 +00:00
|
|
|
import { AppState } from "reducers";
|
2021-08-25 04:34:42 +00:00
|
|
|
import { createSelector } from "reselect";
|
2021-04-23 13:50:55 +00:00
|
|
|
export const getDebuggerErrors = (state: AppState) => state.ui.debugger.errors;
|
2021-08-25 04:34:42 +00:00
|
|
|
export const hideErrors = (state: AppState) => state.ui.debugger.hideErrors;
|
|
|
|
|
export const getFilteredErrors = createSelector(
|
|
|
|
|
getDebuggerErrors,
|
|
|
|
|
hideErrors,
|
|
|
|
|
(errors, hideErrors) => {
|
|
|
|
|
if (hideErrors) return {};
|
|
|
|
|
|
|
|
|
|
return errors;
|
|
|
|
|
},
|
|
|
|
|
);
|
2021-09-20 11:20:22 +00:00
|
|
|
export const getCurrentDebuggerTab = (state: AppState) =>
|
|
|
|
|
state.ui.debugger.currentTab;
|
2021-09-15 14:01:32 +00:00
|
|
|
|
|
|
|
|
export const getMessageCount = createSelector(getFilteredErrors, (errors) => {
|
|
|
|
|
const errorKeys = Object.keys(errors);
|
|
|
|
|
const warningsCount = errorKeys.filter((key: string) =>
|
|
|
|
|
key.includes("warning"),
|
|
|
|
|
).length;
|
|
|
|
|
const errorsCount = errorKeys.length - warningsCount;
|
|
|
|
|
return { errors: errorsCount, warnings: warningsCount };
|
|
|
|
|
});
|