Skip to content

Commit

Permalink
Disable Apply button when things are up to date or if selected addres…
Browse files Browse the repository at this point in the history
…ses is empty
  • Loading branch information
AuroraLS3 committed Mar 28, 2024
1 parent 1bb9437 commit e851591
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const AddressListCard = ({n, group, editGroup, allAddresses, remove}) => {
}
}, [selectedIndexes, group, allAddresses])

const isUpToDate = group.addresses === allAddresses.filter((a, i) => selectedIndexes.includes(i));
const applySelected = useCallback(() => {
editGroup({...group, addresses: allAddresses.filter((a, i) => selectedIndexes.includes(i))})
}, [editGroup, group, allAddresses, selectedIndexes]);
Expand All @@ -30,6 +29,8 @@ const AddressListCard = ({n, group, editGroup, allAddresses, remove}) => {
if (!editingName && name !== group.name) editName(name);
}, [editName, editingName, name])

const selectedAddresses = allAddresses.filter((a, i) => selectedIndexes.includes(i));
const isUpToDate = !selectedIndexes.length || selectedAddresses.length === group.addresses.length && selectedAddresses.every((a, i) => a === group.addresses[i]);
return (
<Card>
<CardHeader icon={faList} color={"amber"} label={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const JoinAddressGraphCard = ({identifier}) => {

let colors = ['#4ab4de'];
const dataByGroup = [];
for (const group of list) {
for (const group of list.filter(group => group.addresses.length)) {
const {data, error} = await fetchJoinAddressByDay(updateRequested, group.addresses, identifier);
if (error) {
setLoadingError(error);
Expand Down

0 comments on commit e851591

Please sign in to comment.