Skip to content

Commit acbce28

Browse files
authored
Merge pull request #596 from MarvyNwaokobia/fix/frontend-issues-560-561-562-563
2 parents 7ddcce6 + 759c7d3 commit acbce28

4 files changed

Lines changed: 13 additions & 10 deletions

File tree

frontend/src/app/activity/page.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function ActivityPage() {
3232
const [hasMore, setHasMore] = useState(true);
3333

3434
const fetchActivity = useCallback(
35-
async (pageNum: number, tab: string, append: boolean = false) => {
35+
async (pageNum: number, tab: string, append: boolean = false, signal?: AbortSignal) => {
3636
if (!session?.publicKey) return;
3737
setLoading(true);
3838

@@ -43,7 +43,7 @@ export default function ActivityPage() {
4343
`${API_BASE_URL}/v1/events?address=${encodeURIComponent(session.publicKey)}` +
4444
`&page=${pageNum}&limit=${PAGE_SIZE}${typeQuery}`;
4545

46-
const response = await fetch(url);
46+
const response = await fetch(url, { signal });
4747
if (!response.ok) {
4848
throw new Error(`Failed to fetch activity (${response.status})`);
4949
}
@@ -62,6 +62,7 @@ export default function ActivityPage() {
6262
setHasMore(next.length === PAGE_SIZE);
6363
}
6464
} catch (error) {
65+
if (error instanceof DOMException && error.name === "AbortError") return;
6566
console.error("Failed to fetch activity:", error);
6667
if (!append) setEvents([]);
6768
setHasMore(false);
@@ -73,10 +74,11 @@ export default function ActivityPage() {
7374
);
7475

7576
useEffect(() => {
76-
if (status === "connected") {
77-
setPage(1);
78-
fetchActivity(1, activeTab, false);
79-
}
77+
if (status !== "connected") return;
78+
const controller = new AbortController();
79+
setPage(1);
80+
fetchActivity(1, activeTab, false, controller.signal);
81+
return () => controller.abort();
8082
}, [activeTab, status, fetchActivity]);
8183

8284
const loadMore = () => {

frontend/src/components/Navbar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ export const Navbar = () => {
5252
{status === "connected" && session?.publicKey && (
5353
<NotificationDropdown publicKey={session.publicKey} />
5454
)}
55-
<Button variant="ghost" className="hidden sm:inline-flex">
56-
Log In
57-
</Button>
5855
<WalletButton />
5956
</div>
6057
</nav>

frontend/src/components/NotificationDropdown.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22
import React, { useState, useEffect, useCallback } from 'react';
3+
import { useRouter } from 'next/navigation';
34
import { useStreamEvents } from '@/hooks/useStreamEvents';
45
import { formatAmount } from '@/utils/amount';
56
import { Button } from './ui/Button';
@@ -18,6 +19,7 @@ interface NotificationItem {
1819
}
1920

2021
export const NotificationDropdown: React.FC<NotificationDropdownProps> = ({ publicKey }) => {
22+
const router = useRouter();
2123
const [isOpen, setIsOpen] = useState(false);
2224
const [notifications, setNotifications] = useState<NotificationItem[]>([]);
2325
const [unreadCount, setUnreadCount] = useState(0);
@@ -165,7 +167,8 @@ export const NotificationDropdown: React.FC<NotificationDropdownProps> = ({ publ
165167
size="sm"
166168
className="w-full text-xs"
167169
onClick={() => {
168-
window.location.href = '/activity';
170+
setIsOpen(false);
171+
router.push('/activity');
169172
}}
170173
>
171174
View All Activity

frontend/src/components/dashboard/ActivityHistory.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export const ActivityHistory: React.FC<ActivityHistoryProps> = ({
154154
<a
155155
href={`https://stellar.expert/explorer/testnet/tx/${event.transactionHash}`}
156156
target="_blank"
157+
rel="noopener noreferrer"
157158
className="text-slate-500 hover:text-white transition-colors"
158159
title="View on Explorer"
159160
>

0 commit comments

Comments
 (0)