Skip to content

Commit 9cbd399

Browse files
committed
feat: Add anonymous scan + back buttons to all pages
1 parent 9ebdb61 commit 9cbd399

9 files changed

Lines changed: 88 additions & 12 deletions

File tree

app/about/page.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client'
22

33
import { motion } from 'framer-motion'
4-
import { Shield, Target, Users, Heart, Github, Mail, Zap, Brain, Eye, Lock } from 'lucide-react'
4+
import { Shield, Target, Users, Heart, Github, Mail, Zap, Brain, Eye, Lock, ArrowLeft } from 'lucide-react'
55
import Image from 'next/image'
66
import Link from 'next/link'
77
import Header from '../components/Header'
@@ -42,6 +42,17 @@ export default function AboutPage() {
4242
<Header />
4343

4444
<main className="flex-1 pt-24 pb-12">
45+
{/* Back Button */}
46+
<div className="max-w-7xl mx-auto px-4 mb-8">
47+
<Link
48+
href="/"
49+
className="inline-flex items-center gap-2 text-gray-400 hover:text-blue-400 transition-colors"
50+
>
51+
<ArrowLeft size={20} />
52+
<span>Quay lại trang chủ</span>
53+
</Link>
54+
</div>
55+
4556
{/* Hero */}
4657
<section className="px-4 mb-16">
4758
<div className="max-w-7xl mx-auto text-center">

app/api/scan-v2/route.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ export async function POST(request: NextRequest) {
4545
)
4646
}
4747
} else {
48-
// Anonymous user - IP-based rate limiting
48+
// Anonymous user - IP-based rate limiting (loose limit)
4949
const ipLimit = checkAnonLimit(clientIP)
5050

5151
if (!ipLimit.allowed) {
5252
return NextResponse.json(
5353
{
5454
success: false,
55-
error: 'Quá nhiều yêu cầu. Vui lòng đăng ký tài khoản để quét nhiều hơn.',
55+
error: 'Quá nhiều yêu cầu. Vui lòng đăng ký tài khoản miễn phí để quét nhiều hơn.',
5656
remaining: ipLimit.remaining,
57+
note: 'Đăng nhập để lưu lịch sử và nhận thêm tính năng!',
5758
},
5859
{ status: 429, headers }
5960
)
@@ -84,7 +85,7 @@ export async function POST(request: NextRequest) {
8485
detectCategoryFromDomain(result.domain),
8586
])
8687

87-
// Save to database (legacy Scan table for stats)
88+
// Save to database (legacy Scan table for global stats - ALWAYS save)
8889
const today = getToday()
8990
await Promise.all([
9091
prisma.scan.create({
@@ -117,7 +118,7 @@ export async function POST(request: NextRequest) {
117118
}),
118119
])
119120

120-
// Save to ScanHistory if user is authenticated
121+
// Save to ScanHistory ONLY if user is authenticated (for personal history)
121122
let shareToken: string | undefined
122123
if (session?.user) {
123124
shareToken = nanoid(16)

app/auth/signin/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useState } from 'react'
55
import { useRouter } from 'next/navigation'
66
import Link from 'next/link'
77
import { motion } from 'framer-motion'
8-
import { Mail, Lock, LogIn, Chrome } from 'lucide-react'
8+
import { Mail, Lock, LogIn, Chrome, ArrowLeft } from 'lucide-react'
99

1010
export default function SignInPage() {
1111
const [email, setEmail] = useState('')
@@ -57,6 +57,15 @@ export default function SignInPage() {
5757
transition={{ duration: 0.5 }}
5858
className="max-w-md w-full relative z-10"
5959
>
60+
{/* Back Button */}
61+
<Link
62+
href="/"
63+
className="inline-flex items-center gap-2 text-gray-400 hover:text-white mb-6 transition-colors"
64+
>
65+
<ArrowLeft className="w-5 h-5" />
66+
<span>Quay lại trang chủ</span>
67+
</Link>
68+
6069
{/* Header */}
6170
<div className="text-center mb-8">
6271
<motion.div

app/auth/signup/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useState } from 'react'
44
import { useRouter } from 'next/navigation'
55
import Link from 'next/link'
66
import { motion } from 'framer-motion'
7-
import { Mail, Lock, User, UserPlus, Check } from 'lucide-react'
7+
import { Mail, Lock, User, UserPlus, Check, ArrowLeft } from 'lucide-react'
88

99
export default function SignUpPage() {
1010
const [formData, setFormData] = useState({
@@ -76,6 +76,15 @@ export default function SignUpPage() {
7676
transition={{ duration: 0.5 }}
7777
className="max-w-md w-full relative z-10"
7878
>
79+
{/* Back Button */}
80+
<Link
81+
href="/"
82+
className="inline-flex items-center gap-2 text-gray-400 hover:text-white mb-6 transition-colors"
83+
>
84+
<ArrowLeft className="w-5 h-5" />
85+
<span>Quay lại trang chủ</span>
86+
</Link>
87+
7988
{/* Header */}
8089
<div className="text-center mb-8">
8190
<motion.div

app/guide/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useState, useEffect } from 'react'
44
import { motion } from 'framer-motion'
5-
import { Search, ChevronLeft, ChevronRight, Shield, Lock, Mail, Wifi, Smartphone, RefreshCw } from 'lucide-react'
5+
import { Search, ChevronLeft, ChevronRight, Shield, Lock, Mail, Wifi, Smartphone, RefreshCw, ArrowLeft } from 'lucide-react'
66
import Link from 'next/link'
77
import Header from '../components/Header'
88
import Footer from '../components/Footer'
@@ -108,6 +108,15 @@ export default function GuidePage() {
108108

109109
<main className="flex-1 pt-24 pb-12">
110110
<div className="max-w-7xl mx-auto px-4">
111+
{/* Back Button */}
112+
<Link
113+
href="/"
114+
className="inline-flex items-center gap-2 text-gray-400 hover:text-blue-400 mb-8 transition-colors"
115+
>
116+
<ArrowLeft size={20} />
117+
<span>Quay lại trang chủ</span>
118+
</Link>
119+
111120
{/* Header */}
112121
<motion.div
113122
initial={{ opacity: 0, y: -20 }}

app/pricing/page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
'use client'
22

33
import { useState } from 'react'
4-
import { Check } from 'lucide-react'
4+
import { Check, ArrowLeft } from 'lucide-react'
55
import { signIn } from 'next-auth/react'
66
import { useRouter } from 'next/navigation'
7+
import Link from 'next/link'
78

89
const plans = [
910
{
@@ -146,6 +147,15 @@ export default function PricingPage() {
146147
return (
147148
<div className="min-h-screen bg-gray-50 dark:bg-gray-900 py-12 px-4">
148149
<div className="max-w-7xl mx-auto">
150+
{/* Back Button */}
151+
<Link
152+
href="/"
153+
className="inline-flex items-center gap-2 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white mb-8 transition-colors"
154+
>
155+
<ArrowLeft className="w-5 h-5" />
156+
<span>Quay lại trang chủ</span>
157+
</Link>
158+
149159
{/* Header */}
150160
<div className="text-center mb-12">
151161
<h1 className="text-4xl font-bold text-gray-900 dark:text-white mb-4">

app/quiz/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { motion, AnimatePresence } from 'framer-motion'
55
import {
66
Brain, Trophy, Target, Clock, CheckCircle, XCircle,
77
ArrowRight, RotateCcw, Home, Zap, Award, TrendingUp,
8-
ChevronDown
8+
ChevronDown, ArrowLeft
99
} from 'lucide-react'
1010
import Link from 'next/link'
1111
import Header from '../components/Header'
@@ -157,6 +157,15 @@ export default function QuizPage() {
157157
<Header />
158158
<main className="flex-1 pt-24 pb-12">
159159
<div className="max-w-7xl mx-auto px-4">
160+
{/* Back Button */}
161+
<Link
162+
href="/"
163+
className="inline-flex items-center gap-2 text-gray-400 hover:text-blue-400 mb-8 transition-colors"
164+
>
165+
<ArrowLeft size={20} />
166+
<span>Quay lại trang chủ</span>
167+
</Link>
168+
160169
<motion.div
161170
initial={{ opacity: 0, y: -20 }}
162171
animate={{ opacity: 1, y: 0 }}

app/report/page.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use client'
22

33
import { motion } from 'framer-motion'
4-
import { Flag, Shield, AlertTriangle } from 'lucide-react'
4+
import { Flag, Shield, AlertTriangle, ArrowLeft } from 'lucide-react'
5+
import Link from 'next/link'
56
import Header from '../components/Header'
67
import Footer from '../components/Footer'
78
import ReportForm from '../components/ReportForm'
@@ -14,6 +15,15 @@ export default function ReportPage() {
1415
<main className="flex-1 pt-20">
1516
<section className="py-16 px-4">
1617
<div className="max-w-7xl mx-auto">
18+
{/* Back Button */}
19+
<Link
20+
href="/"
21+
className="inline-flex items-center gap-2 text-gray-400 hover:text-blue-400 mb-8 transition-colors"
22+
>
23+
<ArrowLeft size={20} />
24+
<span>Quay lại trang chủ</span>
25+
</Link>
26+
1727
<motion.div
1828
initial={{ opacity: 0, y: -20 }}
1929
animate={{ opacity: 1, y: 0 }}

app/transparency/page.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
import { Shield, Lock, Database, Eye, Trash2, FileText } from 'lucide-react'
1+
import { Shield, Lock, Database, Eye, Trash2, FileText, ArrowLeft } from 'lucide-react'
22
import Link from 'next/link'
33

44
export default function TransparencyPage() {
55
return (
66
<div className="min-h-screen bg-gray-50 dark:bg-gray-900">
77
<div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
8+
{/* Back Button */}
9+
<Link
10+
href="/"
11+
className="inline-flex items-center gap-2 text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 mb-8 transition-colors"
12+
>
13+
<ArrowLeft size={20} />
14+
<span>Quay lại trang chủ</span>
15+
</Link>
816
<div className="text-center mb-12">
917
<Shield size={64} className="mx-auto text-blue-600 mb-4" />
1018
<h1 className="text-4xl font-bold text-gray-900 dark:text-white mb-4">

0 commit comments

Comments
 (0)