fix: update Dockerfile and remove .next from git
This commit is contained in:
32
components/AppNavbar.tsx
Normal file
32
components/AppNavbar.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import logo from '@/assets/images/icon.png'
|
||||
import type { User } from '@supabase/supabase-js'
|
||||
import UserMenu from './UserMenu'
|
||||
|
||||
export default function AppNavbar({ user }: { user: User }) {
|
||||
return (
|
||||
<>
|
||||
<header className="border-b border-gray-800 bg-background-dark/80 backdrop-blur-md sticky top-0 z-50">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 h-16 flex items-center justify-between">
|
||||
<Link href="/app" className="flex items-center gap-2">
|
||||
<Image
|
||||
src={logo}
|
||||
alt="Nemia Logo"
|
||||
width={32}
|
||||
height={32}
|
||||
className="rounded-lg object-contain"
|
||||
/>
|
||||
<span className="font-display font-bold text-xl tracking-tight text-white">
|
||||
Nemia
|
||||
</span>
|
||||
</Link>
|
||||
|
||||
<UserMenu email={user.email} />
|
||||
</div>
|
||||
</header>
|
||||
</>
|
||||
)
|
||||
}
|
||||
72
components/DeckList.tsx
Normal file
72
components/DeckList.tsx
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Database } from '@/types_db'
|
||||
import Link from 'next/link'
|
||||
import { Book, Clock, Download } from 'lucide-react'
|
||||
|
||||
type Deck = Database['public']['Tables']['decks']['Row']
|
||||
|
||||
export default function DeckList({ decks }: { decks: Deck[] }) {
|
||||
if (decks.length === 0) {
|
||||
return (
|
||||
<div className="text-center py-12 border border-dashed border-gray-800 rounded-lg bg-surface-dark/50">
|
||||
<h3 className="mt-2 text-sm font-semibold text-gray-200">No decks found</h3>
|
||||
<p className="mt-1 text-sm text-gray-400">Get started by creating a new deck.</p>
|
||||
<div className="mt-6">
|
||||
{/* Action to create deck could go here in future */}
|
||||
<button className="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-gray-900 bg-primary hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
|
||||
Create Deck
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
||||
{decks.map((deck) => (
|
||||
<div
|
||||
key={deck.id}
|
||||
className="relative group bg-surface-dark border border-gray-800 rounded-xl overflow-hidden hover:border-primary/50 transition-all duration-300 hover:shadow-glow"
|
||||
>
|
||||
<div className="h-32 bg-gray-900 relative">
|
||||
{deck.cover_image_url ? (
|
||||
<img
|
||||
src={deck.cover_image_url}
|
||||
alt={deck.title || 'Deck cover'}
|
||||
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
|
||||
/>
|
||||
) : (
|
||||
<div
|
||||
className="w-full h-full bg-gradient-to-br from-gray-800 to-gray-900 flex items-center justify-center"
|
||||
style={{ background: deck.gradient || undefined }}
|
||||
>
|
||||
<Book className="h-10 w-10 text-gray-600" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="p-5">
|
||||
<h3 className="text-lg font-bold text-white mb-2 line-clamp-1">
|
||||
{deck.title || 'Untitled Deck'}
|
||||
</h3>
|
||||
<p className="text-gray-400 text-sm mb-4 line-clamp-2 min-h-[40px]">
|
||||
{deck.description || 'No description provided.'}
|
||||
</p>
|
||||
|
||||
<div className="flex items-center justify-between text-xs text-gray-500 pt-4 border-t border-gray-800">
|
||||
<div className="flex items-center gap-1">
|
||||
<Download size={14} />
|
||||
<span>{deck.downloads || 0}</span>
|
||||
</div>
|
||||
{deck.last_studied_at && (
|
||||
<div className="flex items-center gap-1">
|
||||
<Clock size={14} />
|
||||
<span>{new Date(deck.last_studied_at).toLocaleDateString()}</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
113
components/DeleteAccountModal.tsx
Normal file
113
components/DeleteAccountModal.tsx
Normal file
@@ -0,0 +1,113 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
export default function DeleteAccountModal({
|
||||
isOpen,
|
||||
onClose,
|
||||
}: {
|
||||
isOpen: boolean
|
||||
onClose: () => void
|
||||
}) {
|
||||
const [isLoading, setIsLoading] = useState(false)
|
||||
const [step, setStep] = useState(1)
|
||||
const [confirmText, setConfirmText] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
if (isOpen) {
|
||||
setStep(1)
|
||||
setConfirmText('')
|
||||
setIsLoading(false)
|
||||
}
|
||||
}, [isOpen])
|
||||
|
||||
if (!isOpen) return null
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4">
|
||||
<div className="w-full max-w-md bg-surface-dark border border-gray-800 rounded-2xl p-6 shadow-2xl animate-in fade-in zoom-in-95 duration-200">
|
||||
<h2 className="text-xl font-bold text-white mb-2">Delete Account</h2>
|
||||
|
||||
{step === 1 ? (
|
||||
<>
|
||||
<p className="text-gray-400 mb-6">
|
||||
Are you sure you want to delete your account? This action cannot be
|
||||
undone. Your data will be permanently removed.
|
||||
</p>
|
||||
<div className="flex justify-end space-x-3">
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="px-4 py-2 rounded-lg text-gray-300 hover:text-white hover:bg-gray-800 transition-colors"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setStep(2)}
|
||||
className="px-4 py-2 rounded-lg bg-red-500/10 text-red-500 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-all font-medium"
|
||||
>
|
||||
Continue
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p className="text-gray-400 mb-4">
|
||||
To confirm deletion, please type <span className="text-white font-mono font-bold">DELETE</span> below.
|
||||
</p>
|
||||
<input
|
||||
type="text"
|
||||
value={confirmText}
|
||||
onChange={(e) => setConfirmText(e.target.value)}
|
||||
placeholder="Type DELETE"
|
||||
className="w-full bg-gray-900 border border-gray-700 rounded-lg px-3 py-2 text-white mb-6 focus:outline-none focus:border-red-500 transition-colors"
|
||||
autoFocus
|
||||
/>
|
||||
<div className="flex justify-end space-x-3">
|
||||
<button
|
||||
onClick={onClose}
|
||||
disabled={isLoading}
|
||||
className="px-4 py-2 rounded-lg text-gray-300 hover:text-white hover:bg-gray-800 transition-colors disabled:opacity-50"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<form
|
||||
action="/api/delete-account"
|
||||
method="POST"
|
||||
onSubmit={() => setIsLoading(true)}
|
||||
>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isLoading || confirmText !== 'DELETE'}
|
||||
className="px-4 py-2 rounded-lg bg-red-500/10 text-red-500 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-all font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
|
||||
>
|
||||
{isLoading ? (
|
||||
<>
|
||||
<svg className="animate-spin h-4 w-4" viewBox="0 0 24 24">
|
||||
<circle
|
||||
className="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke="currentColor"
|
||||
strokeWidth="4"
|
||||
/>
|
||||
<path
|
||||
className="opacity-75"
|
||||
fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||
/>
|
||||
</svg>
|
||||
Deleting...
|
||||
</>
|
||||
) : (
|
||||
'Delete Account'
|
||||
)}
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
28
components/DeleteAccountSection.tsx
Normal file
28
components/DeleteAccountSection.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
'use client'
|
||||
|
||||
import { useState } from 'react'
|
||||
import DeleteAccountModal from './DeleteAccountModal'
|
||||
|
||||
export default function DeleteAccountSection() {
|
||||
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
|
||||
|
||||
return (
|
||||
<div className="bg-[#0B0F17] border border-red-900/20 rounded-xl p-6">
|
||||
<h2 className="text-lg font-semibold text-red-500 mb-2">Danger Zone</h2>
|
||||
<p className="text-sm text-gray-400 mb-4">
|
||||
Permanently delete your account and all of your data.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => setIsDeleteModalOpen(true)}
|
||||
className="px-4 py-2 rounded-lg bg-red-500/10 text-red-500 hover:bg-red-500/20 hover:text-red-400 border border-red-500/20 transition-all font-medium"
|
||||
>
|
||||
Delete Account
|
||||
</button>
|
||||
|
||||
<DeleteAccountModal
|
||||
isOpen={isDeleteModalOpen}
|
||||
onClose={() => setIsDeleteModalOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -32,6 +32,7 @@ const Footer: React.FC = () => {
|
||||
<h4 className="font-bold text-white mb-4">Legal</h4>
|
||||
<ul className="space-y-2 text-sm text-gray-400 text-right">
|
||||
<li><Link href="/privacy" className="hover:text-primary transition-colors">Privacy</Link></li>
|
||||
<li><Link href="/delete-account" className="hover:text-primary transition-colors">Delete Account</Link></li>
|
||||
<li><Link href="#" className="hover:text-primary transition-colors">Terms</Link></li>
|
||||
<li><Link href="#" className="hover:text-primary transition-colors">Cookie Policy</Link></li>
|
||||
</ul>
|
||||
|
||||
43
components/GoogleSignInButton.tsx
Normal file
43
components/GoogleSignInButton.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
'use client'
|
||||
|
||||
import { createClient } from '@/utils/supabase/client'
|
||||
|
||||
export default function GoogleSignInButton() {
|
||||
const handleGoogleLogin = async () => {
|
||||
const supabase = createClient()
|
||||
await supabase.auth.signInWithOAuth({
|
||||
provider: 'google',
|
||||
options: {
|
||||
redirectTo: `${window.location.origin}/auth/callback`,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleGoogleLogin}
|
||||
className="flex items-center cursor-pointer justify-center w-full gap-2 px-4 py-2 border border-zinc-700 rounded-md text-white hover:bg-zinc-800 transition-colors"
|
||||
>
|
||||
<svg className="h-5 w-5" viewBox="0 0 24 24">
|
||||
<path
|
||||
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
||||
fill="#4285F4"
|
||||
/>
|
||||
<path
|
||||
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
||||
fill="#34A853"
|
||||
/>
|
||||
<path
|
||||
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
||||
fill="#FBBC05"
|
||||
/>
|
||||
<path
|
||||
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
||||
fill="#EA4335"
|
||||
/>
|
||||
</svg>
|
||||
Continue with Google
|
||||
</button>
|
||||
)
|
||||
}
|
||||
@@ -38,12 +38,12 @@ const Navbar: React.FC = () => {
|
||||
<Link href="/#features" className="text-gray-300 hover:text-primary transition-colors text-sm font-medium">Features</Link>
|
||||
<Link href="/#how-it-works" className="text-gray-300 hover:text-primary transition-colors text-sm font-medium">How it Works</Link>
|
||||
<Link href="/#pricing" className="text-gray-300 hover:text-primary transition-colors text-sm font-medium">Pricing</Link>
|
||||
<button
|
||||
onClick={() => setIsWaitlistOpen(true)}
|
||||
<Link
|
||||
href="/login"
|
||||
className="bg-primary text-gray-900 px-5 py-2 rounded-full font-semibold text-sm hover:brightness-110 transition-all shadow-glow"
|
||||
>
|
||||
Get Started
|
||||
</button>
|
||||
Log In
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
{/* Mobile Menu Button */}
|
||||
@@ -65,15 +65,12 @@ const Navbar: React.FC = () => {
|
||||
<Link href="/#features" className="block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-800">Features</Link>
|
||||
<Link href="/#how-it-works" className="block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-800">How it Works</Link>
|
||||
<Link href="/#pricing" className="block px-3 py-2 rounded-md text-base font-medium text-gray-300 hover:text-white hover:bg-gray-800">Pricing</Link>
|
||||
<button
|
||||
onClick={() => {
|
||||
setIsOpen(false);
|
||||
setIsWaitlistOpen(true);
|
||||
}}
|
||||
className="w-full mt-4 bg-primary text-gray-900 px-5 py-3 rounded-xl font-bold hover:brightness-110 transition-all"
|
||||
<Link
|
||||
href="/login"
|
||||
className="block w-full text-center mt-4 bg-primary text-gray-900 px-5 py-3 rounded-xl font-bold hover:brightness-110 transition-all"
|
||||
>
|
||||
Get Started
|
||||
</button>
|
||||
Log In
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
77
components/UserMenu.tsx
Normal file
77
components/UserMenu.tsx
Normal file
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useRef, useEffect } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { User, Settings, LogOut, ChevronDown } from 'lucide-react';
|
||||
|
||||
interface UserMenuProps {
|
||||
email: string | undefined;
|
||||
}
|
||||
|
||||
export default function UserMenu({ email }: UserMenuProps) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const menuRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Close on click outside
|
||||
useEffect(() => {
|
||||
function handleClickOutside(event: MouseEvent) {
|
||||
if (menuRef.current && !menuRef.current.contains(event.target as Node)) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
}
|
||||
document.addEventListener("mousedown", handleClickOutside);
|
||||
return () => {
|
||||
document.removeEventListener("mousedown", handleClickOutside);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="relative" ref={menuRef}>
|
||||
<button
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
className="flex items-center gap-3 focus:outline-none group cursor-pointer"
|
||||
>
|
||||
<div className="hidden sm:flex flex-col items-end mr-1">
|
||||
<span className="text-sm text-white font-medium group-hover:text-primary transition-colors">{email?.split('@')[0]}</span>
|
||||
</div>
|
||||
<div className="h-9 w-9 rounded-full bg-gray-800 flex items-center justify-center text-gray-300 border border-gray-700 group-hover:border-primary group-hover:text-primary transition-all">
|
||||
<User size={18} />
|
||||
</div>
|
||||
<ChevronDown size={14} className={`text-gray-500 group-hover:text-primary transition-all duration-200 ${isOpen ? 'rotate-180' : ''}`} />
|
||||
</button>
|
||||
|
||||
{isOpen && (
|
||||
<div className="absolute right-0 mt-2 w-56 bg-[#0B0F17] border border-gray-800 rounded-xl shadow-2xl py-1 z-50 animate-in fade-in zoom-in-95 duration-100 overflow-hidden ring-1 ring-white/5">
|
||||
<div className="px-4 py-3 border-b border-gray-800 bg-gray-900/50 sm:hidden">
|
||||
<p className="text-sm text-white font-medium truncate">{email}</p>
|
||||
</div>
|
||||
|
||||
<div className="p-1">
|
||||
<Link
|
||||
href="/app/settings"
|
||||
className="flex items-center gap-2 px-3 py-2 text-sm text-gray-300 hover:text-white hover:bg-gray-800 rounded-lg transition-colors"
|
||||
onClick={() => setIsOpen(false)}
|
||||
>
|
||||
<Settings size={16} />
|
||||
Settings
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<div className="h-px bg-gray-800 my-1 mx-1"></div>
|
||||
|
||||
<div className="p-1">
|
||||
<form action="/auth/signout" method="post">
|
||||
<button
|
||||
type="submit"
|
||||
className="w-full flex items-center gap-2 px-3 py-2 text-sm text-red-400 hover:text-red-300 hover:bg-red-900/20 rounded-lg transition-colors text-left"
|
||||
>
|
||||
<LogOut size={16} />
|
||||
Sign Out
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user