Skip to content

Commit

Permalink
Merge pull request #279 from AmbireTech/development
Browse files Browse the repository at this point in the history
v0.69.48
  • Loading branch information
ivopaunov authored Aug 27, 2024
2 parents 0b8b395 + 21233f2 commit b1ea4ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adex-interface",
"version": "0.69.47",
"version": "0.69.48",
"private": true,
"dependencies": {
"@ambire/login-sdk-core": "^0.0.21",
Expand Down
19 changes: 10 additions & 9 deletions src/components/common/CustomTable/CustomTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const CustomTable = ({
}: CustomTableProps) => {
const isMobile = useMediaQuery('(max-width: 75rem)')
const selectedElements = useSet<string>()
const hasSelectActions = useMemo(() => !!selectedActions?.length, [selectedActions?.length])

const columns: string[] = useMemo(
() =>
Expand Down Expand Up @@ -124,7 +125,7 @@ export const CustomTable = ({
)

const masterActionMenu = useMemo(() => {
return (
return hasSelectActions ? (
<Group>
{selectedActions?.map((a) => {
const label = getLabel(a.label, selectedElements)
Expand All @@ -151,25 +152,25 @@ export const CustomTable = ({
)
})}
</Group>
)
) : null
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedActions, selectedElements, selectedElements.size])
}, [hasSelectActions, selectedActions, selectedElements, selectedElements.size])

const masterSelectAction = useMemo(
() =>
selectedActions && (
hasSelectActions && (
<Checkbox
size="sm"
checked={currentPageElementsAllSelected}
onChange={() => handleCheckboxMaster()}
/>
),
[currentPageElementsAllSelected, handleCheckboxMaster, selectedActions]
[currentPageElementsAllSelected, handleCheckboxMaster, hasSelectActions]
)

const colHeadings: string[] = useMemo(
() => [...(selectedActions ? ['select'] : []), ...headings, ...(actions ? ['actions'] : [])],
[actions, headings, selectedActions]
() => [...(hasSelectActions ? ['select'] : []), ...headings, ...(actions ? ['actions'] : [])],
[actions, headings, hasSelectActions]
)

const rows = useMemo(() => {
Expand Down Expand Up @@ -233,7 +234,7 @@ export const CustomTable = ({
const rowKey = e.id?.toString() || i

const colsToMap = [
...(selectedActions ? ['select'] : []),
...(hasSelectActions ? ['select'] : []),
...columns,
...(activeActions.length ? ['actions'] : [])
]
Expand Down Expand Up @@ -303,7 +304,7 @@ export const CustomTable = ({

{isMobile ? (
<Stack gap="xl">
{selectedActions && (
{hasSelectActions && (
<Group align="center" justify="left" pt="xs">
Select all: {masterSelectAction}
</Group>
Expand Down

0 comments on commit b1ea4ce

Please sign in to comment.