Formatting
This commit is contained in:
parent
84a0d3acb3
commit
37ebbf4e65
4 changed files with 19 additions and 12 deletions
|
|
@ -39,9 +39,7 @@ export default function DropdownButton({
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!showOptions ? (
|
{!showOptions ? (
|
||||||
<IconComponent
|
<IconComponent name="ChevronDown" />
|
||||||
name="ChevronDown"
|
|
||||||
/>
|
|
||||||
) : (
|
) : (
|
||||||
<IconComponent name="ChevronUp" />
|
<IconComponent name="ChevronUp" />
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -315,9 +315,11 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
input.type = "file";
|
input.type = "file";
|
||||||
input.accept = ".json";
|
input.accept = ".json";
|
||||||
// add a change event listener to the file input
|
// add a change event listener to the file input
|
||||||
id = await new Promise(resolve => {
|
id = await new Promise((resolve) => {
|
||||||
input.onchange = async (e: Event) => {
|
input.onchange = async (e: Event) => {
|
||||||
if ((e.target as HTMLInputElement).files![0].type === "application/json") {
|
if (
|
||||||
|
(e.target as HTMLInputElement).files![0].type === "application/json"
|
||||||
|
) {
|
||||||
const currentfile = (e.target as HTMLInputElement).files![0];
|
const currentfile = (e.target as HTMLInputElement).files![0];
|
||||||
let text = await currentfile.text();
|
let text = await currentfile.text();
|
||||||
let flow: FlowType = JSON.parse(text);
|
let flow: FlowType = JSON.parse(text);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useContext, useEffect } from "react";
|
import { useContext, useEffect } from "react";
|
||||||
import { Link, useNavigate } from "react-router-dom";
|
import { Link, useNavigate } from "react-router-dom";
|
||||||
|
import DropdownButton from "../../components/DropdownButtonComponent";
|
||||||
import { CardComponent } from "../../components/cardComponent";
|
import { CardComponent } from "../../components/cardComponent";
|
||||||
import IconComponent from "../../components/genericIconComponent";
|
import IconComponent from "../../components/genericIconComponent";
|
||||||
import Header from "../../components/headerComponent";
|
import Header from "../../components/headerComponent";
|
||||||
|
|
@ -7,7 +8,6 @@ import { SkeletonCardComponent } from "../../components/skeletonCardComponent";
|
||||||
import { Button } from "../../components/ui/button";
|
import { Button } from "../../components/ui/button";
|
||||||
import { USER_PROJECTS_HEADER } from "../../constants/constants";
|
import { USER_PROJECTS_HEADER } from "../../constants/constants";
|
||||||
import { TabsContext } from "../../contexts/tabsContext";
|
import { TabsContext } from "../../contexts/tabsContext";
|
||||||
import DropdownButton from "../../components/DropdownButtonComponent";
|
|
||||||
export default function HomePage(): JSX.Element {
|
export default function HomePage(): JSX.Element {
|
||||||
const {
|
const {
|
||||||
flows,
|
flows,
|
||||||
|
|
@ -15,12 +15,19 @@ export default function HomePage(): JSX.Element {
|
||||||
downloadFlows,
|
downloadFlows,
|
||||||
uploadFlows,
|
uploadFlows,
|
||||||
addFlow,
|
addFlow,
|
||||||
removeFlow, uploadFlow,
|
removeFlow,
|
||||||
|
uploadFlow,
|
||||||
isLoading,
|
isLoading,
|
||||||
} = useContext(TabsContext);
|
} = useContext(TabsContext);
|
||||||
const dropdownOptions = [{name: "Import from JSON", onBtnClick: () => uploadFlow(true).then((id) => {
|
const dropdownOptions = [
|
||||||
navigate("/flow/" + id);
|
{
|
||||||
})}]
|
name: "Import from JSON",
|
||||||
|
onBtnClick: () =>
|
||||||
|
uploadFlow(true).then((id) => {
|
||||||
|
navigate("/flow/" + id);
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
// Set a null id
|
// Set a null id
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
|
|
@ -548,5 +548,5 @@ export type fetchErrorComponentType = {
|
||||||
export type dropdownButtonPropsType = {
|
export type dropdownButtonPropsType = {
|
||||||
firstButtonName: string;
|
firstButtonName: string;
|
||||||
onFirstBtnClick: () => void;
|
onFirstBtnClick: () => void;
|
||||||
options: Array<{ name: string; onBtnClick: () => void; }>;
|
options: Array<{ name: string; onBtnClick: () => void }>;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue