This commit is contained in:
not-nullptr 2024-03-08 15:04:03 +00:00
parent 6756b812d8
commit 9d8f47dcfe
9 changed files with 134 additions and 37 deletions

View file

@ -17,6 +17,17 @@
user-select: none; user-select: none;
} }
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: "Segoe UI Variable", sans-serif !important;
font-size: 24px !important;
font-weight: 600;
}
.fluent-press { .fluent-press {
transition: 0.2s transform var(--fluent-ease-out); transition: 0.2s transform var(--fluent-ease-out);
} }
@ -43,9 +54,9 @@
} }
button { button {
border: var(--fluent-stroke); border: var(--fluent-stroke) !important;
border-radius: 4px; border-radius: 4px !important;
background-color: rgba(255, 255, 255, 0.15); background-color: rgba(255, 255, 255, 0.15) !important;
height: 32px; height: 32px;
padding: 0 12px; padding: 0 12px;
font-size: 10pt !important; font-size: 10pt !important;

View file

@ -10,6 +10,7 @@
const excludedRoutesNav = ["/mockup/boot", "/mockup/w11"]; const excludedRoutesNav = ["/mockup/boot", "/mockup/w11"];
const excludedRoutesBg = ["/mockup", "/mockup/w11"]; const excludedRoutesBg = ["/mockup", "/mockup/w11"];
console.log($page.url);
$: isNavExcluded = excludedRoutesNav.some((route) => $page.url?.pathname.startsWith(route)); $: isNavExcluded = excludedRoutesNav.some((route) => $page.url?.pathname.startsWith(route));
$: isBgExcluded = excludedRoutesBg.some((route) => $page.url?.pathname === route); $: isBgExcluded = excludedRoutesBg.some((route) => $page.url?.pathname === route);
</script> </script>
@ -21,12 +22,12 @@
</div> </div>
<div class="right"> <div class="right">
<a href="https://gitlab.com/suyu-emu/suyu/-/releases" target="_blank"> <a href="https://gitlab.com/suyu-emu/suyu/-/releases" target="_blank">
<Button class='!p-2' pill={true}> <Button class="!p-2" pill={true}>
<DownloadOutline /> <DownloadOutline />
</Button> </Button>
</a> </a>
<a href="https://discord.gg/suyu" target="_blank"> <a href="https://discord.gg/suyu" target="_blank">
<Button class='!p-2' pill={true}> <Button class="!p-2" pill={true}>
<DiscordSolid /> <DiscordSolid />
</Button> </Button>
</a> </a>

View file

@ -85,7 +85,6 @@
.logo { .logo {
animation: spin 2s reverse infinite cubic-bezier(0.8, 0, 0.2, 1); animation: spin 2s reverse infinite cubic-bezier(0.8, 0, 0.2, 1);
transform-origin: 50.1% 47.45%;
} }
.body { .body {

View file

@ -121,6 +121,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="disclaimer">
<h1>Disclaimer</h1>
<p>
This is a <b>concept</b> for suyu's launcher, made by nullptr. It is not<br />a true
desktop application, it is non-functional and running in<br />a browser.
</p>
</div>
</div> </div>
</div> </div>
@ -195,8 +202,13 @@
width: 1012px; width: 1012px;
height: 600px; height: 600px;
position: absolute; position: absolute;
opacity: 0; }
animation: window-appear forwards 0.3s 1s var(--fluent-ease-out);
.disclaimer {
text-align: right;
position: absolute;
bottom: 16px;
right: 24px;
} }
.titlebar-buttons { .titlebar-buttons {

View file

@ -70,7 +70,7 @@
.card-container { .card-container {
width: 128px; width: 128px;
height: 204px; height: 212px;
border-radius: 10px; border-radius: 10px;
border: var(--fluent-stroke); border: var(--fluent-stroke);
position: relative; position: relative;

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, type SvelteComponent } from "svelte"; import { createEventDispatcher, onMount, type SvelteComponent } from "svelte";
interface SidebarItem { interface SidebarItem {
icon: typeof SvelteComponent<{}>; icon: typeof SvelteComponent<{}>;
@ -8,34 +8,104 @@
} }
let itemIndex = 0; let itemIndex = 0;
let pill: HTMLDivElement;
let sidebar: HTMLDivElement;
export let itemsTop: SidebarItem[]; export let itemsTop: SidebarItem[];
export let itemsBottom: SidebarItem[]; export let itemsBottom: SidebarItem[];
const dispatcher = createEventDispatcher<{ const dispatch = createEventDispatcher<{
changepage: { page: typeof SvelteComponent<{}> }; changepage: { page: typeof SvelteComponent<{}> };
}>(); }>();
async function itemClick(item: SidebarItem) { function getIndex(item: SidebarItem) {
if (item.onclick) return item.onclick(); return Array.prototype.concat(itemsTop, itemsBottom).indexOf(item);
}
async function itemClick(item: SidebarItem, e: MouseEvent) {
if (item.onclick) return item.onclick();
const button = (e.target as HTMLElement).closest("button");
console.log(button);
if (!button) return;
const rect = button.getBoundingClientRect();
const sidebarRect = sidebar.getBoundingClientRect();
try { try {
const page = await import(`../pages/${item.text}.svelte`); const page = await import(`../pages/${item.text}.svelte`);
dispatcher("changepage", { page: page.default }); let prevItem = itemIndex;
itemIndex = Array.prototype.concat(itemsTop, itemsBottom).indexOf(item); itemIndex = getIndex(item);
if (prevItem === itemIndex) return;
const isDown = itemIndex > prevItem;
if (isDown) {
await pill.animate(
[
{
height: "28px",
},
],
{ duration: 150, easing: "ease-in" },
).finished;
pill.style.top = `${rect.top - sidebarRect.top}px`;
dispatch("changepage", { page: page.default });
await pill.animate(
[
{
height: "28px",
transform: "translateY(-4px)",
},
{
height: "16px",
},
],
{ duration: 150, easing: "ease-out", fill: "forwards" },
).finished;
} else {
await pill.animate(
[
{
height: "28px",
transform: "translateY(-2px)",
},
],
{ duration: 150, easing: "ease-in" },
).finished;
pill.style.top = `${rect.top - sidebarRect.top}px`;
dispatch("changepage", { page: page.default });
await pill.animate(
[
{
height: "28px",
},
{
height: "16px",
},
],
{ duration: 150, easing: "ease-out", fill: "forwards" },
).finished;
}
} catch { } catch {
console.error(`Page not found: ${item.text}`); console.error(`Page not found: ${item.text}`);
} }
} }
onMount(() => {
// i'm sorry orche
const firstItem = document.querySelector(".sidebar-item");
if (!firstItem) return;
const firstItemRect = firstItem.getBoundingClientRect();
const sidebarRect = sidebar.getBoundingClientRect();
pill.style.display = "block";
pill.style.top = `${firstItemRect.top - sidebarRect.top}px`;
pill.style.left = `${firstItemRect.left - sidebarRect.left + 1}px`;
});
</script> </script>
<div class="sidebar"> <div class="sidebar" bind:this={sidebar}>
<div class="pill" bind:this={pill} />
<div class="sidebar-content top"> <div class="sidebar-content top">
{#each itemsTop as item} {#each itemsTop as item}
<button <button
on:click={() => { on:click={(e) => {
itemClick(item); itemClick(item, e);
}} }}
class="sidebar-item fluent-press" class="sidebar-item fluent-press"
> >
@ -47,8 +117,8 @@
<div class="sidebar-content bottom"> <div class="sidebar-content bottom">
{#each itemsBottom as item} {#each itemsBottom as item}
<button <button
on:click={() => { on:click={(e) => {
itemClick(item); itemClick(item, e);
}} }}
class="sidebar-item fluent-press" class="sidebar-item fluent-press"
> >
@ -60,11 +130,22 @@
</div> </div>
<style> <style>
.pill {
width: 3px;
height: 16px;
background-color: #4e92dc;
border-radius: 8px;
display: none;
position: absolute;
transform: translateY(10px);
}
.sidebar { .sidebar {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-bottom: 5px; padding-bottom: 5px;
height: 100%; height: 100%;
position: relative;
} }
.sidebar-content { .sidebar-content {
@ -86,22 +167,22 @@
appearance: none; appearance: none;
display: flex; display: flex;
align-items: center; align-items: center;
height: 36px; height: 36px !important;
padding: 0 12px; padding: 0 12px;
gap: 10px; gap: 10px;
border-radius: 6px; border-radius: 6px !important;
cursor: pointer; cursor: pointer;
border: none; border: none !important;
background-color: transparent; background-color: transparent !important;
} }
.sidebar-item:hover { .sidebar-item:hover {
background-color: rgba(200, 197, 197, 0.1); background-color: rgba(200, 197, 197, 0.1) !important;
filter: none; filter: none;
} }
.sidebar-item:active { .sidebar-item:active {
background-color: rgba(154, 154, 154, 0.15); background-color: rgba(154, 154, 154, 0.15) !important;
filter: none; filter: none;
} }

View file

@ -4,14 +4,6 @@
<div class="cards"> <div class="cards">
<Card /> <Card />
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />
<Card />
</div> </div>
<style> <style>

View file

@ -0,0 +1 @@
<h1>Multiplayer</h1>

View file

@ -1 +1 @@
bb <h1>Settings</h1>