Refine web mobile download prompt and document pagination
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useState } from 'react';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { useNavigate, Link } from 'react-router-dom';
|
||||
import { useAuth } from '../../contexts/AuthContext';
|
||||
import { Download, PenTool } from 'lucide-react';
|
||||
@@ -11,6 +11,10 @@ export default function LoginPage() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const apiBaseUrl = (import.meta.env.VITE_API_URL || 'http://localhost:4000').replace(/\/$/, '');
|
||||
const androidApkUrl = `${apiBaseUrl}/downloads/android-apk`;
|
||||
const showAndroidDownload = useMemo(() => {
|
||||
if (typeof navigator === 'undefined') return false;
|
||||
return /Android/i.test(navigator.userAgent || '');
|
||||
}, []);
|
||||
|
||||
const handleChange = (e) => setForm((f) => ({ ...f, [e.target.name]: e.target.value }));
|
||||
|
||||
@@ -60,10 +64,12 @@ export default function LoginPage() {
|
||||
<button type="submit" className="btn btn-primary btn-full" disabled={loading}>
|
||||
{loading ? 'Ingresando...' : 'Iniciar sesión'}
|
||||
</button>
|
||||
<a className="btn btn-secondary btn-full auth-download-btn" href={androidApkUrl}>
|
||||
<Download size={14} />
|
||||
Descargar app Android
|
||||
</a>
|
||||
{showAndroidDownload && (
|
||||
<a className="btn btn-secondary btn-full auth-download-btn" href={androidApkUrl}>
|
||||
<Download size={14} />
|
||||
Descargar app Android
|
||||
</a>
|
||||
)}
|
||||
</form>
|
||||
<p className="auth-link">
|
||||
¿No tienes cuenta? <Link to="/register">Registrarse</Link>
|
||||
|
||||
Reference in New Issue
Block a user