add pending bage for appeals tanstak-table
This commit is contained in:
@@ -119,9 +119,9 @@ export async function fetchAppealsContentList(page?: number, size?: number, sort
|
||||
message_body: {
|
||||
action: 'all_appeals',
|
||||
page: page,
|
||||
page_size: size,
|
||||
/* sort_by: sortDirection || 'asc',
|
||||
sort_order: sortBy || '', */
|
||||
pageSize: size,
|
||||
sort_by: sortBy || '',
|
||||
sort_order: sortDirection || 'asc',
|
||||
}
|
||||
}),
|
||||
headers: {
|
||||
@@ -173,7 +173,6 @@ export async function changeAppealContentStatus(appealId?: string, approve?: boo
|
||||
|
||||
if (response.ok) {
|
||||
const parsed = await response.json();
|
||||
console.log(parsed);
|
||||
|
||||
if (parsed.message_code === 0) {
|
||||
return parsed.message_body.message_body;
|
||||
|
||||
@@ -21,6 +21,7 @@ import { FileTypeIcon } from '@/app/components/FileTypeIcon';
|
||||
import { downloadFile } from '@/app/actions/contentActions';
|
||||
import { useContentForAppeals, AppealsFile } from '@/app/hooks/react-query/useContentForAppeals';
|
||||
import AppealModerationModal from '@/app/ui/content/AppealModerationModal';
|
||||
import { formatDate, formatDateTime } from '@/app/lib/formatDate';
|
||||
|
||||
const cutFileExtension = (fileName: string) => {
|
||||
const lastDotIndex = fileName.lastIndexOf('.');
|
||||
@@ -57,6 +58,7 @@ const StatusBadge = ({ status }: { status: string }) => {
|
||||
'REJECTED': { className: 'bg-red-100 text-red-800', label: 'Заблокировано' },
|
||||
'MODERATION': { className: 'bg-yellow-100 text-yellow-800', label: 'На модерации' },
|
||||
'APPROVED': { className: 'bg-green-100 text-green-800', label: 'Одобрено' },
|
||||
'PENDING': { className: 'bg-gray-100 text-gray-800', label: 'На рассмотрении' }
|
||||
};
|
||||
|
||||
const config = statusConfig[status] || { className: 'bg-gray-100 text-gray-800', label: status };
|
||||
@@ -89,8 +91,8 @@ export default function ContentAppealsTable({ permission }: { permission: number
|
||||
|
||||
const sort = sorting[0];
|
||||
const sortByMap: Record<string, string> = {
|
||||
'fileName': 'originalFileName',
|
||||
'userId': 'userId',
|
||||
'fileName': 'fileName',
|
||||
'appealId': 'appealId',
|
||||
'status': 'status',
|
||||
'createdAt': 'createdAt',
|
||||
};
|
||||
@@ -237,7 +239,7 @@ export default function ContentAppealsTable({ permission }: { permission: number
|
||||
</span>
|
||||
<button
|
||||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||
className="sort-button hidden"
|
||||
className="sort-button"
|
||||
>
|
||||
{column.getIsSorted() === 'asc' ?
|
||||
<span><IconArrowUp /></span>
|
||||
@@ -253,6 +255,34 @@ export default function ContentAppealsTable({ permission }: { permission: number
|
||||
<StatusBadge status={row.original.status} />
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: 'createdAt',
|
||||
header: ({ column }) => (
|
||||
<div className="column">
|
||||
<span>
|
||||
createdAt
|
||||
</span>
|
||||
<button
|
||||
onClick={() => column.toggleSorting(column.getIsSorted() === 'asc')}
|
||||
className="sort-button"
|
||||
>
|
||||
{column.getIsSorted() === 'asc' ?
|
||||
<span><IconArrowUp /></span>
|
||||
: column.getIsSorted() === 'desc' ?
|
||||
<span><IconArrowDown /></span>
|
||||
: <span><IconFilter /></span>
|
||||
}
|
||||
</button>
|
||||
</div>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<div className="text-center">
|
||||
{row.original.createdAt ? formatDate(row.original.createdAt) : '---'}
|
||||
<br />
|
||||
{row.original.createdAt ? formatDateTime(row.original.createdAt) : '---'}
|
||||
</div>
|
||||
),
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user