Skip to content

Commit

Permalink
CORE: exclude members by id (#1108) (#1109)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekachxaidze98 authored Mar 6, 2024
1 parent 75ee700 commit 5b83a36
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions templates/governance/supporters/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,26 @@ const Card = ({ plan }) => (
</article>
)

const excludedIds = [
3463, 183, 2145, 1248, 660, 222, 14373, 3559, 21117, 292, 14567, 2812, 196,
3581, 197, 12800, 14335, 1249, 2313, 21853, 15201, 1012, 158,
]

const GovernanceSupportersPageTemplate = ({ members, page }) => {
const [searchValue, setSearchValue] = useState('')
const [displayedItems, setDisplayedItems] = useState(50)
const maxItems = members.length
const [displayedItems, setDisplayedItems] = useState(30)

const handleSearch = (event) => {
const { value } = event.target
setSearchValue(value)
}

const filteredMembers = members.filter((member) =>
member.organisation_name.toLowerCase().includes(searchValue.toLowerCase())
const filteredMembers = members.filter(
(member) =>
member.organisation_name
.toLowerCase()
.includes(searchValue.toLowerCase()) &&
!excludedIds.includes(member.repo_id)
)

const sortedMembers = [...filteredMembers].sort((a, b) =>
Expand Down Expand Up @@ -168,14 +176,17 @@ const GovernanceSupportersPageTemplate = ({ members, page }) => {
<Table.Row className={styles.paginationRow}>
<Table.Cell colSpan={2}>
<p className={styles.paginationText}>
Showing 1 - {Math.min(displayedItems, maxItems)}
Showing 1 -{' '}
{Math.min(displayedItems, filteredMembers.length)}
</p>
<Button
onClick={() =>
setDisplayedItems((prevCount) => prevCount + 10)
setDisplayedItems((prevCount) =>
Math.min(prevCount + 10, filteredMembers.length)
)
}
variant="outlined"
disabled={displayedItems >= maxItems}
disabled={displayedItems >= filteredMembers.length}
>
Show More
</Button>
Expand Down

0 comments on commit 5b83a36

Please sign in to comment.