Skip to content

Commit

Permalink
implemented dynamic imports on imageupload page
Browse files Browse the repository at this point in the history
  • Loading branch information
Dashrekker committed Jul 2, 2023
1 parent 533e4f5 commit eb1cbc7
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions frontend/src/features/Train/components/ImageUploadLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,37 @@ import {
} from "@/features/Train/types/trainTypes";
import { Button, Radio, Stack, Typography } from "@mui/material";
import { Controller, UseFormReturn } from "react-hook-form";

import dynamic from "next/dynamic";
import { formatDate } from "@/common/utils/dateFormat";
import {
useGetDatasetFilesDataQuery,
useUploadDatasetFileMutation,
} from "@/features/Train/redux/trainspaceApi";
import { DataGrid } from "@mui/x-data-grid";
import prettyBytes from "pretty-bytes";
import FilerobotImageEditor, {
TABS,
TOOLS,
} from "react-filerobot-image-editor";
import React from "react";

const FilerobotImageEditor = dynamic(
() => import("react-filerobot-image-editor"),
{
ssr: false,
}
);

const TABS = dynamic(
() => import("react-filerobot-image-editor").then((lib) => lib.TABS),
{
ssr: false,
}
);

const TOOLS = dynamic(
() => import("react-filerobot-image-editor").then((lib) => lib.TOOLS),
{
ssr: false,
}
);

const dataURLtoFile = (dataurl: string, filename: string) => {
const arr = dataurl.split(",");
if (arr.length === 0) {
Expand Down

0 comments on commit eb1cbc7

Please sign in to comment.