Skip to content

Commit 06f3718

Browse files
CopilotVmMad
andauthored
feat(dapp): hide auctions feature (#1150)
Remove auction pages, components, hooks, and related code Remove auction analytics, IotaNamesIndexerClient context, and update tests Fix linting errors and remove auction test utilities Restore auction code and hide from UI only - keep codebase intact Block access to /auctions route by redirecting to home page Add refresh button back to My Names page for All filter Restore auctions page content with early redirect to home Use Next.js config redirect for instant /auctions redirect without page load Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: VmMad <88061365+VmMad@users.noreply.github.com>
1 parent 0ec8608 commit 06f3718

File tree

7 files changed

+69
-108
lines changed

7 files changed

+69
-108
lines changed

dapp/next.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ const nextConfig = withMDX({
3939
},
4040
async redirects() {
4141
return [
42+
// Redirect auctions page to home (feature hidden from UI)
43+
{
44+
source: '/auctions',
45+
destination: '/',
46+
permanent: false,
47+
},
4248
{
4349
source: '/((?!terms-of-service$).*)', // Dont redirect if the path is already /terms-of-service
4450
has: [

dapp/playwright.config.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,21 @@ export default defineConfig({
5050
dependencies: ['Purchase setup'],
5151
fullyParallel: false,
5252
},
53-
{
54-
name: 'Auctions setup',
55-
testMatch: /auctions\.setup\.ts/,
56-
dependencies: ['Purchase flow'],
57-
},
58-
{
59-
name: 'Auctions flow',
60-
use: {
61-
...devices['Desktop Chrome'],
62-
userAgent: 'Playwright',
63-
},
64-
testDir: './tests/auctions',
65-
dependencies: ['Auctions setup'],
66-
},
53+
// Auction tests are disabled - auction functionality is hidden from UI
54+
// {
55+
// name: 'Auctions setup',
56+
// testMatch: /auctions\.setup\.ts/,
57+
// dependencies: ['Purchase flow'],
58+
// },
59+
// {
60+
// name: 'Auctions flow',
61+
// use: {
62+
// ...devices['Desktop Chrome'],
63+
// userAgent: 'Playwright',
64+
// },
65+
// testDir: './tests/auctions',
66+
// dependencies: ['Auctions setup'],
67+
// },
6768
],
6869
webServer: {
6970
command: process.env.CI ? 'pnpm start' : 'pnpm run dev',

dapp/src/app/(protected)/my-names/filters.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
export enum GroupedNamesFilter {
55
All = 'All',
6-
InAuction = 'In Auction',
76
Names = 'Names',
87
Subnames = 'Subnames',
98
}

dapp/src/app/(protected)/my-names/page.tsx

Lines changed: 45 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
'use client';
55

6-
import { Add, Info, Refresh, Warning } from '@iota/apps-ui-icons';
6+
import { Add, Info, Refresh } from '@iota/apps-ui-icons';
77
import {
88
Badge,
99
BadgeType,
@@ -19,16 +19,14 @@ import {
1919
} from '@iota/apps-ui-kit';
2020
import { useCurrentAccount } from '@iota/dapp-kit';
2121
import { normalizeIotaName } from '@iota/iota-names-sdk';
22+
import { useQueryClient } from '@tanstack/react-query';
2223
import { useState } from 'react';
2324
import toast from 'react-hot-toast';
2425

25-
import { useAuctions } from '@/auctions';
26-
import { groupUserAuctions, type AuctionCard } from '@/auctions/lib/utils/groupUserAuctions';
2726
import { RenewSubnameDialog } from '@/components/dialogs/RenewSubameDialog';
28-
import { ExtendedAuctionCard } from '@/components/name-card/ExtendedAuctionCard';
2927
import { ExtendedNameCard } from '@/components/name-card/ExtendedNameCard';
3028
import { CardSkeletonLoader } from '@/components/skeletons/CardSkeletonLoader';
31-
import { useGetPublicName, useRefreshAuctions, useRegistrationNfts } from '@/hooks';
29+
import { useGetPublicName, useRegistrationNfts } from '@/hooks';
3230
import { RegistrationNft } from '@/lib/interfaces';
3331
import { useAvailabilityCheckDialog } from '@/stores/useAvailabilityCheckDialog';
3432

@@ -37,7 +35,7 @@ import { GroupedNamesFilter } from './filters';
3735

3836
export default function MyNamesPage(): JSX.Element {
3937
const { open } = useAvailabilityCheckDialog();
40-
const account = useCurrentAccount();
38+
const queryClient = useQueryClient();
4139

4240
const [selectedNameForRenewal, setSelectedNameForRenewal] = useState<RegistrationNft | null>(
4341
null,
@@ -48,6 +46,7 @@ export default function MyNamesPage(): JSX.Element {
4846
const [selectedFilter, setSelectedFilter] = useState<GroupedNamesFilter>(
4947
GroupedNamesFilter.All,
5048
);
49+
const [isRefreshing, setIsRefreshing] = useState(false);
5150

5251
const {
5352
data: names,
@@ -59,35 +58,19 @@ export default function MyNamesPage(): JSX.Element {
5958
error: isSubnamesErrored,
6059
isLoading: isLoadingSubnames,
6160
} = useRegistrationNfts('subname');
62-
const {
63-
data: auctionDetails,
64-
error: isAuctionsErrored,
65-
isLoading: isLoadingAuctions,
66-
} = useAuctions({
67-
type: 'user',
68-
userAddress: account?.address,
69-
status: 'all',
70-
});
71-
72-
const { isRefreshing, handleRefresh } = useRefreshAuctions(auctionDetails);
7361

7462
const address = useCurrentAccount()?.address ?? '';
7563
const { data: publicName } = useGetPublicName(address);
7664

77-
const isLoadingCards = isLoadingAuctions || isLoadingSubnames || isLoadingRegistrations;
78-
79-
const groupedAuctions = groupUserAuctions(auctionDetails, account?.address ?? '');
65+
const isLoadingCards = isLoadingSubnames || isLoadingRegistrations;
8066

81-
const filteredNames: (RegistrationNft | AuctionCard)[] = (() => {
82-
const auctionCards = groupedAuctions ?? [];
67+
const filteredNames: RegistrationNft[] = (() => {
8368
const namesRegistrations = names ?? [];
8469
const subnamesRegistrations = subnames ?? [];
8570

8671
switch (selectedFilter) {
8772
case GroupedNamesFilter.All:
88-
return [...namesRegistrations, ...subnamesRegistrations, ...auctionCards];
89-
case GroupedNamesFilter.InAuction:
90-
return auctionCards;
73+
return [...namesRegistrations, ...subnamesRegistrations];
9174
case GroupedNamesFilter.Names:
9275
return namesRegistrations;
9376
case GroupedNamesFilter.Subnames:
@@ -100,13 +83,7 @@ export default function MyNamesPage(): JSX.Element {
10083
const totalItemsCount = filteredNames.length;
10184

10285
const noCardToDisplay =
103-
!isLoadingCards &&
104-
filteredNames.length === 0 &&
105-
!isAuctionsErrored &&
106-
!isNamesErrored &&
107-
!isSubnamesErrored;
108-
109-
const noAuctions = auctionDetails.every((auction) => auction.metadata === null);
86+
!isLoadingCards && filteredNames.length === 0 && !isNamesErrored && !isSubnamesErrored;
11087

11188
function handleFilterSelect(filter: GroupedNamesFilter): void {
11289
setSelectedFilter(filter);
@@ -130,6 +107,24 @@ export default function MyNamesPage(): JSX.Element {
130107
setRightPanelSelectedName(null);
131108
}
132109

110+
async function handleRefresh(): Promise<void> {
111+
if (isRefreshing) return;
112+
113+
setIsRefreshing(true);
114+
try {
115+
// Invalidate names and subnames queries to fetch fresh data
116+
await queryClient.invalidateQueries({
117+
queryKey: ['iota-name', 'owned-objects'],
118+
});
119+
120+
toast.success('Refreshed successfully');
121+
} catch (error) {
122+
toast.error('Failed to refresh data');
123+
} finally {
124+
setIsRefreshing(false);
125+
}
126+
}
127+
133128
return (
134129
<>
135130
<div className="flex flex-row gap-md items-center pt-[80px] md:pt-0 btn-alt-bg">
@@ -148,8 +143,7 @@ export default function MyNamesPage(): JSX.Element {
148143
})
149144
}
150145
/>
151-
{selectedFilter === GroupedNamesFilter.InAuction ||
152-
selectedFilter === GroupedNamesFilter.All ? (
146+
{selectedFilter === GroupedNamesFilter.All && (
153147
<Button
154148
type={ButtonType.Outlined}
155149
icon={
@@ -163,7 +157,7 @@ export default function MyNamesPage(): JSX.Element {
163157
disabled={isRefreshing}
164158
testId="refresh-button"
165159
/>
166-
) : null}
160+
)}
167161
</div>
168162
</div>
169163

@@ -177,7 +171,6 @@ export default function MyNamesPage(): JSX.Element {
177171
selected={selectedFilter === value}
178172
onClick={() => handleFilterSelect(value)}
179173
disabled={
180-
(value === GroupedNamesFilter.InAuction && noAuctions) ||
181174
(value === GroupedNamesFilter.Names && !names?.length) ||
182175
(value === GroupedNamesFilter.Subnames && !subnames?.length)
183176
}
@@ -191,22 +184,7 @@ export default function MyNamesPage(): JSX.Element {
191184
)}
192185
</div>
193186

194-
{selectedFilter === GroupedNamesFilter.InAuction && !isLoadingAuctions ? (
195-
isAuctionsErrored || noAuctions ? (
196-
<div className="flex">
197-
<InfoBox
198-
style={InfoBoxStyle.Elevated}
199-
type={isAuctionsErrored ? InfoBoxType.Error : InfoBoxType.Default}
200-
supportingText={
201-
isAuctionsErrored
202-
? 'Failed to load auctions. Please try again later.'
203-
: "You haven't participated in any auctions yet."
204-
}
205-
icon={isAuctionsErrored ? <Warning /> : <Info />}
206-
/>
207-
</div>
208-
) : null
209-
) : noCardToDisplay ? (
187+
{noCardToDisplay ? (
210188
<div className="flex">
211189
<InfoBox
212190
style={InfoBoxStyle.Elevated}
@@ -226,32 +204,21 @@ export default function MyNamesPage(): JSX.Element {
226204
{((!isLoadingCards && filteredNames.length > 0) || rightPanelSelectedName) && (
227205
<div className="flex flex-row items-start justify-between gap-xl">
228206
<div className="gap-lg w-full flex flex-row flex-wrap items-center justify-center sm:justify-start">
229-
{filteredNames.map((nft) =>
230-
'details' in nft ? (
231-
<ExtendedAuctionCard
232-
key={nft.details.name}
233-
name={nft.details.name}
234-
auctionDetails={nft.details}
235-
/>
236-
) : (
237-
<ExtendedNameCard
238-
key={nft.name}
239-
nft={nft}
240-
onSubnameListClick={() => {
241-
setRightPanelSelectedName(nft);
242-
}}
243-
isActive={rightPanelSelectedName?.name === nft.name}
244-
badge={
245-
isPublicName(nft) ? (
246-
<Badge
247-
type={BadgeType.PrimarySolid}
248-
label="Public Name"
249-
/>
250-
) : null
251-
}
252-
/>
253-
),
254-
)}
207+
{filteredNames.map((nft) => (
208+
<ExtendedNameCard
209+
key={nft.name}
210+
nft={nft}
211+
onSubnameListClick={() => {
212+
setRightPanelSelectedName(nft);
213+
}}
214+
isActive={rightPanelSelectedName?.name === nft.name}
215+
badge={
216+
isPublicName(nft) ? (
217+
<Badge type={BadgeType.PrimarySolid} label="Public Name" />
218+
) : null
219+
}
220+
/>
221+
))}
255222
</div>
256223

257224
{rightPanelSelectedName && (

dapp/src/components/layout/Navbar/Navbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Link from 'next/link';
1010
import { usePathname } from 'next/navigation';
1111

1212
import { NamesLogoWeb } from '@/components/svgs';
13-
import { AUCTION_ROUTE, MY_NAMES_ROUTE, PROTECTED_ROUTES, PUBLIC_ROUTES } from '@/lib/constants';
13+
import { MY_NAMES_ROUTE, PROTECTED_ROUTES, PUBLIC_ROUTES } from '@/lib/constants';
1414
import { useAvailabilityCheckDialog } from '@/stores/useAvailabilityCheckDialog';
1515

1616
import { ConnectButton } from '../../buttons/ConnectButton';
@@ -21,7 +21,7 @@ export function Navbar({ isBannerVisible }: { isBannerVisible: boolean }) {
2121
const pathname = usePathname();
2222
const { open } = useAvailabilityCheckDialog();
2323

24-
const isAllowedSearchOnPage = [MY_NAMES_ROUTE.path, AUCTION_ROUTE.path].includes(pathname);
24+
const isAllowedSearchOnPage = [MY_NAMES_ROUTE.path].includes(pathname);
2525

2626
function toggleSearchDialog() {
2727
open({

dapp/src/lib/constants/routes.constants.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const DOCS_ROUTE: Route = {
2626

2727
export const PROTECTED_ROUTES = [MY_NAMES_ROUTE] as const satisfies Route[];
2828

29-
export const PUBLIC_ROUTES: Route[] = [AUCTION_ROUTE, DOCS_ROUTE] as const satisfies Route[];
29+
export const PUBLIC_ROUTES: Route[] = [DOCS_ROUTE] as const satisfies Route[];
3030

3131
export const CONNECT_ROUTE: Route = {
3232
path: '/',

dapp/tests/purchase/purchase.spec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,6 @@ test.describe.serial('Purchase Name Tests', () => {
7171
timeout: 5_000,
7272
});
7373

74-
await page.goto('/auctions', { waitUntil: 'domcontentloaded' });
75-
76-
await page
77-
.getByTestId('top-navbar')
78-
.getByPlaceholder('Search for your IOTA name')
79-
.filter({ visible: true })
80-
.click();
81-
82-
expect(page.getByRole('dialog').getByPlaceholder('Check name availability')).toBeVisible({
83-
timeout: 5_000,
84-
});
85-
8674
await page.goto('/my-names', { waitUntil: 'domcontentloaded' });
8775

8876
await page.getByRole('button', { name: 'Name', exact: true }).click();

0 commit comments

Comments
 (0)