InstalledTheme is done

This commit is contained in:
MotorTruck1221 2025-01-12 01:22:03 -07:00
parent 833b323267
commit 4fe4efd95a
No known key found for this signature in database
GPG key ID: 08F417E2B8B61EA4
4 changed files with 9 additions and 20 deletions

View file

@ -58,7 +58,7 @@ if (parsedDoc.marketplace.enabled) {
await app.register(fastifyMiddie); await app.register(fastifyMiddie);
app.use(ssrHandler); //app.use(ssrHandler);
const port: number = const port: number =
parseInt(process.env.PORT as string) || parsedDoc.server.server.port || parseInt("8080"); parseInt(process.env.PORT as string) || parsedDoc.server.server.port || parseInt("8080");

View file

@ -1,5 +1,5 @@
<div id="parent" class="flex flex-row flex-wrap gap-4 items-center font-roboto justify-center"> <div id="parent" class="flex flex-row flex-wrap gap-4 items-center font-roboto justify-center">
<div id="main-theme" class="rounded-3xl border border-text-color border-2 bg-navbar-color w-64 flex flex-col cursor-pointer"> <div id="main-theme" class="rounded-3xl bg-navbar-color w-64 flex flex-col cursor-pointer">
<div class="w-full"> <div class="w-full">
<img src="/classic_theme.png" alt="Classic nebula" class="aspect-[16/9] rounded-t-3xl" loading="eager" /> <img src="/classic_theme.png" alt="Classic nebula" class="aspect-[16/9] rounded-t-3xl" loading="eager" />
</div> </div>
@ -84,16 +84,13 @@
main.appendChild(click); main.appendChild(click);
main.appendChild(info); main.appendChild(info);
parent.appendChild(main); parent.appendChild(main);
Elements.attachEvent(mainTheme, "click", () => { Elements.attachEvent(mainTheme, "click", () => {
main.classList.remove("border", "border-2");
mainTheme.classList.add("border", "border-2");
marketplace.theme({ type: 'remove' }); marketplace.theme({ type: 'remove' });
}); });
Elements.attachEvent(click, "click", async () => { Elements.attachEvent(click, "click", async () => {
mainTheme.classList.remove("border", "border-2");
main.classList.add("border-2", "border");
await marketplace.theme( await marketplace.theme(
{ {
type: 'normal', type: 'normal',
@ -108,18 +105,10 @@
}); });
Elements.attachEvent(infoInnerDelete, "click", async () => { Elements.attachEvent(infoInnerDelete, "click", async () => {
main.classList.remove("border", "border-2");
mainTheme.classList.add("border-2", "border");
await marketplace.uninstallTheme({ name: item.package_name }); await marketplace.uninstallTheme({ name: item.package_name });
parent.removeChild(main); parent.removeChild(main);
await marketplace.theme({ type: 'remove' }); await marketplace.theme({ type: 'remove' });
}); });
const themeName = await marketplace.getValueFromStore(SettingsVals.marketPlace.appearance.theme.name);
if (themeName !== null && main.dataset.name === themeName) {
mainTheme.classList.remove("border-2", "border");
main.classList.add("border-2", "border");
}
} }
const init = async () => { const init = async () => {

View file

@ -38,12 +38,12 @@ import { VERSION } from "astro:env/client";
class="flex flex-row w-full absolute bottom-4 pr-4 pl-4 text-text-color h-6 justify-between items-center font-roboto" class="flex flex-row w-full absolute bottom-4 pr-4 pl-4 text-text-color h-6 justify-between items-center font-roboto"
> >
<p>Version: {VERSION}</p> <p>Version: {VERSION}</p>
<p class="hidden md:block"> <div class="hidden md:flex gap-2 flex-grow ml-16 justify-center items-center">
Having problems? <p> Having problems? </p>
<button id="reset" class="underline underline-offset-4 hover:decoration-input-border-color active:decoration-input-text"> <button id="reset" class="underline underline-offset-4 hover:decoration-input-border-color active:decoration-input-text">
Click here to reset your instance Click here to reset your instance
</button> </button>
</p> </div>
<p>&copy; Nebula Services 2024</p> <p>&copy; Nebula Services 2024</p>
</div> </div>
</div> </div>

View file

@ -71,7 +71,7 @@ class Elements {
throw new Error(`Something is WRONG. The element doesn't exist!`); throw new Error(`Something is WRONG. The element doesn't exist!`);
} }
static attachEvent<Element extends HTMLElement, EType extends keyof HTMLElementEventMap>(item: Element, event: EType, fn: () => unknown) { static attachEvent<Element extends HTMLElement, EType extends keyof HTMLElementEventMap>(item: Element, event: EType, fn: (event?: Event) => unknown) {
item.addEventListener(event, fn); item.addEventListener(event, fn);
} }