- uploaded files seems to work on desktop version
This commit is contained in:
@@ -41,8 +41,7 @@ const SoundUpload = () => {
|
||||
path: "soundSettings",
|
||||
value: updatedValues,
|
||||
});
|
||||
const responsee = await fileMutation.mutateAsync(values.soundFile);
|
||||
console.log(responsee);
|
||||
await fileMutation.mutateAsync(values.soundFile);
|
||||
if (result.reason !== "OK") {
|
||||
toast.error("Cannot update sound settings");
|
||||
}
|
||||
@@ -52,7 +51,7 @@ const SoundUpload = () => {
|
||||
|
||||
return (
|
||||
<Formik initialValues={initialValues} onSubmit={handleSubmit} enableReinitialize>
|
||||
{({ setFieldValue, errors, setFieldError, values }) => (
|
||||
{({ setFieldValue, errors, setFieldError }) => (
|
||||
<Form>
|
||||
<label htmlFor="soundFile" className="">
|
||||
Sound File
|
||||
@@ -66,6 +65,10 @@ const SoundUpload = () => {
|
||||
className="mt-4 w-full flex flex-col items-center justify-center rounded-2xl border border-slate-800 bg-slate-900/40 p-10 text-center file:px-3 file:border file:border-gray-500 file:rounded-lg file:bg-blue-800 file:mr-5"
|
||||
onChange={(e) => {
|
||||
if (e.target?.files && e.target?.files[0]?.type === "audio/mpeg") {
|
||||
if (e.target.files[0].size / (1024 * 1024) <= 1) {
|
||||
toast.error("File is too large. Max size is 1MB");
|
||||
return;
|
||||
}
|
||||
const url = URL.createObjectURL(e.target.files[0]);
|
||||
setFieldValue("soundUrl", url);
|
||||
setFieldValue("name", e.target.files[0].name);
|
||||
@@ -80,11 +83,6 @@ const SoundUpload = () => {
|
||||
</FormGroup>
|
||||
|
||||
<div className="mt-4 flex flex-col items-center justify-center rounded-2xl border border-slate-800 bg-slate-900/40 p-10 text-center">
|
||||
{!values.soundFile && (
|
||||
<div className="mb-3 rounded-xl bg-slate-800 px-3 py-1 text-xs uppercase tracking-wider text-slate-400">
|
||||
No uploaded sound files
|
||||
</div>
|
||||
)}
|
||||
<p className="max-w-md text-slate-300">
|
||||
Uploaded Sound files will appear in the <span className="font-bold">drop downs</span> once they are
|
||||
uploaded. They can be used for any <span className="text-blue-400">Sighting,</span>{" "}
|
||||
|
||||
Reference in New Issue
Block a user