From e916e60c6de6b8abd461c510819f2837f5b100fe Mon Sep 17 00:00:00 2001 From: OrigamingWasTaken <74014262+OrigamingWasTaken@users.noreply.github.com> Date: Wed, 10 Jul 2024 21:07:08 +0200 Subject: [PATCH] Changed the button to show if the app is currently connected or not --- frontend/src/assets/sidebar/comingsoon.png | Bin 813 -> 0 bytes frontend/src/assets/sidebar/play.png | Bin 0 -> 362 bytes frontend/src/windows/main/App.svelte | 5 + .../src/windows/main/Sidebar/Sidebar.svelte | 92 ++++++++++-------- frontend/src/windows/main/app.css | 4 + .../src/windows/main/pages/Credits.svelte | 8 ++ frontend/src/windows/main/ts/roblox/launch.ts | 10 +- package.json | 2 +- 8 files changed, 81 insertions(+), 40 deletions(-) delete mode 100644 frontend/src/assets/sidebar/comingsoon.png create mode 100644 frontend/src/assets/sidebar/play.png diff --git a/frontend/src/assets/sidebar/comingsoon.png b/frontend/src/assets/sidebar/comingsoon.png deleted file mode 100644 index 3858725c6501a285c2d7d3ab78ae40ff6f2f4b87..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 813 zcmV+|1JeA7P))xW8( z>Y1K}P1{&zB4VS13<1NebC4nD`r-8oawEpaeG0a1z!jhhyaZ}7gQ&?ddrk$|n&Pt` zSSSnTG%yY{VgjbgUh^CnNbtQAn2EXW8?ajoz}~HQkpQ#66X3c4_5nLQp{9USkr?lt z<4X?2Aq{{YU=&yp$A5t_8F-TUW~c=`lo*K5Mc}5~xQ|*8M}RL9bQO33?D4oRbjp2p z2E5Dhvqb~qqTHQ!uxkO=nhaV1&ZBG>fIpEypFFdX6~q9)HDL|{^9g}$JKa|xh>=-v zI4?wxQxk2Slfs(|$V?s(BQdt;0U3>PY9Xv03xF{S8p#UL@3dG~KY$Z*&QajI$28Lb zSxIT}iRLawQO!w4d^2N|^fnaYjEB>Z%os%tgn*2DI`z$rCdimCgzXN$0v!8fMiZnV zPui(=HG}iC%ot@=d_eAIblwR@8>H$3@;XO=q-mzDNgt4}IfJ;FvF{`MrB-eM%Ss?M zACQnj?*wBZqIO%c;8U%o6s$MKcdwG~W;(|IlQe?Gy;JWk6QrRO%+^HI`kZc-NA)s_ zy{%=b30vp~oSHc<-L3FqpHu?r)XlQ4RYo-719Gn*5F?qmqp-eIeLyM&f@tYd5f6=J ztM2>IXzf`S4A>;-F#&eA3kGarw3_90cd82pZX$X`20N*^%4?_@v&rpkkGcTBh#ru` zYzLd}0*D!Bhd$R1{LeLnnAiH0fNYbtKeUvoC14O`8|<)|U4#~k_^jYgvkxUeOlwZ3 zP7PqBpw`@!?v!iiJ=APZf1|i!+r`eVU2A4`pZICUH_N&_J7wBsFUsr_>1BD}n2=A^ rb@?37lHap(tSaZG{b69!Sg-aEZL#`-44n&i00000NkvXXu0mjf*-CPS diff --git a/frontend/src/assets/sidebar/play.png b/frontend/src/assets/sidebar/play.png new file mode 100644 index 0000000000000000000000000000000000000000..bc434db37eb7dfe2f67a6b1ca812e377d8685abe GIT binary patch literal 362 zcmV-w0hRuVP)rZ5G1h0 z3oaxN62%SfaU^+=C@yfLfgph|yx~&vAW>zM5zCUzLB9mGtoYPW-!(S6N!(1ZBj zO;~1sw1(_2`>uu0?;`s^OkYv9r8J&T5#Wc~A=20Qb@qeRXZEA+zJ=w(GW$Ac$iAT4 zjXjlX(EJj6ll`~Cc8;lBgM*mLH8_Z=T!TlPRJl^8)9Lsl-x!RR08W=KaR2}S07*qo IM6N<$f^PMgE&u=k literal 0 HcmV?d00001 diff --git a/frontend/src/windows/main/App.svelte b/frontend/src/windows/main/App.svelte index bdb5bbc..f9efd82 100644 --- a/frontend/src/windows/main/App.svelte +++ b/frontend/src/windows/main/App.svelte @@ -20,6 +20,7 @@ launching: false, progress: 1, text: "Launching...", + isConnected: false, }; // Checks if the app is opened with the --launch argument @@ -34,6 +35,7 @@ // Defines which values should be modified during the launch phase (the loading progress, text, etc...) await launchRoblox( + (value) => (launchInfo.isConnected = value), (value) => (launchInfo.launching = value), (value) => (launchInfo.progress = value), (value) => (launchInfo.text = value) @@ -41,6 +43,7 @@ } else { w.hide().catch(console.error); await launchRoblox( + (value) => (launchInfo.isConnected = value), (value) => (launchInfo.launching = value), (value) => (launchInfo.progress = value), (value) => (launchInfo.text = value) @@ -86,8 +89,10 @@ {:else} { await launchRoblox( + (value) => (launchInfo.isConnected = value), (value) => (launchInfo.launching = value), (value) => (launchInfo.progress = value), (value) => (launchInfo.text = value) diff --git a/frontend/src/windows/main/Sidebar/Sidebar.svelte b/frontend/src/windows/main/Sidebar/Sidebar.svelte index 54d1dbf..21796e2 100644 --- a/frontend/src/windows/main/Sidebar/Sidebar.svelte +++ b/frontend/src/windows/main/Sidebar/Sidebar.svelte @@ -1,51 +1,57 @@ - -
+ + const dispatch = createEventDispatcher<{ launchRoblox: boolean }>(); + + +
+ +
- - \ No newline at end of file + diff --git a/frontend/src/windows/main/app.css b/frontend/src/windows/main/app.css index 2f8c7d3..5d0eaa1 100644 --- a/frontend/src/windows/main/app.css +++ b/frontend/src/windows/main/app.css @@ -127,6 +127,10 @@ h1 { } } +.towhite-always { + -webkit-filter: grayscale(1) invert(1); + filter: grayscale(1) invert(1); +} @media (prefers-color-scheme: dark) { .towhite { -webkit-filter: grayscale(1) invert(1); diff --git a/frontend/src/windows/main/pages/Credits.svelte b/frontend/src/windows/main/pages/Credits.svelte index c9101fd..42fb3ba 100644 --- a/frontend/src/windows/main/pages/Credits.svelte +++ b/frontend/src/windows/main/pages/Credits.svelte @@ -57,6 +57,14 @@ options: { type: "none" }, + }, + { + label: "Icons - https://icons8.com", + description: "All the icons used in the app.", + id: "devs_list", + options: { + type: "none" + }, } ], }, diff --git a/frontend/src/windows/main/ts/roblox/launch.ts b/frontend/src/windows/main/ts/roblox/launch.ts index 21da6e8..04086f1 100644 --- a/frontend/src/windows/main/ts/roblox/launch.ts +++ b/frontend/src/windows/main/ts/roblox/launch.ts @@ -212,7 +212,12 @@ async function onGameEvent(data: GameEventInfo) { } /** Launches a Roblox instance */ -export async function launchRoblox(setLaunchingRoblox: (value: boolean) => void, setLaunchProgress: (value: number) => void, setLaunchText: (value: string) => void) { +export async function launchRoblox( + setRobloxConnected: (value: boolean) => void, + setLaunchingRoblox: (value: boolean) => void, + setLaunchProgress: (value: number) => void, + setLaunchText: (value: string) => void +) { if (rbxInstance || (await os.execCommand('pgrep -f "Roblox"')).stdOut.trim().length > 2) { setLaunchText("Roblox is already open"); setLaunchingRoblox(false); @@ -252,9 +257,11 @@ export async function launchRoblox(setLaunchingRoblox: (value: boolean) => void, const robloxInstance = new RobloxInstance(true); await robloxInstance.init(); await robloxInstance.start(); + setRobloxConnected(true); rbxInstance = robloxInstance; robloxInstance.on("gameEvent", onGameEvent); robloxInstance.on("exit", () => { + setRobloxConnected(false); rbxInstance = null; console.log("Roblox exited"); }); @@ -279,5 +286,6 @@ export async function launchRoblox(setLaunchingRoblox: (value: boolean) => void, console.error("An error occured while launching Roblox"); console.error(err); setLaunchingRoblox(false); + setRobloxConnected(false); } } diff --git a/package.json b/package.json index cee16e8..54f9e4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "appleblox", - "version": "0.4.0", + "version": "0.4.1", "description": "MacOS roblox launcher", "main": "frontend/src/windows/main/main.ts", "scripts": {