diff --git a/Extension/background.js b/Extension/background.js index d099d67..d31f37e 100644 --- a/Extension/background.js +++ b/Extension/background.js @@ -53,7 +53,8 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { // eBay Parsing Response (from eBay content script) if (msg?.action === "PARSE_COMPLETE") { - handleParseComplete(sender.tab?.id, msg.data); + const tabId = sender?.tab?.id; + handleParseComplete(tabId, msg.data); return true; } }); @@ -100,7 +101,10 @@ async function handleParseRequest(url, sendResponse) { url: url, active: false }); - + if (!tab?.id) { + sendResponse({ ok: false, error: "Tab could not be created" }); + return; + } const tabId = tab.id; console.log("[BACKGROUND] Tab created:", tabId); @@ -330,6 +334,7 @@ function handleParseComplete(tabId, data) { * Cleans up parse request: closes tab, clears timeout, sends response */ async function cleanupParseRequest(tabId, data, error) { + if (tabId == null) return; const request = activeParseRequests.get(tabId); if (!request) return; @@ -410,7 +415,10 @@ async function handleScanProductsRequest(url, accountId, sendResponse) { url: targetUrl, active: false }); - + if (!tab?.id) { + sendResponse({ ok: false, error: "Tab could not be created" }); + return; + } const tabId = tab.id; // Set up timeout @@ -562,7 +570,10 @@ async function loadAndParseEachItemTab(items) { url: item.url, active: false }); - + if (!tab?.id) { + console.warn(`[BACKGROUND] Tab could not be created for item ${i + 1}, skipping`); + continue; + } await new Promise((resolve) => { const listener = (tabId, changeInfo) => { if (tabId === tab.id && changeInfo.status === "complete") { @@ -647,6 +658,7 @@ async function handleScanComplete(tabId, data) { * Cleans up scan request: closes tab, clears timeout, sends response */ async function cleanupScanRequest(tabId, data, error) { + if (tabId == null) return; const request = activeScanRequests.get(tabId); if (!request) return; @@ -751,7 +763,9 @@ async function handleParseAccountExtendedRequest(url, sendResponse) { url: url, active: false }); - + if (!baseTab?.id) { + throw new Error("Tab could not be created"); + } await new Promise((resolve) => { const checkLoaded = (tabId, changeInfo) => { if (tabId === baseTab.id && changeInfo.status === 'complete') { @@ -849,6 +863,10 @@ async function parseSingleTab(url, action, timeoutMs) { url: url, active: false }); + if (!tab?.id) { + reject(new Error("Tab could not be created")); + return; + } tabId = tab.id; // Set up timeout diff --git a/Server/src/App.jsx b/Server/src/App.jsx index 11b7722..5276a57 100644 --- a/Server/src/App.jsx +++ b/Server/src/App.jsx @@ -9,6 +9,7 @@ import { IconSettings, IconUserBolt, IconShoppingBag, + IconRobot, } from "@tabler/icons-react"; import { motion } from "motion/react"; import { cn } from "./lib/utils"; @@ -440,6 +441,17 @@ export default function App() { navigate("/blacklist"); }, }, + { + label: "KI", + href: "#/ki", + icon: ( + + ), + onClick: (e) => { + e.preventDefault(); + navigate("/ki"); + }, + }, { label: "Settings", href: "#", @@ -463,6 +475,17 @@ export default function App() { if (route === "/analysis") { return ; } + if (route === "/ki") { + return ( +
+
+ +

KI

+

KI-Seite wird hier angezeigt

+
+
+ ); + } // Default: Dashboard return ; }; diff --git a/Server/src/components/dashboard/sections/OverviewSection.jsx b/Server/src/components/dashboard/sections/OverviewSection.jsx index 77c5d84..4e1e779 100644 --- a/Server/src/components/dashboard/sections/OverviewSection.jsx +++ b/Server/src/components/dashboard/sections/OverviewSection.jsx @@ -161,17 +161,20 @@ export const OverviewSection = ({ onJumpToSection, activeAccountId }) => { }} />
-

Product overview

-
- {loading ? "Loading..." : kpis ? `${kpis.totalProducts} total products` : "No data"} -
+

News

+ {loading ? ( +
Loading...
+ ) : ( +
+
    +
  • - System update available
  • +
  • - New features released
  • +
  • - Dashboard improvements
  • +
+
+ )}
- +
Latest updates
@@ -206,6 +209,31 @@ export const OverviewSection = ({ onJumpToSection, activeAccountId }) => { + + {activeAccountId && !loading && !error && kpis && ( +
+
+
+

Product overview

+
+ {loading ? "Loading..." : kpis ? `${kpis.totalProducts} total products` : "No data"} +
+
+ +
+
+
+ )} ); }; diff --git a/Server/src/components/dashboard/sections/ProductsSection.jsx b/Server/src/components/dashboard/sections/ProductsSection.jsx index 36cf0b7..63a94c6 100644 --- a/Server/src/components/dashboard/sections/ProductsSection.jsx +++ b/Server/src/components/dashboard/sections/ProductsSection.jsx @@ -328,11 +328,15 @@ export const ProductsSection = ({ onJumpToSection, activeAccountId }) => { handleOpenProduct(row.$id)} renderCell={(col, row) => { if (col === "Action") { return (