Use moveToTop so portfolio chevron pins the item to list start.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
be9e7da424
commit
85524544ca
@@ -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)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user