Improved mod install verbosity
This commit is contained in:
@@ -21,6 +21,7 @@ import { twMerge } from "tailwind-merge";
|
|||||||
import { motion, AnimatePresence } from "framer-motion";
|
import { motion, AnimatePresence } from "framer-motion";
|
||||||
import { GameVersion, Mod } from "@/lib/types";
|
import { GameVersion, Mod } from "@/lib/types";
|
||||||
import { versions } from "@/lib/launcher";
|
import { versions } from "@/lib/launcher";
|
||||||
|
import toast from "react-hot-toast";
|
||||||
|
|
||||||
function cn(...inputs: ClassValue[]) {
|
function cn(...inputs: ClassValue[]) {
|
||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs));
|
||||||
@@ -90,12 +91,17 @@ const ModsSection: React.FC<ModsSectionProps> = ({ version }) => {
|
|||||||
|
|
||||||
const handleInstall = async () => {
|
const handleInstall = async () => {
|
||||||
if (selectedModForInstall && selectedVersionsForInstall.length > 0) {
|
if (selectedModForInstall && selectedVersionsForInstall.length > 0) {
|
||||||
await installMod(selectedModForInstall, selectedVersionsForInstall);
|
|
||||||
setIsInstallDialogOpen(false);
|
setIsInstallDialogOpen(false);
|
||||||
|
toast.promise(installMod(selectedModForInstall, selectedVersionsForInstall), {
|
||||||
|
loading: `Installing mod: ${selectedModForInstall.name}`,
|
||||||
|
success: `Mod sucessfully installed: ${selectedModForInstall.name}`,
|
||||||
|
error: (e) => `${selectedModForInstall.name} Failed: ${e}`
|
||||||
|
}).then(async () => {
|
||||||
if (activeTab === "installed") {
|
if (activeTab === "installed") {
|
||||||
const m = await getInstalledMods(version.id);
|
const m = await getInstalledMods(version.id);
|
||||||
setMods(m);
|
setMods(m);
|
||||||
}
|
}
|
||||||
|
}).catch(console.error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user