Vue init (#47)

This commit is contained in:
Geometrically
2023-02-27 09:11:34 -07:00
committed by GitHub
parent e591b7120a
commit c204caa350
58 changed files with 727 additions and 6666 deletions

View File

@@ -1,53 +0,0 @@
<script lang="ts">
export let title: string;
</script>
<div class="card-row">
<div class="card-row__title">{title}</div>
<div class="card-row__items">
<slot />
</div>
</div>
<style lang="postcss">
.card-row {
display: flex;
flex-direction: column;
padding: 1rem 0;
grid-gap: 1rem;
&__title {
padding: 0 1rem;
display: flex;
grid-gap: 1rem;
align-items: center;
&::after {
flex: 1 1;
content: ' ';
background-color: hsla(0, 0%, 100%, 0.2);
height: 0.2rem;
border-radius: var(--rounded-max);
}
}
&__items {
display: flex;
grid-gap: 1rem;
align-items: flex-start;
overflow-x: auto;
padding: 0 1rem;
/* Hide scrollbar */
-ms-overflow-style: none;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
&:nth-of-type(even) {
background-color: hsla(0, 0%, 0%, 0.2);
}
}
</style>

View File

@@ -1,59 +0,0 @@
<script lang="ts">
import { Field, Slider, TextInput, Button } from 'omorphia';
import TitledSection from '$components/TitledSection.svelte';
import WindowSettings from '$components/WindowSettings.svelte';
export let maxConcurrentDownloads: number = 20;
</script>
<div class="section">
<TitledSection title="Downloads">
<Field label="Max concurrent downloads">
<Slider min="1" max="64" bind:value={maxConcurrentDownloads} />
</Field>
</TitledSection>
<TitledSection title="Override game resolution" toggleable="true">
<WindowSettings />
</TitledSection>
<TitledSection title="Profile hooks">
<Field label="Pre-launch">
<TextInput />
</Field>
<Field label="Wrapper">
<TextInput />
</Field>
<Field label="Post-exit">
<TextInput />
</Field>
</TitledSection>
<TitledSection title="Java">
<Field label="Java 8 installation">
<TextInput placeholder="/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home" />
<div class="button-group">
<Button>Auto-detect</Button>
<Button>Browse installations</Button>
<Button>Test</Button>
</div>
</Field>
<Field label="Java 17 installation">
<TextInput placeholder="/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home" />
<div class="button-group">
<Button>Auto-detect</Button>
<Button>Browse installations</Button>
<Button>Test</Button>
</div>
</Field>
<Field label="Minimum memory allocatted (in MB)">
<TextInput />
</Field>
<Field label="Maximum memory allocatted (in MB)">
<TextInput value="2048" />
</Field>
<Field label="Arguments">
<TextInput />
</Field>
</TitledSection>
</div>
<style lang="postcss">
</style>

View File

@@ -1,90 +0,0 @@
<script lang="ts">
import IconPlayFilled from 'virtual:icons/carbon/play-filled-alt';
import IconBadgeCheck from 'virtual:icons/heroicons-solid/badge-check';
export let title: string;
export let id: string;
export let version: string;
export let modpack = false;
export let image: string;
</script>
<a
class="instance"
href="/library/instance/{id}/settings"
style:background-image="linear-gradient(5deg, hsla(0,0%,0%,0.8) 0%, hsla(0,0%,0%,0) 100%), url('{image}')"
>
<div class="instance__version">
{version}{#if modpack}<IconBadgeCheck />{/if}
</div>
<div class="instance__title">{title}</div>
<button class="play-button">
<IconPlayFilled />
</button>
</a>
<style lang="postcss">
.instance {
--size: 8rem;
min-width: var(--size);
min-height: var(--size);
border-radius: var(--rounded);
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: flex-end;
padding: 0.5rem;
box-shadow: var(--shadow-raised) var(--shadow-inset);
position: relative;
background-size: cover;
&__title {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
&__version {
color: var(--color-text);
font-size: var(--font-size-sm);
display: flex;
align-items: center;
grid-gap: 0.15rem;
:global(svg) {
margin-bottom: 0.05rem;
}
}
&:hover .play-button {
visibility: visible;
opacity: 1;
transform: none;
}
.play-button {
position: absolute;
bottom: 0.5rem;
right: 0.5rem;
background-color: var(--color-brand);
width: 2.5rem;
aspect-ratio: 1 / 1;
border-radius: var(--rounded-max);
display: flex;
align-items: center;
justify-content: center;
visibility: hidden;
opacity: 0;
transition-property: opacity, visibility, transform;
transition-duration: 0.2s;
transition-timing-function: ease-in-out;
transform: translateY(1rem);
:global(svg) {
width: 1.25rem;
height: auto;
color: black;
}
}
}
</style>

View File

@@ -1,130 +0,0 @@
<script lang="ts">
import { t } from 'svelte-intl-precompile';
import IconHeart from 'virtual:icons/lucide/heart';
import IconDownload from 'virtual:icons/heroicons-outline/download';
import IconCalendar from 'virtual:icons/lucide/calendar';
import { ago } from 'omorphia/utils';
import { simplify } from '$lib/number';
import { Avatar, Button } from 'omorphia';
import { tagIcons } from '$generated/tags.json';
export let project;
// @ts-ignore: Author is only available in the result
let author = project.author ?? '';
// @ts-ignore: ID is in different locations in the result and project
let id = project.id ?? project.project_id;
// @ts-ignore: Updated is in different locations in the result and project
let updated = project.date_modified ?? project.updated;
const href = `/${project.project_type}/${project.slug || id}`;
</script>
<div class="card project-card">
<a {href} tabindex="-1">
<Avatar src={project.icon_url} size="md" />
</a>
<div class="project-card__info">
<div class="project-card__info__top">
<div class="project-card__info__top__text">
<span
><a class="project-card__info__top__text__title" {href}>{project.title}</a>
{#if author}
<a href="/user/{author}" class="project-card__info__top__text__author"
>{@html $t('generic.byline', { values: { author } })}</a
>
{/if}
</span>
<p class="summary">
{project.description}
</p>
</div>
<div class="button-group">
<Button color="primary"><IconDownload />Install</Button>
</div>
</div>
<div class="tag-group">
{#each project.categories as category}
<div class="tag">
{@html tagIcons[category] || '?'}
{$t(`tags.${category}`)}
</div>
{/each}
<span class="stat">
<IconDownload />
<b>{simplify(project.downloads)}</b>
</span>
<span class="tag">
<IconCalendar />
{@html $t('stats.updated', { values: { ago: ago(updated) } })}
</span>
</div>
</div>
{#if !$$slots.actions}{:else}
<slot name="actions" />
{/if}
</div>
<style lang="postcss">
.project-card {
flex-direction: row;
flex-wrap: nowrap;
padding: 10px;
grid-gap: 1rem;
&__info {
display: flex;
flex-direction: column;
grid-gap: 0.25rem;
line-height: 100%;
margin-top: 0.2rem;
width: 100%;
&__top {
display: flex;
gap: 16px;
&__text {
display: flex;
flex-direction: column;
gap: 4px;
&__title {
font-weight: bold;
font-size: 16px;
}
&__author {
white-space: nowrap;
font-size: 12px;
}
.summary {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: calc(100vw - 224px - 24px - 16px - 64px - 130px);
}
}
:global(.button-group) {
margin-left: auto;
height: 33px;
}
}
.tag-group {
.stat {
margin-left: auto;
}
}
}
}
</style>

View File

@@ -1,49 +0,0 @@
<script lang="ts">
import { Checkbox } from 'omorphia';
export let title: string;
export let toggleable: boolean = false;
export let enabled: boolean = false;
</script>
<div class="section">
<div class="section__title">
{#if toggleable}<Checkbox bind:checked={enabled}>{title}</Checkbox>
{:else}{title}
{/if}
</div>
<div class="section__items">
{#if !toggleable || enabled}<slot />{/if}
</div>
</div>
<style lang="postcss">
.section {
display: flex;
flex-direction: column;
padding: 1rem;
grid-gap: 1rem;
&__title {
display: flex;
grid-gap: 1rem;
align-items: center;
&::after {
flex: 1 1;
content: ' ';
background-color: hsla(0, 0%, 100%, 0.2);
height: 0.2rem;
border-radius: var(--rounded-max);
}
}
&__items {
display: flex;
flex-direction: column;
grid-gap: 1rem;
padding: 0 8px;
}
}
</style>

View File

@@ -1,39 +0,0 @@
<script lang="ts">
import type { SvelteComponent } from 'svelte';
import { page } from '$app/stores';
export let items: {
label: string;
/** Page href, without slash prefix */
href: string;
icon: SvelteComponent;
}[];
/** Path level in URL, zero-indexed */
export let level = 0;
let path: string[];
$: path = $page.url.pathname.substring(1).split('/');
</script>
<div class="vertical-nav">
{#each items as item (item.href)}
<a
class="nav-item"
href="/{item.href}"
class:active={path[level] === item.href}
sveltekit:prefetch
>
<svelte:component this={item.icon} />
{item.label}
</a>
{/each}
</div>
<style lang="postcss">
.vertical-nav {
display: flex;
flex-direction: column;
grid-gap: 0.25rem;
}
</style>

View File

@@ -1,15 +0,0 @@
<script lang="ts">
import { Field, TextInput } from 'omorphia';
</script>
<div class="section">
<Field label="Window width">
<TextInput />
</Field>
<Field label="Window height">
<TextInput />
</Field>
</div>
<style lang="postcss">
</style>