From 9c61607650c26d36a74a3cbd524a6d3cedc4981e Mon Sep 17 00:00:00 2001 From: Yannick Goossens Date: Sun, 12 Jan 2025 20:44:43 +0100 Subject: [PATCH] move AUDIO_MIME_TYPES to constants.ts --- src/components/form/FormFields.jsx | 9 ++------- src/constants.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/components/form/FormFields.jsx b/src/components/form/FormFields.jsx index 32dd9a61c..0c26de485 100644 --- a/src/components/form/FormFields.jsx +++ b/src/components/form/FormFields.jsx @@ -8,6 +8,7 @@ import { AudioVisualizer } from 'react-audio-visualize' import { ALLOWED_FILETYPES_LABEL, ALLOWED_COVER_FILETYPES_LABEL, + AUDIO_MIME_TYPES, } from '@constants' import { Controller, useFormContext } from 'react-hook-form' import classNames from 'classnames' @@ -41,13 +42,7 @@ export const FormFields = ({ value, field, error, register, control }) => { const [showVisualizer, setShowVisualizer] = useState(false) const [audioBlob, setAudioBlob] = useState(null) const visualizerRef = useRef(null) - const AUDIO_MIME_TYPES = [ - 'audio/mpeg', - 'audio/wav', - 'audio/flac', - 'audio/x-flac', - 'audio/ogg', - ] + const getArtistText = (userInfo, address) => { if (userInfo?.name) { return `${userInfo.name} (${address})` diff --git a/src/constants.ts b/src/constants.ts index 4978aaa07..0da6f0041 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -52,6 +52,14 @@ export const MIMETYPE: { [key: string]: string } = { TXT: 'text/plain', } +export const AUDIO_MIME_TYPES = [ + 'audio/mpeg', + 'audio/wav', + 'audio/flac', + 'audio/x-flac', + 'audio/ogg', +] + export const ALLOWED_MIMETYPES = Object.keys(MIMETYPE) .map((k) => MIMETYPE[k]) // disabling GLTF from new updates,