mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
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
@@ -7,6 +7,7 @@ import { BlogCommentsModal } from '../components/BlogCommentsModal'
|
||||
import { ConfirmDeleteModal } from '../components/ConfirmDeleteModal'
|
||||
import { Pagination } from '../components/Pagination'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError } from '../lib/api'
|
||||
import {
|
||||
BLOGS_PER_PAGE,
|
||||
@@ -23,6 +24,7 @@ import styles from './BlogPage.module.css'
|
||||
export function BlogListPage() {
|
||||
const navigate = useNavigate()
|
||||
const { showToast } = useToast()
|
||||
const t = useT()
|
||||
const [blogs, setBlogs] = useState<Blog[]>([])
|
||||
const [totalBlogs, setTotalBlogs] = useState(0)
|
||||
const [currentPage, setCurrentPage] = useState(1)
|
||||
@@ -58,7 +60,7 @@ export function BlogListPage() {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to load blog posts.')
|
||||
setError(t('blog.list.errorLoad'))
|
||||
}
|
||||
} finally {
|
||||
setIsLoading(false)
|
||||
@@ -91,7 +93,7 @@ export function BlogListPage() {
|
||||
|
||||
try {
|
||||
await deleteBlog(deleteTarget.id)
|
||||
showToast('Blog post removed.', 'success')
|
||||
showToast(t('blog.list.toast.removed'), 'success')
|
||||
const nextTotal = totalBlogs - 1
|
||||
const nextTotalPages = Math.max(1, Math.ceil(nextTotal / BLOGS_PER_PAGE))
|
||||
const nextPage = currentPage > nextTotalPages ? nextTotalPages : currentPage
|
||||
@@ -102,7 +104,7 @@ export function BlogListPage() {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to delete blog post.')
|
||||
setError(t('blog.list.errorDelete'))
|
||||
}
|
||||
} finally {
|
||||
setIsDeleting(false)
|
||||
@@ -135,12 +137,15 @@ export function BlogListPage() {
|
||||
setBlogs((prev) =>
|
||||
prev.map((item) => (item.id === id ? mapBlogApiToUi(result.blog) : item)),
|
||||
)
|
||||
showToast(nextVerified ? 'Blog verified.' : 'Blog unverified.', 'success')
|
||||
showToast(
|
||||
nextVerified ? t('blog.list.toast.verified') : t('blog.list.toast.unverified'),
|
||||
'success',
|
||||
)
|
||||
} catch (err) {
|
||||
if (err instanceof ApiError) {
|
||||
setError(err.message)
|
||||
} else {
|
||||
setError('Unable to update blog verification.')
|
||||
setError(t('blog.list.errorVerify'))
|
||||
}
|
||||
} finally {
|
||||
setVerifyingId(null)
|
||||
@@ -159,9 +164,9 @@ export function BlogListPage() {
|
||||
|
||||
<div className={pageStyles.pageHeader}>
|
||||
<div>
|
||||
<h2 className={pageStyles.pageTitle}>My Blogs</h2>
|
||||
<h2 className={pageStyles.pageTitle}>{t('title.myBlogs')}</h2>
|
||||
<p className={pageStyles.pageSubtitle}>
|
||||
{totalBlogs} posts · View, edit and manage your blog content.
|
||||
{t('blog.list.subtitle', { count: totalBlogs })}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -173,9 +178,9 @@ export function BlogListPage() {
|
||||
)}
|
||||
|
||||
{isLoading ? (
|
||||
<p className={styles.empty}>Loading blog posts...</p>
|
||||
<p className={styles.empty}>{t('blog.list.loading')}</p>
|
||||
) : blogs.length === 0 ? (
|
||||
<p className={styles.empty}>No blog posts found.</p>
|
||||
<p className={styles.empty}>{t('blog.list.empty')}</p>
|
||||
) : (
|
||||
<>
|
||||
<div className={pageStyles.grid}>
|
||||
@@ -205,17 +210,17 @@ export function BlogListPage() {
|
||||
type="button"
|
||||
className={styles.addFab}
|
||||
onClick={() => navigate('/blog/new')}
|
||||
aria-label="Add new blog"
|
||||
aria-label={t('blog.list.addNew')}
|
||||
>
|
||||
<Plus size={26} strokeWidth={2.5} />
|
||||
</button>
|
||||
|
||||
<ConfirmDeleteModal
|
||||
open={!!deleteTarget}
|
||||
title="Delete Blog Post"
|
||||
title={t('blog.list.deleteTitle')}
|
||||
message={
|
||||
deleteTarget
|
||||
? `Are you sure you want to delete "${deleteTarget.title}"? This action cannot be undone.`
|
||||
? t('blog.list.deleteMessage', { name: deleteTarget.title })
|
||||
: ''
|
||||
}
|
||||
onConfirm={confirmDelete}
|
||||
|
||||
Reference in New Issue
Block a user