fix build issues

This commit is contained in:
2024-02-21 14:45:33 +01:00
parent 72313304fe
commit 2553ab41c1
6 changed files with 6183 additions and 25 deletions

6141
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,14 +10,15 @@
}, },
"dependencies": { "dependencies": {
"next": "13.2.4", "next": "13.2.4",
"react": "17.0.2", "react": "18.2.0",
"react-dom": "17.0.2", "react-dom": "18.2.0",
"sqlite3": "^5.1.4" "sqlite3": "^5.1.6"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "18.15.5", "@types/node": "18.15.5",
"@types/react": "17.0.53", "@types/react": "18.2.48",
"@types/react-dom": "17.0.19", "@types/react-dom": "18.2.18",
"@types/sqlite3": "^3.1.11",
"eslint": "8.36.0", "eslint": "8.36.0",
"eslint-config-next": "13.2.4", "eslint-config-next": "13.2.4",
"typescript": "4.9.4" "typescript": "4.9.4"

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import type { NextPage } from 'next' import type { NextPage } from 'next'
import Head from 'next/head' import Head from 'next/head'
import Link from 'next/link'
interface DashboardStats { interface DashboardStats {
total_sources: number total_sources: number
@@ -90,7 +91,7 @@ const AdminDashboard: NextPage = () => {
<div style={{ marginTop: '40px' }}> <div style={{ marginTop: '40px' }}>
<h2>Rýchle akcie</h2> <h2>Rýchle akcie</h2>
<div style={{ display: 'flex', gap: '15px', marginTop: '20px' }}> <div style={{ display: 'flex', gap: '15px', marginTop: '20px' }}>
<a href="/admin/sources" style={{ <Link href="/admin/sources" style={{
padding: '12px 24px', padding: '12px 24px',
backgroundColor: '#3b82f6', backgroundColor: '#3b82f6',
color: 'white', color: 'white',
@@ -98,8 +99,8 @@ const AdminDashboard: NextPage = () => {
borderRadius: '6px' borderRadius: '6px'
}}> }}>
Správa zdrojov Správa zdrojov
</a> </Link>
<a href="/admin/reports" style={{ <Link href="/admin/reports" style={{
padding: '12px 24px', padding: '12px 24px',
backgroundColor: '#10b981', backgroundColor: '#10b981',
color: 'white', color: 'white',
@@ -107,7 +108,7 @@ const AdminDashboard: NextPage = () => {
borderRadius: '6px' borderRadius: '6px'
}}> }}>
Hlásenia Hlásenia
</a> </Link>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react' import { useState, useEffect, useCallback } from 'react'
import type { NextPage } from 'next' import type { NextPage } from 'next'
import Head from 'next/head' import Head from 'next/head'
import Link from 'next/link'
interface Source { interface Source {
id: number id: number
@@ -18,11 +19,7 @@ const SourcesManagement: NextPage = () => {
const [loading, setLoading] = useState(true) const [loading, setLoading] = useState(true)
const [filter, setFilter] = useState('pending') const [filter, setFilter] = useState('pending')
useEffect(() => { const fetchSources = useCallback(async () => {
fetchSources()
}, [filter])
const fetchSources = async () => {
try { try {
const response = await fetch(`/api/admin/sources?status=${filter}`) const response = await fetch(`/api/admin/sources?status=${filter}`)
if (response.ok) { if (response.ok) {
@@ -34,7 +31,11 @@ const SourcesManagement: NextPage = () => {
} finally { } finally {
setLoading(false) setLoading(false)
} }
} }, [filter])
useEffect(() => {
fetchSources()
}, [fetchSources])
const updateSource = async (id: number, status: string, riskLevel: number) => { const updateSource = async (id: number, status: string, riskLevel: number) => {
try { try {
@@ -158,7 +159,7 @@ const SourcesManagement: NextPage = () => {
)} )}
<div style={{ marginTop: '30px' }}> <div style={{ marginTop: '30px' }}>
<a href="/admin" style={{ <Link href="/admin" style={{
padding: '10px 20px', padding: '10px 20px',
backgroundColor: '#6b7280', backgroundColor: '#6b7280',
color: 'white', color: 'white',
@@ -166,7 +167,7 @@ const SourcesManagement: NextPage = () => {
borderRadius: '6px' borderRadius: '6px'
}}> }}>
Späť na dashboard Späť na dashboard
</a> </Link>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -76,7 +76,7 @@ export default async function handler(
.split(',') .split(',')
.filter(Boolean) .filter(Boolean)
const uniqueCategories = [...new Set(allCategories)] const uniqueCategories = Array.from(new Set(allCategories))
let message = '' let message = ''
if (maxRiskLevel >= 4) { if (maxRiskLevel >= 4) {

View File

@@ -1,7 +1,11 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": ["dom", "dom.iterable", "es6"], "lib": [
"dom",
"dom.iterable",
"es6"
],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true, "strict": true,
@@ -20,9 +24,19 @@
], ],
"baseUrl": ".", "baseUrl": ".",
"paths": { "paths": {
"@/*": ["./src/*"] "@/*": [
} "./src/*"
]
},
"forceConsistentCasingInFileNames": true
}, },
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "include": [
"exclude": ["node_modules"] "next-env.d.ts",
} "**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
}