Admin Panel storage fix

This commit is contained in:
michi 2025-08-26 14:52:01 +02:00
parent fe119df89f
commit de231cdf5e
15 changed files with 58 additions and 15 deletions

View File

@ -2,7 +2,9 @@
"polyfillFiles": [ "polyfillFiles": [
"static/chunks/polyfills.js" "static/chunks/polyfills.js"
], ],
"devFiles": [], "devFiles": [
"static/chunks/react-refresh.js"
],
"ampDevFiles": [], "ampDevFiles": [],
"lowPriorityFiles": [ "lowPriorityFiles": [
"static/development/_buildManifest.js", "static/development/_buildManifest.js",
@ -10,7 +12,21 @@
], ],
"rootMainFiles": [], "rootMainFiles": [],
"pages": { "pages": {
"/_app": [] "/_app": [
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/_app.js"
],
"/_error": [
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/_error.js"
],
"/admin/login": [
"static/chunks/webpack.js",
"static/chunks/main.js",
"static/chunks/pages/admin/login.js"
]
}, },
"ampFirstPages": [] "ampFirstPages": []
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1 +1 @@
self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":[],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/_app":[]},"ampFirstPages":[]} self.__BUILD_MANIFEST={"polyfillFiles":["static/chunks/polyfills.js"],"devFiles":["static/chunks/react-refresh.js"],"ampDevFiles":[],"lowPriorityFiles":["static/development/_buildManifest.js","static/development/_ssgManifest.js"],"rootMainFiles":[],"pages":{"/_app":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_app.js"],"/_error":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/_error.js"],"/admin/login":["static/chunks/webpack.js","static/chunks/main.js","static/chunks/pages/admin/login.js"]},"ampFirstPages":[]}

View File

@ -1,6 +1,25 @@
{ {
"sortedMiddleware": [], "sortedMiddleware": [
"middleware": {}, "/"
],
"middleware": {
"/": {
"files": [
"server/edge-runtime-webpack.js",
"server/middleware.js"
],
"name": "middleware",
"page": "/",
"matchers": [
{
"regexp": "^/.*$",
"originalSource": "/:path*"
}
],
"wasm": [],
"assets": []
}
},
"functions": {}, "functions": {},
"version": 2 "version": 2
} }

View File

@ -1 +1,6 @@
{} {
"/_app": "pages/_app.js",
"/_error": "pages/_error.js",
"/_document": "pages/_document.js",
"/admin/login": "pages/admin/login.js"
}

View File

@ -1 +1 @@
self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},sortedPages:["\u002F_app"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB() self.__BUILD_MANIFEST = {__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static\u002Fchunks\u002Fpages\u002F_error.js"],"/admin/login":["static\u002Fchunks\u002Fpages\u002Fadmin\u002Flogin.js"],sortedPages:["\u002F_app","\u002F_error","\u002Fadmin\u002Flogin"]};self.__BUILD_MANIFEST_CB && self.__BUILD_MANIFEST_CB()

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,6 @@
"type": "text", "type": "text",
"value": "asdasdasdasdasdasdasd" "value": "asdasdasdasdasdasdasd"
} }
], ]
"index": 0
} }
] ]

View File

@ -14,14 +14,18 @@ export default function AdminPanel() {
}; };
const handleSave = async (entry, index = null) => { const handleSave = async (entry, index = null) => {
// Entferne das 'index' Feld aus dem Entry bevor es gespeichert wird
const cleanEntry = { ...entry };
delete cleanEntry.index;
let updatedEntries; let updatedEntries;
if (index !== null) { if (index !== null) {
// Bearbeite bestehenden Eintrag // Bearbeite bestehenden Eintrag
updatedEntries = entries.map((e, i) => i === index ? entry : e); updatedEntries = entries.map((e, i) => i === index ? cleanEntry : e);
} else { } else {
// Füge neuen Eintrag hinzu // Füge neuen Eintrag hinzu
updatedEntries = [...entries, entry]; updatedEntries = [...entries, cleanEntry];
} }
try { try {
@ -169,7 +173,7 @@ export default function AdminPanel() {
<p className="text-gray-600">{entry.date}</p> <p className="text-gray-600">{entry.date}</p>
<p className="mb-4">{entry.description}</p> <p className="mb-4">{entry.description}</p>
<button <button
onClick={() => setSelectedEntry({ ...entry, index })} onClick={() => setSelectedEntry({ ...entry, editIndex: index })}
className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600" className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600"
> >
Bearbeiten Bearbeiten
@ -181,7 +185,7 @@ export default function AdminPanel() {
) : ( ) : (
<EntryForm <EntryForm
entry={selectedEntry} entry={selectedEntry}
onSave={(formData) => handleSave(formData, selectedEntry.index)} onSave={(formData) => handleSave(formData, selectedEntry.editIndex)}
/> />
)} )}
</div> </div>