Skip to content

Commit

Permalink
fix: remove duplicates filters
Browse files Browse the repository at this point in the history
  • Loading branch information
MartianGreed committed Dec 9, 2024
1 parent 759615f commit d37e1bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion apps/arkmarket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "pnpm with-env next build",
"clean": "git clean -xdf .next .turbo node_modules",
"dev": "pnpm with-env next dev",
"dev": "pnpm with-env next dev --experimental-https",
"format": "prettier --check . --ignore-path ../../.gitignore",
"lint": "eslint",
"start": "pnpm with-env next start",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default function CollectionActivityFiltersContent({
{Object.entries(activityTypeMetadata).map(
([activityType, activityObject], index) => {
const isSelected = filters.includes(activityType as ActivityType);
const type = activityObject.duplicates ?? [activityType];

return (
<button
Expand All @@ -30,12 +31,8 @@ export default function CollectionActivityFiltersContent({
key={index}
onClick={() =>
isSelected
? setFilters(
[...filters].filter(
(activity) => activity !== activityType,
),
)
: setFilters([...filters, activityType as ActivityType])
? setFilters((f) => f.filter((a) => !type.includes(a)))
: setFilters([...filters, ...type])
}
>
<Checkbox checked={isSelected} className="mr-1" />
Expand All @@ -46,6 +43,6 @@ export default function CollectionActivityFiltersContent({
},
)}
</div>
</div>
</div >
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ export default function Portfolio({
walletAddress={walletAddress}
filtersOpen={itemsFiltersOpen}
className="sticky top-[var(--site-header-height)] hidden h-[calc(100vh-var(--site-header-height)-var(--site-footer-height))] sm:block"
// walletCollectionsInitialData={walletCollectionsInitialData}
// walletCollectionsInitialData={walletCollectionsInitialData}
/>
)}
{selectedTab === "offers" && (
<PortfolioOffersFiltersPanel
className="sticky top-[var(--site-header-height)] hidden h-[calc(100vh-var(--site-header-height)-var(--site-footer-height))] lg:block"
value={offerType}
onValueChange={setOfferType}
// walletCollectionsInitialData={walletCollectionsInitialData}
// walletCollectionsInitialData={walletCollectionsInitialData}
/>
)}
{selectedTab === "activity" && (
Expand Down
7 changes: 3 additions & 4 deletions apps/arkmarket/src/constants/activity-type-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { ActivityType } from "~/types";

type ActivityTypeMetadata = Record<
ActivityType,
{ icon: JSX.Element; title: string }
{ icon: JSX.Element; title: string, duplicates?: ActivityType[] }
>;

export default {
Expand All @@ -25,16 +25,15 @@ export default {
CANCEL_OFFER: {
icon: <ActivityCancelOffer size={16} />,
title: "Cancel Offer",
duplicates: ["CANCEL_OFFER", "CANCELLED"],
},
CANCELLED: { icon: <ActivityCancelOffer size={16} />, title: "Cancel Offer" },
DELISTING: { icon: <ActivityDelist size={16} />, title: "Delist" },
EXECUTED: { icon: <ShoppingCart size={16} />, title: "Sale" },
EXPIRED_OFFER: { icon: <TimerReset size={16} />, title: "Expired Offer" },
EXPIRED_LISTING: { icon: <TimerReset size={16} />, title: "Expired Listing" },
FULFILL: { icon: <ShoppingCart size={16} />, title: "Sale in progress" },
LISTING: { icon: <ActivityList size={16} />, title: "List" },
MINT: { icon: <CircleDot size={16} />, title: "Mint" },
OFFER: { icon: <ActivityOffer size={16} />, title: "Offer" },
SALE: { icon: <ShoppingCart size={16} />, title: "Sale" },
SALE: { icon: <ShoppingCart size={16} />, title: "Sale", duplicates: ["EXECUTED", "SALE"] },
TRANSFER: { icon: <ArrowLeftRight size={16} />, title: "Transfer" },
} as ActivityTypeMetadata;

0 comments on commit d37e1bc

Please sign in to comment.