Skip to content

Commit

Permalink
add verified filter
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed Dec 12, 2024
1 parent 559611b commit 6bd5da4
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/grant-explorer/src/features/api/rounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const useRounds = (
const query = useSWR(
// Cache requests on chainIds and variables as keys (when these are the
// same, cache will be used instead of new requests)
["rounds", chainIds, variables],
["rounds", chainIds, variables, onlywWhitelistedPrograms],
async () => {
const whitelistedPrograms = onlywWhitelistedPrograms
? await getWhitelistedPrograms()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import { getExplorerPageTitle } from "./utils/getExplorerPageTitle";
import { RoundsGrid } from "./RoundsGrid";
import { getEnabledChains } from "../../app/chainConfig";
import { useMemo } from "react";
import { getWhitelistedPrograms } from "common";

const ExploreRoundsPage = () => {
const [params] = useSearchParams();
const filter = getRoundSelectionParamsFromUrlParams(params);
// Pass the filter from the search params and build the graphql query
const rounds = useFilterRounds(filter, getEnabledChains(), true);
const rounds = useFilterRounds(
filter,
getEnabledChains(),
filter.status.includes("verified")
);

const publicRounds = useMemo(
() =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ export const FILTER_OPTIONS: RoundFilterUiOption[] = [
},
],
},

{
label: "Status",
value: "status",
children: [
{
label: "Verified",
value: "verified",
},
{
label: "Active",
value: RoundStatus.active,
Expand Down Expand Up @@ -75,7 +78,6 @@ export function FilterDropdown() {

const filter = getRoundSelectionParamsFromUrlParams(params);
const { status = "", type = "", network = "" } = filter;

const selected = getFilterLabel({ status, type, network });
return (
<Dropdown
Expand Down Expand Up @@ -133,7 +135,7 @@ export function FilterDropdown() {
>
<Disclosure.Panel
static
className=" mt-1 w-full overflow-auto p-2"
className="mt-1 w-full overflow-auto p-2"
>
{children
?.filter((child) => !child.hide)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const LandingPage = () => {
<ViewAllLink
to={`/rounds?${toQueryString({
orderBy: ROUNDS_ENDING_SOON_FILTER.orderBy,
status: RoundStatus.active,
status: `${RoundStatus.active},verified`,
})}`}
>
View all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export default function LandingTabs() {
{
to: `/rounds?${toQueryString({
orderBy: "MATCH_AMOUNT_IN_USD_DESC",
status: [RoundStatus.active, RoundStatus.taking_applications].join(","),
status: [
RoundStatus.active,
RoundStatus.taking_applications,
"verified",
].join(","),
})}`,
activeRegExp: /^\/rounds/,
children: isDesktop ? "Explore rounds" : "Rounds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export enum RoundStatus {

export const ACTIVE_ROUNDS_FILTER: RoundSelectionParams = {
orderBy: "MATCH_AMOUNT_IN_USD_DESC",
status: RoundStatus.active,
status: `${RoundStatus.active},verified`,
type: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy,allov1.QF",
network: "",
};
Expand All @@ -69,7 +69,7 @@ export const ROUNDS_ENDING_SOON_FILTER: RoundSelectionParams & {
orderBy: "DONATIONS_END_TIME_ASC",
type: "",
network: "",
status: RoundStatus.ending_soon,
status: `${RoundStatus.ending_soon},verified`,
};

export const useFilterRounds = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function createRoundsStatusFilter(
): TimeFilterVariables[] {
// Default to all filters
const selectedFilters =
status ||
status.replace(",verified", "") ||
[
RoundStatus.active,
RoundStatus.taking_applications,
Expand Down

0 comments on commit 6bd5da4

Please sign in to comment.