Refactored funnel report. Made BarChart more generic.

This commit is contained in:
Mike Cao 2023-05-24 21:40:02 -07:00
parent 050cd2f5d9
commit fb4dd75e18
24 changed files with 327 additions and 367 deletions

View file

@ -15,8 +15,6 @@ const store = create(() => ({ ...initialState }));
export function updateReport(id, data) {
const report = store.getState()[id];
console.log('UPDATE STORE START', id, report);
if (report) {
store.setState(
produce(state => {
@ -37,9 +35,9 @@ export function updateReport(id, data) {
}
}
export function createReport() {
export function createReport(parameters) {
const id = `new_${getRandomChars(16)}`;
const report = { ...emptyReport, id };
const report = { ...emptyReport, id, parameters };
store.setState(
produce(state => {
@ -49,8 +47,6 @@ export function createReport() {
}),
);
console.log('CREATE STORE', report);
return report;
}