source: chapterx-frontend/src/pages/LandingPage.tsx@ 0b502c2

main
Last change on this file since 0b502c2 was 0b502c2, checked in by kikisrbinoska <srbinoskakristina07@…>, 12 days ago

Fixed user profile and reading lists

  • Property mode set to 100644
File size: 7.6 KB
Line 
1import React from 'react'
2import { useNavigate } from 'react-router-dom'
3import { Feather, BookOpen, Users, Sparkles, ArrowRight, ChevronRight } from 'lucide-react'
4import logo from '../assets/chapterX-removebg-preview.png'
5import { useStoryStore } from '../store/storyStore'
6import { useAuthStore } from '../store/authStore'
7import { Button } from '../components/ui/Button'
8import { StoryCard } from '../components/ui/StoryCard'
9import { GenreBadge } from '../components/ui/Badge'
10
11const features = [
12 { icon: <BookOpen size={24} className="text-indigo-400" />, title: 'Read & Discover', desc: 'Explore thousands of stories across every genre. From fantasy epics to contemporary fiction.' },
13 { icon: <Feather size={24} className="text-violet-400" />, title: 'Write & Publish', desc: 'Share your stories with a passionate community. Get feedback, likes, and readers from day one.' },
14 { icon: <Users size={24} className="text-amber-400" />, title: 'Collaborate', desc: 'Invite co-authors, editors, and beta readers. Build stories together with real-time collaboration.' },
15 { icon: <Sparkles size={24} className="text-emerald-400" />, title: 'AI Assistance', desc: 'Get intelligent writing suggestions for grammar, style, plot, and pacing to improve your craft.' },
16]
17
18const genres = ['Fantasy', 'Sci-Fi', 'Romance', 'Historical Fiction', 'Adventure', 'Thriller', 'Mystery', 'Horror']
19
20export const LandingPage: React.FC = () => {
21 const navigate = useNavigate()
22 const { stories } = useStoryStore()
23 const { currentUser } = useAuthStore()
24
25 const trending = stories.filter(s => s.status === 'published').slice(0, 4)
26
27 return (
28 <div className="min-h-screen">
29 {/* Hero */}
30 <section className="relative overflow-hidden py-20 sm:py-32">
31 <div className="absolute inset-0 bg-gradient-to-br from-indigo-950/50 via-slate-950 to-violet-950/30" />
32 <div className="absolute top-20 left-10 w-72 h-72 bg-indigo-600/10 rounded-full blur-3xl" />
33 <div className="absolute bottom-10 right-10 w-96 h-96 bg-violet-600/10 rounded-full blur-3xl" />
34
35 <div className="relative max-w-7xl mx-auto px-4 text-center">
36 <div className="flex justify-center mb-6">
37 <img src={logo} alt="ChapterX" className="h-32 w-32 object-contain" />
38 </div>
39
40 <h1 className="font-serif text-5xl sm:text-6xl lg:text-7xl font-bold text-white mb-6 leading-tight">
41 Write Your Own Story.
42 <br />
43 <span className="bg-gradient-to-r from-indigo-400 via-violet-400 to-purple-400 bg-clip-text text-transparent">
44 Anyone Could Be Shakespeare.
45 </span>
46 </h1>
47
48 <p className="text-xl text-slate-400 max-w-2xl mx-auto mb-10 leading-relaxed">
49 ChapterX is where writers and readers connect. Publish your stories, collaborate with others,
50 and discover your next great read.
51 </p>
52
53 <div className="flex flex-col sm:flex-row items-center justify-center gap-4">
54 {currentUser ? (
55 <>
56 <Button size="lg" onClick={() => navigate('/browse')}>
57 <BookOpen size={18} />
58 Browse Stories
59 <ArrowRight size={16} />
60 </Button>
61 {(currentUser.role === 'writer' || currentUser.role === 'admin') && (
62 <Button size="lg" variant="secondary" onClick={() => navigate('/writer/create-story')}>
63 <Feather size={18} />
64 Start Writing
65 </Button>
66 )}
67 </>
68 ) : (
69 <>
70 <Button size="lg" onClick={() => navigate('/register')}>
71 Get Started Free
72 <ArrowRight size={16} />
73 </Button>
74 <Button size="lg" variant="ghost" onClick={() => navigate('/browse')}>
75 Browse Stories
76 </Button>
77 </>
78 )}
79 </div>
80
81 </div>
82 </section>
83
84 {/* Features */}
85 <section className="py-20 max-w-7xl mx-auto px-4">
86 <div className="text-center mb-12">
87 <h2 className="font-serif text-3xl sm:text-4xl font-bold text-white mb-4">
88 Everything You Need
89 </h2>
90 <p className="text-slate-400 max-w-xl mx-auto">
91 A complete platform for creative writing and reading.
92 </p>
93 </div>
94 <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
95 {features.map(f => (
96 <div key={f.title} className="glass rounded-2xl p-6 hover:border-indigo-500/30 transition-all duration-300 hover:-translate-y-1">
97 <div className="w-12 h-12 rounded-xl bg-slate-800 flex items-center justify-center mb-4">
98 {f.icon}
99 </div>
100 <h3 className="font-serif font-semibold text-white mb-2">{f.title}</h3>
101 <p className="text-slate-400 text-sm leading-relaxed">{f.desc}</p>
102 </div>
103 ))}
104 </div>
105 </section>
106
107 {/* Genres */}
108 <section className="py-16 bg-slate-900/50">
109 <div className="max-w-7xl mx-auto px-4">
110 <div className="flex items-center justify-between mb-8">
111 <h2 className="font-serif text-2xl font-bold text-white">Explore Genres</h2>
112 <button onClick={() => navigate('/genres')} className="text-indigo-400 hover:text-indigo-300 text-sm flex items-center gap-1">
113 See all <ChevronRight size={14} />
114 </button>
115 </div>
116 <div className="flex flex-wrap gap-3">
117 {genres.map(g => (
118 <button
119 key={g}
120 onClick={() => navigate(`/genres/${g.toLowerCase().replace(' ', '-')}`)}
121 className="transition-transform hover:scale-105"
122 >
123 <GenreBadge genre={g} />
124 </button>
125 ))}
126 </div>
127 </div>
128 </section>
129
130 {/* Trending stories */}
131 <section className="py-20 max-w-7xl mx-auto px-4">
132 <div className="flex items-center justify-between mb-8">
133 <div>
134 <h2 className="font-serif text-2xl font-bold text-white">Trending Stories</h2>
135 <p className="text-slate-500 text-sm mt-1">Most popular right now</p>
136 </div>
137 <Button variant="ghost" size="sm" onClick={() => navigate('/browse')}>
138 View all
139 <ChevronRight size={14} />
140 </Button>
141 </div>
142 <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
143 {trending.map(story => (
144 <StoryCard key={story.story_id} story={story} />
145 ))}
146 </div>
147 </section>
148
149 {/* CTA */}
150 {!currentUser && (
151 <section className="py-20">
152 <div className="max-w-3xl mx-auto px-4 text-center">
153 <div className="glass rounded-3xl p-12 border border-indigo-500/20">
154 <h2 className="font-serif text-3xl font-bold text-white mb-4">
155 Ready to Begin Your Story?
156 </h2>
157 <p className="text-slate-400 mb-8">
158 Join thousands of writers and readers on ChapterX today.
159 </p>
160 <div className="flex flex-col sm:flex-row gap-4 justify-center">
161 <Button size="lg" onClick={() => navigate('/register')}>
162 <Feather size={18} />
163 Start Writing
164 </Button>
165 <Button size="lg" variant="secondary" onClick={() => navigate('/browse')}>
166 <BookOpen size={18} />
167 Just Browse
168 </Button>
169 </div>
170 </div>
171 </div>
172 </section>
173 )}
174 </div>
175 )
176}
Note: See TracBrowser for help on using the repository browser.