Improve script UI

This commit is contained in:
2026-01-10 02:07:03 +01:00
parent 6cba63d025
commit 2d5c21e7aa
4 changed files with 102 additions and 40 deletions

View File

@@ -25,8 +25,12 @@
width: 460px; width: 460px;
} }
.modal .modal-inner.medium {
width: 720px;
}
.modal .modal-inner.wide { .modal .modal-inner.wide {
width: 960px; width: 1120px;
} }
.modal .modal-inner .modal-header-row { .modal .modal-inner .modal-header-row {
@@ -58,6 +62,51 @@
gap: 10px; gap: 10px;
} }
.modal .modal-inner .launch-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 14px;
margin-top: 16px;
}
.modal .modal-inner .launch-tile {
display: flex;
flex-direction: column;
gap: 8px;
align-items: flex-start;
padding: 16px;
border-radius: 12px;
border: 1px solid rgba(148, 163, 184, 0.35);
background: rgba(15, 23, 42, 0.75);
color: inherit;
text-align: left;
cursor: pointer;
min-height: 140px;
width: 100%;
transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}
.modal .modal-inner .launch-tile:hover,
.modal .modal-inner .launch-tile:focus-visible {
border-color: rgba(226, 232, 240, 0.7);
background: rgba(30, 41, 59, 0.8);
transform: translateY(-1px);
}
.modal .modal-inner .launch-tile .tile-icon {
font-size: 1.4rem;
color: rgba(226, 232, 240, 0.9);
}
.modal .modal-inner .launch-tile .tile-title {
font-weight: 600;
}
.modal .modal-inner .launch-tile .tile-subtitle {
color: rgba(226, 232, 240, 0.7);
font-size: 0.9rem;
}
.modal .modal-inner .checkbox-row { .modal .modal-inner .checkbox-row {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
@@ -146,21 +195,22 @@
} }
.modal .modal-inner .marketplace-list { .modal .modal-inner .marketplace-list {
display: flex; display: grid;
flex-direction: column; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 12px; gap: 16px;
margin-top: 8px; margin-top: 12px;
} }
.modal .modal-inner .marketplace-card { .modal .modal-inner .marketplace-card {
display: grid; display: flex;
grid-template-columns: 80px 1fr auto; flex-direction: column;
gap: 16px; align-items: flex-start;
align-items: center; gap: 12px;
padding: 12px; padding: 16px;
border: 1px solid rgba(148, 163, 184, 0.3); border: 1px solid rgba(148, 163, 184, 0.3);
border-radius: 10px; border-radius: 10px;
background-color: rgba(15, 23, 42, 0.6); background-color: rgba(15, 23, 42, 0.6);
min-height: 240px;
} }
.modal .modal-inner .marketplace-logo { .modal .modal-inner .marketplace-logo {
@@ -193,6 +243,9 @@
.modal .modal-inner .marketplace-actions { .modal .modal-inner .marketplace-actions {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: auto;
width: 100%;
justify-content: flex-end;
} }
.modal .modal-inner .marketplace-empty, .modal .modal-inner .marketplace-empty,

View File

@@ -110,9 +110,9 @@ export function createAdminConsole({
handleFileSelection(event.target); handleFileSelection(event.target);
}); });
} }
const customAssetButton = document.getElementById("custom-asset-button"); const assetLauncherButton = document.getElementById("asset-launcher-button");
if (customAssetButton && customAssetModal?.openLauncher) { if (assetLauncherButton && customAssetModal?.openLauncher) {
customAssetButton.addEventListener("click", () => customAssetModal.openLauncher()); assetLauncherButton.addEventListener("click", () => customAssetModal.openLauncher());
} }
globalThis.addEventListener("resize", () => { globalThis.addEventListener("resize", () => {
resizeCanvas(); resizeCanvas();

View File

@@ -7,6 +7,7 @@ export function createCustomAssetModal({
const launchModal = document.getElementById("custom-asset-launch-modal"); const launchModal = document.getElementById("custom-asset-launch-modal");
const launchNewButton = document.getElementById("custom-asset-launch-new"); const launchNewButton = document.getElementById("custom-asset-launch-new");
const launchMarketplaceButton = document.getElementById("custom-asset-launch-marketplace"); const launchMarketplaceButton = document.getElementById("custom-asset-launch-marketplace");
const assetFileInput = document.getElementById("asset-file");
const marketplaceModal = document.getElementById("custom-asset-marketplace-modal"); const marketplaceModal = document.getElementById("custom-asset-marketplace-modal");
const marketplaceCloseButton = document.getElementById("custom-asset-marketplace-close"); const marketplaceCloseButton = document.getElementById("custom-asset-marketplace-close");
const marketplaceSearchInput = document.getElementById("custom-asset-marketplace-search"); const marketplaceSearchInput = document.getElementById("custom-asset-marketplace-search");
@@ -234,6 +235,13 @@ export function createCustomAssetModal({
if (launchMarketplaceButton) { if (launchMarketplaceButton) {
launchMarketplaceButton.addEventListener("click", () => openMarketplaceModal()); launchMarketplaceButton.addEventListener("click", () => openMarketplaceModal());
} }
if (assetFileInput) {
assetFileInput.addEventListener("change", (event) => {
if (event.target?.files?.length) {
closeLaunchModal();
}
});
}
if (marketplaceModal) { if (marketplaceModal) {
marketplaceModal.addEventListener("click", (event) => { marketplaceModal.addEventListener("click", (event) => {
if (event.target === marketplaceModal) { if (event.target === marketplaceModal) {

View File

@@ -47,27 +47,13 @@
<div class="admin-workspace"> <div class="admin-workspace">
<aside class="admin-rail"> <aside class="admin-rail">
<div class="upload-row"> <div class="upload-row">
<input <button type="button" class="file-input-trigger" id="asset-launcher-button">
id="asset-file" <span class="file-input-icon"><i class="fa-solid fa-layer-group"></i></span>
class="file-input-field"
type="file"
accept="image/*,video/*,audio/*,application/javascript,text/javascript,.js,.mjs"
/>
<label for="asset-file" class="file-input-trigger">
<span class="file-input-icon"><i class="fa-solid fa-cloud-arrow-up"></i></span>
<span class="file-input-copy"> <span class="file-input-copy">
<strong>Upload asset</strong> <strong>Add asset</strong>
<small id="asset-file-name">No file chosen</small> <small>Upload, build, or browse scripts</small>
</span> </span>
</label> </button>
</div>
<div class="upload-row">
<label class="file-input-trigger" id="custom-asset-button">
<span class="file-input-icon"><i class="fa-solid fa-code"></i></span>
<span class="file-input-copy">
<strong>Create custom asset</strong>
</span>
</label>
</div> </div>
<div class="rail-body"> <div class="rail-body">
<div class="rail-scroll"> <div class="rail-scroll">
@@ -369,15 +355,30 @@
</div> </div>
</div> </div>
<div id="custom-asset-launch-modal" class="modal hidden"> <div id="custom-asset-launch-modal" class="modal hidden">
<section class="modal-inner small"> <section class="modal-inner medium">
<h1>Custom scripts</h1> <h1>Custom assets</h1>
<p>Start a new script or browse scripts shared by other creators.</p> <p>Upload media, build new scripts, or pull from the marketplace.</p>
<div class="form-actions split"> <div class="launch-grid">
<button type="button" class="secondary" id="custom-asset-launch-marketplace"> <input
Browse marketplace id="asset-file"
class="file-input-field"
type="file"
accept="image/*,video/*,audio/*,application/javascript,text/javascript,.js,.mjs"
/>
<label for="asset-file" class="launch-tile">
<span class="tile-icon"><i class="fa-solid fa-cloud-arrow-up"></i></span>
<span class="tile-title">Upload asset</span>
<span class="tile-subtitle" id="asset-file-name">No file chosen</span>
</label>
<button type="button" class="launch-tile" id="custom-asset-launch-new">
<span class="tile-icon"><i class="fa-solid fa-code"></i></span>
<span class="tile-title">Create script</span>
<span class="tile-subtitle">Start from a blank template</span>
</button> </button>
<button type="button" class="primary" id="custom-asset-launch-new"> <button type="button" class="launch-tile" id="custom-asset-launch-marketplace">
Create new script <span class="tile-icon"><i class="fa-solid fa-store"></i></span>
<span class="tile-title">Browse marketplace</span>
<span class="tile-subtitle">Find community scripts</span>
</button> </button>
</div> </div>
</section> </section>