diff --git a/.gitignore b/.gitignore index a547bf3..5ef6a52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,41 @@ -# Logs -logs -*.log +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/versions + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug npm-debug.log* yarn-debug.log* yarn-error.log* -pnpm-debug.log* -lerna-debug.log* +.pnpm-debug.log* -node_modules -dist -dist-ssr -*.local +# env files (can opt-in for committing if needed) +.env* -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? +# vercel +.vercel + +# typescript +*.tsbuildinfo +next-env.d.ts diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..23fd35f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.formatOnSave": true +} \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..719cea2 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,25 @@ +import { dirname } from "path"; +import { fileURLToPath } from "url"; +import { FlatCompat } from "@eslint/eslintrc"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +const compat = new FlatCompat({ + baseDirectory: __dirname, +}); + +const eslintConfig = [ + ...compat.extends("next/core-web-vitals", "next/typescript"), + { + ignores: [ + "node_modules/**", + ".next/**", + "out/**", + "build/**", + "next-env.d.ts", + ], + }, +]; + +export default eslintConfig; diff --git a/index.html b/index.html deleted file mode 100644 index 22f6ccf..0000000 --- a/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/next.config.ts b/next.config.ts new file mode 100644 index 0000000..adbef04 --- /dev/null +++ b/next.config.ts @@ -0,0 +1,14 @@ +import type { NextConfig } from 'next' + +const isProd = process.env.NODE_ENV === 'production' +const internalHost = process.env.TAURI_DEV_HOST || 'localhost' +const nextConfig: NextConfig = { + output: 'export', + images: { + unoptimized: true + }, + assetPrefix: isProd ? undefined : `http://${internalHost}:3000`, + devIndicators: false +} + +export default nextConfig diff --git a/package.json b/package.json index b902283..0443964 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,13 @@ "version": "1.0.0", "type": "module", "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "preview": "vite preview", + "dev": "next dev --turbopack", + "build": "next build", + "start": "next start", + "lint": "next lint", "tauri": "tauri" }, "dependencies": { - "@fontsource/roboto": "5.2.6", "@tauri-apps/api": "2.8.0", "@tauri-apps/plugin-dialog": "2.3.3", "@tauri-apps/plugin-fs": "2.4.2", @@ -20,7 +20,8 @@ "axios": "1.11.0", "date-fns": "4.1.0", "react": "19.1.1", - "react-dom": "19.1.1" + "react-dom": "19.1.1", + "next": "15.5.0" }, "devDependencies": { "@fortawesome/fontawesome-svg-core": "7.0.0", @@ -32,11 +33,12 @@ "@types/crypto-js": "4.2.2", "@types/react": "19.1.11", "@types/react-dom": "19.1.7", - "@vitejs/plugin-react": "5.0.1", "crypto-js": "4.2.0", - "postcss": "8.5.6", + "@types/node": "24.3.0", "tailwindcss": "4.1.12", "typescript": "5.9.2", - "vite": "7.1.3" + "eslint": "9.34.0", + "eslint-config-next": "15.5.0", + "@eslint/eslintrc": "3.3.1" } } diff --git a/postcss.config.mjs b/postcss.config.mjs index 1d5a3b2..c7bcb4b 100644 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -1,5 +1,5 @@ -export default { - plugins: { - '@tailwindcss/postcss': {} - } -} +const config = { + plugins: ["@tailwindcss/postcss"], +}; + +export default config; diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 0447c04..3822a1a 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -5,9 +5,9 @@ "identifier": "xyz.lncvrt.berrydash-launcher", "build": { "beforeDevCommand": "yarn dev", - "devUrl": "http://localhost:1420", + "devUrl": "http://localhost:3000", "beforeBuildCommand": "yarn build", - "frontendDist": "../dist" + "frontendDist": "../out" }, "app": { "windows": [ diff --git a/src-tauri/tauri.linux.conf.json b/src-tauri/tauri.linux.conf.json index 5aac621..697ea51 100644 --- a/src-tauri/tauri.linux.conf.json +++ b/src-tauri/tauri.linux.conf.json @@ -5,9 +5,9 @@ "identifier": "xyz.lncvrt.berrydash-launcher", "build": { "beforeDevCommand": "yarn dev", - "devUrl": "http://localhost:1420", + "devUrl": "http://localhost:3000", "beforeBuildCommand": "yarn build", - "frontendDist": "../dist" + "frontendDist": "../out" }, "app": { "windows": [ diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.json index b178aed..12359ad 100644 --- a/src-tauri/tauri.macos.conf.json +++ b/src-tauri/tauri.macos.conf.json @@ -5,9 +5,9 @@ "identifier": "xyz.lncvrt.berrydash-launcher", "build": { "beforeDevCommand": "yarn dev", - "devUrl": "http://localhost:1420", + "devUrl": "http://localhost:3000", "beforeBuildCommand": "yarn build", - "frontendDist": "../dist" + "frontendDist": "../out" }, "app": { "macOSPrivateApi": true, diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.json index f0a8832..3fbf9c8 100644 --- a/src-tauri/tauri.windows.conf.json +++ b/src-tauri/tauri.windows.conf.json @@ -5,9 +5,9 @@ "identifier": "xyz.lncvrt.berrydash-launcher", "build": { "beforeDevCommand": "yarn dev", - "devUrl": "http://localhost:1420", + "devUrl": "http://localhost:3000", "beforeBuildCommand": "yarn build", - "frontendDist": "../dist" + "frontendDist": "../out" }, "app": { "withGlobalTauri": true, diff --git a/src/app/GlobalProvider.tsx b/src/app/GlobalProvider.tsx new file mode 100644 index 0000000..c891827 --- /dev/null +++ b/src/app/GlobalProvider.tsx @@ -0,0 +1,47 @@ +'use client' + +import { createContext, useContext, ReactNode } from 'react' +import { LauncherVersion } from './types/LauncherVersion' +import { DownloadProgress } from './types/DownloadProgress' +import { VersionsConfig } from './types/VersionsConfig' +import { NormalConfig } from './types/NormalConfig' +import { DownloadedVersion } from './types/DownloadedVersion' + +type GlobalCtxType = { + versionList: LauncherVersion[] | null + setVersionList: (v: LauncherVersion[] | null) => void + selectedVersionList: LauncherVersion[] + setSelectedVersionList: (v: LauncherVersion[]) => void + downloadProgress: DownloadProgress[] + setDownloadProgress: (v: DownloadProgress[]) => void + showPopup: boolean + setShowPopup: (v: boolean) => void + popupMode: number | null + setPopupMode: (v: number | null) => void + fadeOut: boolean + setFadeOut: (v: boolean) => void + downloadedVersionsConfig: VersionsConfig | null + setDownloadedVersionsConfig: (v: VersionsConfig | null) => void + normalConfig: NormalConfig | null + setNormalConfig: (v: NormalConfig | null) => void + managingVersion: DownloadedVersion | null + setManagingVersion: (v: DownloadedVersion | null) => void +} + +const GlobalCtx = createContext(null) + +export const useGlobal = () => { + const ctx = useContext(GlobalCtx) + if (!ctx) throw new Error('useGlobal must be inside GlobalProvider') + return ctx +} + +export const GlobalProvider = ({ + children, + value +}: { + children: ReactNode + value: GlobalCtxType +}) => { + return {children} +} diff --git a/src/Globals.css b/src/app/Globals.css similarity index 96% rename from src/Globals.css rename to src/app/Globals.css index ceb057b..2278344 100644 --- a/src/Globals.css +++ b/src/app/Globals.css @@ -1,7 +1,6 @@ -@import 'tailwindcss'; +@import "tailwindcss"; body { - font-family: 'Roboto', sans-serif; @apply bg-[#0f0f0f] text-white select-none; } diff --git a/src/Icon.png b/src/app/Icon.png similarity index 100% rename from src/Icon.png rename to src/app/Icon.png diff --git a/src/routes/Installs.css b/src/app/Installs.css similarity index 95% rename from src/routes/Installs.css rename to src/app/Installs.css index 44e3de9..dc5d201 100644 --- a/src/routes/Installs.css +++ b/src/app/Installs.css @@ -1,4 +1,4 @@ -@import 'tailwindcss'; +@import "tailwindcss"; .downloads-container { @apply flex justify-center; diff --git a/src/componets/Setting.css b/src/app/componets/Setting.css similarity index 94% rename from src/componets/Setting.css rename to src/app/componets/Setting.css index 943d096..799413c 100644 --- a/src/componets/Setting.css +++ b/src/app/componets/Setting.css @@ -1,4 +1,4 @@ -@import 'tailwindcss'; +@import "tailwindcss"; .setting-checkbox-wrapper { @apply relative w-5 h-5; diff --git a/src/componets/Setting.tsx b/src/app/componets/Setting.tsx similarity index 100% rename from src/componets/Setting.tsx rename to src/app/componets/Setting.tsx index 3168cc5..17d8cce 100644 --- a/src/componets/Setting.tsx +++ b/src/app/componets/Setting.tsx @@ -1,7 +1,7 @@ -import { SettingProps } from '../types/SettingProps' import './Setting.css' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faCheck } from '@fortawesome/free-solid-svg-icons' +import { SettingProps } from '../types/SettingProps' export function Setting ({ label, value, onChange, className }: SettingProps) { return ( diff --git a/src/componets/Sidebar.css b/src/app/componets/Sidebar.css similarity index 97% rename from src/componets/Sidebar.css rename to src/app/componets/Sidebar.css index 1602c3e..fcfe0ff 100644 --- a/src/componets/Sidebar.css +++ b/src/app/componets/Sidebar.css @@ -1,4 +1,4 @@ -@import 'tailwindcss'; +@import "tailwindcss"; .sidebar { @apply fixed top-0 left-0 w-60 h-screen bg-[#161616] flex flex-col border-e-[1px] border-[#242424] z-[1]; diff --git a/src/componets/Sidebar.tsx b/src/app/componets/Sidebar.tsx similarity index 79% rename from src/componets/Sidebar.tsx rename to src/app/componets/Sidebar.tsx index c25ea7b..ca93f25 100644 --- a/src/componets/Sidebar.tsx +++ b/src/app/componets/Sidebar.tsx @@ -1,3 +1,5 @@ +'use client' + import './Sidebar.css' import Icon from '../Icon.png' import { openUrl } from '@tauri-apps/plugin-opener' @@ -12,16 +14,17 @@ import { faDiscord } from '@fortawesome/free-brands-svg-icons' import { useState } from 'react' import { platform } from '@tauri-apps/plugin-os' import { getCurrentWindow } from '@tauri-apps/api/window' -import { SidebarProps } from '../types/SidebarProps' +import { useGlobal } from '../GlobalProvider' +import Image from 'next/image' +import Link from 'next/link' +import { usePathname } from 'next/navigation' -export default function Sidebar ({ - setShowPopup, - setPopupMode, - setFadeOut, - downloadProgress -}: SidebarProps) { +export default function Sidebar () { const [rot, setRot] = useState(0) const [dir, setDir] = useState(1) + const { setShowPopup, setPopupMode, setFadeOut, downloadProgress } = + useGlobal() + const pathname = usePathname() return (