-
-
-
- {!props.isDragActive && (
- <>
-
-
- Supports: XLSX, CSV
-
-
- Drag and Drop Spreadsheets File here or connect to Google
- Drive
-
-
-
-
- External search
-
-
- Local upload
-
-
(
+
+ {file.name} - {formatBytes(file.size)}
+
+ {errors.map((e) => (
+ {e.message}
+ ))}
+
+
+ ));
+ return (
+ <>
+
+
+
+
+ {!isDragActive && (
+ <>
+
+
-
Connect to google drive
-
-
-
- {/* {props.uploadError && (
-
+
-
- {" "}
- Unable to upload your file. Please try again!
-
-
Error
-
- )} */}
- >
- )}
+ Drag and Drop Spreadsheets File here
+
+ >
+ )}
+
+
-
+
+ {fileRejections.length > 0 && fileRejectionItems}
+ >
);
};
diff --git a/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx b/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx
new file mode 100644
index 000000000..602353970
--- /dev/null
+++ b/src/app/modules/dataset-upload-module/component/externalSourcesList.tsx
@@ -0,0 +1,78 @@
+import React from "react";
+
+interface Source {
+ name: string;
+ value: string;
+}
+
+interface Props {
+ baseSources: Source[];
+ sources: string[];
+ setSources: (c: string[]) => void;
+ customCss?: { gap: string };
+}
+export default function SourceCategoryList(props: Readonly
) {
+ const { customCss } = props;
+ return (
+ button {
+ font-size: 14px;
+ cursor: pointer;
+ min-width: 160px;
+ background: #fff;
+ border-radius: 30px;
+ border: 0.5px solid #231d2c;
+ font-family: "GothamNarrow-Book", sans-serif;
+ padding: 12px 0px;
+ }
+ `}
+ >
+ {props.baseSources.map((s) => (
+ {
+ if (!props.sources.includes(s.value)) {
+ props.setSources([...props.sources, s.value]);
+ } else {
+ const fSource = props.sources.filter((f) => f !== s.value);
+ props.setSources(fSource);
+ }
+ }}
+ style={
+ props.sources.includes(s.value)
+ ? {
+ color: "#fff",
+ background: "#6061E5",
+ border: "none",
+ fontWeight: 400,
+ fontFamily: "GothamNarrow-Bold, sans-serif",
+ }
+ : {}
+ }
+ >
+ {s.name}
+
+ ))}
+
+ );
+}
diff --git a/src/app/modules/dataset-upload-module/component/tabs.tsx b/src/app/modules/dataset-upload-module/component/tabs.tsx
new file mode 100644
index 000000000..d5267d986
--- /dev/null
+++ b/src/app/modules/dataset-upload-module/component/tabs.tsx
@@ -0,0 +1,67 @@
+import React from "react";
+import ComputerIcon from "../assets/computer-icon";
+import { Search } from "@material-ui/icons";
+
+interface Props {
+ activeTab: "search" | "file";
+ setActiveTab: (c: "search" | "file") => void;
+}
+
+function UploadTabs({ activeTab, setActiveTab }: Props) {
+ return (
+
+ setActiveTab("search")}
+ >
+ Federated search
+
+
+ setActiveTab("file")}
+ >
+ FILE
+ upload
+
+
+ );
+}
+
+export default UploadTabs;
diff --git a/src/app/modules/dataset-upload-module/component/uploadOption.tsx b/src/app/modules/dataset-upload-module/component/uploadOption.tsx
new file mode 100644
index 000000000..cdbd60c52
--- /dev/null
+++ b/src/app/modules/dataset-upload-module/component/uploadOption.tsx
@@ -0,0 +1,196 @@
+import React from "react";
+import SettingsIcon from "../assets/upload-options-icons/settings";
+
+const UploadOption = (props: {
+ name: string;
+ type: string;
+ formats: string[];
+ icon: React.ReactNode;
+ disabled?: boolean;
+ onClick: (e: React.MouseEvent) => void;
+ setActiveOption: React.Dispatch>;
+ connected?: boolean;
+ onLogout?: () => void;
+ canConnect?: boolean;
+}) => {
+ const [openSettings, setOpenSettings] = React.useState(false);
+ return (
+ {
+ props.setActiveOption(props.name);
+ props.onClick(e);
+ }}
+ >
+
+ {props.icon}
+
+
+ {props.name}
+
+
+ {props.type}
+
+
+
+
+ {props.canConnect ? (
+
+
+
+ {props.connected ? "Connected" : "Not Connected"}
+
+
+ {props.connected ? (
+
{
+ e.stopPropagation();
+ setOpenSettings(!openSettings);
+ }}
+ >
+
{
+ e.stopPropagation();
+ }}
+ >
+ {
+ props.onLogout?.();
+ setOpenSettings(false);
+ }}
+ css={`
+ font-size: 12px;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 15px; /* 125% */
+ letter-spacing: 0.5px;
+ color: white;
+ font-family: "GothamNarrow-Bold", sans-serif;
+ border-radius: 12px;
+ background: #6061e5;
+ border: none;
+ /* padding: 5px 0; */
+ width: 113px;
+ height: 24px;
+ cursor: pointer;
+ :hover: {
+ opacity: 0.8;
+ }
+ `}
+ >
+ Logout
+
+
+
+
+
+ ) : null}
+
+ ) : (
+
+ {props.formats.map((f) => (
+ {f}
+ ))}
+
+ )}
+
+
+ );
+};
+
+export default UploadOption;
diff --git a/src/app/modules/dataset-upload-module/style.ts b/src/app/modules/dataset-upload-module/style.ts
index 14969be72..f94d6767c 100644
--- a/src/app/modules/dataset-upload-module/style.ts
+++ b/src/app/modules/dataset-upload-module/style.ts
@@ -18,36 +18,14 @@ export const stepcss = css`
height: 50px;
}
`;
-export const uploadDatasetcss = css`
- div:nth-child(1) {
- background: #dadaf8;
- height: 55px;
- width: 100%;
- color: #231d2c;
- font-family: "GothamNarrow-Book";
- font-style: normal;
- font-weight: 500;
- font-size: 14px;
- display: flex;
- align-items: center;
- padding-left: 2rem;
- margin-top: 5rem;
- }
-`;
export const uploadAreacss = (isDragActive: boolean, disabled?: boolean) => css`
- height: 529px;
+ height: 131px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
- background-color: ${isDragActive && !disabled ? "#c4c4c4" : "#ffffff"};
- background-image: ${isDragActive && !disabled
- ? `url(
- "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='163' height='163' viewBox='0 0 20 20'%3E%3Cg %3E%3Cpolygon fill='%23ffffff' points='20 10 10 0 0 0 20 20'/%3E%3Cpolygon fill='%23ffffff' points='0 10 0 20 10 20'/%3E%3C/g%3E%3C/svg%3E"
- )`
- : "unset"};
&:hover {
cursor: ${!isDragActive && !disabled ? "pointer" : "default"};
}
@@ -94,7 +72,7 @@ export const metaDatacss = css`
font-weight: 500;
font-size: 48px;
font-family: "Inter", sans-serif;
- margin-top: 6rem;
+ margin-top: 40px;
margin-bottom: 4.5rem;
}
diff --git a/src/app/modules/dataset-upload-module/upload-steps/addDatasetFragment.tsx b/src/app/modules/dataset-upload-module/upload-steps/addDatasetFragment.tsx
index 583b07326..509fcae5a 100644
--- a/src/app/modules/dataset-upload-module/upload-steps/addDatasetFragment.tsx
+++ b/src/app/modules/dataset-upload-module/upload-steps/addDatasetFragment.tsx
@@ -1,69 +1,59 @@
/**third party */
-import React, { useCallback, useEffect } from "react";
-import { useDropzone } from "react-dropzone";
-import useDrivePicker from "react-google-drive-picker";
-import {
- CallbackDoc,
- PickerCallback,
-} from "react-google-drive-picker/dist/typeDefs";
-import axios from "axios";
+import React, { useCallback } from "react";
+
/** project */
-import { formatBytes } from "app/utils/formatBytes";
-import { useStoreState } from "app/state/store/hooks";
+
import { DropZone } from "app/modules/dataset-upload-module/component/dropzone/";
+import { Box } from "@material-ui/core";
+import LocalIcon from "../assets/upload-options-icons/local";
+import GoogleIcon from "../assets/upload-options-icons/google";
+import MicrosoftIcon from "../assets/upload-options-icons/microsoft";
+import ApiIcon from "../assets/upload-options-icons/api";
+import MSSQLIcon from "../assets/upload-options-icons/mssql.png";
+import MYSQLIcon from "../assets/upload-options-icons/mysql.png";
+import PostgresIcon from "../assets/upload-options-icons/postgres";
+import MongoDbIcon from "../assets/upload-options-icons/mongodb";
+import HubspotIcon from "../assets/upload-options-icons/hubspot";
+import UploadOption from "../component/uploadOption";
+import { useCookie } from "react-use";
+import useGoogleDrivePicker from "app/hooks/useGoogleDrivePicker";
+import { useOneDrivePicker } from "app/hooks/useOneDrivePicker";
interface Props {
disabled: boolean;
onFileSubmit: (file: File) => void;
processingError: string | null;
- setIsExternalSearch: React.Dispatch>;
+ activeOption: string | null;
+ setActiveOption: React.Dispatch>;
+ setActiveStep: React.Dispatch>;
}
export default function AddDatasetFragment(props: Props) {
- const [openPicker] = useDrivePicker();
- const token = useStoreState((state) => state.AuthToken.value);
-
- const handleGoogleDriveFilePicker = async (
- file: CallbackDoc,
- accessToken: string
- ) => {
- try {
- const response = await axios({
- url: `https://www.googleapis.com/drive/v3/files/${file.id}${
- file.type === "file" ? "?alt=media" : "/export?mimeType=text/csv"
- }`,
- method: "GET",
- headers: {
- Authorization: `Bearer ${accessToken}`,
- },
- responseType: "blob", // important
- });
-
- const b = response?.data;
- const gfile = new File([b], file.name, { type: "text/csv" });
+ const [googleDriveToken, setGoogleDriveToken, deleteGoogleDriveToken] =
+ useCookie("googleDriveToken");
- props.onFileSubmit(gfile);
- } catch (e) {
- console.log(e, "handleGoogleDriveFilePicker error");
- }
- };
- useEffect(() => {
- if (process.env.REACT_APP_CYPRESS_TEST === "true") {
- window.handleGoogleDriveFilePicker = function (file: any, token: string) {
- handleGoogleDriveFilePicker(file, token);
- };
- }
- }, []);
+ const { getAccessTokenAndOpenPicker } = useGoogleDrivePicker({
+ onCancel: () => {
+ props.setActiveOption(null);
+ },
+ onFileSubmit: (file: File) => {
+ props.onFileSubmit(file);
+ },
+ googleDriveToken,
+ setGoogleDriveToken,
+ });
- const ACCEPTED_FILES = {
- "text/csv": [".csv"],
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
- ".xlsx",
- ],
- "application/xml": [".xml"],
- "application/vnd.ms-excel": [".xls"],
- "application/xhtml+xml": [".xhtml"],
- };
+ const { launchPicker, clearToken, connected } = useOneDrivePicker({
+ onCancel: () => {
+ props.setActiveOption(null);
+ },
+ onFileSubmit: (file: File) => {
+ props.onFileSubmit(file);
+ },
+ onDownloadStart: () => {
+ props.setActiveStep(1);
+ },
+ });
const onDrop = useCallback((acceptedFiles: File[]) => {
if (acceptedFiles.length > 0) {
@@ -71,76 +61,207 @@ export default function AddDatasetFragment(props: Props) {
}
}, []);
- const {
- getRootProps,
- getInputProps,
- isDragActive,
- acceptedFiles,
- fileRejections,
- } = useDropzone({ onDrop, accept: ACCEPTED_FILES });
-
- const getAccessToken = () => {
- return axios.get(
- `${process.env.REACT_APP_API}/dataset/google-drive/user-token`,
- {
- headers: {
- Authorization: `Bearer ${token}`,
- },
- }
- );
- };
-
- const getAccessTokenAndOpenPicker = async () => {
- try {
- const res = await getAccessToken();
-
- //opens google drive picker
- openPicker({
- clientId: process.env.REACT_APP_GOOGLE_API_CLIENT_ID as string,
- developerKey: process.env.REACT_APP_GOOGLE_API_DEV_KEY as string,
- viewId: "SPREADSHEETS",
- supportDrives: true,
- token: res.data,
- setSelectFolderEnabled: true,
- callbackFunction: (d: PickerCallback) => {
- handleGoogleDriveFilePicker(d.docs[0], res.data);
- },
- });
- } catch (e) {
- console.log(e, "error");
- }
- };
-
- function handleOpenPicker(e: React.MouseEvent) {
- e.stopPropagation();
- getAccessTokenAndOpenPicker();
- }
-
- const fileRejectionItems = fileRejections.map(({ file, errors }) => (
-
- {file.name} - {formatBytes(file.size)}
-
- {errors.map((e) => (
- {e.message}
- ))}
-
-
- ));
+ const uploadOptions = [
+ {
+ name: "Local upload",
+ type: "Table Dataset",
+ formats: ["CSV", "XSLX", "JSON", "ODS", "SQLite"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "Google Drive",
+ type: "Upload",
+ formats: [],
+ icon: ,
+ onClick: (e: React.MouseEvent) => {
+ e.stopPropagation();
+ getAccessTokenAndOpenPicker();
+ },
+ canConnect: true,
+ connected: !!googleDriveToken,
+ onLogout: () => {
+ deleteGoogleDriveToken();
+ },
+ },
+ {
+ name: "Microsoft Cloud",
+ type: "Upload",
+ formats: [],
+ icon: ,
+ onClick: (e: React.MouseEvent) => {
+ e.stopPropagation();
+ launchPicker();
+ },
+ canConnect: true,
+ connected: connected,
+ onLogout: async () => {
+ await clearToken();
+ },
+ },
+ {
+ name: "API Connection",
+ type: "URL, JSON or XML root",
+ formats: ["CSV", "XSLX", "JSON", "ODS", "SQLite"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "MSSQL",
+ type: "DataBase Connection",
+ formats: ["Coming Soon"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "MSSQL",
+ type: "DataBase Connection",
+ formats: ["Coming Soon"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "PostgreSQL",
+ type: "DataBase Connection",
+ formats: ["Coming Soon"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "MongoDB",
+ type: "DataBase Connection",
+ formats: ["Coming Soon"],
+ icon: ,
+ onClick: () => {},
+ },
+ {
+ name: "Hubspot",
+ type: "DataBase Connection",
+ formats: ["Coming Soon"],
+ icon: ,
+ onClick: () => {},
+ },
+ ];
return (
<>
-
- {fileRejections.length > 0 && fileRejectionItems}
+
+
File Upload
+
+
+ Upload your favourite data effortlessly in DataXplorer, and with just
+ a few clicks, import datasets without the hassle of downloading,{" "}
+
+ enabling you to visualize and analyse diverse data like never before.
+
+
+
+
+
+ {props.activeOption === "Local upload" ? (
+ <>
+
+ >
+ ) : (
+
+
+ Connect your data
+
+
+
+ {uploadOptions.slice(0, 3).map((option) => (
+
+ ))}
+
+
+
+
+
+ {uploadOptions.slice(3).map((option) => (
+
+ ))}
+
+
+
+ )}
>
);
}
diff --git a/src/app/modules/dataset-upload-module/upload-steps/externalSearch.tsx b/src/app/modules/dataset-upload-module/upload-steps/externalSearch.tsx
index 2ffa2cd79..43aae4f6c 100644
--- a/src/app/modules/dataset-upload-module/upload-steps/externalSearch.tsx
+++ b/src/app/modules/dataset-upload-module/upload-steps/externalSearch.tsx
@@ -9,6 +9,7 @@ import useDebounce from "react-use/lib/useDebounce";
import axios from "axios";
import CircleLoader from "app/modules/home-module/components/Loader";
import { useInfinityScroll } from "app/hooks/useInfinityScroll";
+import SourceCategoryList from "../component/externalSourcesList";
export interface IExternalDataset {
name: string;
@@ -32,7 +33,6 @@ export default function ExternalSearch(props: {
handleDownload: (dataset: IExternalDataset) => void;
setProcessingError: React.Dispatch>;
setActiveStep: React.Dispatch>;
- setIsExternalSearch: React.Dispatch>;
}) {
const observerTarget = React.useRef(null);
const [tableView, setTableView] = React.useState(false);
@@ -45,6 +45,14 @@ export default function ExternalSearch(props: {
const limit = 20;
const [datasets, setDatasets] = React.useState([]);
+ const [sources, setSources] = React.useState([]);
+ const baseSources = [
+ { name: "Kaggle", value: "Kaggle" },
+ { name: "World Bank", value: "World Bank" },
+ { name: "WHO", value: "WHO" },
+ { name: "HDX", value: "HDX" },
+ ];
+
const { isObserved } = useInfinityScroll(observerTarget);
const abortControllerRef = React.useRef(
@@ -53,8 +61,8 @@ export default function ExternalSearch(props: {
const terminateSearch = () => {
abortControllerRef.current.abort();
abortControllerRef.current = new AbortController();
- setDatasets([]);
- setOffset(0);
+ // setDatasets([]);
+ // setOffset(0);
};
// Pagination on scroll
@@ -70,7 +78,9 @@ export default function ExternalSearch(props: {
const response = await axios.get(
`${
process.env.REACT_APP_API
- }/external-sources/search?q=${searchValue}&source=${"Kaggle,World Bank,WHO,HDX"}&offset=${offset}&limit=${limit}`,
+ }/external-sources/search?q=${searchValue}&source=${
+ sources.length ? sources.join(",") : "Kaggle,World Bank,WHO,HDX"
+ }&offset=${offset}&limit=${limit}`,
{
signal: abortControllerRef.current.signal,
headers: {
@@ -112,70 +122,62 @@ export default function ExternalSearch(props: {
}
},
500,
- [searchValue, token]
+ [searchValue, token, sources]
);
return (
<>
-
props.setIsExternalSearch(false)}>
-
-
-
-
External Search
-
- Connect to your favourite data sources effortlessly in DataXplorer,
- and with just a few clicks, import datasets without the hassle of
- downloading, enabling you to visualize and analyse diverse data like
- never before.
-
-
+
Federated Search
+
+
+ Connect to your favourite data sources effortlessly in DataXplorer,
+ and with just a few clicks, import datasets without the hassle of
+ downloading,
+ enabling you to visualize and analyse diverse data like never
+ before.
+
-
-
-
-
+
+
+
+
+
-
+
+
{datasets &&
datasets?.map((dataset, index) => (
diff --git a/src/app/modules/dataset-upload-module/upload-steps/index.tsx b/src/app/modules/dataset-upload-module/upload-steps/index.tsx
index 7cbe4154d..6c0919e58 100644
--- a/src/app/modules/dataset-upload-module/upload-steps/index.tsx
+++ b/src/app/modules/dataset-upload-module/upload-steps/index.tsx
@@ -1,5 +1,5 @@
/** third party */
-import React from "react";
+import React, { useEffect } from "react";
import axios from "axios";
import Container from "@material-ui/core/Container";
import { useAuth0, withAuthenticationRequired } from "@auth0/auth0-react";
@@ -23,6 +23,10 @@ import ExternalSearch, {
import Stepper from "app/modules/dataset-upload-module/component/stepper";
import { Box } from "@material-ui/core";
import { useTitle } from "react-use";
+import BreadCrumbs from "app/modules/home-module/components/Breadcrumbs";
+import UploadTabs from "../component/tabs";
+import HomeFooter from "app/modules/home-module/components/Footer";
+import SmallFooter from "app/modules/home-module/components/Footer/smallFooter";
interface Props {
datasetId: string;
@@ -50,7 +54,9 @@ function DatasetUploadSteps(props: Props) {
const [processed, setProcessed] = React.useState(false);
const [selectedFile, setSelectedFile] = React.useState(null);
const [isExternalSearch, setIsExternalSearch] = React.useState(false);
- const [fromExternalSearch, setFromExternalSearch] = React.useState(false);
+
+ const [activeTab, setActiveTab] = React.useState<"search" | "file">("search");
+ const [activeOption, setActiveOption] = React.useState(null);
const defaultProcessingError =
"Data could not be processed, please try again or contact your administrator";
@@ -203,9 +209,6 @@ function DatasetUploadSteps(props: Props) {
const id = ObjectId();
//expose file id to datasetId state; to be used in dataset upload
props.setDatasetId(id);
- //set isExternalSearch to false
- setIsExternalSearch(false);
- setFromExternalSearch(true);
//set active step to processing
setActiveStep(1);
axios
@@ -249,21 +252,63 @@ function DatasetUploadSteps(props: Props) {
const tryAgain = () => {
setActiveStep(0);
- if (fromExternalSearch) {
- setIsExternalSearch(true);
- }
};
+ useEffect(() => {
+ if (activeOption) {
+ setActiveOption(null);
+ }
+ }, [activeTab]);
+
const currentStep = () => {
switch (activeStep) {
case 0:
return (
-
+ <>
+
+ {
+ if (activeOption) {
+ setActiveOption(null);
+ }
+ }}
+ >
+ Connect Data
+
+ ),
+ path: "#",
+ },
+ ...(activeOption ? [{ title: activeOption }] : []),
+ ]}
+ />
+
+
+
+ {activeTab === "search" ? (
+ <>
+
+ >
+ ) : (
+
+ )}
+ >
);
case 1:
return (
@@ -309,7 +354,9 @@ function DatasetUploadSteps(props: Props) {
onFileSubmit={onFileSubmit}
disabled={false}
processingError={processingError}
- setIsExternalSearch={setIsExternalSearch}
+ setActiveOption={setActiveOption}
+ activeOption={activeOption}
+ setActiveStep={setActiveStep}
/>
);
}
@@ -317,38 +364,32 @@ function DatasetUploadSteps(props: Props) {
return (
<>
-
-
- {steps.map((tab, index) => (
- 0 && !processed && activeStep !== index}
- />
- ))}
-
+
+
+
+ {steps.map((tab, index) => (
+ 0 && !processed && activeStep !== index}
+ />
+ ))}
+
- {isExternalSearch ? (
- <>
-
-
- >
- ) : (
<>
{currentStep()}
>
- )}
-
+
+
+ {activeStep === 0 ? : null}
>
);
}
diff --git a/src/app/modules/home-module/components/All/assetsGrid.tsx b/src/app/modules/home-module/components/All/assetsGrid.tsx
index 09f6b0211..760c9449e 100644
--- a/src/app/modules/home-module/components/All/assetsGrid.tsx
+++ b/src/app/modules/home-module/components/All/assetsGrid.tsx
@@ -22,12 +22,12 @@ import ReportAddnewCard from "../Reports/reportAddNewCard";
import ColoredReportIcon from "app/assets/icons/ColoredReportIcon";
import DeleteDatasetDialog from "app/components/Dialogs/deleteDatasetDialog";
import DeleteReportDialog from "app/components/Dialogs/deleteReportDialog";
+import { HomepageTable } from "../Table";
interface Props {
sortBy: string;
searchStr: string;
tableView: boolean;
- addCard?: boolean;
showMenuButton: boolean;
inChartBuilder?: boolean;
category?: string;
@@ -236,87 +236,115 @@ export default function AssetsGrid(props: Props) {
return (
<>
-
- {props.addCard && (
- <>
-
-
-
- >
- )}
- {loadedAssets.map((d, index) => (
-
- {
- {
- chart: (
- {
- setActiveAssetType(d.assetType as assetType);
- handleModal(d.id);
- }}
- handleDuplicate={() =>
- handleDuplicate(d.id, d.assetType as assetType)
- }
- owner={d.owner}
- isAIAssisted={d.isAIAssisted}
- />
- ),
- dataset: (
- {
- setActiveAssetType(d.assetType as assetType);
- handleModal(d.id);
- }}
- descr={d.description}
- handleDuplicate={() => {
- handleDuplicate(d.id, d.assetType as assetType);
- }}
- showMenu={!props.inChartBuilder}
- id={d.id}
- owner={d.owner}
- inChartBuilder={props.inChartBuilder as boolean}
- fromHome={props.fromHome}
- />
- ),
- report: (
- }
- color={d.backgroundColor}
- showMenuButton={props.showMenuButton}
- handleDelete={() => {
- setActiveAssetType(d.assetType as assetType);
- handleModal(d.id);
- }}
- handleDuplicate={() =>
- handleDuplicate(d.id, d.assetType as assetType)
- }
- title={d.title || d.name}
- owner={d.owner}
- />
- ),
- }[d.assetType as assetType]
+ {props.tableView ? (
+ {
+ if (data.assetType === "chart") {
+ return {
+ id: data.id,
+ name: data.name,
+ description: data.title,
+ createdDate: data.createdDate,
+ type: data.assetType,
+ };
+ } else if (data.assetType === "dataset") {
+ return {
+ id: data.id,
+ name: data.name,
+ description: data.description,
+ createdDate: data.createdDate,
+ type: data.assetType,
+ };
}
-
-
- ))}
-
+ return {
+ id: data.id,
+ name: data.name,
+ description: data.title,
+ createdDate: data.createdDate,
+ type: data.assetType,
+ };
+ })}
+ />
+ ) : (
+
+ {loadedAssets.map((d, index) => (
+
+ {
+ {
+ chart: (
+ {
+ setActiveAssetType(d.assetType as assetType);
+ handleModal(d.id);
+ }}
+ handleDuplicate={() =>
+ handleDuplicate(d.id, d.assetType as assetType)
+ }
+ owner={d.owner}
+ isAIAssisted={d.isAIAssisted}
+ />
+ ),
+ dataset: (
+ {
+ setActiveAssetType(d.assetType as assetType);
+ handleModal(d.id);
+ }}
+ descr={d.description}
+ handleDuplicate={() => {
+ handleDuplicate(d.id, d.assetType as assetType);
+ }}
+ showMenu={!props.inChartBuilder}
+ id={d.id}
+ owner={d.owner}
+ inChartBuilder={props.inChartBuilder as boolean}
+ fromHome={props.fromHome}
+ />
+ ),
+ report: (
+ }
+ color={d.backgroundColor}
+ showMenuButton={props.showMenuButton}
+ handleDelete={() => {
+ setActiveAssetType(d.assetType as assetType);
+ handleModal(d.id);
+ }}
+ handleDuplicate={() =>
+ handleDuplicate(d.id, d.assetType as assetType)
+ }
+ title={d.title || d.name}
+ owner={d.owner}
+ />
+ ),
+ }[d.assetType as assetType]
+ }
+
+
+
+ ))}
+
+ )}
diff --git a/src/app/modules/home-module/components/Breadcrumbs/index.tsx b/src/app/modules/home-module/components/Breadcrumbs/index.tsx
new file mode 100644
index 000000000..9e5b45b9d
--- /dev/null
+++ b/src/app/modules/home-module/components/Breadcrumbs/index.tsx
@@ -0,0 +1,81 @@
+import { KeyboardArrowRight } from "@material-ui/icons";
+import React from "react";
+import { Link } from "react-router-dom";
+
+interface BreadCrumbsProps {
+ items: { path?: string; title: React.ReactNode }[];
+}
+
+function BreadCrumbs(props: BreadCrumbsProps) {
+ return (
+
+ {props.items.map((item, index) => (
+
+ {index === props.items.length - 1 ? (
+
+ {item.title}
+
+ ) : (
+
+ {item.title}
+
+ )}
+
+ {index < props.items.length - 1 && (
+
+ )}
+
+ ))}
+
+ );
+}
+
+export default BreadCrumbs;
diff --git a/src/app/modules/home-module/components/Charts/chartsGrid.tsx b/src/app/modules/home-module/components/Charts/chartsGrid.tsx
index 9bca2b8d5..ef90a2044 100644
--- a/src/app/modules/home-module/components/Charts/chartsGrid.tsx
+++ b/src/app/modules/home-module/components/Charts/chartsGrid.tsx
@@ -210,7 +210,7 @@ export default function ChartsGrid(props: Props) {
<>
{!props.tableView && (
- {props.addCard && isAuthenticated ? : null}
+ {props.addCard ? : null}
{loadedCharts.map((c, index) => (
)}
diff --git a/src/app/modules/home-module/components/Datasets/datasetsGrid.tsx b/src/app/modules/home-module/components/Datasets/datasetsGrid.tsx
index 5b9f49bbd..b904bd863 100644
--- a/src/app/modules/home-module/components/Datasets/datasetsGrid.tsx
+++ b/src/app/modules/home-module/components/Datasets/datasetsGrid.tsx
@@ -209,7 +209,7 @@ export default function DatasetsGrid(props: Readonly) {
<>
{!props.tableView && (
- {props.addCard && isAuthenticated ? : null}
+ {props.addCard ? : null}
{loadedDatasets?.map((data, index) => (
) {
name: data.name,
description: data.description,
createdDate: data.createdDate,
+ type: "dataset",
}))}
/>
)}
diff --git a/src/app/modules/home-module/components/Filter/index.tsx b/src/app/modules/home-module/components/Filter/index.tsx
index 1eda07ad1..270096dc5 100644
--- a/src/app/modules/home-module/components/Filter/index.tsx
+++ b/src/app/modules/home-module/components/Filter/index.tsx
@@ -20,6 +20,7 @@ export default function Filter(
setTableView: React.Dispatch>;
tableView: boolean;
terminateSearch?: () => void;
+ searchInputWidth?: string;
}>
) {
const inputRef = React.useRef(null);
@@ -55,7 +56,7 @@ export default function Filter(
gap: 8px;
`}
>
-
+
+ );
+}
+
+export default SmallFooter;
diff --git a/src/app/modules/home-module/components/Reports/reportsGrid.tsx b/src/app/modules/home-module/components/Reports/reportsGrid.tsx
index dd8f1eb38..fcd207cbe 100644
--- a/src/app/modules/home-module/components/Reports/reportsGrid.tsx
+++ b/src/app/modules/home-module/components/Reports/reportsGrid.tsx
@@ -198,7 +198,7 @@ export default function ReportsGrid(props: Props) {
<>
{!props.tableView && (
- {props.addCard && isAuthenticated ? : null}
+ {props.addCard ? : null}
{loadedReports.map((data, index) => (
)}
diff --git a/src/app/modules/home-module/components/Table/index.tsx b/src/app/modules/home-module/components/Table/index.tsx
index f2bb9ef40..063aaa884 100644
--- a/src/app/modules/home-module/components/Table/index.tsx
+++ b/src/app/modules/home-module/components/Table/index.tsx
@@ -16,19 +16,13 @@ export function HomepageTable(props: {
name: string;
description: string;
createdDate: Date;
+ type: string;
}[];
inChartBuilder?: boolean;
onItemClick?: (v: string) => void;
fromHome?: boolean;
}) {
const history = useHistory();
- const display = useRecoilState(homeDisplayAtom)[0];
- const pathBase = {
- all: "all",
- data: "dataset",
- charts: "chart",
- reports: "report",
- };
return (
{
if (!props.inChartBuilder) {
history.push(
- `/${pathBase[display]}/${data.id}${
- display === "data"
+ `/${data.type}/${data.id}${
+ data.type === "dataset"
? `/detail?fromHome=${props.fromHome}`
: ""
}`
diff --git a/src/app/modules/home-module/index.tsx b/src/app/modules/home-module/index.tsx
index 62b119c64..462a1657d 100644
--- a/src/app/modules/home-module/index.tsx
+++ b/src/app/modules/home-module/index.tsx
@@ -7,21 +7,14 @@ import { useRecoilState, useResetRecoilState } from "recoil";
import { Box, Grid, Container, IconButton, Popover } from "@material-ui/core";
/* project */
import { Tab } from "app/components/Styled/tabs";
-import { socialAuth } from "app/utils/socialAuth";
import HomeFooter from "app/modules/home-module/components/Footer";
import ChartsGrid from "app/modules/home-module/components/Charts/chartsGrid";
import ReportsGrid from "app/modules/home-module/components/Reports/reportsGrid";
-import DatasetDetailImage from "app/modules/home-module/assets/dataset-detail.png";
import DatasetsGrid from "app/modules/home-module/components/Datasets/datasetsGrid";
import { ReactComponent as SortIcon } from "app/modules/home-module/assets/sort-fill.svg";
import { ReactComponent as GridIcon } from "app/modules/home-module/assets/grid-fill.svg";
import { ReactComponent as CloseIcon } from "app/modules/home-module/assets/close-icon.svg";
import { ReactComponent as SearchIcon } from "app/modules/home-module/assets/search-fill.svg";
-import { ReactComponent as GoogleIcon } from "app/modules/onboarding-module/asset/google-img.svg";
-import { ReactComponent as LinkedInIcon } from "app/modules/onboarding-module/asset/linkedIn-img.svg";
-import { ReactComponent as TopRightEllipse } from "app/modules/home-module/assets/top-right-ellipse.svg";
-import { ReactComponent as BottomLeftEllipse } from "app/modules/home-module/assets/bottom-left-ellipse.svg";
-import { ReactComponent as BottomRightEllipse } from "app/modules/home-module/assets/bottom-right-ellipse.svg";
import {
homeDisplayAtom,
persistedReportStateAtom,
@@ -29,10 +22,6 @@ import {
unSavedReportPreviewModeAtom,
} from "app/state/recoil/atoms";
import {
- TopRightEllipseCss,
- bottomLeftEllipseCss,
- bottomRightEllipseCss,
- datsetDetailImgcss,
featuredAssetsCss,
iconButtonCss,
rowFlexCss,
@@ -43,6 +32,8 @@ import {
import DatasetCategoryList from "./components/Datasets/datasetCategoryList";
import { datasetCategories } from "../dataset-upload-module/upload-steps/metaData";
import AssetsGrid from "./components/All/assetsGrid";
+import BreadCrumbs from "./components/Breadcrumbs";
+import SmallFooter from "./components/Footer/smallFooter";
export default function HomeModule() {
useTitle("DX DataXplorer");
@@ -63,7 +54,7 @@ export default function HomeModule() {
setReportPreviewMode(false);
}, []);
- const [category, setCategory] = React.useState("");
+ const [categories, setCategories] = React.useState([]);
const [tableView, setTableView] = React.useState(false);
const [searchValue, setSearchValue] = React.useState(
@@ -106,8 +97,7 @@ export default function HomeModule() {
sortBy={sortByStr}
searchStr={searchStr}
tableView={tableView}
- category={category}
- addCard
+ categories={categories}
fromHome
/>
);
@@ -117,7 +107,6 @@ export default function HomeModule() {
sortBy={sortByStr}
searchStr={searchStr}
tableView={tableView}
- addCard
/>
);
case "reports":
@@ -127,7 +116,6 @@ export default function HomeModule() {
searchStr={searchStr}
tableView={tableView}
showMenuButton={false}
- addCard
/>
);
case "all":
@@ -137,7 +125,6 @@ export default function HomeModule() {
searchStr={searchStr}
tableView={tableView}
showMenuButton={false}
- addCard
fromHome
/>
);
@@ -166,7 +153,7 @@ export default function HomeModule() {
}, [display]);
const descriptions = {
- all: "Explore the collection of Reports, Charts and Datasets",
+ all: "Explore the collection of Assets",
data: "Explore the collection of Datasets used to create Charts",
charts: "Explore the collection of Charts used in Reports",
reports: "Explore the collection of Reports",
@@ -175,132 +162,10 @@ export default function HomeModule() {
return (
- {/*
-
-
-
-
-
Turn data into impact with DataXplorer
-
-
-
- DataXplorer simplifies and empowers visual data reporting
- for all.
-
-
-
- {isAuthenticated && (
-
-
- CREATE REPORT
-
-
- EXPLORE REPORTS
-
-
- )}
- {!isAuthenticated && (
-
button {
- gap: 10px;
- color: #fff;
- display: flex;
- padding: 9px 18px;
- background: #a1a2ff;
- align-items: center;
- justify-content: center;
- text-transform: uppercase;
-
- > svg {
- transform: scale(0.8);
- }
- }
- `}
- >
- socialAuth("google-oauth2")}>
- sign in for free
-
- socialAuth("linkedin")}>
- sign in for free
-
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
*/}
-
- Library:
+
))}
- {display !== "all" && (
- {
- setTableView(!tableView);
- }}
- css={iconButtonCss(tableView)}
- >
-
-
- )}
+ {
+ setTableView(!tableView);
+ }}
+ css={iconButtonCss(tableView)}
+ >
+
+
@@ -525,9 +388,9 @@ export default function HomeModule() {
{display === "data" ? (
) : (
@@ -545,7 +408,7 @@ export default function HomeModule() {
{displayGrid(searchValue as string, sortValue)}
-