fix: Update Tailwind CSS and Better Auth imports for frontend build

- Update Tailwind CSS v4 PostCSS configuration
- Fix Better Auth React imports (better-auth/react)
- Update all page components to use Better Auth useSession
- Add @tailwindcss/postcss to dependencies
- Remove SessionProvider from layout (Better Auth handles sessions)
- Fix globals.css for Tailwind v4 compatibility
- Update page components with correct session state checking

This addresses build failures related to:
- Tailwind CSS v4 PostCSS plugin compatibility
- Better Auth React client import paths
- NextAuth v5 to Better Auth migration
This commit is contained in:
Francesco
2026-02-21 02:09:11 +00:00
parent 517db95126
commit 7df3d54103
9 changed files with 3725 additions and 36 deletions

View File

@@ -1,20 +1,20 @@
'use client';
import { useSession } from 'next-auth/react';
import { useSession } from '@/lib/better-auth';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import Link from 'next/link';
import { format } from 'date-fns';
export default function FilingsPage() {
const { data: session, status } = useSession();
const { data: session, isPending } = useSession();
const router = useRouter();
const [filings, setFilings] = useState([]);
const [loading, setLoading] = useState(true);
const [searchTicker, setSearchTicker] = useState('');
useEffect(() => {
if (status === 'unauthenticated') {
if (!isPending && !session) {
router.push('/auth/signin');
return;
}
@@ -22,7 +22,7 @@ export default function FilingsPage() {
if (session?.user) {
fetchFilings();
}
}, [session, status, router]);
}, [session, isPending, router]);
const fetchFilings = async (ticker?: string) => {
setLoading(true);

View File

@@ -6,14 +6,16 @@
:root {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;
--border: 217.2 32.6% 17.5%;
}
}
@layer base {
* {
@apply border-border;
border-color: hsl(var(--border));
}
body {
@apply bg-background text-foreground;
background-color: hsl(var(--background));
color: hsl(var(--foreground));
}
}

View File

@@ -1,6 +1,3 @@
'use client';
import { SessionProvider } from 'next-auth/react';
import './globals.css';
export default function RootLayout({
@@ -11,9 +8,7 @@ export default function RootLayout({
return (
<html lang="en">
<body>
<SessionProvider>
{children}
</SessionProvider>
</body>
</html>
)

View File

@@ -1,17 +1,17 @@
'use client';
import { useSession } from 'next-auth/react';
import { useSession } from '@/lib/better-auth';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import Link from 'next/link';
export default function Home() {
const { data: session, status } = useSession();
const { data: session, isPending } = useSession();
const router = useRouter();
const [stats, setStats] = useState({ filings: 0, portfolioValue: 0, watchlist: 0 });
useEffect(() => {
if (status === 'unauthenticated') {
if (!isPending && !session) {
router.push('/auth/signin');
return;
}
@@ -19,7 +19,7 @@ export default function Home() {
if (session?.user) {
fetchStats(session.user.id);
}
}, [session, status, router]);
}, [session, isPending, router]);
const fetchStats = async (userId: string) => {
try {

View File

@@ -1,6 +1,6 @@
'use client';
import { useSession } from 'next-auth/react';
import { useSession } from '@/lib/better-auth';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, PieChart, Pie, Cell, Legend } from 'recharts';
@@ -8,7 +8,7 @@ import { format } from 'date-fns';
import Link from 'next/link';
export default function PortfolioPage() {
const { data: session, status } = useSession();
const { data: session, isPending } = useSession();
const router = useRouter();
const [portfolio, setPortfolio] = useState([]);
const [summary, setSummary] = useState({ total_value: 0, total_gain_loss: 0, cost_basis: 0 });
@@ -17,7 +17,7 @@ export default function PortfolioPage() {
const [newHolding, setNewHolding] = useState({ ticker: '', shares: '', avg_cost: '' });
useEffect(() => {
if (status === 'unauthenticated') {
if (!isPending && !session) {
router.push('/auth/signin');
return;
}
@@ -25,7 +25,7 @@ export default function PortfolioPage() {
if (session?.user) {
fetchPortfolio(session.user.id);
}
}, [session, status, router]);
}, [session, isPending, router]);
const fetchPortfolio = async (userId: string) => {
try {

View File

@@ -1,12 +1,12 @@
'use client';
import { useSession } from 'next-auth/react';
import { useSession } from '@/lib/better-auth';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';
import Link from 'next/link';
export default function WatchlistPage() {
const { data: session, status } = useSession();
const { data: session, isPending } = useSession();
const router = useRouter();
const [watchlist, setWatchlist] = useState([]);
const [loading, setLoading] = useState(true);
@@ -14,7 +14,7 @@ export default function WatchlistPage() {
const [newStock, setNewStock] = useState({ ticker: '', company_name: '', sector: '' });
useEffect(() => {
if (status === 'unauthenticated') {
if (!isPending && !session) {
router.push('/auth/signin');
return;
}
@@ -22,7 +22,7 @@ export default function WatchlistPage() {
if (session?.user) {
fetchWatchlist(session.user.id);
}
}, [session, status, router]);
}, [session, isPending, router]);
const fetchWatchlist = async (userId: string) => {
try {

3693
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -8,30 +8,29 @@
"lint": "next lint"
},
"dependencies": {
"next": "16.1.6",
"better-auth": "^1.4.18",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"recharts": "^3.7.0",
"lucide-react": "^0.574.0",
"date-fns": "^4.1.0",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-toast": "^1.2.15",
"better-auth": "^1.4.18",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^4.1.0",
"lucide-react": "^0.574.0",
"next": "16.1.6",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"recharts": "^3.7.0",
"tailwind-merge": "^3.5.0"
},
"devDependencies": {
"@types/node": "^25.3.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"typescript": "^5.9.3",
"tailwindcss": "^4.2.0",
"postcss": "^8.5.6",
"autoprefixer": "^10.4.24",
"@tailwindcss/postcss": "^4.0.0"
"postcss": "^8.5.6",
"tailwindcss": "^3.4.17",
"typescript": "^5.9.3"
}
}

View File

@@ -1,6 +1,6 @@
module.exports = {
plugins: {
'@tailwindcss/postcss': {},
tailwindcss: {},
autoprefixer: {},
},
}