Polish business FA layout and wire special-group keys plus SSL sync.
RTL carousels/FABs, special key+title fields, slider gallery fixes, and dashboard SSL sync agent for super-admin. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
66004a0fba
commit
672091d1f5
@@ -9,6 +9,7 @@ import { ProductVariantsModal } from '../components/ProductVariantsModal'
|
||||
import { ProductTechnicalInfoModal } from '../components/ProductTechnicalInfoModal'
|
||||
import { ProductCommentsModal } from '../components/ProductCommentsModal'
|
||||
import { Breadcrumbs } from '../components/Breadcrumbs'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError } from '../lib/api'
|
||||
import {
|
||||
deleteProduct,
|
||||
@@ -22,6 +23,7 @@ import styles from './MyProductsPage.module.css'
|
||||
import aiStyles from '../styles/ai.module.css'
|
||||
|
||||
export function MyProductsPage() {
|
||||
const t = useT()
|
||||
const navigate = useNavigate()
|
||||
const [products, setProducts] = useState<Product[]>([])
|
||||
const [totalProducts, setTotalProducts] = useState(0)
|
||||
@@ -75,7 +77,7 @@ export function MyProductsPage() {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to load products.')
|
||||
setError(t('products.list.errorLoad'))
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
@@ -89,7 +91,7 @@ export function MyProductsPage() {
|
||||
function handleComments(id: string) {
|
||||
const product = products.find((p) => p.id === id)
|
||||
if (product) {
|
||||
setCommentsTarget({ id, name: product.nameEn })
|
||||
setCommentsTarget({ id, name: product.nameFa || product.nameEn })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +100,7 @@ export function MyProductsPage() {
|
||||
if (product) {
|
||||
setVariantsTarget({
|
||||
id,
|
||||
name: product.nameEn,
|
||||
name: product.nameFa || product.nameEn,
|
||||
categoryId: product.categoryId,
|
||||
})
|
||||
}
|
||||
@@ -109,7 +111,7 @@ export function MyProductsPage() {
|
||||
if (product) {
|
||||
setTechnicalTarget({
|
||||
id,
|
||||
name: product.nameEn,
|
||||
name: product.nameFa || product.nameEn,
|
||||
categoryId: product.categoryId,
|
||||
})
|
||||
}
|
||||
@@ -118,7 +120,7 @@ export function MyProductsPage() {
|
||||
function handleRemoveRequest(id: string) {
|
||||
const product = products.find((p) => p.id === id)
|
||||
if (product) {
|
||||
setDeleteTarget({ id, name: product.nameEn })
|
||||
setDeleteTarget({ id, name: product.nameFa || product.nameEn })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +142,7 @@ export function MyProductsPage() {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to delete product.')
|
||||
setError(t('products.list.errorDelete'))
|
||||
}
|
||||
} finally {
|
||||
setIsDeleting(false)
|
||||
@@ -182,24 +184,24 @@ export function MyProductsPage() {
|
||||
/>
|
||||
<div className={pageStyles.pageHeader}>
|
||||
<div>
|
||||
<h2 className={pageStyles.pageTitle}>My Products</h2>
|
||||
<h2 className={pageStyles.pageTitle}>{t('title.myProducts')}</h2>
|
||||
<p className={pageStyles.pageSubtitle}>
|
||||
{totalProducts} products · View, edit and manage your catalog.
|
||||
{t('products.list.subtitle', { count: totalProducts })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={filterStyles.filtersPanel}>
|
||||
<div className={filterStyles.filtersTitle}>Filters</div>
|
||||
<div className={filterStyles.filtersTitle}>{t('products.list.filters')}</div>
|
||||
<div className={filterStyles.filtersGrid}>
|
||||
<div className={filterStyles.filtersInputs}>
|
||||
<div className={`${filterStyles.field} ${filterStyles.fieldCol4}`}>
|
||||
<label htmlFor="filter-product-name">Name</label>
|
||||
<input
|
||||
id="filter-product-name"
|
||||
value={draftName}
|
||||
onChange={(e) => setDraftName(e.target.value)}
|
||||
placeholder="Search by product name"
|
||||
placeholder={t('products.list.filterNamePlaceholder')}
|
||||
aria-label={t('products.list.filterName')}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
</div>
|
||||
@@ -210,8 +212,8 @@ export function MyProductsPage() {
|
||||
className={`${filterStyles.iconActionBtn} ${filterStyles.iconActionBtnPrimary}`}
|
||||
onClick={applyFilters}
|
||||
disabled={isLoading}
|
||||
aria-label="Search"
|
||||
title="Search"
|
||||
aria-label={t('products.list.search')}
|
||||
title={t('products.list.search')}
|
||||
>
|
||||
<Search size={18} />
|
||||
</button>
|
||||
@@ -220,8 +222,8 @@ export function MyProductsPage() {
|
||||
className={`${filterStyles.iconActionBtn} ${filterStyles.iconActionBtnGhost}`}
|
||||
onClick={clearFilters}
|
||||
disabled={isLoading}
|
||||
aria-label="Clear filters"
|
||||
title="Clear filters"
|
||||
aria-label={t('products.list.clearFilters')}
|
||||
title={t('products.list.clearFilters')}
|
||||
>
|
||||
<RotateCcw size={18} />
|
||||
</button>
|
||||
@@ -236,10 +238,10 @@ export function MyProductsPage() {
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<p className={styles.empty}>Loading products...</p>
|
||||
<p className={styles.empty}>{t('products.list.loading')}</p>
|
||||
) : products.length === 0 ? (
|
||||
<p className={styles.empty}>
|
||||
{appliedName ? 'No products match your filters.' : 'No products found.'}
|
||||
{appliedName ? t('products.list.emptyFiltered') : t('products.list.empty')}
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
@@ -261,9 +263,13 @@ export function MyProductsPage() {
|
||||
</div>
|
||||
|
||||
<div className={styles.pagination}>
|
||||
<div>
|
||||
Page {currentPage} / {totalPages} · {PRODUCTS_PER_PAGE} per page ·{' '}
|
||||
{totalProducts} total
|
||||
<div className={styles.paginationMeta}>
|
||||
{t('products.list.pagination', {
|
||||
page: currentPage,
|
||||
totalPages,
|
||||
perPage: PRODUCTS_PER_PAGE,
|
||||
total: totalProducts,
|
||||
})}
|
||||
</div>
|
||||
<Pagination
|
||||
currentPage={currentPage}
|
||||
@@ -278,10 +284,10 @@ export function MyProductsPage() {
|
||||
|
||||
<ConfirmDeleteModal
|
||||
open={!!deleteTarget}
|
||||
title="Delete Product"
|
||||
title={t('products.list.deleteTitle')}
|
||||
message={
|
||||
deleteTarget
|
||||
? `Are you sure you want to delete "${deleteTarget.name}"? This action cannot be undone.`
|
||||
? t('products.list.deleteMessage', { name: deleteTarget.name })
|
||||
: ''
|
||||
}
|
||||
onConfirm={confirmDelete}
|
||||
@@ -337,9 +343,9 @@ export function MyProductsPage() {
|
||||
onClick={() => setAiModalOpen(true)}
|
||||
>
|
||||
<Sparkles size={18} />
|
||||
<span>Add product by AI</span>
|
||||
<span>{t('products.list.addByAi')}</span>
|
||||
</button>
|
||||
<Link to="/products/new" className={styles.addFab} aria-label="Add new product">
|
||||
<Link to="/products/new" className={styles.addFab} aria-label={t('products.list.addNew')}>
|
||||
<Plus size={24} />
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user