diff --git a/bun.lockb b/bun.lockb index 88ebec1b..cbe476fc 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ed788677..d64ea302 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "astro": "^4.5.16", "fuse.js": "^7.0.0", "svelte": "^4.2.12", + "svelte-select": "^5.8.3", "typescript": "^5.4.4", "yaml": "^2.4.0" }, diff --git a/src/components/PortExplorer.svelte b/src/components/PortExplorer.svelte index 7e01f7b3..670d3d4f 100644 --- a/src/components/PortExplorer.svelte +++ b/src/components/PortExplorer.svelte @@ -1,40 +1,127 @@ - + +
+
+ +
+
+ +
+
+ diff --git a/src/components/SearchBar.svelte b/src/components/SearchBar.svelte index fec9604d..2b4da848 100644 --- a/src/components/SearchBar.svelte +++ b/src/components/SearchBar.svelte @@ -11,7 +11,7 @@ type="text" id="search-field" aria-label="Search" - placeholder="Search port or category..." + placeholder="Search port..." autocomplete="off" bind:value={searchTerm} on:input={handleInput} /> @@ -38,7 +38,7 @@ border: none; outline: none; width: 100%; - font-size: 2rem; + font-size: 2.2rem; } } diff --git a/src/components/dropdowns/CategorySelect.svelte b/src/components/dropdowns/CategorySelect.svelte new file mode 100644 index 00000000..761f8531 --- /dev/null +++ b/src/components/dropdowns/CategorySelect.svelte @@ -0,0 +1,33 @@ + + + diff --git a/src/components/dropdowns/PlatformSelect.svelte b/src/components/dropdowns/PlatformSelect.svelte new file mode 100644 index 00000000..3d7c464e --- /dev/null +++ b/src/components/dropdowns/PlatformSelect.svelte @@ -0,0 +1,67 @@ + + + + {item.label} + + + diff --git a/src/components/lists/Pills.svelte b/src/components/lists/Pills.svelte index d60b930d..aa05a00f 100644 --- a/src/components/lists/Pills.svelte +++ b/src/components/lists/Pills.svelte @@ -25,7 +25,7 @@ @include utils.containerPadding(xxs-y); border-radius: 9999px; - background-color: color-mix(in srgb, var(--base), var(--subtext0) 20%); + background-color: color-mix(in srgb, var(--base), var(--subtext0) 10%); font-size: 80%; } diff --git a/src/lib/ports.ts b/src/lib/ports.ts index 7c2b06bb..7d50ac37 100644 --- a/src/lib/ports.ts +++ b/src/lib/ports.ts @@ -3,6 +3,11 @@ import { PropertyBasedSet } from "./propertyBasedSet"; import { getIcon } from "./getIcon"; import type { ColorName } from "@catppuccin/palette"; +export type HandleCategory = { + value: string; + label: string; +}; + // Mostly auto-generated but have made manual edits to the types // to stop TypeScript from complaining about the types. Future // Hammy can deal with the consequences of this decision. @@ -21,7 +26,7 @@ export interface ArchivedPort { name: string; reason: string; categories: Category[]; - platform: PlatformElement[] | "agnostic"; + platform: Platform; color: ColorName; icon?: string; key: string; @@ -43,6 +48,8 @@ export enum PlatformElement { Windows = "windows", } +export type Platform = PlatformElement | "agnostic"; + export interface Repository { name: string; url: string; @@ -59,7 +66,7 @@ export interface Collaborator { export interface Port { name: string; categories: Category[]; - platform: PlatformElement[] | "agnostic"; + platform: Platform; color: ColorName; key: string; repository: Repository; @@ -108,6 +115,8 @@ export interface FAQ { answer: string; } +export type CategoryWithPortCount = Category & { portCount: number; nameWithCount: string }; + export const repositoriesYml = (await fetch( "https://raw.githubusercontent.com/catppuccin/catppuccin/portscelain/pigeon/ports.porcelain.yml", ) @@ -134,3 +143,23 @@ export const currentMaintainers: Collaborator[] = new PropertyBasedSet p["current-maintainers"], ), ).sorted(); + +export const categories = repositoriesYml.categories.map((category) => { + const portCount = ports.filter((port) => port.categories.some((c) => c.key === category.key)).length; + return { + ...category, + portCount, + nameWithCount: `${category.name} (${portCount})`, + }; +}); +categories.push({ + key: "everything", + name: "Ports", + description: "All ports and userstyles", + emoji: "🌐", + portCount: ports.length, + nameWithCount: `Ports (${ports.length})`, +}); +categories.sort((a, b) => b.portCount - a.portCount); + +export const platforms: Platform[] = [...Object.values(PlatformElement), "agnostic"]; diff --git a/src/pages/ports.astro b/src/pages/ports.astro index 7fa4e5c1..9ce5fa0f 100644 --- a/src/pages/ports.astro +++ b/src/pages/ports.astro @@ -1,5 +1,5 @@ --- -import { ports } from "../lib/ports"; +import { platforms, categories, ports } from "../lib/ports"; import Layout from "../layouts/Layout.astro"; @@ -17,7 +17,6 @@ import Link from "../components/Link.astro"; Catppuccin offers ports for all sorts of different applications, tools, websites and just about anything that comes to your mind!

-

Total Ports: {ports.length}

@@ -27,7 +26,7 @@ import Link from "../components/Link.astro"; - +

Sorry, we couldn't find any ports matching your search :(