Refactor, move some fa icons to dedicated components. Eventually get rid of fontawesome css hopefully.
This commit is contained in:
parent
9a48ae3416
commit
4ce7d5a065
8 changed files with 22 additions and 19 deletions
|
|
@ -15,7 +15,7 @@ function loadExtensionScripts() {
|
||||||
let store = transaction.objectStore("InstalledExtensions");
|
let store = transaction.objectStore("InstalledExtensions");
|
||||||
let request = store.getAll();
|
let request = store.getAll();
|
||||||
request.onsuccess = () => {
|
request.onsuccess = () => {
|
||||||
let extensions = request.result;
|
let extensions = request.result.filter((extension) => extension.type != "theme");
|
||||||
extensions.forEach((extension) => {
|
extensions.forEach((extension) => {
|
||||||
eval(atob(extension.scriptCopy));
|
eval(atob(extension.scriptCopy));
|
||||||
const func = self[extension.entryNamespace][extension.entryFunc];
|
const func = self[extension.entryNamespace][extension.entryFunc];
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,31 @@
|
||||||
---
|
---
|
||||||
|
import Paintbrush from "@components/icons/paintbrush.astro";
|
||||||
|
import Scroll from "@components/icons/scroll.astro";
|
||||||
|
|
||||||
const { type } = Astro.props;
|
const { type } = Astro.props;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
type: ExtType;
|
type: ExtType;
|
||||||
};
|
};
|
||||||
|
|
||||||
let icon = "fa-solid fa-paintbrush";
|
const abbrTitle = type === "theme" ? "Theme" : "Script";
|
||||||
let abbrTitle = "Style";
|
|
||||||
|
|
||||||
if (type === "page" || type === "serviceWorker") {
|
|
||||||
icon = "fa-solid fa-scroll";
|
|
||||||
abbrTitle = "Script";
|
|
||||||
}
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<div class="marketplace-icon">
|
<div class="marketplace-icon">
|
||||||
<abbr title={abbrTitle}>
|
<abbr title={abbrTitle}>
|
||||||
<i class={icon + " fa-lg marketplace-icon"}></i>
|
{type === "theme" ? <Paintbrush class="icon" /> : <Scroll class="icon" />}
|
||||||
</abbr>
|
</abbr>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style is:global>
|
||||||
.marketplace-icon {
|
.marketplace-icon {
|
||||||
width: 32px;
|
width: 32px;
|
||||||
filter: brightness(0.8);
|
filter: brightness(0.8);
|
||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mp-icon {
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
3
src/components/icons/paintbrush.astro
Normal file
3
src/components/icons/paintbrush.astro
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="var(--text-color)" class="mp-icon">
|
||||||
|
<path d="M339.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L568.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S517.7-4.4 499.1 9.6L262.4 187.2c-24 18-38.2 46.1-38.4 76.1L339.3 367.1zm-19.6 25.4l-116-104.4C143.9 290.3 96 339.6 96 400c0 3.9 .2 7.8 .6 11.6C98.4 429.1 86.4 448 68.8 448L64 448c-17.7 0-32 14.3-32 32s14.3 32 32 32l144 0c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 472 B |
3
src/components/icons/scroll.astro
Normal file
3
src/components/icons/scroll.astro
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" fill="var(--text-color)" class="mp-icon">
|
||||||
|
<path d="M0 80l0 48c0 17.7 14.3 32 32 32l16 0 48 0 0-80c0-26.5-21.5-48-48-48S0 53.5 0 80zM112 32c10 13.4 16 30 16 48l0 304c0 35.3 28.7 64 64 64s64-28.7 64-64l0-5.3c0-32.4 26.3-58.7 58.7-58.7L480 320l0-192c0-53-43-96-96-96L112 32zM464 480c61.9 0 112-50.1 112-112c0-8.8-7.2-16-16-16l-245.3 0c-14.7 0-26.7 11.9-26.7 26.7l0 5.3c0 53-43 96-96 96l176 0 96 0z" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 471 B |
|
|
@ -1,8 +1,8 @@
|
||||||
import "notyf/notyf.min.css";
|
import "notyf/notyf.min.css";
|
||||||
import { Notyf } from "notyf";
|
import { Notyf } from "notyf";
|
||||||
import marketplaceManifest from "../../json/marketplace.json";
|
import marketplaceManifest from "../../json/marketplace.json";
|
||||||
const installButtons = document.getElementsByClassName("btn-install");
|
|
||||||
import IDBManager, { loadIDBPromise } from "./IDBManager";
|
import IDBManager, { loadIDBPromise } from "./IDBManager";
|
||||||
|
const installButtons = document.getElementsByClassName("btn-install");
|
||||||
|
|
||||||
const extManifest = marketplaceManifest as ExtensionMetadataJSON;
|
const extManifest = marketplaceManifest as ExtensionMetadataJSON;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const getStaticPaths = () => {
|
||||||
};
|
};
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title="Marketplace | Alu" optionalStylesheets={["https://site-assets.fontawesome.com/releases/v6.6.0/css/all.css"]}>
|
<Layout title="Marketplace | Alu">
|
||||||
<div id="main-content">
|
<div id="main-content">
|
||||||
<h1 class="title-text">Marketplace</h1>
|
<h1 class="title-text">Marketplace</h1>
|
||||||
<p class="title-desc">(WIP) Install custom extensions for Alu!</p>
|
<p class="title-desc">(WIP) Install custom extensions for Alu!</p>
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,9 @@ import SchemaData from "@components/SchemaData.astro";
|
||||||
import instantiateAlu from "@components/ts/Alu";
|
import instantiateAlu from "@components/ts/Alu";
|
||||||
instantiateAlu();
|
instantiateAlu();
|
||||||
const lang = Alu.store.get("lang");
|
const lang = Alu.store.get("lang");
|
||||||
const redirect = (loc: string) => (window.location.href = loc);
|
const redirect = (loc: string) => window.location.href = loc;
|
||||||
if (lang) {
|
if (lang) {
|
||||||
try {
|
redirect(`/${lang.value}/`);
|
||||||
redirect(`/${lang.value}/`);
|
|
||||||
} catch {
|
|
||||||
localStorage.clear();
|
|
||||||
window.location.reload();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const lang = navigator.language;
|
const lang = navigator.language;
|
||||||
if (lang.includes("ja")) {
|
if (lang.includes("ja")) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@components/*": ["src/components/*"],
|
"@components/*": ["src/components/*"],
|
||||||
|
"@icons/*": ["src/icons/*"],
|
||||||
"@i18n/*": ["src/i18n/*"],
|
"@i18n/*": ["src/i18n/*"],
|
||||||
"@json/*": ["src/json/*"]
|
"@json/*": ["src/json/*"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue