open package meta links with default user browser + new packages filter (#350)

* #344 open package meta links with default user browser

* #318 enable new packages filter

---------

Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
Neil 2023-03-29 10:09:32 +08:00 committed by GitHub
parent 858839495b
commit 8766702c35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 21 deletions

View file

@ -25,9 +25,8 @@
[SideMenuOptions.recently_updated]: (pkg: GUIPackage) => {
return moment(pkg.last_modified).isAfter(moment().subtract(30, "days"));
},
[SideMenuOptions.new_packages]: (_pkg: GUIPackage) => {
// todo: use pkg.created_at but its depends on https://github.com/teaxyz/kettle/issues/119
return true;
[SideMenuOptions.new_packages]: (pkg: GUIPackage) => {
return moment(pkg.created).isAfter(moment().subtract(30, "days"));
},
[SideMenuOptions.popular]: (pkg: GUIPackage) => pkg.categories.includes(SideMenuOptions.popular),
[SideMenuOptions.featured]: (pkg: GUIPackage) => pkg.categories.includes(SideMenuOptions.featured),

View file

@ -31,10 +31,10 @@
active={activeOption === SideMenuOptions.recently_updated}
on:click={() => selectToggle(SideMenuOptions.recently_updated)}
/>
<!-- <MenuButton label="New packages" icon="birthday-cake"
<MenuButton label="New packages" icon="birthday-cake"
active={activeOption === SideMenuOptions.new_packages}
on:click={() => selectToggle(SideMenuOptions.new_packages)}
/> -->
/>
<MenuButton label="Popular" icon="bar-chart"
active={activeOption === SideMenuOptions.popular}
on:click={() => selectToggle(SideMenuOptions.popular)}

View file

@ -2,6 +2,7 @@
import type { Package } from "../types";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import { shellOpenExternal } from "@native";
dayjs.extend(relativeTime);
@ -48,29 +49,26 @@
</ul>
<h1 class="text-primary">Homepage</h1>
<ul class="mb-10 flex flex-col gap-2">
<li>
<a target="_blank" rel="noreferrer" href={pkg.homepage}>
<span>{pkg.homepage}</span>
</a>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li on:click={() => shellOpenExternal(pkg.homepage)}>
<span>{pkg.homepage}</span>
</li>
</ul>
{#if pkg.documentation_url}
<h1 class="text-primary">Documentation</h1>
<ul class="mb-10 flex flex-col gap-2">
<li>
<a target="_blank" rel="noreferrer" href={pkg.documentation_url}>
<span>{pkg.documentation_url}</span>
</a>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li on:click={() => shellOpenExternal(pkg.documentation_url)}>
<span>{pkg.documentation_url}</span>
</li>
</ul>
{/if}
{#if pkg.github}
<h1 class="text-primary">Github Repository</h1>
<ul class="mb-10 flex flex-col gap-2">
<li>
<a target="_blank" rel="noreferrer" href={`https://github.com/${pkg.github}`}>
<span>{pkg.github}</span>
</a>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li on:click={() => shellOpenExternal(`https://github.com/${pkg.github}`)}>
<span>{pkg.github}</span>
</li>
</ul>
{/if}
@ -78,13 +76,12 @@
<h1 class="text-primary">Contributors</h1>
<ul class="mb-10 flex flex-col gap-2">
{#each pkg.contributors as contributor}
<li>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<li on:click={() => shellOpenExternal(`https://github.com/${contributor.login}`)}>
<!-- <figure class="h-5 w-5 bg-gray">
<img src={contributor.avatar_url} alt={contributor.login} />
</figure> -->
<a href={`https://github.com/${contributor.login}`} rel="noreferrer" target="_blank">
<span>{contributor.login}</span>
</a>
<span>{contributor.login}</span>
</li>
{/each}
</ul>