remove bloat fonts, get rid of svelte-i18n
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
@@ -1,110 +1,65 @@
|
||||
<script>
|
||||
import Service from "$lib/service.svelte";
|
||||
import Header from "$lib/header.svelte";
|
||||
import Error from "$lib/error.svelte";
|
||||
import Link from "$lib/link.svelte";
|
||||
import Head from "$lib/head.svelte";
|
||||
|
||||
import { api_urljoin } from "$lib/api.js";
|
||||
import { locale, _ } from "svelte-i18n";
|
||||
import { onMount } from "svelte";
|
||||
import Navbar from "$components/navbar.svelte";
|
||||
import Footer from "$components/footer.svelte";
|
||||
import Header from "$components/header.svelte";
|
||||
import Service from "$components/service.svelte";
|
||||
import Head from "$components/head.svelte";
|
||||
import Card from "$components/card.svelte";
|
||||
|
||||
import { locale, _ } from "$lib/locale.js";
|
||||
import api from "$lib/api.js";
|
||||
let { data } = $props();
|
||||
let services = $state(data.services);
|
||||
let show_input = $state(false);
|
||||
|
||||
function change(input) {
|
||||
let value = input.target.value.toLowerCase();
|
||||
services = [];
|
||||
|
||||
if (value === "") {
|
||||
services = data.services;
|
||||
return;
|
||||
}
|
||||
|
||||
data.services.forEach((s) => {
|
||||
if (s.name.toLowerCase().includes(value)) services.push(s);
|
||||
else if (s.desc[$locale].toLowerCase().includes(value)) services.push(s);
|
||||
});
|
||||
}
|
||||
|
||||
function get_services() {
|
||||
return services.filter((s) => {
|
||||
return (
|
||||
s.desc[$locale] !== "" &&
|
||||
s.desc[$locale] !== null &&
|
||||
s.desc[$locale] !== undefined
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
show_input = true;
|
||||
});
|
||||
// filtered list of services that have descriptions for the current locale
|
||||
let services = $derived(
|
||||
data.services.filter(
|
||||
s =>
|
||||
s.desc[$locale.code] !== "" &&
|
||||
s.desc[$locale.code] !== null &&
|
||||
s.desc[$locale.code] !== undefined
|
||||
)
|
||||
);
|
||||
</script>
|
||||
|
||||
<Head title="services" desc="my self-hosted services and projects" />
|
||||
<Navbar />
|
||||
<Header picture="cool" title={$_("services.title")} />
|
||||
|
||||
{#if data.error.length !== 0}
|
||||
<Error error={data.error} />
|
||||
{:else}
|
||||
<main>
|
||||
<div class="title">
|
||||
{#if show_input}
|
||||
<input
|
||||
oninput={change}
|
||||
type="text"
|
||||
placeholder={$_("services.search")}
|
||||
/>
|
||||
{/if}
|
||||
<div>
|
||||
<Link icon="nf-fa-feed" link={api_urljoin("/news/" + $locale)}
|
||||
>{$_("services.feed")}</Link
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="services">
|
||||
{#if get_services().length == 0}
|
||||
<h3 class="none">{$_("services.none")}</h3>
|
||||
{:else}
|
||||
{#each get_services() as service}
|
||||
<Service {service} />
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
{/if}
|
||||
<main>
|
||||
<Card>
|
||||
<p>{@html $_("services.desc")}</p>
|
||||
<br />
|
||||
<p>
|
||||
{@html $_("services.feed", {
|
||||
links: [api.join("/news/" + $locale.code)],
|
||||
})}
|
||||
</p>
|
||||
</Card>
|
||||
<div class="services">
|
||||
{#if services.length === 0}
|
||||
<h3>{$_("services.none")}</h3>
|
||||
{:else}
|
||||
{#each services as service}
|
||||
<Service {service} />
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</main>
|
||||
<Footer />
|
||||
|
||||
<style>
|
||||
main {
|
||||
padding: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
main .title {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
main .none {
|
||||
color: var(--white-3);
|
||||
background: var(--black-1);
|
||||
flex: 1;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
main .services {
|
||||
margin-top: 20px;
|
||||
margin-top: 15px;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: stretch;
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1200px) {
|
||||
main .services {
|
||||
flex-direction: column;
|
||||
}
|
||||
color: var(--white-3);
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user