Skip to content

Commit 8b941df

Browse files
committed
alter layout of buttons
1 parent 1c7707b commit 8b941df

File tree

1 file changed

+29
-47
lines changed

1 file changed

+29
-47
lines changed

src/routes/+page.svelte

Lines changed: 29 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,6 @@
344344
<button
345345
class="flex items-center px-3 py-2 hover:bg-white/3 cursor-pointer"
346346
onclick={loadDialog.open}>Load</button>
347-
<button
348-
class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-3 select-none"
349-
use:tippy={{ content: "Click to toggle", placement: "top" }}
350-
onclick={() => {
351-
const ov = outputVersion;
352-
if (ov == "new") {
353-
outputVersion = "old";
354-
} else {
355-
outputVersion = "new";
356-
}
357-
}}>{outputVersion == "new" ? "1.21.5+" : "pre 1.21.5"}</button>
358347
<div class="flex-grow"></div>
359348
<a
360349
href="https://discord.datapackhub.net/"
@@ -507,23 +496,6 @@
507496
placement: "bottom",
508497
}}
509498
aria-label="Redo"><IconRedo /></button>
510-
511-
<div class="h-5 w-px bg-zinc-600 mx-2"></div>
512-
513-
<div class="flex items-center gap-2">
514-
<p>Optimise?</p>
515-
<button
516-
use:tippy={{
517-
content: "Optimising makes the output smaller, but makes it harder to edit",
518-
placement: "bottom",
519-
}}
520-
class="size-8 aspect-square bg-zinc-950 rounded-md flex flex-col items-center"
521-
onclick={() => (shouldOptimise = !shouldOptimise)}>
522-
{#if shouldOptimise}
523-
<IconTick class="m-auto text-lg" />
524-
{/if}
525-
</button>
526-
</div>
527499

528500
<div class="flex-grow"></div>
529501

@@ -552,8 +524,8 @@
552524
: "Loading..."}</code>
553525
<br />
554526
{/if}
555-
<div class="bg-zinc-950 p-3 max-h-56 overflow-auto">
556-
<div class="flex max-w-screen items-start space-x-2">
527+
<div class="bg-zinc-950 p-3">
528+
<div class="flex max-w-screen items-start space-x-2 max-h-56 overflow-auto">
557529
<button
558530
class="p-1 text-lg hover:bg-zinc-900 active:bg-white/10 rounded-md font-medium"
559531
onclick={() => {
@@ -575,9 +547,27 @@
575547
? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise)
576548
: "Loading..."}
577549
</code>
550+
</p>
551+
</div>
552+
{#if doesContentExist}
553+
<div class="flex items-center space-x-2 mt-2 select-none">
554+
<p class="font-lexend text-xs text-white/60 nomob">
555+
{editor
556+
? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise).length
557+
: 0} characters
558+
</p>
559+
<p class="font-lexend text-xs text-white/60 nomob">
560+
{getTextComponentCount()} components
561+
</p>
562+
<p class="font-lexend text-xs text-white/60 nomob">
563+
564+
</p>
565+
<p class="font-lexend text-xs text-white/60">
566+
Click to change output settings:
567+
</p>
578568
<button
579569
class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-1 select-none"
580-
use:tippy={{ content: "Click to toggle", placement: "top" }}
570+
use:tippy={{ content: "Click to toggle the output version. 1.21.5 drastically changed the format of text components, so make sure you select the correct version.", placement: "top" }}
581571
onclick={() => {
582572
const ov = outputVersion;
583573
if (ov == "new") {
@@ -586,18 +576,10 @@
586576
outputVersion = "new";
587577
}
588578
}}>{outputVersion == "new" ? "1.21.5+" : "pre 1.21.5"}</button>
589-
</p>
590-
</div>
591-
{#if doesContentExist}
592-
<div class="flex items-center space-x-3 mt-2 select-none">
593-
<p class="font-lexend text-xs text-white/60">
594-
{editor
595-
? convert(editor.getJSON(), "standard", outputVersion, shouldOptimise).length
596-
: 0} characters
597-
</p>
598-
<p class="font-lexend text-xs text-white/60">
599-
{getTextComponentCount()} components
600-
</p>
579+
<button
580+
class="bg-zinc-800 hover:bg-zinc-700 font-mono px-1 rounded-md ml-1 select-none"
581+
use:tippy={{ content: "Click to toggle whether the output should be optimised (shortest possible output), or expanded (easier to edit manually).", placement: "top" }}
582+
onclick={() => shouldOptimise = !shouldOptimise}>{shouldOptimise ? "optimised" : "expanded"}</button>
601583
</div>
602584
{/if}
603585
</div>
@@ -689,16 +671,16 @@
689671
{indentSize}
690672
{recentlyCopied} />
691673

692-
<Modal title="Import from NBT" bind:this={importDialog} big key="I">
674+
<Modal title="Import from NBT" bind:this={importDialog} key="I">
693675
<div class="flex flex-col w-full space-y-2">
694676
<p>
695677
Paste your text components below to import them into the editor. This will
696678
clear the current contents of the editor!
697679
</p>
698-
<input
699-
class="flex items-start bg-zinc-950 p-3 rounded-lg font-minecraft"
680+
<textarea
681+
class="flex items-start bg-zinc-950 p-3 rounded-lg font-minecraft h-32"
700682
placeholder="Paste NBT text components here"
701-
bind:value={importText} />
683+
bind:value={importText} ></textarea>
702684

703685
<button
704686
onclick={importToEditor}

0 commit comments

Comments
 (0)