add simple debug prompt to make it easier to debug on mobile devices

This commit is contained in:
hippoz 2022-09-02 13:40:59 +03:00
parent 6a962f2fba
commit 8b14ff2c96
No known key found for this signature in database
GPG key ID: 7C52899193467641

View file

@ -4,10 +4,37 @@
import { logOut } from "../../auth";
import { maybeModalFade, maybeModalFly } from "../../animations";
import request from "../../request";
import { apiRoute } from "../../storage";
import { apiRoute, getItem } from "../../storage";
const close = () => overlayStore.close("settings");
const doDeveloper = () => {
overlayStore.open("prompt", {
heading: "",
valueName: "",
async onSubmit(value) {
const parts = value.split("##");
if (parts.length < 1) {
return;
}
const respond = (value) => {
overlayStore.close("prompt");
overlayStore.open("toast", { message: value });
};
switch (parts[0]) {
case "storage.getItem": {
return respond(getItem(parts[1]));
}
default: {
return respond("Error: unknown operator");
}
}
},
});
};
const doLogout = () => {
close();
logOut();
@ -70,7 +97,7 @@
<div class="modal-backdrop" transition:maybeModalFade on:click="{ close }">
<div class="modal" class:large-settings="{ !$smallViewport }" transition:maybeModalFly on:click|stopPropagation>
<span class="input-label">Account</span>
<span class="input-label" on:click={ doDeveloper }>Account</span>
<div class="settings-card full-width">
<AtSignIcon />
<span class="h5 top-bar-heading">{ $userInfoStore ? $userInfoStore.username : "" }</span>