Fix portfolio list sorting UX and add name/category filters.
Newest portfolios show first with corrected move-up, category no longer mixes into the date, and website link generation can filter by tags. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
2477936bce
commit
1e9f6481b0
@@ -2,6 +2,8 @@ import { getBusinessDomain } from '../lib/config'
|
||||
|
||||
export type WebsiteLinkKind = 'product' | 'storeItem' | 'blog' | 'portfolio' | 'video'
|
||||
|
||||
export type WebsiteLinkFilter = 'category' | 'tag'
|
||||
|
||||
export const WEBSITE_LINK_KINDS: WebsiteLinkKind[] = [
|
||||
'product',
|
||||
'storeItem',
|
||||
@@ -35,3 +37,21 @@ export function buildWebsiteCategoryUrl(
|
||||
: `categoryId=${encodeURIComponent(category.id)}`
|
||||
return `${getWebsiteOrigin(domain)}${path}?${query}`
|
||||
}
|
||||
|
||||
export function buildWebsiteTagsUrl(
|
||||
kind: WebsiteLinkKind,
|
||||
tags: string[],
|
||||
domain = getBusinessDomain(),
|
||||
): string {
|
||||
const cleaned = [
|
||||
...new Set(tags.map((tag) => tag.trim()).filter(Boolean)),
|
||||
]
|
||||
if (cleaned.length === 0) return ''
|
||||
|
||||
const path = WEBSITE_LINK_KIND_PATH[kind]
|
||||
const query =
|
||||
cleaned.length === 1
|
||||
? `tag=${encodeURIComponent(cleaned[0])}`
|
||||
: `tags=${cleaned.map((tag) => encodeURIComponent(tag)).join(',')}`
|
||||
return `${getWebsiteOrigin(domain)}${path}?${query}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user