Skip to content

Commit 916deb1

Browse files
committed
Added model and prediction code
2 parents 00340d8 + 0860f76 commit 916deb1

30 files changed

+7315
-6
lines changed

.gitignore

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
13
# Python
24
__pycache__/
35
*.py[cod]
@@ -9,14 +11,45 @@ env/
911
ENV/
1012
.venv
1113

14+
# Node.js / Next.js
15+
/node_modules
16+
/.pnp
17+
.pnp.js
18+
19+
# testing
20+
/coverage
21+
22+
# next.js
23+
/.next/
24+
/out/
25+
26+
# production
27+
/build
28+
29+
# misc
30+
.DS_Store
31+
Thumbs.db
32+
*.pem
33+
34+
# debug
35+
npm-debug.log*
36+
yarn-debug.log*
37+
yarn-error.log*
38+
39+
# local env files
40+
.env*.local
41+
.env
42+
43+
# vercel
44+
.vercel
45+
46+
# typescript
47+
*.tsbuildinfo
48+
next-env.d.ts
49+
1250
# IDE
1351
.vscode/
1452
.idea/
1553
*.swp
1654
*.swo
1755
*~
18-
19-
# OS
20-
.DS_Store
21-
Thumbs.db
22-

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
1-
"# flow-builder"
1+
"Flow Builder
2+
3+
A simple app built with Next.js 14, TypeScript, Tailwind CSS, and Supabase.
4+
5+
## Features
6+
7+
- ✅ User Sign Up
8+
- ✅ User Sign In
9+
- ✅ User Sign Out
10+
- ✅ Supabase for authentication backend
11+
12+
## Tech Stack
13+
14+
- **Frontend Framework**: Next.js 14 (App Router)
15+
- **Language**: TypeScript
16+
- **Styling**: Tailwind CSS
17+
- **Authentication**: Supabase Auth
18+
- **Package Manager**: npm
19+
20+
## Getting Started
21+
22+
### Prerequisites
23+
24+
- Node.js 18+ installed
25+
- A Supabase account (free tier works fine)
26+
27+
### 1. Clone and Install
28+
29+
```bash
30+
# Install dependencies
31+
npm install
32+
```
33+
34+
### 4. Run the Development Server
35+
36+
```bash
37+
npm run dev
38+
```
39+
40+
Open [http://localhost:3000](http://localhost:3000) in your browser.
41+
42+
For my cute devs:
43+
By default, Supabase requires email confirmation. To disable this for development:
44+
45+
1. Go to your Supabase project
46+
2. Navigate to Authentication → Settings
47+
3. Disable "Enable email confirmations"
48+
49+
## License
50+
51+
MIT"

app/auth/signin/page.tsx

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
'use client';
2+
3+
import { useState } from 'react';
4+
import { useRouter } from 'next/navigation';
5+
import { useAuth } from '@/contexts';
6+
import { Button, Input, Card, CardHeader, CardContent, CardTitle } from '@/components/ui';
7+
import { Alert } from '@/components/ui/Alert';
8+
import Link from 'next/link';
9+
10+
export default function SignIn() {
11+
const [email, setEmail] = useState('');
12+
const [password, setPassword] = useState('');
13+
const [localError, setLocalError] = useState('');
14+
const router = useRouter();
15+
const { signIn } = useAuth();
16+
const [isLoading, setIsLoading] = useState(false);
17+
18+
const handleSignIn = async (e: React.FormEvent) => {
19+
e.preventDefault();
20+
setLocalError('');
21+
setIsLoading(true);
22+
23+
try {
24+
await signIn(email, password);
25+
router.push('/dashboard');
26+
} catch (error: any) {
27+
setLocalError(error.message || 'An error occurred during sign in');
28+
} finally {
29+
setIsLoading(false);
30+
}
31+
};
32+
33+
return (
34+
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 p-4">
35+
<Card className="w-full max-w-md">
36+
<CardHeader>
37+
<CardTitle>Sign In</CardTitle>
38+
</CardHeader>
39+
40+
<CardContent>
41+
{localError && <Alert variant="error" message={localError} />}
42+
43+
<form onSubmit={handleSignIn} className="space-y-4">
44+
<Input
45+
id="email"
46+
type="email"
47+
label="Email"
48+
value={email}
49+
onChange={(e) => setEmail(e.target.value)}
50+
placeholder="[email protected]"
51+
required
52+
/>
53+
54+
<Input
55+
id="password"
56+
type="password"
57+
label="Password"
58+
value={password}
59+
onChange={(e) => setPassword(e.target.value)}
60+
placeholder="••••••••"
61+
required
62+
/>
63+
64+
<Button
65+
type="submit"
66+
variant="primary"
67+
className="w-full"
68+
isLoading={isLoading}
69+
>
70+
Sign In
71+
</Button>
72+
</form>
73+
74+
<p className="mt-6 text-center text-gray-600">
75+
Don't have an account?{' '}
76+
<Link href="/auth/signup" className="text-indigo-600 hover:text-indigo-800 font-medium">
77+
Sign Up
78+
</Link>
79+
</p>
80+
81+
<p className="mt-2 text-center">
82+
<Link href="/" className="text-sm text-gray-500 hover:text-gray-700">
83+
← Back to home
84+
</Link>
85+
</p>
86+
</CardContent>
87+
</Card>
88+
</div>
89+
);
90+
}

app/auth/signup/page.tsx

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
'use client';
2+
3+
import { useState } from 'react';
4+
import { useRouter } from 'next/navigation';
5+
import { useAuth } from '@/contexts';
6+
import { Button, Input, Card, CardHeader, CardContent, CardTitle } from '@/components/ui';
7+
import { Alert } from '@/components/ui/Alert';
8+
import Link from 'next/link';
9+
10+
export default function SignUp() {
11+
const [email, setEmail] = useState('');
12+
const [password, setPassword] = useState('');
13+
const [confirmPassword, setConfirmPassword] = useState('');
14+
const [localError, setLocalError] = useState('');
15+
const [success, setSuccess] = useState(false);
16+
const router = useRouter();
17+
const { signUp } = useAuth();
18+
const [isLoading, setIsLoading] = useState(false);
19+
20+
const handleSignUp = async (e: React.FormEvent) => {
21+
e.preventDefault();
22+
setLocalError('');
23+
setIsLoading(true);
24+
setSuccess(false);
25+
26+
// Validation
27+
if (password !== confirmPassword) {
28+
setLocalError('Passwords do not match');
29+
setIsLoading(false);
30+
return;
31+
}
32+
33+
if (password.length < 6) {
34+
setLocalError('Password must be at least 6 characters long');
35+
setIsLoading(false);
36+
return;
37+
}
38+
39+
try {
40+
await signUp(email, password);
41+
setSuccess(true);
42+
setTimeout(() => {
43+
router.push('/dashboard');
44+
}, 2000);
45+
} catch (error: any) {
46+
setLocalError(error.message || 'An error occurred during sign up');
47+
} finally {
48+
setIsLoading(false);
49+
}
50+
};
51+
52+
return (
53+
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-blue-50 to-indigo-100 p-4">
54+
<Card className="w-full max-w-md">
55+
<CardHeader>
56+
<CardTitle>Sign Up</CardTitle>
57+
</CardHeader>
58+
59+
<CardContent>
60+
{localError && <Alert variant="error" message={localError} />}
61+
{success && (
62+
<Alert variant="success" message="Account created successfully! Redirecting..." />
63+
)}
64+
65+
<form onSubmit={handleSignUp} className="space-y-4">
66+
<Input
67+
id="email"
68+
type="email"
69+
label="Email"
70+
value={email}
71+
onChange={(e) => setEmail(e.target.value)}
72+
placeholder="[email protected]"
73+
required
74+
/>
75+
76+
<Input
77+
id="password"
78+
type="password"
79+
label="Password"
80+
value={password}
81+
onChange={(e) => setPassword(e.target.value)}
82+
placeholder="••••••••"
83+
required
84+
/>
85+
86+
<Input
87+
id="confirmPassword"
88+
type="password"
89+
label="Confirm Password"
90+
value={confirmPassword}
91+
onChange={(e) => setConfirmPassword(e.target.value)}
92+
placeholder="••••••••"
93+
required
94+
/>
95+
96+
<Button
97+
type="submit"
98+
variant="primary"
99+
className="w-full"
100+
isLoading={isLoading}
101+
>
102+
Sign Up
103+
</Button>
104+
</form>
105+
106+
<p className="mt-6 text-center text-gray-600">
107+
Already have an account?{' '}
108+
<Link href="/auth/signin" className="text-indigo-600 hover:text-indigo-800 font-medium">
109+
Sign In
110+
</Link>
111+
</p>
112+
113+
<p className="mt-2 text-center">
114+
<Link href="/" className="text-sm text-gray-500 hover:text-gray-700">
115+
← Back to home
116+
</Link>
117+
</p>
118+
</CardContent>
119+
</Card>
120+
</div>
121+
);
122+
}

0 commit comments

Comments
 (0)