diff --git a/apps/business/src/pages/PortfolioListPage.tsx b/apps/business/src/pages/PortfolioListPage.tsx index 1e7c4f1..780a5f3 100644 --- a/apps/business/src/pages/PortfolioListPage.tsx +++ b/apps/business/src/pages/PortfolioListPage.tsx @@ -176,22 +176,17 @@ export function PortfolioListPage() { if (index < 0) return if (index === 0 && currentPage === 1) return - const current = portfolios[index] - // Jump above the current page leader (highest sort_order wins). Avoids - // fragile swaps that no-op when ties / secondary date order disagree. - const leader = portfolios[0] - const nextSortOrder = - index === 0 - ? current.sortOrder + 1 - : Math.max(leader.sortOrder, current.sortOrder) + 1 - setMovingUpId(id) setError('') try { - await updatePortfolio(current.id, { sortOrder: nextSortOrder }) + await updatePortfolio(id, { moveToTop: true }) showToast(t('portfolio.list.toast.movedUp'), 'success') - await loadPortfolios(currentPage) + // Absolute top lives on page 1 — jump there so the move is visible. + writeListQuery(appliedName, appliedCategoryId, 1) + if (currentPage === 1) { + await loadPortfolios(1) + } } catch (err) { if (err instanceof ApiError) { setError(err.message) diff --git a/apps/business/src/services/portfolioService.ts b/apps/business/src/services/portfolioService.ts index aeed02e..b7fabde 100644 --- a/apps/business/src/services/portfolioService.ts +++ b/apps/business/src/services/portfolioService.ts @@ -80,6 +80,8 @@ export interface UpdatePortfolioPayload { galleryMediaIds?: string[] tags?: string[] sortOrder?: number + /** Pin to absolute top of the business portfolio list. */ + moveToTop?: boolean } export function resolvePortfolioTitleImageUrl(portfolio: PortfolioApi): string | null {