Modularized Card Wrap and fixed name of pages
This commit is contained in:
parent
1f5ad28243
commit
fe9ce486d4
7 changed files with 173 additions and 305 deletions
76
src/frontend/src/components/cardsWrapComponent/index.tsx
Normal file
76
src/frontend/src/components/cardsWrapComponent/index.tsx
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
import { useState } from "react";
|
||||||
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
|
import { SkeletonCardComponent } from "../skeletonCardComponent";
|
||||||
|
|
||||||
|
export default function CardsWrapComponent({
|
||||||
|
onFileDrop,
|
||||||
|
children,
|
||||||
|
isLoading,
|
||||||
|
dragMessage,
|
||||||
|
}: {
|
||||||
|
onFileDrop?: (e: any) => void;
|
||||||
|
children: JSX.Element | JSX.Element[];
|
||||||
|
isLoading: boolean;
|
||||||
|
dragMessage?: string;
|
||||||
|
}) {
|
||||||
|
const [isDragging, setIsDragging] = useState(false);
|
||||||
|
|
||||||
|
const dragOver = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (e.dataTransfer.types.some((types) => types === "Files") && onFileDrop) {
|
||||||
|
setIsDragging(true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const dragEnter = (e) => {
|
||||||
|
if (e.dataTransfer.types.some((types) => types === "Files") && onFileDrop) {
|
||||||
|
setIsDragging(true);
|
||||||
|
}
|
||||||
|
e.preventDefault();
|
||||||
|
};
|
||||||
|
|
||||||
|
const dragLeave = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (onFileDrop) setIsDragging(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onDrop = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (onFileDrop) onFileDrop(e);
|
||||||
|
setIsDragging(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
onDragOver={dragOver}
|
||||||
|
onDragEnter={dragEnter}
|
||||||
|
onDragLeave={dragLeave}
|
||||||
|
onDrop={onDrop}
|
||||||
|
className={
|
||||||
|
"h-full w-full " +
|
||||||
|
(isDragging
|
||||||
|
? "mb-24 flex flex-col items-center justify-center gap-4 text-2xl font-light"
|
||||||
|
: "")
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{isDragging ? (
|
||||||
|
<>
|
||||||
|
<IconComponent name="ArrowUpToLine" className="h-12 w-12 stroke-1" />
|
||||||
|
{dragMessage ? dragMessage : "Drop your file here"}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<div className="main-page-flows-display">
|
||||||
|
{isLoading ? (
|
||||||
|
<>
|
||||||
|
<SkeletonCardComponent />
|
||||||
|
<SkeletonCardComponent />
|
||||||
|
<SkeletonCardComponent />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
children
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,6 @@
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
|
import CardsWrapComponent from "../../../../components/cardsWrapComponent";
|
||||||
import { SkeletonCardComponent } from "../../../../components/skeletonCardComponent";
|
|
||||||
import { alertContext } from "../../../../contexts/alertContext";
|
import { alertContext } from "../../../../contexts/alertContext";
|
||||||
import { AuthContext } from "../../../../contexts/authContext";
|
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
|
||||||
import {
|
import {
|
||||||
getStoreComponents,
|
getStoreComponents,
|
||||||
getStoreSavedComponents,
|
getStoreSavedComponents,
|
||||||
|
|
@ -11,15 +8,7 @@ import {
|
||||||
import { storeComponent } from "../../../../types/store";
|
import { storeComponent } from "../../../../types/store";
|
||||||
import { MarketCardComponent } from "../../../StorePage/components/market-card";
|
import { MarketCardComponent } from "../../../StorePage/components/market-card";
|
||||||
|
|
||||||
export default function SavedComponents(): JSX.Element {
|
export default function AddedComponents(): JSX.Element {
|
||||||
const { setTabId } = useContext(TabsContext);
|
|
||||||
|
|
||||||
const { setApiKey, apiKey } = useContext(AuthContext);
|
|
||||||
|
|
||||||
// set null id
|
|
||||||
useEffect(() => {
|
|
||||||
setTabId("");
|
|
||||||
}, []);
|
|
||||||
const [data, setData] = useState<storeComponent[]>([]);
|
const [data, setData] = useState<storeComponent[]>([]);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [filteredCategories, setFilteredCategories] = useState(new Set());
|
const [filteredCategories, setFilteredCategories] = useState(new Set());
|
||||||
|
|
@ -62,30 +51,16 @@ export default function SavedComponents(): JSX.Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<CardsWrapComponent isLoading={loading}>
|
||||||
{loading ? (
|
{data
|
||||||
<>
|
.filter(
|
||||||
<div className="mt-6 grid w-full gap-4 md:grid-cols-2 lg:grid-cols-3">
|
(f) =>
|
||||||
<SkeletonCardComponent />
|
Array.from(filteredCategories).length === 0 ||
|
||||||
<SkeletonCardComponent />
|
filteredCategories.has(f.is_component)
|
||||||
<SkeletonCardComponent />
|
)
|
||||||
</div>
|
.map((item, idx) => (
|
||||||
</>
|
<MarketCardComponent key={idx} data={item} />
|
||||||
) : (
|
))}
|
||||||
<div className="flex w-full flex-col gap-4 p-4">
|
</CardsWrapComponent>
|
||||||
<div className="mt-6 grid w-full gap-4 md:grid-cols-2 lg:grid-cols-3">
|
|
||||||
{data
|
|
||||||
.filter(
|
|
||||||
(f) =>
|
|
||||||
Array.from(filteredCategories).length === 0 ||
|
|
||||||
filteredCategories.has(f.is_component)
|
|
||||||
)
|
|
||||||
.map((item, idx) => (
|
|
||||||
<MarketCardComponent key={idx} data={item} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -1,64 +1,18 @@
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext } from "react";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { CardComponent } from "../../../../components/cardComponent";
|
import { CardComponent } from "../../../../components/cardComponent";
|
||||||
|
import CardsWrapComponent from "../../../../components/cardsWrapComponent";
|
||||||
import IconComponent from "../../../../components/genericIconComponent";
|
import IconComponent from "../../../../components/genericIconComponent";
|
||||||
import { SkeletonCardComponent } from "../../../../components/skeletonCardComponent";
|
|
||||||
import { Button } from "../../../../components/ui/button";
|
import { Button } from "../../../../components/ui/button";
|
||||||
import { alertContext } from "../../../../contexts/alertContext";
|
import { alertContext } from "../../../../contexts/alertContext";
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
import { TabsContext } from "../../../../contexts/tabsContext";
|
||||||
|
|
||||||
export default function ComponentsComponent() {
|
export default function ComponentsComponent() {
|
||||||
const {
|
const { flows, removeFlow, uploadFlow, isLoading } = useContext(TabsContext);
|
||||||
flows,
|
|
||||||
setTabId,
|
|
||||||
downloadFlows,
|
|
||||||
uploadFlows,
|
|
||||||
addFlow,
|
|
||||||
removeFlow,
|
|
||||||
uploadFlow,
|
|
||||||
isLoading,
|
|
||||||
} = useContext(TabsContext);
|
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
|
|
||||||
const dropdownOptions = [
|
const onFileDrop = (e) => {
|
||||||
{
|
|
||||||
name: "Import from JSON",
|
|
||||||
onBtnClick: () =>
|
|
||||||
uploadFlow(true).then((id) => {
|
|
||||||
navigate("/flow/" + id);
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// Set a null id
|
|
||||||
useEffect(() => {
|
|
||||||
setTabId("");
|
|
||||||
}, []);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
|
||||||
|
|
||||||
const dragOver = (e) => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragEnter = (e) => {
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragLeave = () => {
|
|
||||||
setIsDragging(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fileDrop = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
setIsDragging(false);
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
||||||
if (e.dataTransfer.files.item(0).type === "application/json") {
|
if (e.dataTransfer.files.item(0).type === "application/json") {
|
||||||
uploadFlow(true, e.dataTransfer.files.item(0)!);
|
uploadFlow(true, e.dataTransfer.files.item(0)!);
|
||||||
|
|
@ -72,62 +26,38 @@ export default function ComponentsComponent() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<CardsWrapComponent
|
||||||
onDragOver={dragOver}
|
onFileDrop={onFileDrop}
|
||||||
onDragEnter={dragEnter}
|
isLoading={isLoading && flows.length == 0}
|
||||||
onDragLeave={dragLeave}
|
dragMessage={"Drop your component here"}
|
||||||
onDrop={fileDrop}
|
|
||||||
className={
|
|
||||||
"h-full w-full " +
|
|
||||||
(isDragging
|
|
||||||
? "mb-24 flex flex-col items-center justify-center gap-4 text-2xl font-light"
|
|
||||||
: "")
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{isDragging ? (
|
{flows
|
||||||
<>
|
.filter((flow) => flow.is_component)
|
||||||
<IconComponent name="ArrowUpToLine" className="h-12 w-12 stroke-1" />
|
.map((flow, idx) => (
|
||||||
Drop your flow here
|
<CardComponent
|
||||||
</>
|
key={idx}
|
||||||
) : (
|
data={flow}
|
||||||
<div className="main-page-flows-display">
|
id={flow.id}
|
||||||
{isLoading && flows.length == 0 ? (
|
button={
|
||||||
<>
|
<Link to={"/flow/" + flow.id}>
|
||||||
<SkeletonCardComponent />
|
<Button
|
||||||
<SkeletonCardComponent />
|
variant="outline"
|
||||||
<SkeletonCardComponent />
|
size="sm"
|
||||||
</>
|
className="whitespace-nowrap "
|
||||||
) : (
|
>
|
||||||
flows
|
<IconComponent
|
||||||
.filter((flow) => flow.is_component)
|
name="ExternalLink"
|
||||||
.map((flow, idx) => (
|
className="main-page-nav-button"
|
||||||
<CardComponent
|
/>
|
||||||
key={idx}
|
Edit Flow
|
||||||
data={flow}
|
</Button>
|
||||||
id={flow.id}
|
</Link>
|
||||||
button={
|
}
|
||||||
<Link to={"/flow/" + flow.id}>
|
onDelete={() => {
|
||||||
<Button
|
removeFlow(flow.id);
|
||||||
variant="outline"
|
}}
|
||||||
size="sm"
|
/>
|
||||||
className="whitespace-nowrap "
|
))}
|
||||||
>
|
</CardsWrapComponent>
|
||||||
<IconComponent
|
|
||||||
name="ExternalLink"
|
|
||||||
className="main-page-nav-button"
|
|
||||||
/>
|
|
||||||
Edit Flow
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
}
|
|
||||||
onDelete={() => {
|
|
||||||
removeFlow(flow.id);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,18 @@
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext } from "react";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { CardComponent } from "../../../../components/cardComponent";
|
import { CardComponent } from "../../../../components/cardComponent";
|
||||||
|
import CardsWrapComponent from "../../../../components/cardsWrapComponent";
|
||||||
import IconComponent from "../../../../components/genericIconComponent";
|
import IconComponent from "../../../../components/genericIconComponent";
|
||||||
import { SkeletonCardComponent } from "../../../../components/skeletonCardComponent";
|
|
||||||
import { Button } from "../../../../components/ui/button";
|
import { Button } from "../../../../components/ui/button";
|
||||||
import { alertContext } from "../../../../contexts/alertContext";
|
import { alertContext } from "../../../../contexts/alertContext";
|
||||||
import { TabsContext } from "../../../../contexts/tabsContext";
|
import { TabsContext } from "../../../../contexts/tabsContext";
|
||||||
|
|
||||||
export default function FlowsComponent() {
|
export default function FlowsComponent() {
|
||||||
const {
|
const { uploadFlow, removeFlow, flows, isLoading } = useContext(TabsContext);
|
||||||
flows,
|
|
||||||
setTabId,
|
|
||||||
downloadFlows,
|
|
||||||
uploadFlows,
|
|
||||||
addFlow,
|
|
||||||
removeFlow,
|
|
||||||
uploadFlow,
|
|
||||||
isLoading,
|
|
||||||
} = useContext(TabsContext);
|
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
const dropdownOptions = [
|
|
||||||
{
|
|
||||||
name: "Import from JSON",
|
|
||||||
onBtnClick: () =>
|
|
||||||
uploadFlow(true).then((id) => {
|
|
||||||
navigate("/flow/" + id);
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
// Set a null id
|
const onFileDrop = (e) => {
|
||||||
useEffect(() => {
|
|
||||||
setTabId("");
|
|
||||||
}, []);
|
|
||||||
const navigate = useNavigate();
|
|
||||||
|
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
|
||||||
|
|
||||||
const dragOver = (e) => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragEnter = (e) => {
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragLeave = () => {
|
|
||||||
setIsDragging(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fileDrop = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
setIsDragging(false);
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
||||||
if (e.dataTransfer.files.item(0).type === "application/json") {
|
if (e.dataTransfer.files.item(0).type === "application/json") {
|
||||||
uploadFlow(true, e.dataTransfer.files.item(0)!);
|
uploadFlow(true, e.dataTransfer.files.item(0)!);
|
||||||
|
|
@ -70,63 +25,39 @@ export default function FlowsComponent() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<div
|
<CardsWrapComponent
|
||||||
onDragOver={dragOver}
|
onFileDrop={onFileDrop}
|
||||||
onDragEnter={dragEnter}
|
dragMessage={"Drag your flow here"}
|
||||||
onDragLeave={dragLeave}
|
isLoading={isLoading && flows.length == 0}
|
||||||
onDrop={fileDrop}
|
|
||||||
className={
|
|
||||||
"h-full w-full " +
|
|
||||||
(isDragging
|
|
||||||
? "mb-24 flex flex-col items-center justify-center gap-4 text-2xl font-light"
|
|
||||||
: "")
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{isDragging ? (
|
{flows
|
||||||
<>
|
.filter((flow) => !flow.is_component)
|
||||||
<IconComponent name="ArrowUpToLine" className="h-12 w-12 stroke-1" />
|
.map((flow, idx) => (
|
||||||
Drop your flow here
|
<CardComponent
|
||||||
</>
|
key={idx}
|
||||||
) : (
|
isFlow
|
||||||
<div className="main-page-flows-display">
|
data={flow}
|
||||||
{isLoading && flows.length == 0 ? (
|
id={flow.id}
|
||||||
<>
|
button={
|
||||||
<SkeletonCardComponent />
|
<Link to={"/flow/" + flow.id}>
|
||||||
<SkeletonCardComponent />
|
<Button
|
||||||
<SkeletonCardComponent />
|
variant="outline"
|
||||||
</>
|
size="sm"
|
||||||
) : (
|
className="whitespace-nowrap "
|
||||||
flows
|
>
|
||||||
.filter((flow) => !flow.is_component)
|
<IconComponent
|
||||||
.map((flow, idx) => (
|
name="ExternalLink"
|
||||||
<CardComponent
|
className="main-page-nav-button"
|
||||||
key={idx}
|
/>
|
||||||
isFlow
|
Edit Flow
|
||||||
data={flow}
|
</Button>
|
||||||
id={flow.id}
|
</Link>
|
||||||
button={
|
}
|
||||||
<Link to={"/flow/" + flow.id}>
|
onDelete={() => {
|
||||||
<Button
|
removeFlow(flow.id);
|
||||||
variant="outline"
|
}}
|
||||||
size="sm"
|
/>
|
||||||
className="whitespace-nowrap "
|
))}
|
||||||
>
|
</CardsWrapComponent>
|
||||||
<IconComponent
|
|
||||||
name="ExternalLink"
|
|
||||||
className="main-page-nav-button"
|
|
||||||
/>
|
|
||||||
Edit Flow
|
|
||||||
</Button>
|
|
||||||
</Link>
|
|
||||||
}
|
|
||||||
onDelete={() => {
|
|
||||||
removeFlow(flow.id);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
))
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect } from "react";
|
||||||
import { Outlet, useNavigate } from "react-router-dom";
|
import { Outlet, useNavigate } from "react-router-dom";
|
||||||
import DropdownButton from "../../components/DropdownButtonComponent";
|
import DropdownButton from "../../components/DropdownButtonComponent";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
|
|
@ -7,20 +7,11 @@ import SidebarNav from "../../components/sidebarComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { Separator } from "../../components/ui/separator";
|
import { Separator } from "../../components/ui/separator";
|
||||||
import { USER_PROJECTS_HEADER } from "../../constants/constants";
|
import { USER_PROJECTS_HEADER } from "../../constants/constants";
|
||||||
import { alertContext } from "../../contexts/alertContext";
|
|
||||||
import { StoreContext } from "../../contexts/storeContext";
|
import { StoreContext } from "../../contexts/storeContext";
|
||||||
import { TabsContext } from "../../contexts/tabsContext";
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
export default function HomePage(): JSX.Element {
|
export default function HomePage(): JSX.Element {
|
||||||
const {
|
const { setTabId, downloadFlows, uploadFlows, addFlow, uploadFlow } =
|
||||||
flows,
|
useContext(TabsContext);
|
||||||
setTabId,
|
|
||||||
downloadFlows,
|
|
||||||
uploadFlows,
|
|
||||||
addFlow,
|
|
||||||
uploadFlow,
|
|
||||||
isLoading,
|
|
||||||
} = useContext(TabsContext);
|
|
||||||
const { setErrorData } = useContext(alertContext);
|
|
||||||
const { hasStore } = useContext(StoreContext);
|
const { hasStore } = useContext(StoreContext);
|
||||||
const dropdownOptions = [
|
const dropdownOptions = [
|
||||||
{
|
{
|
||||||
|
|
@ -44,8 +35,8 @@ export default function HomePage(): JSX.Element {
|
||||||
|
|
||||||
if (hasStore) {
|
if (hasStore) {
|
||||||
sidebarNavItems.push({
|
sidebarNavItems.push({
|
||||||
title: "Saved Components",
|
title: "Added Components",
|
||||||
href: "/saved-components",
|
href: "/added-components",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,41 +46,6 @@ export default function HomePage(): JSX.Element {
|
||||||
}, []);
|
}, []);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [isDragging, setIsDragging] = useState(false);
|
|
||||||
|
|
||||||
const dragOver = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragEnter = (e) => {
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
setIsDragging(true);
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
const dragLeave = () => {
|
|
||||||
setIsDragging(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const fileDrop = (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
setIsDragging(false);
|
|
||||||
if (e.dataTransfer.types.some((types) => types === "Files")) {
|
|
||||||
if (e.dataTransfer.files.item(0).type === "application/json") {
|
|
||||||
uploadFlow(true, e.dataTransfer.files.item(0)!);
|
|
||||||
} else {
|
|
||||||
setErrorData({
|
|
||||||
title: "Invalid file type",
|
|
||||||
list: ["Please upload a JSON file"],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Personal flows display
|
// Personal flows display
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ export const MarketCardComponent = ({ data }: { data: storeComponent }) => {
|
||||||
"main-page-nav-button" + (loading ? " animate-spin" : "")
|
"main-page-nav-button" + (loading ? " animate-spin" : "")
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{added ? "Install Locally" : "Add to Account"}
|
{added ? "Use Template" : "Add to Account"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@ import ApiKeysPage from "./pages/ApiKeysPage";
|
||||||
import CommunityPage from "./pages/CommunityPage";
|
import CommunityPage from "./pages/CommunityPage";
|
||||||
import FlowPage from "./pages/FlowPage";
|
import FlowPage from "./pages/FlowPage";
|
||||||
import HomePage from "./pages/MainPage";
|
import HomePage from "./pages/MainPage";
|
||||||
|
import AddedComponents from "./pages/MainPage/components/added-components";
|
||||||
import ComponentsComponent from "./pages/MainPage/components/components";
|
import ComponentsComponent from "./pages/MainPage/components/components";
|
||||||
import FlowsComponent from "./pages/MainPage/components/flows";
|
import FlowsComponent from "./pages/MainPage/components/flows";
|
||||||
import SavedComponents from "./pages/MainPage/components/saved-components";
|
|
||||||
import ProfileSettingsPage from "./pages/ProfileSettingsPage";
|
import ProfileSettingsPage from "./pages/ProfileSettingsPage";
|
||||||
import StorePage from "./pages/StorePage";
|
import StorePage from "./pages/StorePage";
|
||||||
import ViewPage from "./pages/ViewPage";
|
import ViewPage from "./pages/ViewPage";
|
||||||
|
|
@ -41,10 +41,10 @@ const Router = () => {
|
||||||
<Route path="flows" element={<FlowsComponent />} />
|
<Route path="flows" element={<FlowsComponent />} />
|
||||||
<Route path="components" element={<ComponentsComponent />} />
|
<Route path="components" element={<ComponentsComponent />} />
|
||||||
<Route
|
<Route
|
||||||
path="saved-components"
|
path="added-components"
|
||||||
element={
|
element={
|
||||||
<StoreGuard>
|
<StoreGuard>
|
||||||
<SavedComponents />
|
<AddedComponents />
|
||||||
</StoreGuard>
|
</StoreGuard>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue