Skip to content

Commit 4d729bb

Browse files
committed
refactor: update wallet connection rendering in account layout
1 parent f5520d0 commit 4d729bb

File tree

2 files changed

+36
-34
lines changed

2 files changed

+36
-34
lines changed

src/modules/account/Faucet.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FAUCET_API_URL } from '@/config';
2+
import { cn } from '@/lib/utils';
23
import {
34
SignedIn,
45
SignedOut,
@@ -100,7 +101,12 @@ export function Faucet() {
100101
});
101102

102103
return (
103-
<div className="grid max-w-xl gap-6 rounded-2xl border p-4 md:p-10">
104+
<div
105+
className={cn(
106+
'grid max-w-xl gap-6 rounded-2xl border p-4 md:p-10',
107+
!userAddress ? 'mx-auto' : ''
108+
)}
109+
>
104110
<h1 className="w-full text-center text-2xl font-extrabold">Faucet</h1>
105111
{isError && <ErrorAlert className="w-full" message={error?.message} />}
106112
{badChainId ? (

src/routes/$chainSlug/_layout/account.tsx

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,18 @@ function RouteComponent() {
141141
label: <>Wallet Activity</>,
142142
component: WalletActivityPanel,
143143
},
144-
...(userAddress
145-
? [
146-
{
147-
titleText: 'Log out',
148-
label: (
149-
<>
150-
<span className="hidden sm:inline">Log out</span>
151-
<span className="inline-block">
152-
<LogOut size={20} />
153-
</span>
154-
</>
155-
),
156-
action: logout,
157-
},
158-
]
159-
: []),
144+
{
145+
titleText: 'Log out',
146+
label: (
147+
<>
148+
<span className="hidden sm:inline">Log out</span>
149+
<span className="inline-block">
150+
<LogOut size={20} />
151+
</span>
152+
</>
153+
),
154+
action: logout,
155+
},
160156
];
161157

162158
const tabLabels = tabs.map((tab) => tab.titleText);
@@ -173,8 +169,8 @@ function RouteComponent() {
173169

174170
return (
175171
<div className="mt-8 grid gap-4 md:flex md:gap-10 lg:gap-20">
176-
<div className="top-4 h-fit space-y-4 self-start overflow-x-auto rounded-2xl border px-3 py-4 md:sticky md:top-8 md:max-w-56 md:px-6 md:py-8">
177-
{userAddress && (
172+
{userAddress && (
173+
<div className="top-4 h-fit space-y-4 self-start overflow-x-auto rounded-2xl border px-3 py-4 md:sticky md:top-8 md:max-w-56 md:px-6 md:py-8">
178174
<div className="sticky left-0 inline-flex items-center gap-1">
179175
<div
180176
className={cn(
@@ -186,22 +182,22 @@ function RouteComponent() {
186182
{truncateAddress(userAddress)}
187183
</span>
188184
</div>
189-
)}
190-
<div className="flex justify-between gap-2 md:flex-col md:gap-4">
191-
{tabs.map((tab, index) => (
192-
<button
193-
key={tab.titleText}
194-
onClick={() => handleTabClick(index)}
195-
className={cn(
196-
'text-muted-foreground flex items-center gap-2 rounded-md bg-transparent px-2 py-2 text-left whitespace-nowrap duration-200 md:px-4',
197-
index === currentTab && 'bg-muted text-foreground'
198-
)}
199-
>
200-
{tab.label}
201-
</button>
202-
))}
185+
<div className="flex justify-between gap-2 md:flex-col md:gap-4">
186+
{tabs.map((tab, index) => (
187+
<button
188+
key={tab.titleText}
189+
onClick={() => handleTabClick(index)}
190+
className={cn(
191+
'text-muted-foreground flex items-center gap-2 rounded-md bg-transparent px-2 py-2 text-left whitespace-nowrap duration-200 md:px-4',
192+
index === currentTab && 'bg-muted text-foreground'
193+
)}
194+
>
195+
{tab.label}
196+
</button>
197+
))}
198+
</div>
203199
</div>
204-
</div>
200+
)}
205201
<div className="min-w-0 flex-1 overflow-x-auto">
206202
{tabs[currentTab].component
207203
? React.createElement(tabs[currentTab].component)

0 commit comments

Comments
 (0)