From 4587fe381092abecc0cc040a8d7c69098dbe9afe Mon Sep 17 00:00:00 2001 From: Ngo Quoc Dat Date: Sun, 8 Nov 2026 16:11:04 +0700 Subject: [PATCH 1/3] feat(integrations): rebuild /integrations as category bands without filters, and the detail page as a hero with term rows --- .../Controllers/IntegrationController.php | 50 +-- .../data/content/en/integrations/index.json | 38 +- .../js/components/features/feature-hero.tsx | 5 +- .../js/components/integrations/README.md | 4 +- .../integrations/integration-filters.tsx | 82 ---- .../integrations/integration-list.tsx | 42 +- resources/js/components/integrations/model.ts | 69 +-- resources/js/components/integrations/types.ts | 15 +- resources/js/pages/Integrations/Index.tsx | 143 ++----- resources/js/pages/Integrations/Show.tsx | 404 ++++++++++-------- tests/Feature/Pages/IntegrationsTest.php | 47 +- tests/Feature/Pages/PagesTest.php | 2 +- tests/js/integrations-model.test.ts | 86 +--- 13 files changed, 377 insertions(+), 610 deletions(-) delete mode 100644 resources/js/components/integrations/integration-filters.tsx diff --git a/app/Http/Controllers/IntegrationController.php b/app/Http/Controllers/IntegrationController.php index 4d2079b3..82e92477 100644 --- a/app/Http/Controllers/IntegrationController.php +++ b/app/Http/Controllers/IntegrationController.php @@ -5,7 +5,6 @@ use App\Support\Content\ContentRepository; use App\Support\Content\IntegrationCatalog; use App\Support\Localization\Locales; -use Illuminate\Http\Request; use Illuminate\Support\Arr; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\App; @@ -15,34 +14,29 @@ /** * @phpstan-type Icon array{src: string, width: int, height: int} - * @phpstan-type Summary array{slug: string, name: string, publisher: string, tier: string, categories: list, platforms: list, closedSource: bool, tagline: string, keywords: list, icon: Icon|null} - * @phpstan-type Filters array{q: string|null, category: string|null, platform: string|null, tier: string|null} + * @phpstan-type Summary array{slug: string, name: string, publisher: string, tier: string, group: string, closedSource: bool, tagline: string, icon: Icon|null} */ class IntegrationController extends Controller { private const array TIERS = ['official', 'partner', 'community']; // The registry names the OS a TablePro app runs on; the site names the app. - private const array PLATFORMS = ['macos' => 'mac', 'ios' => 'ios', 'ipados' => 'ios']; + private const array PLATFORMS = ['macos' => 'mac', 'linux' => 'linux', 'ios' => 'ios', 'ipados' => 'ios']; private const array NETWORK = ['none', 'local', 'internet']; private const array PAYMENT = ['free', 'optional', 'paid']; - private const int QUERY_LENGTH = 100; - private const string IMAGES = '/images/integrations/'; - public function index(Request $request, ContentRepository $content, IntegrationCatalog $catalog): Response + public function index(ContentRepository $content, IntegrationCatalog $catalog): Response { $locale = App::getLocale(); $page = $content->page('integrations/index', $locale); - $listed = $this->listed($catalog, $page, $content, $locale); return Inertia::render('Integrations/Index', [ 'content' => Arr::except($page, ['taglines', 'show']), - 'integrations' => $listed, - 'filters' => $this->filters($request, $listed), + 'integrations' => $this->listed($catalog, $page, $content, $locale), ]); } @@ -94,16 +88,21 @@ private function listed(IntegrationCatalog $catalog, array $page, ContentReposit continue; } + // The hub groups an entry under its first category the content file labels, in the registry's order. + $group = array_values(array_intersect($integration['categories'], $categories))[0] ?? null; + + if ($group === null) { + continue; + } + $listed[] = [ 'slug' => $slug, 'name' => $integration['name'], 'publisher' => $integration['publisher']['name'], 'tier' => $this->tier($integration), - 'categories' => $this->known($integration['categories'], $categories), - 'platforms' => $this->platforms($integration['platforms']), + 'group' => $group, 'closedSource' => $integration['closedSource'] === true, 'tagline' => $tagline, - 'keywords' => array_values(array_filter($integration['keywords'] ?? [], 'is_string')), 'icon' => $this->image($integration['icon']['128'] ?? null), ]; } @@ -126,30 +125,6 @@ private function taglines(array $page): array return array_filter($taglines, fn(mixed $tagline): bool => is_string($tagline) && trim($tagline) !== ''); } - /** - * @param list $listed - * @return Filters - */ - private function filters(Request $request, array $listed): array - { - $value = function (string $key, string $field) use ($request, $listed): ?string { - $value = $request->query($key); - $present = array_merge(...array_map(fn(array $entry): array => (array) $entry[$field], $listed)); - - return is_string($value) && in_array($value, $present, true) ? $value : null; - }; - - $q = $request->query('q'); - $q = is_string($q) ? trim(mb_substr(trim($q), 0, self::QUERY_LENGTH)) : ''; - - return [ - 'q' => $q !== '' ? $q : null, - 'category' => $value('category', 'categories'), - 'platform' => $value('platform', 'platforms'), - 'tier' => $value('tier', 'tier'), - ]; - } - /** * @param array $integration * @param array $page @@ -182,6 +157,7 @@ private function detail(array $integration, array $page, IntegrationCatalog $cat 'platforms' => $this->platforms($integration['platforms']), 'versions' => [ 'mac' => $this->text($versions['macos'] ?? null), + 'linux' => $this->text($versions['linux'] ?? null), 'ios' => $this->text($versions['ios'] ?? $versions['ipados'] ?? null), ], 'host' => is_array($host) ? [ diff --git a/resources/data/content/en/integrations/index.json b/resources/data/content/en/integrations/index.json index ee83e1df..fcae51d6 100644 --- a/resources/data/content/en/integrations/index.json +++ b/resources/data/content/en/integrations/index.json @@ -5,40 +5,19 @@ }, "header": { "title": "Integrations", - "lead": "Apps and tools that work with TablePro.", + "lead": "Apps and tools that work with TablePro, built by the TablePro team or by others.", "build": "Build an integration" }, - "filters": { - "label": "Filter integrations", - "search": "Search", - "category": { - "label": "Category", - "all": "All categories" - }, - "platform": { - "label": "TablePro app", - "all": "All apps" - }, - "tier": { - "label": "Type", - "all": "All types" - }, - "submit": "Show results", - "count": { - "one": "{count} integration", - "other": "{count} integrations" - }, - "empty": "No integrations match these filters.", - "clear": "Clear filters" - }, "publish": { "title": "List your integration", + "sentence": "Built something that works with TablePro? Send it to the registry on GitHub.", "guide": "How to submit", "policy": "Listing policy" }, "notice": "Names and logos belong to their owners. Only Official integrations are built by TablePro.", "labels": { "by": "By {publisher}", + "byTier": "{tier}, by {publisher}", "closedSource": "Closed source", "tiers": { "official": "Official", @@ -72,7 +51,8 @@ "source": "Source code", "details": { "title": "Details", - "publisher": "Publisher", + "publisher": "Made by", + "tier": "Type", "category": "Category", "host": "Works with", "hostVersion": "{host} {version} or later", @@ -82,7 +62,6 @@ "added": "Listed", "verified": "Last checked" }, - "about": "About", "screenshots": "Screenshots", "uses": { "title": "What it uses", @@ -133,11 +112,16 @@ "payment": { "optional": "Free, with paid options", "paid": "Paid" + }, + "terms": { + "internet": "Internet", + "account": "Account", + "payment": "Price" } }, "support": { "title": "Help", - "report": "Report a problem with this listing", + "sentence": "Something wrong with this listing? Report it on GitHub.", "help": "Get help from {publisher}", "docs": "Read the docs" }, diff --git a/resources/js/components/features/feature-hero.tsx b/resources/js/components/features/feature-hero.tsx index 3e305f44..bec1ffc2 100644 --- a/resources/js/components/features/feature-hero.tsx +++ b/resources/js/components/features/feature-hero.tsx @@ -12,6 +12,8 @@ import { docsHref } from './model'; interface FeatureHeroProps { title: ReactNode; lead: ReactNode; + // Under the lead, before the actions: an integration's description and archive notice. + more?: ReactNode; // A docs.tablepro.app path; the hub links the docs home. docs?: string; docsLabel?: string; @@ -31,7 +33,7 @@ interface FeatureHeroProps { } // The same editorial hero as Home: left on the grid, one Download, the docs as a quiet link. -export default function FeatureHero({ title, lead, docs, docsLabel, actions, primary, eyebrow, aside, location = 'feature-header', settle = true, children }: FeatureHeroProps) { +export default function FeatureHero({ title, lead, more, docs, docsLabel, actions, primary, eyebrow, aside, location = 'feature-header', settle = true, children }: FeatureHeroProps) { const { locale, m } = useI18n(); const text = ( @@ -44,6 +46,7 @@ export default function FeatureHero({ title, lead, docs, docsLabel, actions, pri {title}

{lead}

+ {more} {actions === null ? null : actions !== undefined ? (
{actions}
) : ( diff --git a/resources/js/components/integrations/README.md b/resources/js/components/integrations/README.md index 49b3e2db..f4c529c0 100644 --- a/resources/js/components/integrations/README.md +++ b/resources/js/components/integrations/README.md @@ -9,8 +9,8 @@ ## The content file -- `seo`, `header`, `filters`, `publish`, `notice`: the hub. -- `labels`: shared by the hub and the detail page (tiers, categories, "By {publisher}", "Closed source"). +- `seo`, `header`, `publish`, `notice`: the hub. It has one band per category and no filters (owner, 2026-11-08). +- `labels`: shared by the hub and the detail page (tiers, categories, "By {publisher}", "Closed source"). An entry sits in the hub band of its first category that `labels.categories` names, in the registry's order; an entry with no labelled category stays off the hub. - `show`: the detail page. It renders in English only today, but the keys exist in every language, so translating the page later is a content change. - `show.uses.surface.{id}.docs`: a docs.tablepro.app path, the same in every language. - `taglines`: one sentence per slug. The English value is the registry `summary` it was translated from. diff --git a/resources/js/components/integrations/integration-filters.tsx b/resources/js/components/integrations/integration-filters.tsx deleted file mode 100644 index 0076290e..00000000 --- a/resources/js/components/integrations/integration-filters.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import type { FormEvent } from 'react'; -import Button from '@/components/ui/button'; -import Field, { Input } from '@/components/ui/field'; -import Select from '@/components/ui/select'; -import { useI18n } from '@/i18n'; -import type { FacetOptions } from './model'; -import type { AppPlatform, Category, IntegrationFilters as Filters, IntegrationsHubContent, Tier } from './types'; - -interface IntegrationFiltersProps { - content: IntegrationsHubContent; - filters: Filters; - options: FacetOptions; - appName: (platform: AppPlatform) => string; - onChange: (filters: Filters, urlDelay: number) => void; -} - -// A plain GET form, so the filters work before hydration and without JavaScript. -export default function IntegrationFilters({ content, filters, options, appName, onChange }: IntegrationFiltersProps) { - const { path } = useI18n(); - const copy = content.filters; - const labels = content.labels; - - const submit = (event: FormEvent) => { - event.preventDefault(); - onChange(filters, 0); - }; - - return ( -
- - onChange({ ...filters, q: event.target.value === '' ? null : event.target.value }, 300)} - /> - - - onChange({ ...filters, platform: value === '' ? null : (value as AppPlatform) }, 0)} - options={[{ value: '', label: copy.platform.all }, ...options.platforms.map((platform) => ({ value: platform, label: appName(platform) }))]} - /> - - -