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

main
Last change on this file since b62cefc was b62cefc, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added frontend and imporoved AI Suggestions service

  • Property mode set to 100644
File size: 7.9 KB
Line 
1import React from 'react'
2import { useNavigate } from 'react-router-dom'
3import { Feather, Star, 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="inline-flex items-center gap-2 px-4 py-2 rounded-full glass text-sm text-indigo-300 mb-8 border border-indigo-500/20">
37 <Star size={14} className="text-amber-400 fill-amber-400" />
38 The collaborative storytelling platform
39 </div>
40
41 <div className="flex justify-center mb-6">
42 <img src={logo} alt="ChapterX" className="h-32 w-32 object-contain" />
43 </div>
44
45 <h1 className="font-serif text-5xl sm:text-6xl lg:text-7xl font-bold text-white mb-6 leading-tight">
46 Write Your Own Story.
47 <br />
48 <span className="bg-gradient-to-r from-indigo-400 via-violet-400 to-purple-400 bg-clip-text text-transparent">
49 Anyone Could Be Shakespeare.
50 </span>
51 </h1>
52
53 <p className="text-xl text-slate-400 max-w-2xl mx-auto mb-10 leading-relaxed">
54 ChapterX is where writers and readers connect. Publish your stories, collaborate with others,
55 and discover your next great read.
56 </p>
57
58 <div className="flex flex-col sm:flex-row items-center justify-center gap-4">
59 {currentUser ? (
60 <>
61 <Button size="lg" onClick={() => navigate('/browse')}>
62 <BookOpen size={18} />
63 Browse Stories
64 <ArrowRight size={16} />
65 </Button>
66 {(currentUser.role === 'writer' || currentUser.role === 'admin') && (
67 <Button size="lg" variant="secondary" onClick={() => navigate('/writer/create-story')}>
68 <Feather size={18} />
69 Start Writing
70 </Button>
71 )}
72 </>
73 ) : (
74 <>
75 <Button size="lg" onClick={() => navigate('/register')}>
76 Get Started Free
77 <ArrowRight size={16} />
78 </Button>
79 <Button size="lg" variant="ghost" onClick={() => navigate('/browse')}>
80 Browse Stories
81 </Button>
82 </>
83 )}
84 </div>
85
86 </div>
87 </section>
88
89 {/* Features */}
90 <section className="py-20 max-w-7xl mx-auto px-4">
91 <div className="text-center mb-12">
92 <h2 className="font-serif text-3xl sm:text-4xl font-bold text-white mb-4">
93 Everything You Need
94 </h2>
95 <p className="text-slate-400 max-w-xl mx-auto">
96 A complete platform for creative writing and reading.
97 </p>
98 </div>
99 <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-6">
100 {features.map(f => (
101 <div key={f.title} className="glass rounded-2xl p-6 hover:border-indigo-500/30 transition-all duration-300 hover:-translate-y-1">
102 <div className="w-12 h-12 rounded-xl bg-slate-800 flex items-center justify-center mb-4">
103 {f.icon}
104 </div>
105 <h3 className="font-serif font-semibold text-white mb-2">{f.title}</h3>
106 <p className="text-slate-400 text-sm leading-relaxed">{f.desc}</p>
107 </div>
108 ))}
109 </div>
110 </section>
111
112 {/* Genres */}
113 <section className="py-16 bg-slate-900/50">
114 <div className="max-w-7xl mx-auto px-4">
115 <div className="flex items-center justify-between mb-8">
116 <h2 className="font-serif text-2xl font-bold text-white">Explore Genres</h2>
117 <button onClick={() => navigate('/genres')} className="text-indigo-400 hover:text-indigo-300 text-sm flex items-center gap-1">
118 See all <ChevronRight size={14} />
119 </button>
120 </div>
121 <div className="flex flex-wrap gap-3">
122 {genres.map(g => (
123 <button
124 key={g}
125 onClick={() => navigate(`/genres/${g.toLowerCase().replace(' ', '-')}`)}
126 className="transition-transform hover:scale-105"
127 >
128 <GenreBadge genre={g} />
129 </button>
130 ))}
131 </div>
132 </div>
133 </section>
134
135 {/* Trending stories */}
136 <section className="py-20 max-w-7xl mx-auto px-4">
137 <div className="flex items-center justify-between mb-8">
138 <div>
139 <h2 className="font-serif text-2xl font-bold text-white">Trending Stories</h2>
140 <p className="text-slate-500 text-sm mt-1">Most popular right now</p>
141 </div>
142 <Button variant="ghost" size="sm" onClick={() => navigate('/browse')}>
143 View all
144 <ChevronRight size={14} />
145 </Button>
146 </div>
147 <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4">
148 {trending.map(story => (
149 <StoryCard key={story.story_id} story={story} />
150 ))}
151 </div>
152 </section>
153
154 {/* CTA */}
155 {!currentUser && (
156 <section className="py-20">
157 <div className="max-w-3xl mx-auto px-4 text-center">
158 <div className="glass rounded-3xl p-12 border border-indigo-500/20">
159 <h2 className="font-serif text-3xl font-bold text-white mb-4">
160 Ready to Begin Your Story?
161 </h2>
162 <p className="text-slate-400 mb-8">
163 Join thousands of writers and readers on ChapterX today.
164 </p>
165 <div className="flex flex-col sm:flex-row gap-4 justify-center">
166 <Button size="lg" onClick={() => navigate('/register')}>
167 <Feather size={18} />
168 Start Writing
169 </Button>
170 <Button size="lg" variant="secondary" onClick={() => navigate('/browse')}>
171 <BookOpen size={18} />
172 Just Browse
173 </Button>
174 </div>
175 </div>
176 </div>
177 </section>
178 )}
179 </div>
180 )
181}
Note: See TracBrowser for help on using the repository browser.