Skip to content

Commit eefd79d

Browse files
Improves login form layout and workflow for improved user experience.
Enhances the accessibility and readability of the login form by providing clear labels and links for users. Updates the layout to direct users to the correct authentication routes. Adds social login buttons for GitHub. Updates the CTAs on the landing page and header to direct users to the login/auth/register pages. Improves overall user navigation and reduces confusion.
1 parent ee77a09 commit eefd79d

File tree

4 files changed

+57
-22
lines changed

4 files changed

+57
-22
lines changed

src/app/auth/login/_components/login-form.tsx

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export function LoginForm() {
4343
const [loading, setLoading] = useState(false)
4444
const [rememberMe, setRememberMe] = useState(false)
4545
const router = useRouter()
46-
// No longer need the serverError state: const [serverError, setServerError] = useState('')
4746

4847
const form = useForm<z.infer<typeof formSchema>>({
4948
resolver: zodResolver(formSchema),
@@ -119,15 +118,18 @@ export function LoginForm() {
119118
render={({ field }) => (
120119
<FormItem>
121120
<div className="flex items-center">
122-
<FormLabel>Password</FormLabel>
123-
<Link href="#" className="ml-auto inline-block text-sm underline">
124-
Forgot your password?
121+
<FormLabel>Kata Sandi</FormLabel>
122+
<Link
123+
href="/auth/forgot-password"
124+
className="ml-auto inline-block text-sm underline"
125+
>
126+
lupa kata sandi?
125127
</Link>
126128
</div>
127129
<FormControl>
128130
<Input type="password" placeholder="••••••••" {...field} />
129131
</FormControl>
130-
<FormMessage /> {/* Server error messages will now appear here */}
132+
<FormMessage />
131133
</FormItem>
132134
)}
133135
/>
@@ -138,7 +140,7 @@ export function LoginForm() {
138140
checked={rememberMe}
139141
onCheckedChange={(checked) => setRememberMe(Boolean(checked))}
140142
/>
141-
<Label htmlFor="remember">Remember me</Label>
143+
<Label htmlFor="remember">Ingat Saya</Label>
142144
</div>
143145

144146
<Button type="submit" className="w-full" disabled={loading}>
@@ -147,7 +149,6 @@ export function LoginForm() {
147149
</form>
148150
</Form>
149151
<div className={cn('w-full gap-2 flex items-center flex-col mt-4')}>
150-
{/* ... Social login buttons remain the same ... */}
151152
<Button
152153
variant="outline"
153154
className={cn('w-full gap-2')}
@@ -182,18 +183,49 @@ export function LoginForm() {
182183
d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"
183184
></path>
184185
</svg>
185-
Sign in with Google
186+
Masuk dengan Google
187+
</Button>
188+
189+
<Button
190+
variant="outline"
191+
className={cn('w-full gap-2')}
192+
disabled={loading}
193+
onClick={async () => {
194+
await authClient.signIn.social(
195+
{
196+
provider: 'github',
197+
callbackURL: '/feeds',
198+
},
199+
{
200+
onRequest: () => {
201+
setLoading(true)
202+
},
203+
onResponse: () => {
204+
setLoading(false)
205+
},
206+
}
207+
)
208+
}}
209+
>
210+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24">
211+
<path
212+
fill="currentColor"
213+
d="M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"
214+
></path>
215+
</svg>
216+
Masuk dengan Github
186217
</Button>
187218
</div>
188219
</CardContent>
189220
<CardFooter>
190221
<div className="flex justify-center w-full border-t py-4">
191-
<p className="text-center text-xs text-neutral-500">
192-
built with{' '}
193-
<Link href="https://better-auth.com" className="underline" target="_blank">
194-
<span className="dark:text-white/70 cursor-pointer">better-auth.</span>
195-
</Link>
196-
</p>
222+
<Link
223+
href="/auth/register"
224+
className="text-xs text-neutral-500 hover:text-primary transition-colors"
225+
target="_blank"
226+
>
227+
Belum punya akun? <span className="underline">Daftar di sini.</span>
228+
</Link>
197229
</div>
198230
</CardFooter>
199231
</Card>

src/features/landing/components/cta-section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default function CTASection() {
2525
</p>
2626

2727
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
28-
<Link href="/register">
28+
<Link href="/auth/login">
2929
<Button size="lg" className="glow-purple group">
3030
Mulai Sekarang
3131
<ArrowRight className="ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform" />

src/features/landing/components/header.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ export default function Header() {
5656
>
5757
Leaderboard
5858
</a>
59-
<Link href="/login">
59+
<Link href="/auth/login">
6060
<Button variant="outline" size="sm">
6161
Masuk
6262
</Button>
6363
</Link>
6464

65-
<Link href="/register">
65+
<Link href="/auth/register">
6666
<Button size="sm" className="glow-purple">
67-
Mulai Sekarang
67+
Daftar
6868
</Button>
6969
</Link>
7070
</nav>

src/features/landing/components/hero-section.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Button } from '@/components/ui/button'
22
import { ArrowRight, Sparkles } from 'lucide-react'
3+
import Link from 'next/link'
34

45
export default function HeroSection() {
56
return (
@@ -23,10 +24,12 @@ export default function HeroSection() {
2324
</p>
2425

2526
<div className="flex flex-col sm:flex-row gap-4 justify-center items-center">
26-
<Button size="lg" className="glow-purple group">
27-
Mulai Showcase
28-
<ArrowRight className="ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform" />
29-
</Button>
27+
<Link href="/auth/login">
28+
<Button size="lg" className="glow-purple group">
29+
Mulai Showcase
30+
<ArrowRight className="ml-2 h-4 w-4 group-hover:translate-x-1 transition-transform" />
31+
</Button>
32+
</Link>
3033
{/* <Button variant="outline" size="lg" className="group bg-transparent">
3134
<Play className="mr-2 h-4 w-4" />
3235
Lihat Demo

0 commit comments

Comments
 (0)