Phase 3-4: Goals AI planner, Team tasks, Push notifications, i18n (CZ/HE/RU/UA)
- Goals CRUD API + AI study plan generator + progress reports - Goals frontend page with progress bars - Team tasks: assign, transfer, collaborate endpoints - Push notifications: web-push, VAPID, subscribe/send - i18n: 4 languages (cs, he, ru, ua) translation files - notifications.js + goals.js routes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,18 +5,20 @@ import { useRouter } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import { login } from "@/lib/api";
|
||||
import { useAuth } from "@/lib/auth";
|
||||
import { useTranslation } from "@/lib/i18n";
|
||||
|
||||
export default function LoginPage() {
|
||||
const [email, setEmail] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const { setAuth } = useAuth();
|
||||
const { t } = useTranslation();
|
||||
const router = useRouter();
|
||||
|
||||
async function handleSubmit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (!email.trim()) {
|
||||
setError("Zadejte email");
|
||||
setError(t("auth.email"));
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
@@ -26,7 +28,7 @@ export default function LoginPage() {
|
||||
setAuth(result.data.token, result.data.user);
|
||||
router.push("/tasks");
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : "Chyba prihlaseni");
|
||||
setError(err instanceof Error ? err.message : t("common.error"));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -36,7 +38,7 @@ export default function LoginPage() {
|
||||
<div className="min-h-[70vh] flex items-center justify-center">
|
||||
<div className="w-full max-w-sm">
|
||||
<div className="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-2xl p-6 shadow-sm">
|
||||
<h1 className="text-2xl font-bold text-center mb-6">Prihlaseni</h1>
|
||||
<h1 className="text-2xl font-bold text-center mb-6">{t("auth.login")}</h1>
|
||||
|
||||
{error && (
|
||||
<div className="bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 text-red-700 dark:text-red-300 px-4 py-3 rounded-lg text-sm mb-4">
|
||||
@@ -46,7 +48,7 @@ export default function LoginPage() {
|
||||
|
||||
<form onSubmit={handleSubmit} className="space-y-4">
|
||||
<div>
|
||||
<label className="block text-sm font-medium mb-1">Email</label>
|
||||
<label className="block text-sm font-medium mb-1">{t("auth.email")}</label>
|
||||
<input
|
||||
type="email"
|
||||
value={email}
|
||||
@@ -63,14 +65,14 @@ export default function LoginPage() {
|
||||
disabled={loading}
|
||||
className="w-full bg-blue-600 hover:bg-blue-700 text-white font-medium py-2.5 px-4 rounded-lg transition-colors disabled:opacity-50"
|
||||
>
|
||||
{loading ? "Prihlasuji..." : "Prihlasit se"}
|
||||
{loading ? t("common.loading") : t("auth.submit")}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p className="text-center text-sm text-muted mt-4">
|
||||
Nemate ucet?{" "}
|
||||
{t("auth.noAccount")}{" "}
|
||||
<Link href="/register" className="text-blue-600 hover:underline">
|
||||
Registrovat se
|
||||
{t("auth.registerBtn")}
|
||||
</Link>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user