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": {
"next": "13.2.4",
"react": "17.0.2",
"react-dom": "17.0.2",
"sqlite3": "^5.1.4"
"react": "18.2.0",
"react-dom": "18.2.0",
"sqlite3": "^5.1.6"
},
"devDependencies": {
"@types/node": "18.15.5",
"@types/react": "17.0.53",
"@types/react-dom": "17.0.19",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"@types/sqlite3": "^3.1.11",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"typescript": "4.9.4"

View File

@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react'
import type { NextPage } from 'next'
import Head from 'next/head'
import Link from 'next/link'
interface DashboardStats {
total_sources: number
@@ -90,7 +91,7 @@ const AdminDashboard: NextPage = () => {
<div style={{ marginTop: '40px' }}>
<h2>Rýchle akcie</h2>
<div style={{ display: 'flex', gap: '15px', marginTop: '20px' }}>
<a href="/admin/sources" style={{
<Link href="/admin/sources" style={{
padding: '12px 24px',
backgroundColor: '#3b82f6',
color: 'white',
@@ -98,8 +99,8 @@ const AdminDashboard: NextPage = () => {
borderRadius: '6px'
}}>
Správa zdrojov
</a>
<a href="/admin/reports" style={{
</Link>
<Link href="/admin/reports" style={{
padding: '12px 24px',
backgroundColor: '#10b981',
color: 'white',
@@ -107,7 +108,7 @@ const AdminDashboard: NextPage = () => {
borderRadius: '6px'
}}>
Hlásenia
</a>
</Link>
</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 Head from 'next/head'
import Link from 'next/link'
interface Source {
id: number
@@ -18,11 +19,7 @@ const SourcesManagement: NextPage = () => {
const [loading, setLoading] = useState(true)
const [filter, setFilter] = useState('pending')
useEffect(() => {
fetchSources()
}, [filter])
const fetchSources = async () => {
const fetchSources = useCallback(async () => {
try {
const response = await fetch(`/api/admin/sources?status=${filter}`)
if (response.ok) {
@@ -34,7 +31,11 @@ const SourcesManagement: NextPage = () => {
} finally {
setLoading(false)
}
}
}, [filter])
useEffect(() => {
fetchSources()
}, [fetchSources])
const updateSource = async (id: number, status: string, riskLevel: number) => {
try {
@@ -158,7 +159,7 @@ const SourcesManagement: NextPage = () => {
)}
<div style={{ marginTop: '30px' }}>
<a href="/admin" style={{
<Link href="/admin" style={{
padding: '10px 20px',
backgroundColor: '#6b7280',
color: 'white',
@@ -166,7 +167,7 @@ const SourcesManagement: NextPage = () => {
borderRadius: '6px'
}}>
Späť na dashboard
</a>
</Link>
</div>
</div>
</div>

View File

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

View File

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