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