Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: Change home page column ordering and version labels #8

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions frontend/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { path } from "../utils/api.ts";
import type { Package, PackageVersion, Stats } from "../utils/api_types.ts";
import type { PanelEntry } from "../components/ListPanel.tsx";
import { ListPanel } from "../components/ListPanel.tsx";
import twas from "$twas";
import { Head } from "$fresh/runtime.ts";
import { ComponentChildren } from "preact";

Expand All @@ -23,14 +22,14 @@ export default function Home({ data }: PageProps<Data>) {
</Head>

<div class="grid grid-cols-1 gap-8 lg:grid-cols-3 md:gap-14">
<ListPanel title="New Packages">
{data.stats.newest.map(PackageToPanelEntry)}
<ListPanel title="Featured Packages">
{data.stats.featured.map(PackageToPanelEntry)}
</ListPanel>
<ListPanel title="Recent updates">
{data.stats.updated.map(PackageVersionToPanelEntry)}
</ListPanel>
<ListPanel title="Featured Packages">
{data.stats.featured.map(PackageToPanelEntryNoLabel)}
<ListPanel title="New Packages">
{data.stats.newest.map(PackageToPanelEntry)}
</ListPanel>
</div>

Expand Down Expand Up @@ -184,16 +183,6 @@ function BenefitText({ children }: { children: ComponentChildren }) {

function PackageToPanelEntry(
entry: Package,
): PanelEntry {
return {
value: `@${entry.scope}/${entry.name}`,
href: `/@${entry.scope}/${entry.name}`,
label: twas(new Date(entry.createdAt)),
};
}

function PackageToPanelEntryNoLabel(
entry: Package,
): PanelEntry {
return {
value: `@${entry.scope}/${entry.name}`,
Expand Down
Loading