Skip to content

Commit 50eeba9

Browse files
committed
refactor: move My Activity button from SearcherBar to Navbar
1 parent 5599d81 commit 50eeba9

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

src/components/navbar/NavBar.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { AddressChip } from './AddressChip.tsx';
1010
import { ChainSelector } from './ChainSelector.tsx';
1111

1212
export function Navbar() {
13-
const { isConnected, address } = useUserStore();
13+
const { isConnected, address: userAddress } = useUserStore();
1414
const { logout, login } = useLoginLogout();
1515
const [isMenuOpen, setMenuOpen] = useState(false);
1616
const handleMenuToggle = () => {
@@ -26,6 +26,11 @@ export function Navbar() {
2626
<div className="mr-8 flex items-center gap-4 md:mr-0">
2727
{isConnected && (
2828
<div className="hidden md:flex">
29+
<Button variant="link" asChild className="text-foreground">
30+
<ChainLink to={`/address/${userAddress}?from=my_activity`}>
31+
My activity
32+
</ChainLink>
33+
</Button>
2934
<Button variant="link" asChild className="text-foreground">
3035
<ChainLink to="/account">iExec Account</ChainLink>
3136
</Button>
@@ -38,7 +43,7 @@ export function Navbar() {
3843
</div>
3944
{isConnected ? (
4045
<div className="flex max-w-[1260px] items-center gap-2">
41-
<AddressChip address={address!} />
46+
<AddressChip address={userAddress!} />
4247

4348
<button
4449
type="button"
@@ -81,7 +86,7 @@ export function Navbar() {
8186
</ChainLink>
8287
{isConnected ? (
8388
<div className="flex max-w-[1260px] items-center gap-2">
84-
<AddressChip address={address!} />
89+
<AddressChip address={userAddress!} />
8590

8691
<button
8792
type="button"

src/modules/search/SearcherBar.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { useMutation } from '@tanstack/react-query';
44
import { useNavigate, useParams } from '@tanstack/react-router';
55
import { Search } from 'lucide-react';
66
import { useEffect, useRef, useState } from 'react';
7-
import { ChainLink } from '@/components/ChainLink';
87
import { Button } from '@/components/ui/button';
98
import { Input } from '@/components/ui/input';
109
import { getIExec, getReadonlyIExec } from '@/externals/iexecSdkClient';
@@ -20,7 +19,7 @@ export function SearcherBar({
2019
className?: string;
2120
initialSearch?: string;
2221
}) {
23-
const { isConnected, address: userAddress } = useUserStore();
22+
const { isConnected } = useUserStore();
2423
const [inputValue, setInputValue] = useState('');
2524
const [shake, setShake] = useState(false);
2625
const [errorCount, setErrorCount] = useState(0);
@@ -173,17 +172,6 @@ export function SearcherBar({
173172
size="18"
174173
className="pointer-events-none absolute top-1/2 left-4 -translate-y-1/2 sm:left-6"
175174
/>
176-
{isConnected && (
177-
<Button
178-
variant="outline"
179-
className="bg-muted hover:bg-secondary absolute top-1/2 right-4 hidden -translate-y-1/2 sm:flex"
180-
asChild
181-
>
182-
<ChainLink to={`/address/${userAddress}?from=my_activity`}>
183-
My activity
184-
</ChainLink>
185-
</Button>
186-
)}
187175
</div>
188176

189177
<div className={cn('mt-4 flex justify-center gap-4', isError && 'mt-10')}>
@@ -192,14 +180,6 @@ export function SearcherBar({
192180
{isPending ? 'Searching...' : 'Search'}
193181
</Button>
194182
</div>
195-
196-
{isConnected && (
197-
<Button variant="outline" className="sm:hidden" asChild>
198-
<ChainLink to={`/address/${userAddress}?from=my_activity`}>
199-
My activity
200-
</ChainLink>
201-
</Button>
202-
)}
203183
</div>
204184
</div>
205185
);

0 commit comments

Comments
 (0)