diff --git a/src/css/App.css b/src/css/App.css index 1d76bf5..c60b78b 100644 --- a/src/css/App.css +++ b/src/css/App.css @@ -1 +1,55 @@ -/* empty :P */ \ No newline at end of file +@keyframes splashPulse { + 0% { transform: scale(0.95) rotate(-20deg); } + 100% { transform: scale(1.08) rotate(-20deg); } +} + +.mc-splash { + animation: splashPulse 0.45s ease-in-out infinite alternate; + transform-origin: center; +} + +.mc-slider-custom { + -webkit-appearance: none; + appearance: none; + background: transparent; + height: 100%; + outline: none; + border: none; + margin: 0; + padding: 0; +} + +.mc-slider-custom::-webkit-slider-thumb { + -webkit-appearance: none; + appearance: none; + width: 14px; + height: 44px; + background: url('/images/Slider_Handle.png') no-repeat center; + background-size: 100% 100%; + cursor: pointer; + position: relative; + z-index: 30; +} + +*:focus { + outline: none !important; + box-shadow: none !important; +} + +button, input { + border-radius: 0 !important; + border: none !important; + outline: none !important; + box-shadow: none !important; +} + +.mc-sq-btn { + background: url('/images/Button_Square.png') no-repeat center; + background-size: 100% 100%; + image-rendering: pixelated; +} + +.mc-sq-btn:hover { + background: url('/images/Button_Square_Highlighted.png') no-repeat center; + background-size: 100% 100%; +} \ No newline at end of file diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 7e33dfb..834e160 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -1,5 +1,6 @@ -import { useEffect, useState } from "react"; +import { useEffect, useState, useMemo } from "react"; import { motion, AnimatePresence, MotionConfig } from "framer-motion"; +import "../css/App.css"; import HomeView from "../components/views/HomeView"; import SettingsView from "../components/views/SettingsView"; import VersionsView from "../components/views/VersionsView"; @@ -35,6 +36,7 @@ import { useLceLiveNotifications } from "../hooks/useLceLiveNotifications"; import type { Edition } from "../types/edition"; import pkg from "../../package.json"; export default function App() { + const ui = useUI(); const { showIntro, setShowIntro, @@ -49,24 +51,24 @@ export default function App() { updateMessage, updateUrl, clearUpdateMessage, - } = useUI(); + connected, + } = ui; const config = useConfig(); const audio = useAudio(); const game = useGame(); - const { skinUrl, setSkinUrl, capeUrl } = useSkin(); + const skin = useSkin(); + const { skinUrl, setSkinUrl, capeUrl } = skin; + const notifications = useLceLiveNotifications(); const { friendRequestMessage, gameInviteMessage, clearFriendRequestMessage, clearGameInviteMessage, - } = useLceLiveNotifications(); + } = notifications; const [showSetup, setShowSetup] = useState(false); - const [displayIsDay, setDisplayIsDay] = useState(config.isDayTime); const [isSetupChecked, setIsSetupChecked] = useState(false); + const displayIsDay = config.isDayTime; - useEffect(() => { - setDisplayIsDay(config.isDayTime); - }, [config.isDayTime]); useEffect(() => { if (config.isLoaded) { @@ -76,14 +78,13 @@ export default function App() { } }, [config.isLoaded]); - const selectedEdition = game.editions.find( - (e: Edition) => e.instanceId === config.profile, + const selectedEdition = useMemo(() => + game.editions.find((e: Edition) => e.instanceId === config.profile), + [game.editions, config.profile] ); - const selectedVersionName = selectedEdition?.name || ""; + const selectedVersionName = selectedEdition?.name ?? ""; const hasAnyInstall = game.installs.length > 0; - const titleImage = hasAnyInstall - ? selectedEdition?.titleImage || "/images/MenuTitle.png" - : "/images/MenuTitle.png"; + const titleImage = selectedEdition?.titleImage ?? "/images/MenuTitle.png"; useEffect(() => { const handleContextMenu = (e: MouseEvent) => e.preventDefault(); @@ -91,19 +92,20 @@ export default function App() { return () => document.removeEventListener("contextmenu", handleContextMenu); }, []); - const uiFade = { + const animDuration = config.animationsEnabled ? undefined : { duration: 0 }; + const uiFade = useMemo(() => ({ initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, - transition: { duration: config.animationsEnabled ? 0.5 : 0 }, - }; + transition: animDuration ?? { duration: 0.5 }, + }), [animDuration]); - const backgroundFade = { + const backgroundFade = useMemo(() => ({ initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, - transition: { duration: config.animationsEnabled ? 0.8 : 0 }, - }; + transition: animDuration ?? { duration: 0.8 }, + }), [animDuration]); if (!config.isLoaded || !isSetupChecked) { return
; @@ -140,16 +142,6 @@ export default function App() {
-
@@ -179,13 +171,11 @@ export default function App() { )} - - - + - - - - <> - {!config.legacyMode && ( - - - - )} - - {!config.legacyMode && ( - - - {displayIsDay ? "Day" : "Night"} - - - - )} - - {isUiHidden && - !displayIsDay && - activeView == "devtools" && ( - - - - )} - - - -
-
- - - <> - -
- {audio.splashIndex === -1 - ? `Welcome ${config.username}!` - : audio.splashes[audio.splashIndex]} -
-
- {activeView === "main" && - hasAnyInstall && - titleImage === "/images/MenuTitle.png" && ( - - {selectedVersionName} - - )} - -
-
-
- -
-
- - {activeView === "main" && ( - - )} - - -
- - {activeView === "main" && } - {activeView === "settings" && ( - - )} - {activeView === "versions" && ( - - )} - {activeView === "workshop" && ( - - )} - {activeView === "devtools" && ( - - )} - {activeView === "pck-editor" && ( - - )} - {activeView === "arc-editor" && ( - - )} - {activeView === "loc-editor" && ( - - )} - {activeView === "grf-editor" && ( - - )} - {activeView === "col-editor" && ( - - )} - {activeView === "options-editor" && ( - - )} - {activeView === "swf-editor" && ( - - )} - {activeView === "lcelive" && ( - - )} - {activeView === "skins" && } - {activeView === "screenshots" && ( - - )} - -
-
-
- - - -
- Version: {pkg.version} ({__BUILD_DATE__}) -
-
- Not affiliated with Mojang AB or Microsoft. "Minecraft" is - a trademark of Mojang Synergies AB. -
-
- {useUI().connected && "CONTROLLER CONNECTED"} -
-
-
+ + {!config.legacyMode && ( + + -
+ )} + + {!config.legacyMode && ( + + + {displayIsDay ? "Day" : "Night"} + + + + )} + + {isUiHidden && !displayIsDay && activeView === "devtools" && ( + + + + )} + +
+
+ + +
+ {audio.splashIndex === -1 + ? `Welcome ${config.username}!` + : audio.splashes[audio.splashIndex]} +
+
+ {activeView === "main" && hasAnyInstall && titleImage === "/images/MenuTitle.png" && ( + + {selectedVersionName} + + )} +
+
+ +
+
+ + {activeView === "main" && ( + + )} + + +
+ + {activeView === "main" && } + {activeView === "settings" && ( + + )} + {activeView === "versions" && ( + + )} + {activeView === "workshop" && ( + + )} + {activeView === "devtools" && ( + + )} + {activeView === "pck-editor" && ( + + )} + {activeView === "arc-editor" && ( + + )} + {activeView === "loc-editor" && ( + + )} + {activeView === "grf-editor" && ( + + )} + {activeView === "col-editor" && ( + + )} + {activeView === "options-editor" && ( + + )} + {activeView === "swf-editor" && ( + + )} + {activeView === "lcelive" && ( + + )} + {activeView === "skins" && } + {activeView === "screenshots" && ( + + )} + +
+
+
+ + +
+ Version: {pkg.version} ({__BUILD_DATE__}) +
+
+ Not affiliated with Mojang AB or Microsoft. "Minecraft" is + a trademark of Mojang Synergies AB. +
+
+ {connected && "CONTROLLER CONNECTED"} +
+
+