updaded typescript to 7 and fixed few bugs

This commit is contained in:
Altair-sh
2026-09-22 19:31:51 +02:00
parent 9c25922a3b
commit 5da5fd2c7e
15 changed files with 1040 additions and 493 deletions
@@ -4,6 +4,10 @@ import { redirectRequest, respondToOPTIONS } from '@/app/api/proxy/functions'
import { PROXY_PATHS } from '@/app/api/proxy/paths'
import { appConfig } from '@/lib/configLoader'
//TODO: remove this proxy once the backend handles CORS itself. It only exists
// so the browser can make same-origin requests; with CORS on the backend the
// client can call it directly and this extra hop disappears.
// Forwards the incoming request to the save parser backend.
async function redirect(req: NextRequest): Promise<NextResponse> {
return await redirectRequest(
+4
View File
@@ -14,6 +14,7 @@ const DARK_SCHEME_QUERY = '(prefers-color-scheme: dark)'
const BASE_THEME = themeQuartz.withParams({
columnBorder: true,
headerColumnBorder: true,
headerCellBackgroundTransitionDuration: 0,
})
// Built once, so the grid keeps seeing the same theme object between renders.
const LIGHT_THEME = BASE_THEME
@@ -53,6 +54,9 @@ export default function BrowseSaveDataPage() {
<AgGridReact
theme={agTheme}
modules={[AllCommunityModule]}
// ddisable all animations
animateRows={false}
suppressColumnMoveAnimation={true}
rowData={[
{ id: 1, col1: 'Hello', col2: 'AG Grid' },
{ id: 2, col1: 'Dark Mode', col2: 'Support' },
-1
View File
@@ -1,7 +1,6 @@
:root {
--background: #ffffff;
--foreground: #171717;
font-family: var(--font-ibm-plex-sans), monospace;
}
@media (prefers-color-scheme: dark) {
+2 -4
View File
@@ -1,8 +1,8 @@
import 'bootstrap/dist/css/bootstrap.min.css'
import './globals.css'
import type { Metadata } from 'next'
import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community'
import Navbar from '@/components/Navbar'
import { font_IbmPlexSans } from '@/lib/myFonts'
export const metadata: Metadata = {
title: 'Home',
@@ -12,14 +12,12 @@ export const metadata: Metadata = {
export default function RootLayout({
children,
}: Readonly<{ children: React.ReactNode }>) {
// Register the ag-grid community features
ModuleRegistry.registerModules([AllCommunityModule])
return (
<html lang="en">
<head>
<title>paradox-save-parser-frontend</title>
</head>
<body>
<body className={font_IbmPlexSans.className}>
<Navbar />
{children}
</body>
+1 -4
View File
@@ -1,14 +1,11 @@
'use client'
import Link from 'next/link'
import { font_Hack } from '@/lib/myFonts'
// Top navigation bar with a home link and login/register buttons.
export default function Navbar() {
return (
<nav
className={`navbar navbar-expand-lg navbar-dark bg-dark px-3 ${font_Hack.className}`}
>
<nav className={`navbar navbar-expand-lg navbar-dark bg-dark px-3`}>
<div className="container-fluid">
{/* Left: Home Link */}
<Link href="/" className="navbar-brand">
+2 -1
View File
@@ -3,6 +3,7 @@ import fs from 'fs'
import path from 'path'
import { AppConfig, defaultConfig } from '@/config/AppConfig'
// TODO: get rid of this file and read about configs for next.js. Maybe use .env file where variables NEXT_PUBLIC_* are avaliable from client.
const configFilePath = path.join(process.cwd(), 'runtimeConfig.json')
// Reads runtimeConfig.json (merging it over the defaults) and creates new config file if missing
@@ -18,7 +19,7 @@ function loadConfig(): AppConfig {
console.log(`creating default config file '${configFilePath}'`)
fs.mkdirSync(path.dirname(configFilePath), { recursive: true })
}
fs.writeFileSync(configFilePath, JSON.stringify(defaultConfig, null, 4))
fs.writeFileSync(configFilePath, JSON.stringify(config, null, 4))
return config
}
+4
View File
@@ -1,3 +1,7 @@
//TODO: replace this whole service with Discord OAuth. The target audience
// already uses Discord, so email/password login is not worth building. The
// /api/auth/login and /api/auth/register routes below are never implemented —
// delete them along with this service.
//TODO: controllable rate limits
class AuthService {