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() {
|
||||
try {
|
||||
addFlow(undefined, true).then((id) => {
|
||||
addFlow(true).then((id) => {
|
||||
navigate("/flow/" + id);
|
||||
});
|
||||
// saveFlowStyleInDataBase();
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ const TabsContextInitialValue: TabsContextType = {
|
|||
isLoading: true,
|
||||
flows: [],
|
||||
removeFlow: (id: string) => {},
|
||||
addFlow: async (flowData?: any) => "",
|
||||
addFlow: async (newProject:boolean,flowData?: FlowType) => "",
|
||||
updateFlow: (newFlow: FlowType) => {},
|
||||
incrementNodeId: () => uid(),
|
||||
downloadFlow: (flow: FlowType) => {},
|
||||
|
|
@ -324,7 +324,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
// parse the text into a JSON object
|
||||
let flow: FlowType = JSON.parse(text);
|
||||
|
||||
id = await addFlow(flow, newProject);
|
||||
id = await addFlow(newProject,flow);
|
||||
} else {
|
||||
// create a file input
|
||||
const input = document.createElement("input");
|
||||
|
|
@ -339,7 +339,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
const currentfile = (e.target as HTMLInputElement).files![0];
|
||||
let text = await currentfile.text();
|
||||
let flow: FlowType = JSON.parse(text);
|
||||
const flowId = await addFlow(flow, newProject);
|
||||
const flowId = await addFlow(newProject,flow);
|
||||
resolve(flowId);
|
||||
}
|
||||
};
|
||||
|
|
@ -485,8 +485,8 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
|||
}
|
||||
|
||||
const addFlow = async (
|
||||
newProject?: Boolean,
|
||||
flow?: FlowType,
|
||||
newProject?: Boolean
|
||||
): Promise<String | undefined> => {
|
||||
if (newProject) {
|
||||
let flowData = extractDataFromFlow(flow!);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ export default function CommunityPage(): JSX.Element {
|
|||
size="sm"
|
||||
className="whitespace-nowrap "
|
||||
onClick={() => {
|
||||
addFlow(flow, true).then((id) => {
|
||||
addFlow(true,flow).then((id) => {
|
||||
navigate("/flow/" + id);
|
||||
});
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export default function HomePage(): JSX.Element {
|
|||
<DropdownButton
|
||||
firstButtonName="New Project"
|
||||
onFirstBtnClick={() => {
|
||||
addFlow(undefined, true).then((id) => {
|
||||
addFlow(true).then((id) => {
|
||||
navigate("/flow/" + id);
|
||||
});
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ export type TabsContextType = {
|
|||
flows: Array<FlowType>;
|
||||
removeFlow: (id: string) => void;
|
||||
addFlow: (
|
||||
flow?: FlowType,
|
||||
newProject?: Boolean
|
||||
newProject: boolean,
|
||||
flow?: FlowType
|
||||
) => Promise<String | undefined>;
|
||||
updateFlow: (newFlow: FlowType) => void;
|
||||
incrementNodeId: () => string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue