mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 14:51:13 -05:00
Refactor upload form fields
This commit is contained in:
@@ -26,7 +26,6 @@ export function UppyPhotoSubmissionUpload({
|
||||
rideId,
|
||||
}: UppyPhotoSubmissionUploadProps) {
|
||||
const [title, setTitle] = useState('');
|
||||
const [description, setDescription] = useState('');
|
||||
const [photos, setPhotos] = useState<PhotoWithCaption[]>([]);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
const [uploadProgress, setUploadProgress] = useState<{ current: number; total: number } | null>(null);
|
||||
@@ -194,8 +193,7 @@ export function UppyPhotoSubmissionUpload({
|
||||
user_id: user.id,
|
||||
submission_type: 'photo',
|
||||
content: {
|
||||
title: title.trim(),
|
||||
description: description.trim(),
|
||||
title: title.trim() || undefined,
|
||||
photos: photos.map((photo, index) => ({
|
||||
url: photo.uploadStatus === 'uploaded' ? photo.url : uploadedPhotos.find(p => p.order === photo.order)?.url || photo.url,
|
||||
caption: photo.caption.trim(),
|
||||
@@ -230,7 +228,6 @@ export function UppyPhotoSubmissionUpload({
|
||||
});
|
||||
|
||||
setTitle('');
|
||||
setDescription('');
|
||||
setPhotos([]);
|
||||
onSubmissionComplete?.();
|
||||
} catch (error) {
|
||||
@@ -300,15 +297,14 @@ export function UppyPhotoSubmissionUpload({
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="title" className="text-base font-medium">
|
||||
Title *
|
||||
Title
|
||||
</Label>
|
||||
<Input
|
||||
id="title"
|
||||
value={title}
|
||||
onChange={(e) => setTitle(e.target.value)}
|
||||
placeholder="Give your photos a descriptive title"
|
||||
placeholder="Give your photos a descriptive title (optional)"
|
||||
maxLength={100}
|
||||
required
|
||||
disabled={isSubmitting}
|
||||
className="transition-all duration-200 focus:ring-2 focus:ring-primary/20"
|
||||
/>
|
||||
@@ -317,25 +313,6 @@ export function UppyPhotoSubmissionUpload({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="description" className="text-base font-medium">
|
||||
Description
|
||||
</Label>
|
||||
<Textarea
|
||||
id="description"
|
||||
value={description}
|
||||
onChange={(e) => setDescription(e.target.value)}
|
||||
placeholder="Add a general description about these photos..."
|
||||
maxLength={500}
|
||||
rows={3}
|
||||
disabled={isSubmitting}
|
||||
className="transition-all duration-200 focus:ring-2 focus:ring-primary/20 resize-none"
|
||||
/>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{description.length}/500 characters
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label className="text-base font-medium">Photos *</Label>
|
||||
|
||||
Reference in New Issue
Block a user