mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-24 17:41:27 -04:00
Disable next button while uploading photos
This commit is contained in:
@@ -58,6 +58,7 @@ export const OptionalProfileUserForm = (props: {
|
||||
const {profile, user, buttonLabel, setProfile, onSubmit, bottomNavBarVisible = true} = props
|
||||
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
const [uploadingImages, setUploadingImages] = useState(false)
|
||||
const [lookingRelationship, setLookingRelationship] = useState(
|
||||
(profile.pref_relation_styles || []).includes('relationship'),
|
||||
)
|
||||
@@ -1003,6 +1004,7 @@ export const OptionalProfileUserForm = (props: {
|
||||
})
|
||||
}
|
||||
image_descriptions={profile.image_descriptions as Record<string, string>}
|
||||
onUpload={(uploading) => setUploadingImages(uploading)}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
@@ -1014,7 +1016,7 @@ export const OptionalProfileUserForm = (props: {
|
||||
? 'bottom-[calc(90px+var(--bnh))]'
|
||||
: 'bottom-[calc(30px+var(--bnh))]',
|
||||
)}
|
||||
disabled={isSubmitting}
|
||||
disabled={isSubmitting || uploadingImages}
|
||||
loading={isSubmitting}
|
||||
onClick={handleSubmit}
|
||||
color={'gray'}
|
||||
|
||||
@@ -19,6 +19,7 @@ export const AddPhotosWidget = (props: {
|
||||
setPhotoUrls: (urls: string[]) => void
|
||||
setPinnedUrl: (url: string) => void
|
||||
setDescription: (url: string, description: string) => void
|
||||
onUpload?: (uploading: boolean) => void
|
||||
}) => {
|
||||
const {
|
||||
username,
|
||||
@@ -28,6 +29,7 @@ export const AddPhotosWidget = (props: {
|
||||
setPinnedUrl,
|
||||
setDescription,
|
||||
image_descriptions,
|
||||
onUpload,
|
||||
} = props
|
||||
const t = useT()
|
||||
|
||||
@@ -37,6 +39,7 @@ export const AddPhotosWidget = (props: {
|
||||
const files = e.target.files
|
||||
if (!files) return
|
||||
setUploadingImages(true)
|
||||
onUpload?.(true)
|
||||
|
||||
// Convert files to an array and take only the first 6 files
|
||||
const selectedFiles = Array.from(files).slice(0, 6)
|
||||
@@ -50,6 +53,7 @@ export const AddPhotosWidget = (props: {
|
||||
if (!pinned_url) setPinnedUrl(urls[0])
|
||||
setPhotoUrls(uniq([...(photo_urls ?? []), ...urls]))
|
||||
setUploadingImages(false)
|
||||
onUpload?.(false)
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user