fix: inline video upload in artefacts — drop modal, add drag-and-drop + progress bar
Deploy / deploy (push) Successful in 12s

- Replace the two-step video modal with inline drag-and-drop zone + click-to-browse
- Add Google Drive URL input directly in the versions tab
- Add upload progress bar with percentage via XHR
- Support onUploadProgress in api.upload()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
fahed
2026-03-11 11:34:11 +03:00
parent 51708267d3
commit 14751c42e4
4 changed files with 104 additions and 126 deletions
+26 -5
View File
@@ -79,11 +79,32 @@ export const api = {
credentials: 'include',
}).then(r => handleResponse(r, `DELETE ${path}`)),
upload: (path, formData) => fetch(`${API}${path}`, {
method: 'POST',
credentials: 'include',
body: formData,
}).then(r => handleResponse(r, `UPLOAD ${path}`)),
upload: (path, formData, opts = {}) => {
if (opts.onUploadProgress) {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest()
xhr.open('POST', `${API}${path}`)
xhr.withCredentials = true
xhr.upload.onprogress = (e) => {
if (e.lengthComputable) opts.onUploadProgress({ loaded: e.loaded, total: e.total })
}
xhr.onload = () => {
if (xhr.status >= 200 && xhr.status < 300) {
try { resolve(normalize(JSON.parse(xhr.responseText))) } catch { resolve(xhr.responseText) }
} else {
reject(new Error(`Upload failed: ${xhr.status}`))
}
}
xhr.onerror = () => reject(new Error('Upload failed'))
xhr.send(formData)
})
}
return fetch(`${API}${path}`, {
method: 'POST',
credentials: 'include',
body: formData,
}).then(r => handleResponse(r, `UPLOAD ${path}`))
},
};
// Brand color palette — dynamically assigned from a rotating palette