mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 12:51:14 -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:
@@ -21,14 +21,25 @@ export const QueueSortControls = ({
|
||||
onSortChange,
|
||||
isMobile
|
||||
}: 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 });
|
||||
};
|
||||
|
||||
const handleDirectionToggle = () => {
|
||||
const newDirection = sortConfig.direction === 'asc' ? 'desc' : 'asc';
|
||||
console.log('🔄 [SORT] Direction toggle:', { from: sortConfig.direction, to: newDirection });
|
||||
onSortChange({
|
||||
...sortConfig,
|
||||
direction: sortConfig.direction === 'asc' ? 'desc' : 'asc'
|
||||
direction: newDirection
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user