diff --git a/seeder/electron.vite.config.ts b/seeder/electron.vite.config.ts index 1f994f6007..9fe24a0c94 100644 --- a/seeder/electron.vite.config.ts +++ b/seeder/electron.vite.config.ts @@ -73,7 +73,8 @@ export default defineConfig({ "@routes": resolve(__dirname, "./src/renderer/routes"), "@layouts": resolve(__dirname, "./src/renderer/layouts"), "@constants": resolve(__dirname, "./src/renderer/constants"), - "@utils": resolve(__dirname, "./src/renderer/utils") + "@utils": resolve(__dirname, "./src/renderer/utils"), + "@stores": resolve(__dirname, "./src/renderer/stores") } }, plugins: [solid(), svg()] diff --git a/seeder/package-lock.json b/seeder/package-lock.json index 0913970246..16512f336d 100644 --- a/seeder/package-lock.json +++ b/seeder/package-lock.json @@ -13,6 +13,7 @@ "@electron-toolkit/utils": "^3.0.0", "better-sqlite3": "^11.1.2", "cors": "^2.8.5", + "diff": "^5.2.0", "electron-updater": "^6.1.7", "express": "^4.19.2", "local-devices": "^4.0.0" @@ -24,9 +25,11 @@ "@electron-toolkit/tsconfig": "^1.0.1", "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.9.0", + "@solid-primitives/event-dispatcher": "^0.0.107", "@solidjs/router": "^0.14.1", "@types/better-sqlite3": "^7.6.11", "@types/cors": "^2.8.17", + "@types/diff": "^5.2.1", "@types/express": "^4.17.21", "@types/node": "^22.2.0", "@typescript-eslint/eslint-plugin": "^8.0.1", @@ -2054,6 +2057,16 @@ "url": "https://github.com/sindresorhus/is?sponsor=1" } }, + "node_modules/@solid-primitives/event-dispatcher": { + "version": "0.0.107", + "resolved": "https://registry.npmjs.org/@solid-primitives/event-dispatcher/-/event-dispatcher-0.0.107.tgz", + "integrity": "sha512-DtSz/fu5wmO7i5OVVx7lf1ykhFvEF/OEpuND6o5/8ktfBCdIJw2OlaXI7UG3O5CcFyaXxp1gVdoEi7Yt0Ezw7Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "solid-js": "^1.6.12" + } + }, "node_modules/@solidjs/router": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/@solidjs/router/-/router-0.14.1.tgz", @@ -2200,6 +2213,13 @@ "@types/ms": "*" } }, + "node_modules/@types/diff": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@types/diff/-/diff-5.2.1.tgz", + "integrity": "sha512-uxpcuwWJGhe2AR1g8hD9F5OYGCqjqWnBUQFD8gMZsDbv8oPHzxJF6iMO6n8Tk0AdzlxoaaoQhOYlIg/PukVU8g==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", @@ -4452,6 +4472,15 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/diff": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", + "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/dir-compare": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/dir-compare/-/dir-compare-3.3.0.tgz", diff --git a/seeder/package.json b/seeder/package.json index 54b6f08b20..2f216b5a84 100644 --- a/seeder/package.json +++ b/seeder/package.json @@ -24,6 +24,7 @@ "@electron-toolkit/utils": "^3.0.0", "better-sqlite3": "^11.1.2", "cors": "^2.8.5", + "diff": "^5.2.0", "electron-updater": "^6.1.7", "express": "^4.19.2", "local-devices": "^4.0.0" @@ -35,9 +36,11 @@ "@electron-toolkit/tsconfig": "^1.0.1", "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.9.0", + "@solid-primitives/event-dispatcher": "^0.0.107", "@solidjs/router": "^0.14.1", "@types/better-sqlite3": "^7.6.11", "@types/cors": "^2.8.17", + "@types/diff": "^5.2.1", "@types/express": "^4.17.21", "@types/node": "^22.2.0", "@typescript-eslint/eslint-plugin": "^8.0.1", diff --git a/seeder/src/renderer/components/CommandInitializer.tsx b/seeder/src/renderer/components/CommandInitializer.tsx new file mode 100644 index 0000000000..2f11dd6d68 --- /dev/null +++ b/seeder/src/renderer/components/CommandInitializer.tsx @@ -0,0 +1,61 @@ +import { PLATFORMS } from "@renderer/constants/shiinobi"; +import { Component, createSignal, For } from "solid-js"; +import { createEventDispatcher } from "@solid-primitives/event-dispatcher"; + +type Props = { + title: string; + onFetchClick: (e: CustomEvent) => void; +}; + +const CommandInitializer: Component = (props) => { + const [platform, setPlatform] = createSignal<(typeof PLATFORMS)[0]>("myanimelist"); + + const dispatch = createEventDispatcher(props); + + const handleFetchClick = () => { + dispatch("fetchClick", platform()); + }; + + return ( +
+

{props.title}

+
+ Select Platform: + +
+ +
+ ); +}; + +export default CommandInitializer; diff --git a/seeder/src/renderer/components/RenderDiffField.tsx b/seeder/src/renderer/components/RenderDiffField.tsx new file mode 100644 index 0000000000..4ea363165b --- /dev/null +++ b/seeder/src/renderer/components/RenderDiffField.tsx @@ -0,0 +1,37 @@ +import { Change } from "diff"; +import { Component, For } from "solid-js"; + +type Props = { + diff: { + [key: string]: Change[]; + }; + field: string; + type: "old" | "new"; +}; + +const RenderDiffField: Component = (props) => { + return ( +
+ + props.type === "old" ? !part.added : !part.removed + )} + > + {(part) => ( + + {part.removed ? "-" : part.added ? "+" : ""} {part.value} + + )} + +
+ ); +}; + +export default RenderDiffField; diff --git a/seeder/src/renderer/components/navbar/index.tsx b/seeder/src/renderer/components/navbar/index.tsx index 97260ba6a1..269c2fc4ba 100644 --- a/seeder/src/renderer/components/navbar/index.tsx +++ b/seeder/src/renderer/components/navbar/index.tsx @@ -1,14 +1,22 @@ import type { Component } from "solid-js"; import CoreLogo from "@assets/icons/core/logo.svg?component-solid"; import CoreSeederLogo from "@assets/icons/core/coreseeder.svg?component-solid"; +import sidebarStore from "@stores/sidebar"; const Navbar: Component = () => { return ( -
-
+
+
+ -
+