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
@@ -1,6 +1,8 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { createPortal } from 'react-dom'
|
||||
import { Plus, X } from 'lucide-react'
|
||||
import { useLocale } from '@meshkee/dashboard-ui'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError } from '../lib/api'
|
||||
import {
|
||||
getProductVariationValues,
|
||||
@@ -59,6 +61,9 @@ export function EditStoreItemsModal({
|
||||
onClose,
|
||||
onSaved,
|
||||
}: EditStoreItemsModalProps) {
|
||||
const t = useT()
|
||||
const { locale } = useLocale()
|
||||
const isFa = locale === 'fa'
|
||||
const [mounted, setMounted] = useState(open)
|
||||
const [closing, setClosing] = useState(false)
|
||||
const [variations, setVariations] = useState<ProductVariationSelection[]>([])
|
||||
@@ -113,7 +118,7 @@ export function EditStoreItemsModal({
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to load product variations.')
|
||||
setError(t('storeItems.create.errorVariations'))
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
@@ -203,13 +208,17 @@ export function EditStoreItemsModal({
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to save store items.')
|
||||
setError(t('storeItems.edit.errorSave'))
|
||||
}
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
}
|
||||
}
|
||||
|
||||
const subtitle = isFa
|
||||
? [productNameFa, productTitle].filter(Boolean).join(' / ')
|
||||
: [productTitle, productNameFa].filter(Boolean).join(' / ')
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
className={`${modalStyles.overlay} ${closing ? modalStyles.overlayOut : modalStyles.overlayIn}`}
|
||||
@@ -221,25 +230,28 @@ export function EditStoreItemsModal({
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="edit-store-items-title"
|
||||
lang={isFa ? 'fa' : 'en'}
|
||||
dir={isFa ? 'rtl' : 'ltr'}
|
||||
>
|
||||
<div className={modalStyles.header}>
|
||||
<div>
|
||||
<h3 id="edit-store-items-title" className={modalStyles.title}>
|
||||
Edit Store Items
|
||||
{t('storeItems.edit.title')}
|
||||
</h3>
|
||||
<p className={modalStyles.subtitle}>
|
||||
{productTitle}
|
||||
{productNameFa ? ` / ${productNameFa}` : ''}
|
||||
</p>
|
||||
<p className={modalStyles.subtitle}>{subtitle}</p>
|
||||
</div>
|
||||
<button className={modalStyles.closeBtn} onClick={onClose} aria-label="Close">
|
||||
<button
|
||||
className={modalStyles.closeBtn}
|
||||
onClick={onClose}
|
||||
aria-label={t('common.close')}
|
||||
>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form className={modalStyles.body} onSubmit={(e) => void handleSubmit(e)}>
|
||||
{isLoading ? (
|
||||
<p className={modalStyles.emptyText}>Loading product variations...</p>
|
||||
<p className={modalStyles.emptyText}>{t('storeItems.create.loadingVariations')}</p>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
@@ -249,8 +261,8 @@ export function EditStoreItemsModal({
|
||||
{formVariations.map((variation) => (
|
||||
<span key={variation.id}>{variation.name}</span>
|
||||
))}
|
||||
<span>Price (IRT)</span>
|
||||
<span>Stock</span>
|
||||
<span>{t('storeItems.create.price')}</span>
|
||||
<span>{t('storeItems.create.stock')}</span>
|
||||
<span />
|
||||
</div>
|
||||
|
||||
@@ -301,13 +313,13 @@ export function EditStoreItemsModal({
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
<div className={rowStyles.removeCell}>
|
||||
<Tooltip label="Remove row">
|
||||
<Tooltip label={t('storeItems.create.removeRow')}>
|
||||
<button
|
||||
type="button"
|
||||
className={modalStyles.removeRowBtn}
|
||||
onClick={() => removeRow(row.id)}
|
||||
disabled={rows.length <= 1 || isSubmitting}
|
||||
aria-label="Remove row"
|
||||
aria-label={t('storeItems.create.removeRow')}
|
||||
>
|
||||
<X size={16} />
|
||||
</button>
|
||||
@@ -324,7 +336,7 @@ export function EditStoreItemsModal({
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
<Plus size={16} />
|
||||
Add row
|
||||
{t('storeItems.create.addRow')}
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
@@ -338,10 +350,10 @@ export function EditStoreItemsModal({
|
||||
onClick={onClose}
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
Cancel
|
||||
{t('storeItems.create.cancel')}
|
||||
</button>
|
||||
<button type="submit" className={modalStyles.submitBtn} disabled={!canSubmit}>
|
||||
{isSubmitting ? 'Saving…' : 'Save changes'}
|
||||
{isSubmitting ? t('storeItems.edit.saving') : t('storeItems.edit.save')}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user