diff --git a/Makefile b/Makefile index 4f0cb2f..a43b99e 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,11 @@ build: wails3 build @echo Done! +generate: + @echo Generating bindings... + wails3 generate bindings -ts + @echo Done! + release: @echo Building release application... wails3 package diff --git a/frontend/bindings/firefly-launcher/internal/app-service/appservice.js b/frontend/bindings/firefly-launcher/internal/app-service/appservice.js index 31fed0c..c7fc0e6 100644 --- a/frontend/bindings/firefly-launcher/internal/app-service/appservice.js +++ b/frontend/bindings/firefly-launcher/internal/app-service/appservice.js @@ -28,9 +28,30 @@ export function GetCurrentLauncherVersion() { return $Call.ByID(3575133982); } +/** + * @returns {$CancellablePromise<[boolean, string]>} + */ +export function HideApp() { + return $Call.ByID(88003266); +} + +/** + * @returns {$CancellablePromise<[boolean, string]>} + */ +export function MaximizeApp() { + return $Call.ByID(1257306588); +} + /** * @returns {$CancellablePromise<[boolean, string]>} */ export function MinimizeApp() { return $Call.ByID(3434614194); } + +/** + * @returns {$CancellablePromise<[boolean, string]>} + */ +export function RestoreApp() { + return $Call.ByID(3115625834); +} diff --git a/frontend/index.html b/frontend/index.html index f9a62a1..be82471 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,5 +1,5 @@ - + @@ -9,7 +9,7 @@ -
+
diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 6aba156..9f13291 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -16,6 +16,7 @@ "path-browserify": "^1.0.1", "react": "^19.1.1", "react-dom": "^19.1.1", + "react-easy-crop": "^5.5.3", "react-toastify": "^11.0.5", "tailwindcss": "^4.1.14", "zustand": "^5.0.8" @@ -3783,6 +3784,12 @@ "node": ">=0.10.0" } }, + "node_modules/normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==", + "license": "BSD-3-Clause" + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -4000,6 +4007,20 @@ "react": "^19.2.0" } }, + "node_modules/react-easy-crop": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/react-easy-crop/-/react-easy-crop-5.5.3.tgz", + "integrity": "sha512-iKwFTnAsq+IVuyF6N0Q3zjRx9DG1NMySkwWxVfM/xAOeHYH1vhvM+V2kFiq5HOIQGWouITjfltCx54mbDpMpmA==", + "license": "MIT", + "dependencies": { + "normalize-wheel": "^1.0.1", + "tslib": "^2.0.1" + }, + "peerDependencies": { + "react": ">=16.4.0", + "react-dom": ">=16.4.0" + } + }, "node_modules/react-refresh": { "version": "0.17.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 7efc931..00c593d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,6 +19,7 @@ "path-browserify": "^1.0.1", "react": "^19.1.1", "react-dom": "^19.1.1", + "react-easy-crop": "^5.5.3", "react-toastify": "^11.0.5", "tailwindcss": "^4.1.14", "zustand": "^5.0.8" diff --git a/frontend/public/bg-1.jpeg b/frontend/public/bg-1.jpeg new file mode 100644 index 0000000..a5616ff Binary files /dev/null and b/frontend/public/bg-1.jpeg differ diff --git a/frontend/public/bg-10.jpg b/frontend/public/bg-10.jpg new file mode 100644 index 0000000..c13cf9d Binary files /dev/null and b/frontend/public/bg-10.jpg differ diff --git a/frontend/public/bg-11.jpeg b/frontend/public/bg-11.jpeg new file mode 100644 index 0000000..d1f8ca6 Binary files /dev/null and b/frontend/public/bg-11.jpeg differ diff --git a/frontend/public/bg-12.jpg b/frontend/public/bg-12.jpg new file mode 100644 index 0000000..c895fb5 Binary files /dev/null and b/frontend/public/bg-12.jpg differ diff --git a/frontend/public/bg-13.jpg b/frontend/public/bg-13.jpg new file mode 100644 index 0000000..43fd148 Binary files /dev/null and b/frontend/public/bg-13.jpg differ diff --git a/frontend/public/bg-16.jpg b/frontend/public/bg-16.jpg new file mode 100644 index 0000000..d0afc19 Binary files /dev/null and b/frontend/public/bg-16.jpg differ diff --git a/frontend/public/bg-2.png b/frontend/public/bg-2.png new file mode 100644 index 0000000..3f3e8f2 Binary files /dev/null and b/frontend/public/bg-2.png differ diff --git a/frontend/public/bg-3.png b/frontend/public/bg-3.png new file mode 100644 index 0000000..c4c24ee Binary files /dev/null and b/frontend/public/bg-3.png differ diff --git a/frontend/public/bg-5.jpeg b/frontend/public/bg-5.jpeg new file mode 100644 index 0000000..003290a Binary files /dev/null and b/frontend/public/bg-5.jpeg differ diff --git a/frontend/public/bg-6.png b/frontend/public/bg-6.png new file mode 100644 index 0000000..e1576c6 Binary files /dev/null and b/frontend/public/bg-6.png differ diff --git a/frontend/public/bg-7.jpeg b/frontend/public/bg-7.jpeg new file mode 100644 index 0000000..81a60f9 Binary files /dev/null and b/frontend/public/bg-7.jpeg differ diff --git a/frontend/public/bg-8.png b/frontend/public/bg-8.png new file mode 100644 index 0000000..971facd Binary files /dev/null and b/frontend/public/bg-8.png differ diff --git a/frontend/public/bg-9.jpeg b/frontend/public/bg-9.jpeg new file mode 100644 index 0000000..907ea71 Binary files /dev/null and b/frontend/public/bg-9.jpeg differ diff --git a/frontend/public/bg.jpg b/frontend/public/bg.jpg deleted file mode 100644 index 309e5a5..0000000 Binary files a/frontend/public/bg.jpg and /dev/null differ diff --git a/frontend/src/components/backgroudModal/index.tsx b/frontend/src/components/backgroudModal/index.tsx new file mode 100644 index 0000000..4b79c5d --- /dev/null +++ b/frontend/src/components/backgroudModal/index.tsx @@ -0,0 +1,180 @@ +'use client' + +import { useState, useRef } from 'react' +import { X, Image as ImageIcon, Plus, Upload, Check } from 'lucide-react' +import useSettingStore from '@/stores/settingStore' +import Cropper from 'react-easy-crop' +import getCroppedImg from '@/utils/cropImage' + +const initialImages = { + "bg-1": "bg-1.jpeg", + "bg-2": "bg-2.png", + "bg-3": "bg-3.png", + "bg-6": "bg-6.png", + "bg-7": "bg-7.jpeg", + "bg-8": "bg-8.png", + "bg-9": "bg-9.jpeg", + "bg-10": "bg-10.jpg", + "bg-11": "bg-11.jpeg", + "bg-12": "bg-12.jpg", + "bg-13": "bg-13.jpg", + "bg-16": "bg-16.jpg", +} + +export const BackgroundSelector = () => { + const [isOpen, setIsOpen] = useState(false) + const [newUrl, setNewUrl] = useState('') + const [croppingImage, setCroppingImage] = useState(null) + const [crop, setCrop] = useState({ x: 0, y: 0 }) + const [zoom, setZoom] = useState(1) + const [croppedAreaPixels, setCroppedAreaPixels] = useState(null) + const { background, setBackground, extraBackgrounds, setExtraBackgrounds } = useSettingStore() + const fileInputRef = useRef(null) + + const handleSelect = (img: string) => { + setIsOpen(false) + setBackground(img) + } + + const handleAddUrl = () => { + if (!newUrl.trim()) return setCroppingImage(newUrl) + setNewUrl('') + } + + const handleRemoveExtra = (url: string) => { + setExtraBackgrounds(extraBackgrounds.filter(bg => bg !== url)) + } + + const handleUploadFile = (file: File) => { + const reader = new FileReader() + reader.onload = () => setCroppingImage(reader.result as string) + reader.readAsDataURL(file) + } + + const handleCropComplete = async () => { + if (!croppingImage || !croppedAreaPixels) return + const croppedBase64 = await getCroppedImg(croppingImage, croppedAreaPixels) + setExtraBackgrounds([croppedBase64, ...extraBackgrounds]) + setCroppingImage(null) + } + + const allBackgrounds = [...extraBackgrounds, ...Object.values(initialImages)] + + return ( +
+
+ +
+ + {isOpen && ( +
+
+ + +

Choose Background

+ + {/* Add via URL */} +
+ setNewUrl(e.target.value)} + /> + +
+ + {/* Upload from computer */} +
+ + { + const file = e.target.files?.[0] + if (file) handleUploadFile(file) + e.target.value = '' + }} + /> +
+ + {/* Crop Modal */} + {croppingImage && ( +
+
+ setCroppedAreaPixels(croppedAreaPixels)} + /> + + +
+
+ )} + +
+ {allBackgrounds.map((value, i) => { + const isExtra = i < extraBackgrounds.length + return ( +
handleSelect(value)} + > + {`bg-${i}`} + {isExtra && ( + + )} +
+ ) + })} +
+
+
+ )} +
+ ) +} + diff --git a/frontend/src/components/closeModal/index.tsx b/frontend/src/components/closeModal/index.tsx index 7b2fad5..720f3a7 100644 --- a/frontend/src/components/closeModal/index.tsx +++ b/frontend/src/components/closeModal/index.tsx @@ -53,7 +53,7 @@ export default function CloseModal({ className="btn btn-warning" onClick={async () => { onClose() - const [success, message] = await AppService.MinimizeApp() + const [success, message] = await AppService.HideApp() if (!success) toast.error(message) if (!closingOption.isAsk) { setClosingOption({ isMinimize: true, isAsk: false }) diff --git a/frontend/src/components/header/index.tsx b/frontend/src/components/header/index.tsx index b09be11..ee27cb1 100644 --- a/frontend/src/components/header/index.tsx +++ b/frontend/src/components/header/index.tsx @@ -1,12 +1,35 @@ import { Link } from "@tanstack/react-router"; -import ThemeController from "../themeController"; import useModalStore from "@/stores/modalStore"; -import { Settings2 } from "lucide-react"; +import { Blend, BookOpen, Diff, Home, Info, Languages, Minus, Puzzle, Settings, TrendingUpDown, Wrench, X } from "lucide-react"; +import { AppService } from "@bindings/firefly-launcher/internal/app-service"; +import { motion } from "motion/react"; export default function Header() { const { setIsOpenSettingModal } = useModalStore() + + const controlButtons = [ + { + icon: , + action: () => setIsOpenSettingModal(true), + tip: "Settings", + hover: { rotate: 20, color: "#ffffff" }, + }, + { + icon: , + action: () => AppService.MinimizeApp(), + tip: "Minimize", + hover: { rotate: 20, color: "#ffffff" }, + }, + { + icon: , + action: () => AppService.CloseApp(), + tip: "Close", + hover: {color: "#ffffff", rotate: -10 }, + }, + ] + return ( -
+
@@ -14,7 +37,7 @@ export default function Header() {
    + className="menu menu-sm dropdown-content bg-black/50 backdrop-blur-md rounded-box z-1 mt-3 w-52 p-2 shadow">
  • Home
  • @@ -50,36 +73,79 @@ export default function Header() {
-
-