Skip to content

Commit

Permalink
change styling for reset buttons and make it use promises
Browse files Browse the repository at this point in the history
Co-Authored-By: kat <116377025+kxtzownsu@users.noreply.github.com>
  • Loading branch information
Percslol and kxtzownsu committed Jan 20, 2024
1 parent 5ab3927 commit 1905f9c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 18 deletions.
51 changes: 35 additions & 16 deletions src/coreapps/SettingsApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ class SettingsApp extends App {
<a href="#v86">v86</a>
</h4>
</div>
<div class="sidebar-settings-item">
<h4 class="sidebar-settings-item-name">
<a href="#reset">Reset</a>
</h4>
</div>
</div>
<div class="settings-body">
<div id="general" class="general settings-category">
Expand Down Expand Up @@ -235,22 +240,6 @@ class SettingsApp extends App {
type="text"
/>
</div>
<button
on:click={async () => {
const confirmation = await confirm(
"Are you sure you want to factory reset Anura? All of your data will be lost.",
);
if (confirmation) {
const sh = new anura.fs.Shell();
sh.rm("/", { recursive: true });
await sleep(2);
window.location.reload();
}
}}
class="settings-button"
>
Factory Reset
</button>
</div>
<div id="v86" class="v86 settings-category">
<h3 class="settings-category-name">Anura x86</h3>
Expand Down Expand Up @@ -535,6 +524,36 @@ class SettingsApp extends App {
</div>
)}
</div>
<div id="reset" class="settings-category">
<h3 class="settings-category-name">Reset Anura</h3>
<div class="settings-item">
<h4 class="settings-item-name">
Reset your Anura install.
</h4>
<button
class="settings-button"
on:click={async () => {
const confirmation = await confirm(
"Are you sure you want to powerwash Anura? All of your data will be lost.",
);
if (confirmation) {
const sh = new anura.fs.Shell();
try {
await sleep(2);
await sh.promises.rm("/", {
recursive: true,
});
window.location.reload();
} catch (error) {
window.location.reload();
}
}
}}
>
Powerwash
</button>
</div>
</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/coreapps/XFrogApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class XFrogApp extends App {
if (this.activeWin && this.activeWin != win) {
const newImg = document.createElement("img");

const blob: any = await new Promise((resolve) =>
anura.x86?.vgacanvas.toBlob(resolve),
const blob: any = await new Promise(
(resolve) => anura.x86?.vgacanvas.toBlob(resolve),
)!;
const url = URL.createObjectURL(blob);
newImg.src = url;
Expand Down

0 comments on commit 1905f9c

Please sign in to comment.