PDFs in Projekt in public Verzeichnis
This commit is contained in:
@@ -3,16 +3,35 @@ import { useEffect } from "react";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { ClipLoader } from "react-spinners";
|
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() {
|
export default function WaitPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
useEffect(() => {
|
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(() => {
|
const timer = setTimeout(() => {
|
||||||
router.push("/");
|
router.push("/");
|
||||||
}, 20000); // 20 Sekunden warten
|
}, 20000);
|
||||||
|
|
||||||
// Timer aufräumen, wenn die Komponente entladen wird
|
// Cleanup timer when component is unmounted
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}, [router]);
|
}, [router]);
|
||||||
|
|
||||||
|
|||||||
@@ -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 ReactModal from "react-modal";
|
||||||
import { ClipLoader } from "react-spinners";
|
import { ClipLoader } from "react-spinners";
|
||||||
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
|
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
|
||||||
|
|||||||
BIN
public/doku/ACCESS.PDF
Normal file
BIN
public/doku/ACCESS.PDF
Normal file
Binary file not shown.
BIN
public/doku/CPL.PDF
Normal file
BIN
public/doku/CPL.PDF
Normal file
Binary file not shown.
BIN
public/doku/CPL220.PDF
Normal file
BIN
public/doku/CPL220.PDF
Normal file
Binary file not shown.
BIN
public/doku/CPL3.PDF
Normal file
BIN
public/doku/CPL3.PDF
Normal file
Binary file not shown.
BIN
public/doku/Daten_APL.pdf
Normal file
BIN
public/doku/Daten_APL.pdf
Normal file
Binary file not shown.
BIN
public/doku/Daten_CDO.pdf
Normal file
BIN
public/doku/Daten_CDO.pdf
Normal file
Binary file not shown.
BIN
public/doku/Daten_DPL.pdf
Normal file
BIN
public/doku/Daten_DPL.pdf
Normal file
Binary file not shown.
BIN
public/doku/KUE605.PDF
Normal file
BIN
public/doku/KUE605.PDF
Normal file
Binary file not shown.
BIN
public/doku/KUE605uC.PDF
Normal file
BIN
public/doku/KUE605uC.PDF
Normal file
Binary file not shown.
BIN
public/doku/KUE605uF.PDF
Normal file
BIN
public/doku/KUE605uF.PDF
Normal file
Binary file not shown.
BIN
public/doku/KUE705FO.PDF
Normal file
BIN
public/doku/KUE705FO.PDF
Normal file
Binary file not shown.
BIN
public/doku/Meldungen.ods
Normal file
BIN
public/doku/Meldungen.ods
Normal file
Binary file not shown.
BIN
public/doku/Meldungen.xlsx
Normal file
BIN
public/doku/Meldungen.xlsx
Normal file
Binary file not shown.
BIN
public/doku/Modem.pdf
Normal file
BIN
public/doku/Modem.pdf
Normal file
Binary file not shown.
BIN
public/doku/PST212.PDF
Normal file
BIN
public/doku/PST212.PDF
Normal file
Binary file not shown.
BIN
public/doku/Temper.pdf
Normal file
BIN
public/doku/Temper.pdf
Normal file
Binary file not shown.
BIN
public/doku/Wasser.pdf
Normal file
BIN
public/doku/Wasser.pdf
Normal file
Binary file not shown.
BIN
public/doku/XIOPM.PDF
Normal file
BIN
public/doku/XIOPM.PDF
Normal file
Binary file not shown.
@@ -1,13 +1,17 @@
|
|||||||
import { openDB } from "idb";
|
import { openDB } from "idb"; // utils/indexedDB.js
|
||||||
|
|
||||||
const dbPromise = openDB("my-pdf-store", 1, {
|
const dbPromise = openDB("my-pdf-store", 1, {
|
||||||
upgrade(db) {
|
upgrade(db) {
|
||||||
if (!db.objectStoreNames.contains("pdfs")) {
|
if (!db.objectStoreNames.contains("pdfs")) {
|
||||||
db.createObjectStore("pdfs");
|
db.createObjectStore("pdfs");
|
||||||
}
|
}
|
||||||
|
if (!db.objectStoreNames.contains("pages")) {
|
||||||
|
db.createObjectStore("pages");
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Store PDF
|
||||||
export async function storePDF(name, file) {
|
export async function storePDF(name, file) {
|
||||||
const db = await dbPromise;
|
const db = await dbPromise;
|
||||||
await db.put("pdfs", file, name);
|
await db.put("pdfs", file, name);
|
||||||
@@ -17,3 +21,14 @@ export async function getPDF(name) {
|
|||||||
const db = await dbPromise;
|
const db = await dbPromise;
|
||||||
return await db.get("pdfs", name);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user