Skip to content

Commit 71f1812

Browse files
committed
fix: address UI issues and improve functionality
- Changed hero text to 'Sign Once. Transact Freely.' - Fixed Lenis touchpad scrolling with syncTouch option - Made Connect Wallet buttons clickable with useAppKit hook - Added Network switch button in navbar when connected - Updated AppKit theme for better visibility (cyan accent) - Sidebar only shows when wallet is connected - Both CTA buttons on landing page now open wallet modal
1 parent c7dae65 commit 71f1812

File tree

5 files changed

+97
-29
lines changed

5 files changed

+97
-29
lines changed

src/components/LandingPage.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import React from 'react';
22
import { Shield, Zap, Lock, Clock, ArrowRight, CheckCircle2, Layers, Fingerprint } from 'lucide-react';
3-
import { AppKitButton } from "@reown/appkit/react";
3+
import { useAppKit } from "@reown/appkit/react";
44
import { Card } from './ui/Card';
55
import { Button } from './ui/Button';
66

77
export function LandingPage() {
8+
const { open } = useAppKit();
9+
10+
const handleConnectWallet = () => {
11+
open();
12+
};
13+
814
return (
915
<div className="flex flex-col items-center min-h-[90vh]">
1016
{/* Hero Section */}
@@ -25,11 +31,9 @@ export function LandingPage() {
2531

2632
{/* Headline */}
2733
<h1 className="text-5xl md:text-7xl lg:text-8xl font-bold font-display tracking-tight mb-6 animate-slide-up">
28-
<span className="text-text-primary">Secure </span>
29-
<span className="gradient-text">Sessions</span>
34+
<span className="text-text-primary">Sign Once.</span>
3035
<br />
31-
<span className="text-text-primary">Zero </span>
32-
<span className="gradient-text-primary">Friction</span>
36+
<span className="gradient-text">Transact Freely.</span>
3337
</h1>
3438

3539
{/* Subheadline */}
@@ -41,7 +45,9 @@ export function LandingPage() {
4145

4246
{/* CTA */}
4347
<div className="flex flex-col sm:flex-row gap-4 items-center animate-slide-up animation-delay-200">
44-
<AppKitButton />
48+
<Button onClick={handleConnectWallet} size="lg" className="text-lg px-8">
49+
Connect Wallet
50+
</Button>
4551
<a
4652
href="https://github.com/cryptoflops/smart-session-dapp"
4753
target="_blank"
@@ -213,7 +219,9 @@ export function LandingPage() {
213219
<p className="text-text-secondary text-lg mb-8">
214220
Connect your wallet and experience frictionless Web3
215221
</p>
216-
<AppKitButton />
222+
<Button onClick={handleConnectWallet} size="lg" className="text-lg px-8">
223+
Connect Wallet
224+
</Button>
217225
</section>
218226
</div>
219227
);

src/components/layout/Layout.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState } from 'react';
2+
import { useAccount } from 'wagmi';
23
import { Navbar } from './Navbar';
34
import { Sidebar } from './Sidebar';
45

@@ -12,20 +13,24 @@ interface LayoutProps {
1213

1314
export function Layout({ children, onNavigate, currentView = 'dashboard' }: LayoutProps) {
1415
const [sidebarOpen, setSidebarOpen] = useState(false);
16+
const { isConnected } = useAccount();
1517

1618
return (
1719
<div className="min-h-screen bg-background text-text-primary">
1820
<Navbar onMenuClick={() => setSidebarOpen(true)} />
1921

2022
<div className="flex h-[calc(100vh-4rem)]">
21-
<Sidebar
22-
isOpen={sidebarOpen}
23-
onClose={() => setSidebarOpen(false)}
24-
onNavigate={onNavigate}
25-
currentView={currentView}
26-
/>
23+
{/* Only show sidebar when connected */}
24+
{isConnected && (
25+
<Sidebar
26+
isOpen={sidebarOpen}
27+
onClose={() => setSidebarOpen(false)}
28+
onNavigate={onNavigate}
29+
currentView={currentView}
30+
/>
31+
)}
2732

28-
<main className="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8">
33+
<main className="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8" data-lenis-prevent>
2934
<div className="mx-auto max-w-6xl animate-fade-in">
3035
{children}
3136
</div>

src/components/layout/Navbar.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import React from 'react';
22
import { Shield, Menu } from 'lucide-react';
3-
import { AppKitButton } from "@reown/appkit/react";
3+
import { useAppKit } from "@reown/appkit/react";
4+
import { useAccount } from 'wagmi';
45
import { Button } from '../ui/Button';
56

67
interface NavbarProps {
78
onMenuClick?: () => void;
89
}
910

1011
export function Navbar({ onMenuClick }: NavbarProps) {
12+
const { open } = useAppKit();
13+
const { isConnected } = useAccount();
14+
1115
return (
1216
<header className="sticky top-0 z-40 w-full border-b border-white/10 bg-background/80 backdrop-blur-md">
1317
<div className="flex h-16 items-center justify-between px-4 sm:px-6 lg:px-8">
1418
<div className="flex items-center gap-4">
1519
<button
1620
onClick={onMenuClick}
17-
className="lg:hidden text-text-secondary hover:text-text-primary"
21+
className="lg:hidden text-text-secondary hover:text-text-primary transition-colors"
1822
>
1923
<Menu className="h-6 w-6" />
2024
</button>
@@ -23,14 +27,34 @@ export function Navbar({ onMenuClick }: NavbarProps) {
2327
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10 text-primary">
2428
<Shield className="h-5 w-5" />
2529
</div>
26-
<span className="text-lg font-bold tracking-tight text-text-primary">
30+
<span className="text-lg font-bold tracking-tight text-text-primary font-display">
2731
Smart Session
2832
</span>
2933
</div>
3034
</div>
3135

32-
<div className="flex items-center gap-4">
33-
<AppKitButton />
36+
<div className="flex items-center gap-3">
37+
{/* Network Switch Button */}
38+
{isConnected && (
39+
<Button
40+
variant="ghost"
41+
size="sm"
42+
onClick={() => open({ view: 'Networks' })}
43+
className="hidden sm:flex items-center gap-2"
44+
>
45+
<span className="h-2 w-2 rounded-full bg-success animate-pulse" />
46+
<span className="text-sm">Network</span>
47+
</Button>
48+
)}
49+
50+
{/* Wallet Connect Button */}
51+
<Button
52+
onClick={() => open()}
53+
variant={isConnected ? 'secondary' : 'primary'}
54+
size="sm"
55+
>
56+
{isConnected ? 'Account' : 'Connect Wallet'}
57+
</Button>
3458
</div>
3559
</div>
3660
</header>

src/hooks/useLenis.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ interface UseLenisOptions {
1414
touchMultiplier?: number;
1515
/** Enable infinite scroll (default: false) */
1616
infinite?: boolean;
17+
/** Gesture orientation (default: vertical) */
18+
orientation?: 'vertical' | 'horizontal';
19+
/** Gesture direction (default: 1) */
20+
gestureOrientation?: 'vertical' | 'horizontal' | 'both';
21+
/** Smooth touch (default: false for better touchpad support) */
22+
smoothTouch?: boolean;
23+
/** Sync touch lerp (default: 0.1) */
24+
syncTouch?: boolean;
25+
/** Sync touch lerp value */
26+
syncTouchLerp?: number;
1727
}
1828

1929
// Premium easing function - easeOutExpo
@@ -28,7 +38,12 @@ export function useLenis(options: UseLenisOptions = {}) {
2838
const lenis = new Lenis({
2939
duration: options.duration ?? 1.2,
3040
easing: options.easing ?? easeOutExpo,
41+
orientation: options.orientation ?? 'vertical',
42+
gestureOrientation: options.gestureOrientation ?? 'vertical',
3143
smoothWheel: options.smoothWheel ?? true,
44+
smoothTouch: options.smoothTouch ?? false,
45+
syncTouch: options.syncTouch ?? true,
46+
syncTouchLerp: options.syncTouchLerp ?? 0.075,
3247
wheelMultiplier: options.wheelMultiplier ?? 1,
3348
touchMultiplier: options.touchMultiplier ?? 2,
3449
infinite: options.infinite ?? false,
@@ -49,18 +64,33 @@ export function useLenis(options: UseLenisOptions = {}) {
4964
lenis.destroy();
5065
lenisRef.current = null;
5166
};
52-
}, [options.duration, options.easing, options.smoothWheel, options.wheelMultiplier, options.touchMultiplier, options.infinite]);
67+
}, [
68+
options.duration,
69+
options.easing,
70+
options.smoothWheel,
71+
options.wheelMultiplier,
72+
options.touchMultiplier,
73+
options.infinite,
74+
options.orientation,
75+
options.gestureOrientation,
76+
options.smoothTouch,
77+
options.syncTouch,
78+
options.syncTouchLerp
79+
]);
5380

5481
return lenisRef;
5582
}
5683

5784
// Provider component for app-wide Lenis
5885
export function LenisProvider({ children }: { children: React.ReactNode }) {
5986
useLenis({
60-
duration: 1.2,
87+
duration: 1.0,
6188
smoothWheel: true,
89+
smoothTouch: false,
90+
syncTouch: true,
91+
syncTouchLerp: 0.075,
6292
wheelMultiplier: 1,
63-
touchMultiplier: 2,
93+
touchMultiplier: 1.5,
6494
});
6595

6696
return <>{children}</>;

src/lib/appkit.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { WagmiAdapter } from "@reown/appkit-adapter-wagmi";
33
import { base, optimism, celo } from "wagmi/chains";
44

55
const projectId = import.meta.env.VITE_REOWN_PROJECT_ID as string | undefined;
6-
const appName = import.meta.env.VITE_APP_NAME || "Smart Session Playground";
6+
const appName = import.meta.env.VITE_APP_NAME || "Smart Session Dapp";
77
const appUrl = import.meta.env.VITE_APP_URL || "http://localhost:5173";
88
const appIcon = import.meta.env.VITE_APP_ICON_URL || appUrl + "/favicon.ico";
99

@@ -31,20 +31,21 @@ export const appKit = createAppKit({
3131
metadata: {
3232
name: appName,
3333
description:
34-
"Multichain smart-session playground on Base, Optimism, and Celo.",
34+
"Secure, temporary, revocable on-chain session permissions for Web3.",
3535
url: appUrl,
3636
icons: [appIcon],
3737
},
3838
features: {
3939
email: true,
4040
socials: ["google", "x", "github"],
41-
// Smart Sessions are enabled at the wallet UX level,
42-
// but this demo executes via a backend signer.
4341
smartSessions: true,
4442
},
43+
themeMode: 'dark',
4544
themeVariables: {
46-
"--w3m-accent": "#4f46e5",
47-
"--w3m-border-radius-master": "16px",
48-
"--w3m-font-size-master": "14px",
45+
'--w3m-accent': '#00F0FF',
46+
'--w3m-color-mix': '#0B0C15',
47+
'--w3m-color-mix-strength': 40,
48+
'--w3m-border-radius-master': '1px',
49+
'--w3m-font-size-master': '10px',
4950
},
5051
});

0 commit comments

Comments
 (0)