PDFs in Projekt in public Verzeichnis

This commit is contained in:
ISA
2024-10-18 11:42:52 +02:00
parent 421740cfc3
commit bbe49e549c
21 changed files with 39 additions and 5 deletions

View File

@@ -3,16 +3,35 @@ import { useEffect } from "react";
import { useRouter } from "next/navigation";
import { ClipLoader } from "react-spinners";
// IndexedDB functions only in the browser
let storePage, getPage;
if (typeof window !== "undefined") {
const indexedDBModule = require("../../utils/indexedDB");
storePage = indexedDBModule.storePage;
getPage = indexedDBModule.getPage;
}
export default function WaitPage() {
const router = useRouter();
useEffect(() => {
// Starte den Timer, um nach 20 Sekunden weiterzuleiten
// Store the page as a Blob in IndexedDB in the background
if (typeof window !== "undefined" && storePage) {
const pageContent = `
<div style="text-align: center; margin-top: 100px;">
<h1>Bitte warten...</h1>
<div class="spinner"></div>
<p>Die Seite wird automatisch neu geladen.</p>
</div>`;
storePage("waitPage", new Blob([pageContent], { type: "text/html" }));
}
// Timer to redirect after 20 seconds
const timer = setTimeout(() => {
router.push("/");
}, 20000); // 20 Sekunden warten
}, 20000);
// Timer aufräumen, wenn die Komponente entladen wird
// Cleanup timer when component is unmounted
return () => clearTimeout(timer);
}, [router]);

View File

@@ -1,4 +1,4 @@
import React, { useState, useEffect } from "react";
import React, { useState, useEffect } from "react"; // omponents/modales/settingsModal.jsx
import ReactModal from "react-modal";
import { ClipLoader } from "react-spinners";
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons

BIN
public/doku/ACCESS.PDF Normal file

Binary file not shown.

BIN
public/doku/CPL.PDF Normal file

Binary file not shown.

BIN
public/doku/CPL220.PDF Normal file

Binary file not shown.

BIN
public/doku/CPL3.PDF Normal file

Binary file not shown.

BIN
public/doku/Daten_APL.pdf Normal file

Binary file not shown.

BIN
public/doku/Daten_CDO.pdf Normal file

Binary file not shown.

BIN
public/doku/Daten_DPL.pdf Normal file

Binary file not shown.

BIN
public/doku/KUE605.PDF Normal file

Binary file not shown.

BIN
public/doku/KUE605uC.PDF Normal file

Binary file not shown.

BIN
public/doku/KUE605uF.PDF Normal file

Binary file not shown.

BIN
public/doku/KUE705FO.PDF Normal file

Binary file not shown.

BIN
public/doku/Meldungen.ods Normal file

Binary file not shown.

BIN
public/doku/Meldungen.xlsx Normal file

Binary file not shown.

BIN
public/doku/Modem.pdf Normal file

Binary file not shown.

BIN
public/doku/PST212.PDF Normal file

Binary file not shown.

BIN
public/doku/Temper.pdf Normal file

Binary file not shown.

BIN
public/doku/Wasser.pdf Normal file

Binary file not shown.

BIN
public/doku/XIOPM.PDF Normal file

Binary file not shown.

View File

@@ -1,13 +1,17 @@
import { openDB } from "idb";
import { openDB } from "idb"; // utils/indexedDB.js
const dbPromise = openDB("my-pdf-store", 1, {
upgrade(db) {
if (!db.objectStoreNames.contains("pdfs")) {
db.createObjectStore("pdfs");
}
if (!db.objectStoreNames.contains("pages")) {
db.createObjectStore("pages");
}
},
});
// Store PDF
export async function storePDF(name, file) {
const db = await dbPromise;
await db.put("pdfs", file, name);
@@ -17,3 +21,14 @@ export async function getPDF(name) {
const db = await dbPromise;
return await db.get("pdfs", name);
}
// Store page
export async function storePage(name, file) {
const db = await dbPromise;
await db.put("pages", file, name);
}
export async function getPage(name) {
const db = await dbPromise;
return await db.get("pages", name);
}