Skip to content

Commit 163cc99

Browse files
authored
feat: update environment configuration and redirect paths for user authentication (#126)
- Added API and NextAuth configuration to env.example for better setup clarity. - Changed redirect path for authenticated users from '/dashboard' to '/user' in middleware and sign-in logic. - Updated AuthNav component to link to the new '/user' route. - Simplified the Home page by adding a button to navigate to the user dashboard. - Adjusted API base URL reference in the api.ts file for consistency.
1 parent b86dfe8 commit 163cc99

9 files changed

Lines changed: 98 additions & 107 deletions

File tree

.env.example

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
NEXT_PUBLIC_STELLAR_NETWORK=testnet
2+
3+
NEXT_PUBLIC_APP_URL=http://localhost:3000
4+
5+
NEXT_PUBLIC_API_URL=https://staging-api.boundlessfi.xyz/api
6+
7+
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id
8+
# Get this from https://cloud.walletconnect.com/
9+
10+
NEXT_PUBLIC_HORIZON_TESTNET_URL=https://horizon-testnet.stellar.org
11+
NEXT_PUBLIC_HORIZON_PUBLIC_URL=https://horizon.stellar.org
12+
13+
NEXT_PUBLIC_APP_NAME=Boundless
14+
NEXT_PUBLIC_APP_DESCRIPTION=Stellar-based application
15+
NEXT_PUBLIC_APP_ICON=/logo.svg
16+
17+
NEXT_PUBLIC_DEBUG_MODE=false
18+
19+
NEXT_PUBLIC_ENABLE_WALLET_CONNECT=true
20+
NEXT_PUBLIC_ENABLE_MULTI_WALLET=true
21+
NEXT_PUBLIC_ENABLE_NETWORK_SWITCHING=true
22+
23+
NEXTAUTH_SECRET=your_nextauth_secret_here
24+
25+
NEXTAUTH_URL=http://localhost:3000
26+
27+
GOOGLE_CLIENT_ID=your_google_client_id
28+
29+
GOOGLE_CLIENT_SECRET=your_google_client_secret
30+
31+
NODE_ENV=development
32+
33+
34+
35+

app/auth/signin/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default function SignInPage() {
7373
const handleGoogleSignIn = async () => {
7474
setIsLoading(true);
7575
try {
76-
await signIn('google', { callbackUrl: '/dashboard' });
76+
await signIn('google', { callbackUrl: '/user' });
7777
} catch {
7878
setError('Failed to sign in with Google');
7979
setIsLoading(false);

app/auth/signup/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ export default function SignUpPage() {
261261
</Button>
262262
</form>
263263

264-
<div className='relative'>
264+
<div className='relative hidden'>
265265
<div className='absolute inset-0 flex items-center'>
266266
<Separator className='w-full' />
267267
</div>
@@ -278,7 +278,7 @@ export default function SignUpPage() {
278278
window.location.href = '/api/auth/signin/google';
279279
}}
280280
disabled={isLoading}
281-
className='w-full'
281+
className='w-full hidden'
282282
>
283283
<svg className='mr-2 h-4 w-4' viewBox='0 0 24 24'>
284284
<path

app/page.tsx

Lines changed: 6 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
'use client';
2-
import { PriceDisplay } from '@/components/PriceDisplay';
3-
import EmptyState from '@/components/EmptyState';
42
import { BoundlessButton } from '@/components/buttons';
5-
import { Coins, History, Plus } from 'lucide-react';
6-
import Card from '@/components/card';
7-
import RecentProjects from '@/components/overview/RecentProjects';
8-
import RecentContributions from '@/components/overview/ReecntContributions';
9-
import GrantHistory from '@/components/overview/GrantHistory';
103
import { AuthNav } from '@/components/auth/AuthNav';
114
import { motion } from 'framer-motion';
125
import {
13-
fadeInUp,
146
staggerContainer,
157
slideInFromLeft,
168
slideInFromRight,
179
} from '@/lib/motion';
1810
import PageTransition from '@/components/PageTransition';
11+
import Link from 'next/link';
1912

2013
export default function Home() {
2114
return (
@@ -34,95 +27,12 @@ export default function Home() {
3427
<AuthNav />
3528
</motion.header>
3629
<motion.main
37-
className='flex flex-col gap-[32px] items-center sm:items-start'
38-
variants={staggerContainer}
30+
className='w-full max-w-6xl flex flex-col items-center justify-center'
31+
variants={slideInFromRight}
3932
>
40-
<motion.div
41-
className='bg-[#1C1C1C] rounded-lg p-4 w-full max-w-[550px]'
42-
variants={fadeInUp}
43-
>
44-
<PriceDisplay price={100} className='text-2xl font-bold' />
45-
<EmptyState
46-
title='No comments yet'
47-
description='Start by sharing your first project idea with the Boundless community. Once submitted, your projects will appear here for easy tracking.'
48-
type='default'
49-
action={
50-
<BoundlessButton
51-
variant='default'
52-
size='lg'
53-
icon={<Plus className='w-5 h-5' />}
54-
iconPosition='right'
55-
>
56-
Add comment
57-
</BoundlessButton>
58-
}
59-
/>
60-
</motion.div>
61-
<motion.div className='flex gap-4' variants={staggerContainer}>
62-
<motion.div variants={fadeInUp}>
63-
<Card
64-
title='Active Campaigns'
65-
value='10'
66-
bottomText={
67-
<div className='flex items-center gap-2'>
68-
<Coins className='w-4 h-4 text-white/60' />
69-
<PriceDisplay
70-
price={0}
71-
className='!text-xs !tracking-[-0.06px]'
72-
/>
73-
</div>
74-
}
75-
/>
76-
</motion.div>
77-
<motion.div variants={fadeInUp}>
78-
<Card
79-
title='Pending Submissions'
80-
value='0'
81-
bottomText={
82-
<div className='flex items-center gap-2'>
83-
<History className='w-4 h-4 text-white/60' />
84-
<span className='text-white/60'>No recent submissions</span>
85-
</div>
86-
}
87-
/>
88-
</motion.div>
89-
<motion.div variants={fadeInUp}>
90-
<Card
91-
title='Active Projects'
92-
value='0'
93-
bottomText={
94-
<div className='flex items-center gap-2'>
95-
<span className='text-white/90'>0</span>
96-
Approved Submissions
97-
</div>
98-
}
99-
/>
100-
</motion.div>
101-
<motion.div variants={fadeInUp}>
102-
<Card
103-
title='Available Grants'
104-
value={
105-
<PriceDisplay price={0} className='!tracking-[-0.06px]' />
106-
}
107-
bottomText={
108-
<div className='flex items-center gap-2 text-white/90'>
109-
6 grants available
110-
</div>
111-
}
112-
/>
113-
</motion.div>
114-
</motion.div>
115-
<motion.div variants={fadeInUp}>
116-
<RecentProjects projects={[]} />
117-
</motion.div>
118-
<motion.div className='flex gap-4' variants={staggerContainer}>
119-
<motion.div variants={slideInFromLeft}>
120-
<RecentContributions projects={[]} />
121-
</motion.div>
122-
<motion.div variants={slideInFromRight}>
123-
<GrantHistory projects={[]} />
124-
</motion.div>
125-
</motion.div>
33+
<Link href='/user'>
34+
<BoundlessButton>Go to Dashboard</BoundlessButton>
35+
</Link>
12636
</motion.main>
12737
</motion.div>
12838
</PageTransition>

components/auth/AuthNav.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function AuthNav() {
2929
if (!session) {
3030
return (
3131
<div className='flex items-center space-x-2'>
32-
<Button variant='ghost' onClick={() => signIn()}>
32+
<Button variant='outline' onClick={() => signIn()}>
3333
Sign In
3434
</Button>
3535
<Button asChild>
@@ -73,7 +73,7 @@ export function AuthNav() {
7373
</DropdownMenuLabel>
7474
<DropdownMenuSeparator />
7575
<DropdownMenuItem asChild>
76-
<Link href='/dashboard' className='flex items-center'>
76+
<Link href='/user' className='flex items-center'>
7777
<User className='mr-2 h-4 w-4' />
7878
Dashboard
7979
</Link>

components/connect-wallet/index.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { ScrollArea } from '../ui/scroll-area';
1313
import { Button } from '../ui/button';
1414
import { useWalletStore } from '@/hooks/use-wallet';
1515
import { toast } from 'sonner';
16+
import { TooltipContent, TooltipProvider } from '@radix-ui/react-tooltip';
17+
import { Tooltip, TooltipTrigger } from '../ui/tooltip';
1618

1719
const ConnectWallet = ({
1820
open,
@@ -214,6 +216,29 @@ const ConnectWallet = ({
214216
Connect Wallet
215217
</DialogTitle>
216218
<CircleQuestionMark className='w-4 h-4 text-[#484848]' />
219+
<TooltipProvider>
220+
<Tooltip>
221+
<TooltipTrigger>
222+
<CircleQuestionMark className='w-4 h-4 text-[#484848]' />
223+
</TooltipTrigger>
224+
<TooltipContent>
225+
<h4 className='text-white text-lg font-medium'>
226+
What is a Wallet?
227+
</h4>
228+
<p className='text-[#B5B5B5] text-sm'>
229+
Wallets are used to send, receive, and store the keys you
230+
use to sign blockchain transactions.
231+
</p>
232+
<h4 className='text-white text-lg font-medium'>
233+
What is a Stellar Blockchain?
234+
</h4>
235+
<p className='text-[#B5B5B5] text-sm'>
236+
Stellar is a decentralized network that allows you to send
237+
and receive digital assets.
238+
</p>
239+
</TooltipContent>
240+
</Tooltip>
241+
</TooltipProvider>
217242
</div>
218243
<Button
219244
variant='ghost'

env.example

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ NEXT_PUBLIC_STELLAR_NETWORK=testnet
66
NEXT_PUBLIC_APP_URL=http://localhost:3000
77
# Your application's public URL
88

9+
# API Configuration
10+
NEXT_PUBLIC_API_URL=http://localhost:8000/api
11+
# Your backend API URL
12+
913
# WalletConnect Configuration
1014
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id
1115
# Get this from https://cloud.walletconnect.com/
@@ -26,4 +30,23 @@ NEXT_PUBLIC_DEBUG_MODE=false
2630
# Feature Flags
2731
NEXT_PUBLIC_ENABLE_WALLET_CONNECT=true
2832
NEXT_PUBLIC_ENABLE_MULTI_WALLET=true
29-
NEXT_PUBLIC_ENABLE_NETWORK_SWITCHING=true
33+
NEXT_PUBLIC_ENABLE_NETWORK_SWITCHING=true
34+
35+
# NextAuth Configuration
36+
NEXTAUTH_SECRET=your_nextauth_secret_here
37+
# Generate a random string for this secret
38+
# You can use: openssl rand -base64 32
39+
40+
NEXTAUTH_URL=http://localhost:3000
41+
# Your application's public URL (same as NEXT_PUBLIC_APP_URL)
42+
43+
# Google OAuth Configuration
44+
GOOGLE_CLIENT_ID=your_google_client_id
45+
# Get this from Google Cloud Console
46+
47+
GOOGLE_CLIENT_SECRET=your_google_client_secret
48+
# Get this from Google Cloud Console
49+
50+
# Environment
51+
NODE_ENV=development
52+
# Options: development, production, test

lib/api/api.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
22
import Cookies from 'js-cookie';
33
import { useAuthStore } from '@/lib/stores/auth-store';
44

5-
const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
5+
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL;
66
if (!API_BASE_URL) {
7-
throw new Error(
8-
'NEXT_PUBLIC_API_BASE_URL environment variable is not defined'
9-
);
7+
throw new Error('NEXT_PUBLIC_API_URL environment variable is not defined');
108
}
119

1210
export interface ApiResponse<T = unknown> {

middleware.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function middleware(request: NextRequest) {
3030

3131
// Redirect authenticated users away from auth routes
3232
if (isAuthRoute && isAuthenticated) {
33-
return NextResponse.redirect(new URL('/dashboard', request.url));
33+
return NextResponse.redirect(new URL('/user', request.url));
3434
}
3535

3636
// Redirect unauthenticated users to signin for protected routes

0 commit comments

Comments
 (0)