Unify dropzone accept prop with accept helpers
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -304,16 +304,11 @@ export default function AuditDetailsPage(props: Props) {
|
||||
</p>
|
||||
<Dropzone
|
||||
description={__(
|
||||
"Only PDF, DOCX files up to 25MB are allowed",
|
||||
"Only PDF up to 25MB are allowed",
|
||||
)}
|
||||
isUploading={isUploading}
|
||||
onDrop={files => void handleUploadFile(files)}
|
||||
accept={{
|
||||
"application/pdf": [".pdf"],
|
||||
"application/msword": [".doc"],
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
||||
"application/vnd.oasis.opendocument.text": [".odt"],
|
||||
}}
|
||||
accept={{ "application/pdf": [".pdf"] }}
|
||||
maxSize={25}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import { acceptImage } from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import {
|
||||
Button,
|
||||
@@ -286,12 +287,7 @@ export function CompliancePageBrandPage(props: { queryRef: PreloadedQuery<Compli
|
||||
description={__("Upload logo image (PNG, JPG, SVG, WEBP up to 5MB)")}
|
||||
isUploading={isUpdating}
|
||||
onDrop={handleLogoDrop}
|
||||
accept={{
|
||||
"image/png": [".png"],
|
||||
"image/jpeg": [".jpg", ".jpeg"],
|
||||
"image/svg+xml": [".svg"],
|
||||
"image/webp": [".webp"],
|
||||
}}
|
||||
accept={acceptImage}
|
||||
maxSize={5}
|
||||
/>
|
||||
)}
|
||||
@@ -336,12 +332,7 @@ export function CompliancePageBrandPage(props: { queryRef: PreloadedQuery<Compli
|
||||
description={__("Upload dark logo image (PNG, JPG, SVG, WEBP up to 5MB)")}
|
||||
isUploading={isUpdating}
|
||||
onDrop={handleDarkLogoDrop}
|
||||
accept={{
|
||||
"image/png": [".png"],
|
||||
"image/jpeg": [".jpg", ".jpeg"],
|
||||
"image/svg+xml": [".svg"],
|
||||
"image/webp": [".webp"],
|
||||
}}
|
||||
accept={acceptImage}
|
||||
maxSize={5}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -12,7 +12,15 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import { getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||
import {
|
||||
acceptData,
|
||||
acceptDocument,
|
||||
acceptImage,
|
||||
acceptPresentation,
|
||||
acceptSpreadsheet,
|
||||
acceptText,
|
||||
getTrustCenterVisibilityOptions,
|
||||
} from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import { Badge, Button, Dialog, DialogContent, DialogFooter, type DialogRef, Dropzone, Field, Option, Spinner } from "@probo/ui";
|
||||
import { useCallback, useState } from "react";
|
||||
@@ -25,38 +33,12 @@ import { useMutationWithToasts } from "#/hooks/useMutationWithToasts";
|
||||
import { useOrganizationId } from "#/hooks/useOrganizationId";
|
||||
|
||||
const acceptedFileTypes = {
|
||||
"application/csv": [".csv"],
|
||||
"application/json": [".json"],
|
||||
"application/msword": [".doc"],
|
||||
"application/pdf": [".pdf"],
|
||||
"application/vnd.ms-excel": [".xls"],
|
||||
"application/vnd.ms-powerpoint": [".ppt"],
|
||||
"application/vnd.oasis.opendocument.presentation": [".odp"],
|
||||
"application/vnd.oasis.opendocument.spreadsheet": [".ods"],
|
||||
"application/vnd.oasis.opendocument.text": [".odt"],
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
|
||||
".pptx",
|
||||
],
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
|
||||
".xlsx",
|
||||
],
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
|
||||
".docx",
|
||||
],
|
||||
"application/yaml": [".yaml", ".yml"],
|
||||
"image/gif": [".gif"],
|
||||
"image/jpeg": [".jpeg", ".jpg"],
|
||||
"image/png": [".png"],
|
||||
"image/svg+xml": [".svg"],
|
||||
"image/webp": [".webp"],
|
||||
"text/csv": [".csv"],
|
||||
"text/json": [".json"],
|
||||
"text/markdown": [".md"],
|
||||
"text/plain": [".txt"],
|
||||
"text/uri-list; charset=utf-8": [".uri"],
|
||||
"text/uri-list": [".uri"],
|
||||
"text/x-log": [".log"],
|
||||
"text/yaml": [".yaml", ".yml"],
|
||||
...acceptDocument,
|
||||
...acceptSpreadsheet,
|
||||
...acceptPresentation,
|
||||
...acceptText,
|
||||
...acceptImage,
|
||||
...acceptData,
|
||||
};
|
||||
|
||||
const createCompliancePageFileMutation = graphql`
|
||||
|
||||
@@ -12,6 +12,14 @@
|
||||
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
// PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
import {
|
||||
acceptData,
|
||||
acceptDocument,
|
||||
acceptImage,
|
||||
acceptPresentation,
|
||||
acceptSpreadsheet,
|
||||
acceptText,
|
||||
} from "@probo/helpers";
|
||||
import { useTranslate } from "@probo/i18n";
|
||||
import {
|
||||
Breadcrumb,
|
||||
@@ -124,18 +132,12 @@ function EvidenceUpload({ measureId, connectionId }: Omit<Props, "ref">) {
|
||||
isUploading={isUpdating}
|
||||
onDrop={files => void handleDrop(files)}
|
||||
accept={{
|
||||
"text/plain": [".uri"],
|
||||
"text/csv": [".csv"],
|
||||
"application/pdf": [".pdf"],
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document":
|
||||
[".docx"],
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":
|
||||
[".xlsx"],
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation":
|
||||
[".pptx"],
|
||||
"image/jpeg": [".jpg", ".jpeg"],
|
||||
"image/png": [".png"],
|
||||
"image/webp": [".webp"],
|
||||
...acceptDocument,
|
||||
...acceptSpreadsheet,
|
||||
...acceptPresentation,
|
||||
...acceptText,
|
||||
...acceptData,
|
||||
...acceptImage,
|
||||
}}
|
||||
maxSize={20}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user