mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 12:28:48 +02:00
Update pages and components for new module paths
Repoints imports at the relocated lib/api and src/contexts modules, and refreshes Layout + Login alongside the rest of the migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,8 @@ import {
|
||||
} from 'recharts';
|
||||
import { BarChart3 } from 'lucide-react';
|
||||
|
||||
import api from '../api';
|
||||
import BillingCycleSelector from '../components/BillingCycleSelector';
|
||||
import api from '@/lib/api';
|
||||
import BillingCycleSelector from '@/components/BillingCycleSelector';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import {
|
||||
ChartContainer,
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
import { useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Wallet, ArrowRight, AlertCircle } from 'lucide-react';
|
||||
import { useState, type FormEvent } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Wallet, ArrowRight, AlertCircle } from "lucide-react";
|
||||
import { login } from "@/lib/api";
|
||||
import { useAuth } from "@/AuthContext";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
import { login } from '../api';
|
||||
import { useAuth } from '../AuthContext';
|
||||
import { subscribeToPush } from '../pushNotifications';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
|
||||
export default function Login() {
|
||||
const [username, setUsername] = useState('');
|
||||
const [password, setPassword] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
export default function LoginPage() {
|
||||
const [username, setUsername] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [error, setError] = useState("");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const { setAuthenticated } = useAuth();
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
const handleSubmit = async (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
setLoading(true);
|
||||
setError('');
|
||||
setError("");
|
||||
try {
|
||||
await login(username, password);
|
||||
setAuthenticated(true);
|
||||
subscribeToPush();
|
||||
navigate('/');
|
||||
navigate("/asistente", { replace: true });
|
||||
} catch {
|
||||
setError('Invalid credentials');
|
||||
setError("Invalid credentials");
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -41,7 +38,7 @@ export default function Login() {
|
||||
<div className="w-10 h-10 rounded-lg bg-primary flex items-center justify-center">
|
||||
<Wallet className="w-6 h-6 text-primary-foreground" strokeWidth={2.5} />
|
||||
</div>
|
||||
<span className="text-2xl font-bold tracking-tight font-heading">
|
||||
<span className="text-2xl font-bold tracking-tight" style={{ fontFamily: "var(--font-heading)" }}>
|
||||
Wealthy<span className="text-primary">Smart</span>
|
||||
</span>
|
||||
</div>
|
||||
@@ -84,7 +81,7 @@ export default function Login() {
|
||||
)}
|
||||
|
||||
<Button type="submit" disabled={loading} className="w-full h-10">
|
||||
{loading ? 'Signing in...' : 'Sign in'}
|
||||
{loading ? "Signing in..." : "Sign in"}
|
||||
{!loading && <ArrowRight className="w-4 h-4" />}
|
||||
</Button>
|
||||
</form>
|
||||
|
||||
@@ -34,7 +34,7 @@ import {
|
||||
getPensionSnapshots,
|
||||
type PensionSnapshot,
|
||||
type PensionUploadResult,
|
||||
} from '@/api';
|
||||
} from '@/lib/api';
|
||||
import PensionManualEntryModal from '@/components/PensionManualEntryModal';
|
||||
import { ClipboardPaste } from 'lucide-react';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react';
|
||||
import { type ColumnDef } from '@tanstack/react-table';
|
||||
import { Landmark, RefreshCw, Hash, CalendarDays, Banknote } from 'lucide-react';
|
||||
|
||||
import { type Transaction, type SalariosSummary, getSalarios, getSalariosSummary } from '../api';
|
||||
import { type Transaction, type SalariosSummary, getSalarios, getSalariosSummary } from '@/lib/api';
|
||||
import { formatAmount, formatDate } from '@/lib/format';
|
||||
import { DataTable } from '@/components/ui/data-table';
|
||||
import { DataTableColumnHeader } from '@/components/ui/data-table-column-header';
|
||||
|
||||
@@ -41,7 +41,7 @@ import {
|
||||
type MunicipalReceipt,
|
||||
type MunicipalReceiptUploadResult,
|
||||
type WaterMeterReading,
|
||||
} from '@/api';
|
||||
} from '@/lib/api';
|
||||
|
||||
// ─── Constants ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in New Issue
Block a user