mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 06:31:13 -05:00
Improve sorting controls for moderation queues
Update the `QueueSortControls` component to validate sort fields and improve type safety for sort direction toggling. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ef7037e7-a631-48a2-94d1-9a4b52d7c35a Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7cdf4e95-3f41-4180-b8e3-8ef56d032c0e/ef7037e7-a631-48a2-94d1-9a4b52d7c35a/kcnWjk6
This commit is contained in:
4
.replit
4
.replit
@@ -41,3 +41,7 @@ externalPort = 3000
|
|||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 37143
|
localPort = 37143
|
||||||
externalPort = 3001
|
externalPort = 3001
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 46865
|
||||||
|
externalPort = 3002
|
||||||
|
|||||||
@@ -21,14 +21,25 @@ export const QueueSortControls = ({
|
|||||||
onSortChange,
|
onSortChange,
|
||||||
isMobile
|
isMobile
|
||||||
}: QueueSortControlsProps) => {
|
}: QueueSortControlsProps) => {
|
||||||
const handleFieldChange = (field: SortField) => {
|
const handleFieldChange = (value: string) => {
|
||||||
|
const validFields: SortField[] = ['created_at', 'submission_type', 'status'];
|
||||||
|
|
||||||
|
if (!validFields.includes(value as SortField)) {
|
||||||
|
console.warn('⚠️ [SORT] Invalid sort field:', value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const field = value as SortField;
|
||||||
|
console.log('🔄 [SORT] Field change:', { from: sortConfig.field, to: field });
|
||||||
onSortChange({ ...sortConfig, field });
|
onSortChange({ ...sortConfig, field });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDirectionToggle = () => {
|
const handleDirectionToggle = () => {
|
||||||
|
const newDirection = sortConfig.direction === 'asc' ? 'desc' : 'asc';
|
||||||
|
console.log('🔄 [SORT] Direction toggle:', { from: sortConfig.direction, to: newDirection });
|
||||||
onSortChange({
|
onSortChange({
|
||||||
...sortConfig,
|
...sortConfig,
|
||||||
direction: sortConfig.direction === 'asc' ? 'desc' : 'asc'
|
direction: newDirection
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user