Add portfolio website link field and card open-link control.
Stay on the current list page after move-to-top; only toast success. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
85524544ca
commit
c289de5d2e
@@ -53,6 +53,7 @@ export function AddNewPortfolioPage() {
|
||||
const [titleFa, setTitleFa] = useState('')
|
||||
const [titleEn, setTitleEn] = useState('')
|
||||
const [abstract, setAbstract] = useState('')
|
||||
const [projectUrl, setProjectUrl] = useState('')
|
||||
const [mainTextHtml, setMainTextHtml] = useState('')
|
||||
const [titleImage, setTitleImage] = useState<string | null>(null)
|
||||
const [titleImageAspect, setTitleImageAspect] = useState<TitleImageAspectId>('3:2')
|
||||
@@ -103,6 +104,7 @@ export function AddNewPortfolioPage() {
|
||||
setTitleFa(form.titleFa)
|
||||
setTitleEn(form.titleEn)
|
||||
setAbstract(form.abstract)
|
||||
setProjectUrl(form.projectUrl)
|
||||
setMainTextHtml(form.mainTextHtml)
|
||||
setTitleImage(form.titleImage)
|
||||
setImages(form.images)
|
||||
@@ -146,6 +148,7 @@ export function AddNewPortfolioPage() {
|
||||
titleFa: titleFa.trim(),
|
||||
titleEn: titleEn.trim() || undefined,
|
||||
abstract: abstract.trim(),
|
||||
projectUrl: projectUrl.trim() || undefined,
|
||||
mainTextHtml: resolvedMainTextHtml,
|
||||
categoryId: categoryId || undefined,
|
||||
featuredMediaId: nextFeaturedMediaId ?? undefined,
|
||||
@@ -159,6 +162,7 @@ export function AddNewPortfolioPage() {
|
||||
...payload,
|
||||
categoryId: categoryId || null,
|
||||
featuredMediaId: nextFeaturedMediaId,
|
||||
projectUrl: projectUrl.trim() || null,
|
||||
})
|
||||
showToast(t('portfolio.form.toast.updated'), 'success')
|
||||
} else {
|
||||
@@ -319,6 +323,22 @@ export function AddNewPortfolioPage() {
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.field}>
|
||||
<label htmlFor="portfolio-link">{t('portfolio.form.link')}</label>
|
||||
<input
|
||||
id="portfolio-link"
|
||||
name="projectUrl"
|
||||
type="url"
|
||||
dir="ltr"
|
||||
lang="en"
|
||||
inputMode="url"
|
||||
placeholder={t('portfolio.form.linkPlaceholder')}
|
||||
value={projectUrl}
|
||||
onChange={(e) => setProjectUrl(e.target.value)}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={`${styles.field} ${styles.col12}`}>
|
||||
|
||||
@@ -182,11 +182,7 @@ export function PortfolioListPage() {
|
||||
try {
|
||||
await updatePortfolio(id, { moveToTop: true })
|
||||
showToast(t('portfolio.list.toast.movedUp'), 'success')
|
||||
// Absolute top lives on page 1 — jump there so the move is visible.
|
||||
writeListQuery(appliedName, appliedCategoryId, 1)
|
||||
if (currentPage === 1) {
|
||||
await loadPortfolios(1)
|
||||
}
|
||||
await loadPortfolios(currentPage)
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
|
||||
Reference in New Issue
Block a user