2026-02-06 01:11:33 +00:00
|
|
|
import { Card } from '@/components/ui/card';
|
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
import { Clock, MapPin, AlertCircle, Trash2 } from 'lucide-react';
|
|
|
|
|
import { RETENTION_OPTIONS, REGION_OPTIONS } from './types';
|
|
|
|
|
import type { RetentionValue, RegionValue } from './types';
|
|
|
|
|
|
|
|
|
|
interface CloudSettingsViewPreferencesProps {
|
|
|
|
|
retention: RetentionValue;
|
|
|
|
|
onRetentionChange: (value: RetentionValue) => void;
|
|
|
|
|
region: RegionValue;
|
|
|
|
|
onRegionChange: (value: RegionValue) => void;
|
|
|
|
|
onEmptyTrash: () => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function CloudSettingsViewPreferences({
|
|
|
|
|
retention,
|
|
|
|
|
onRetentionChange,
|
|
|
|
|
region,
|
|
|
|
|
onRegionChange,
|
|
|
|
|
onEmptyTrash,
|
|
|
|
|
}: CloudSettingsViewPreferencesProps) {
|
|
|
|
|
return (
|
|
|
|
|
<Card variant="default">
|
2026-02-07 13:25:20 +00:00
|
|
|
<h3 className="font-bold text-foreground mb-6 tracking-tight">Preferences</h3>
|
2026-02-06 01:11:33 +00:00
|
|
|
|
|
|
|
|
<div className="space-y-6">
|
|
|
|
|
<div>
|
2026-02-07 13:25:20 +00:00
|
|
|
<label className="block text-sm font-bold text-muted-foreground mb-2 flex items-center gap-2">
|
2026-02-06 01:11:33 +00:00
|
|
|
<Clock className="w-4 h-4" /> Trash Retention Policy
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
2026-02-12 01:09:29 +00:00
|
|
|
className="w-full bg-muted border border-border rounded-xl p-4 text-foreground outline-none focus:border-primary transition-colors duration-[var(--sumi-duration-normal)]"
|
2026-02-06 01:11:33 +00:00
|
|
|
value={retention}
|
|
|
|
|
onChange={(e) => onRetentionChange(e.target.value as RetentionValue)}
|
|
|
|
|
>
|
|
|
|
|
{RETENTION_OPTIONS.map((opt) => (
|
|
|
|
|
<option key={opt.value} value={opt.value}>
|
|
|
|
|
{opt.label}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
2026-02-07 13:25:20 +00:00
|
|
|
<p className="text-xs text-muted-foreground mt-1">
|
2026-02-06 01:11:33 +00:00
|
|
|
Deleted files are permanently removed after this period.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
2026-02-07 13:25:20 +00:00
|
|
|
<label className="block text-sm font-bold text-muted-foreground mb-2 flex items-center gap-2">
|
2026-02-06 01:11:33 +00:00
|
|
|
<MapPin className="w-4 h-4" /> Storage Region
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
2026-02-12 01:09:29 +00:00
|
|
|
className="w-full bg-muted border border-border rounded-xl p-4 text-foreground outline-none focus:border-primary transition-colors duration-[var(--sumi-duration-normal)]"
|
2026-02-06 01:11:33 +00:00
|
|
|
value={region}
|
|
|
|
|
onChange={(e) => onRegionChange(e.target.value as RegionValue)}
|
|
|
|
|
>
|
|
|
|
|
{REGION_OPTIONS.map((opt) => (
|
|
|
|
|
<option key={opt.value} value={opt.value}>
|
|
|
|
|
{opt.label}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
2026-02-07 13:25:20 +00:00
|
|
|
<div className="flex items-start gap-2 mt-2 text-xs text-warning bg-warning/10 p-2 rounded-xl">
|
2026-02-06 01:11:33 +00:00
|
|
|
<AlertCircle className="w-3 h-3 mt-0.5 shrink-0" />
|
|
|
|
|
Changing regions requires data migration which may take up to 24 hours.
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-02-07 13:25:20 +00:00
|
|
|
<div className="pt-4 border-t border-border">
|
2026-02-06 01:11:33 +00:00
|
|
|
<Button
|
2026-02-07 13:25:20 +00:00
|
|
|
variant="destructive"
|
|
|
|
|
className="w-full"
|
2026-02-06 01:11:33 +00:00
|
|
|
onClick={onEmptyTrash}
|
|
|
|
|
>
|
|
|
|
|
<Trash2 className="w-4 h-4 mr-2" /> Empty Trash Now
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
}
|