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 { X } from 'lucide-react'
|
||||
import { useLocale } from '@meshkee/dashboard-ui'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError } from '../lib/api'
|
||||
import { listAllStoreItems } from '../services/storeItemService'
|
||||
import { groupStoreItemsByProduct } from '../utils/storeProductGroups'
|
||||
@@ -30,6 +32,9 @@ export function PickStoreSpecialItemsModal({
|
||||
onConfirm,
|
||||
isSubmitting = false,
|
||||
}: PickStoreSpecialItemsModalProps) {
|
||||
const t = useT()
|
||||
const { locale } = useLocale()
|
||||
const isFa = locale === 'fa'
|
||||
const [mounted, setMounted] = useState(open)
|
||||
const [closing, setClosing] = useState(false)
|
||||
const [options, setOptions] = useState<StoreItemSearchOption[]>([])
|
||||
@@ -97,7 +102,7 @@ export function PickStoreSpecialItemsModal({
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to load store items.')
|
||||
setError(t('website.specialItems.pickErrorLoad'))
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
@@ -117,6 +122,12 @@ export function PickStoreSpecialItemsModal({
|
||||
onConfirm(selectedIds)
|
||||
}
|
||||
|
||||
function confirmLabel() {
|
||||
if (isSubmitting) return t('website.adding')
|
||||
if (selectedIds.length === 1) return t('website.pick.addOneItem')
|
||||
return t('website.pick.addItems', { count: selectedIds.length })
|
||||
}
|
||||
|
||||
if (!mounted) return null
|
||||
|
||||
return createPortal(
|
||||
@@ -130,15 +141,22 @@ export function PickStoreSpecialItemsModal({
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="pick-special-items-title"
|
||||
lang={isFa ? 'fa' : 'en'}
|
||||
dir={isFa ? 'rtl' : 'ltr'}
|
||||
>
|
||||
<div className={modalStyles.header}>
|
||||
<div>
|
||||
<h2 id="pick-special-items-title" className={modalStyles.title}>
|
||||
Add to {specialTitle}
|
||||
{t('website.pick.addTo', { title: specialTitle })}
|
||||
</h2>
|
||||
<p className={modalStyles.subtitle}>Select store items to feature in this category.</p>
|
||||
<p className={modalStyles.subtitle}>{t('website.specialItems.pickSubtitle')}</p>
|
||||
</div>
|
||||
<button type="button" className={modalStyles.closeBtn} onClick={onClose} aria-label="Close">
|
||||
<button
|
||||
type="button"
|
||||
className={modalStyles.closeBtn}
|
||||
onClick={onClose}
|
||||
aria-label={t('common.close')}
|
||||
>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
@@ -147,22 +165,22 @@ export function PickStoreSpecialItemsModal({
|
||||
{error && <p className={styles.error}>{error}</p>}
|
||||
|
||||
{isLoading ? (
|
||||
<p className={styles.empty}>Loading store items...</p>
|
||||
<p className={styles.empty}>{t('website.specialItems.pickLoading')}</p>
|
||||
) : options.length === 0 ? (
|
||||
<p className={styles.empty}>All store items are already in this category.</p>
|
||||
<p className={styles.empty}>{t('website.specialItems.pickEmpty')}</p>
|
||||
) : (
|
||||
<StoreItemMultiSearchSelect
|
||||
options={options}
|
||||
selectedIds={selectedIds}
|
||||
onToggle={toggleSelection}
|
||||
placeholder="Type 3+ characters to search store items"
|
||||
placeholder={t('website.specialItems.pickSearch')}
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className={styles.footer}>
|
||||
<button type="button" className={styles.cancelBtn} onClick={onClose} disabled={isSubmitting}>
|
||||
Cancel
|
||||
{t('products.form.cancel')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -170,7 +188,7 @@ export function PickStoreSpecialItemsModal({
|
||||
onClick={handleConfirm}
|
||||
disabled={isSubmitting || selectedIds.length === 0}
|
||||
>
|
||||
{isSubmitting ? 'Adding...' : `Add ${selectedIds.length || ''} item${selectedIds.length === 1 ? '' : 's'}`}
|
||||
{confirmLabel()}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user