-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update UI to reflect to configs view changes
Fixes #2324
- Loading branch information
1 parent
8001260
commit 1d46b2a
Showing
3 changed files
with
5 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 3 additions & 11 deletions
14
src/components/Configs/ConfigList/Cells/ConfigListChangeCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,16 @@ | ||
import ChangeCountIcon from "@flanksource-ui/ui/Icons/ChangeCount"; | ||
import { CellContext } from "@tanstack/react-table"; | ||
import { useMemo } from "react"; | ||
import { ConfigItem } from "../../../../api/types/configs"; | ||
import ChangeCountIcon from "@flanksource-ui/ui/Icons/ChangeCount"; | ||
|
||
export default function ConfigListChangeCell({ | ||
row, | ||
column | ||
}: CellContext<ConfigItem, any>) { | ||
const changes = row?.getValue<ConfigItem["changes"]>(column.id); | ||
const totalChanges = useMemo(() => { | ||
let total = 0; | ||
(changes || []).forEach((change) => { | ||
total += change.total || 0; | ||
}); | ||
return total; | ||
}, [changes]); | ||
|
||
if (changes == null) { | ||
if (!changes) { | ||
return null; | ||
} | ||
|
||
return <ChangeCountIcon count={totalChanges} />; | ||
return <ChangeCountIcon count={changes} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters