Visual edit in Lovable

This commit is contained in:
gpt-engineer-app[bot]
2025-10-13 01:01:56 +00:00
parent 879b890b64
commit 8164e4ab76

View File

@@ -3,7 +3,6 @@ import { Label } from '@/components/ui/label';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Button } from '@/components/ui/button'; import { Button } from '@/components/ui/button';
import type { SortConfig, SortField } from '@/types/moderation'; import type { SortConfig, SortField } from '@/types/moderation';
interface QueueSortControlsProps { interface QueueSortControlsProps {
sortConfig: SortConfig; sortConfig: SortConfig;
onSortChange: (config: SortConfig) => void; onSortChange: (config: SortConfig) => void;
@@ -11,53 +10,48 @@ interface QueueSortControlsProps {
variant?: 'inline' | 'standalone'; variant?: 'inline' | 'standalone';
showLabel?: boolean; showLabel?: boolean;
} }
const getSortFieldLabel = (field: SortField): string => { const getSortFieldLabel = (field: SortField): string => {
switch (field) { switch (field) {
case 'created_at': return 'Date Created'; case 'created_at':
case 'username': return 'Submitter'; return 'Date Created';
case 'submission_type': return 'Type'; case 'username':
case 'status': return 'Status'; return 'Submitter';
case 'escalated': return 'Escalated'; case 'submission_type':
default: return field; return 'Type';
case 'status':
return 'Status';
case 'escalated':
return 'Escalated';
default:
return field;
} }
}; };
export const QueueSortControls = ({
export const QueueSortControls = ({ sortConfig,
sortConfig,
onSortChange, onSortChange,
isMobile = false, isMobile = false,
variant = 'inline', variant = 'inline',
showLabel = true showLabel = true
}: QueueSortControlsProps) => { }: QueueSortControlsProps) => {
const handleFieldChange = (field: SortField) => { const handleFieldChange = (field: SortField) => {
onSortChange({ ...sortConfig, field }); onSortChange({
}; ...sortConfig,
field
const handleDirectionToggle = () => {
onSortChange({
...sortConfig,
direction: sortConfig.direction === 'asc' ? 'desc' : 'asc'
}); });
}; };
const handleDirectionToggle = () => {
return ( onSortChange({
<div className={`space-y-2 ${isMobile ? 'w-full' : 'min-w-[180px]'}`}> ...sortConfig,
{showLabel && ( direction: sortConfig.direction === 'asc' ? 'desc' : 'asc'
<Label className={`font-medium ${isMobile ? 'text-xs' : 'text-sm'}`}> });
};
return <div className={`space-y-2 ${isMobile ? 'w-full' : 'min-w-[180px]'}`}>
{showLabel && <Label className={`font-medium ${isMobile ? 'text-xs' : 'text-sm'}`}>
Sort By Sort By
</Label> </Label>}
)}
<div className="flex items-center gap-2 text-xs text-muted-foreground mb-1">
<span>
Sorting by {getSortFieldLabel(sortConfig.field)} ({sortConfig.direction === 'asc' ? '↑ Ascending' : '↓ Descending'})
</span>
</div>
<div className="flex gap-2"> <div className="flex gap-2">
<Select <Select value={sortConfig.field} onValueChange={handleFieldChange}>
value={sortConfig.field}
onValueChange={handleFieldChange}
>
<SelectTrigger className={isMobile ? "h-10 flex-1" : "flex-1"}> <SelectTrigger className={isMobile ? "h-10 flex-1" : "flex-1"}>
<SelectValue /> <SelectValue />
</SelectTrigger> </SelectTrigger>
@@ -70,20 +64,9 @@ export const QueueSortControls = ({
</SelectContent> </SelectContent>
</Select> </Select>
<Button <Button variant="outline" size={isMobile ? "default" : "sm"} onClick={handleDirectionToggle} className={isMobile ? "h-10" : ""} title={sortConfig.direction === 'asc' ? 'Sort Descending' : 'Sort Ascending'}>
variant="outline" {sortConfig.direction === 'asc' ? <ArrowUp className="w-4 h-4" /> : <ArrowDown className="w-4 h-4" />}
size={isMobile ? "default" : "sm"}
onClick={handleDirectionToggle}
className={isMobile ? "h-10" : ""}
title={sortConfig.direction === 'asc' ? 'Sort Descending' : 'Sort Ascending'}
>
{sortConfig.direction === 'asc' ? (
<ArrowUp className="w-4 h-4" />
) : (
<ArrowDown className="w-4 h-4" />
)}
</Button> </Button>
</div> </div>
</div> </div>;
); };
};