fix(menuBar): remove unnecessary parameter in addFlow function call to improve code readability
fix(tabsContext): change parameter order in addFlow function signature to match the implementation fix(tabsContext): change parameter order in addFlow function call to match the implementation fix(communityPage): change parameter order in addFlow function call to match the implementation fix(mainPage): remove unnecessary parameter in addFlow function call to improve code readability fix(tabs): change parameter order in addFlow function signature to match the implementation
This commit is contained in:
parent
4ddc65d5a9
commit
1868540a10
5 changed files with 9 additions and 9 deletions
|
|
@ -26,7 +26,7 @@ export const MenuBar = ({ flows, tabId }: menuBarPropsType): JSX.Element => {
|
||||||
|
|
||||||
function handleAddFlow() {
|
function handleAddFlow() {
|
||||||
try {
|
try {
|
||||||
addFlow(undefined, true).then((id) => {
|
addFlow(true).then((id) => {
|
||||||
navigate("/flow/" + id);
|
navigate("/flow/" + id);
|
||||||
});
|
});
|
||||||
// saveFlowStyleInDataBase();
|
// saveFlowStyleInDataBase();
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ const TabsContextInitialValue: TabsContextType = {
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
flows: [],
|
flows: [],
|
||||||
removeFlow: (id: string) => {},
|
removeFlow: (id: string) => {},
|
||||||
addFlow: async (flowData?: any) => "",
|
addFlow: async (newProject:boolean,flowData?: FlowType) => "",
|
||||||
updateFlow: (newFlow: FlowType) => {},
|
updateFlow: (newFlow: FlowType) => {},
|
||||||
incrementNodeId: () => uid(),
|
incrementNodeId: () => uid(),
|
||||||
downloadFlow: (flow: FlowType) => {},
|
downloadFlow: (flow: FlowType) => {},
|
||||||
|
|
@ -324,7 +324,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
// parse the text into a JSON object
|
// parse the text into a JSON object
|
||||||
let flow: FlowType = JSON.parse(text);
|
let flow: FlowType = JSON.parse(text);
|
||||||
|
|
||||||
id = await addFlow(flow, newProject);
|
id = await addFlow(newProject,flow);
|
||||||
} else {
|
} else {
|
||||||
// create a file input
|
// create a file input
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
|
|
@ -339,7 +339,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
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);
|
||||||
const flowId = await addFlow(flow, newProject);
|
const flowId = await addFlow(newProject,flow);
|
||||||
resolve(flowId);
|
resolve(flowId);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -485,8 +485,8 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const addFlow = async (
|
const addFlow = async (
|
||||||
|
newProject?: Boolean,
|
||||||
flow?: FlowType,
|
flow?: FlowType,
|
||||||
newProject?: Boolean
|
|
||||||
): Promise<String | undefined> => {
|
): Promise<String | undefined> => {
|
||||||
if (newProject) {
|
if (newProject) {
|
||||||
let flowData = extractDataFromFlow(flow!);
|
let flowData = extractDataFromFlow(flow!);
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ export default function CommunityPage(): JSX.Element {
|
||||||
size="sm"
|
size="sm"
|
||||||
className="whitespace-nowrap "
|
className="whitespace-nowrap "
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
addFlow(flow, true).then((id) => {
|
addFlow(true,flow).then((id) => {
|
||||||
navigate("/flow/" + id);
|
navigate("/flow/" + id);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export default function HomePage(): JSX.Element {
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
firstButtonName="New Project"
|
firstButtonName="New Project"
|
||||||
onFirstBtnClick={() => {
|
onFirstBtnClick={() => {
|
||||||
addFlow(undefined, true).then((id) => {
|
addFlow(true).then((id) => {
|
||||||
navigate("/flow/" + id);
|
navigate("/flow/" + id);
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ export type TabsContextType = {
|
||||||
flows: Array<FlowType>;
|
flows: Array<FlowType>;
|
||||||
removeFlow: (id: string) => void;
|
removeFlow: (id: string) => void;
|
||||||
addFlow: (
|
addFlow: (
|
||||||
flow?: FlowType,
|
newProject: boolean,
|
||||||
newProject?: Boolean
|
flow?: FlowType
|
||||||
) => Promise<String | undefined>;
|
) => Promise<String | undefined>;
|
||||||
updateFlow: (newFlow: FlowType) => void;
|
updateFlow: (newFlow: FlowType) => void;
|
||||||
incrementNodeId: () => string;
|
incrementNodeId: () => string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue