mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
Merge branch 'main' into open-terminal
This commit is contained in:
commit
1ca78c9613
5 changed files with 10 additions and 9 deletions
|
@ -4,13 +4,14 @@
|
|||
import { PackageStates } from '$libs/types';
|
||||
import Preloader from '@tea/ui/Preloader/Preloader.svelte';
|
||||
import PackageCard from '@tea/ui/PackageCard/PackageCard.svelte';
|
||||
import { onMount } from 'svelte';
|
||||
import { packagesStore } from '$libs/stores';
|
||||
|
||||
// TODO: replace with getting foundation essentials
|
||||
import { getTopPackages } from '$libs/api/mock';
|
||||
import { installPackage } from '@api';
|
||||
|
||||
export let title = 'Packages';
|
||||
export let category = ''; // filter
|
||||
|
||||
let packages: GUIPackage[] = [];
|
||||
|
||||
|
@ -23,10 +24,10 @@
|
|||
}[state];
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
if (!packages.length) {
|
||||
packages = await getTopPackages();
|
||||
}
|
||||
packagesStore.subscribe((ps) => {
|
||||
packages = category ?
|
||||
ps.filter((p) => (p.categories || []).includes(category)) :
|
||||
ps;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import { get as apiGet } from '$libs/v1Client';
|
|||
|
||||
export async function getPackages(): Promise<GUIPackage[]> {
|
||||
const [packages, installedPackages] = await Promise.all([
|
||||
apiGet<Package[]>('packages'),
|
||||
apiGet<Package[]>('packages', { nocache: 'true' }),
|
||||
getInstalledPackages()
|
||||
]);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export default function initPackagesStore() {
|
|||
getPackages().then((pkgs) => {
|
||||
set(pkgs);
|
||||
packagesIndex = new Fuse(pkgs, {
|
||||
keys: ['name', 'full_name', 'desc']
|
||||
keys: ['name', 'full_name', 'desc', 'categories']
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<div>
|
||||
<PageHeader coverUrl="/images/headers/header_bg_1.png">Discover</PageHeader>
|
||||
<section class="mt-8 mb-8">
|
||||
<Packages title="FOUNDATION ESSENTIALS" />
|
||||
<Packages title="FOUNDATION ESSENTIALS" category="foundation_essentials" />
|
||||
</section>
|
||||
<PageHeader coverUrl="/images/headers/header_bg_1.png">ASSET TYPE</PageHeader>
|
||||
<section class="mt-8 mb-8 flex gap-4">
|
||||
|
|
|
@ -20,6 +20,7 @@ export interface Package {
|
|||
installs: number;
|
||||
reviews?: Review[];
|
||||
package_yml_url?: string;
|
||||
categories: string[];
|
||||
// metas
|
||||
full_description?: string; // probably markdown
|
||||
bottles?: Bottle[];
|
||||
|
@ -27,7 +28,6 @@ export interface Package {
|
|||
size_bytes?: number;
|
||||
documentation_url?: string;
|
||||
github?: string;
|
||||
categories?: string[];
|
||||
contributors?: Contributor[];
|
||||
readme_md?: string;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue