Skip to content

Commit

Permalink
import: flow skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Oct 26, 2023
1 parent 7fa4e1a commit 0eca151
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/web-console/src/modules/Import/dropbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react"

export const DropBox = () => {
return <div>dropbox</div>
}
32 changes: 32 additions & 0 deletions packages/web-console/src/modules/Import/import-file.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { createContext, useReducer } from "react"
import { DropBox } from "./dropbox"
import { Settings } from "./settings"
import { Result } from "./result"

export const Context = createContext({})

type State = {
step: "dropbox" | "settings" | "result"
// TODO: file+schema
}

const initialState: State = {
step: "dropbox",
}

const reducer = (state: typeof initialState, action: Partial<State>) => ({
...state,
...action,
})

export const ImportFile = () => {
const [state, dispatch] = useReducer(reducer, initialState)

return (
<Context.Provider value={{ state, dispatch }}>
{state.step === "dropbox" && <DropBox />}
{state.step === "settings" && <Settings />}
{state.step === "result" && <Result />}
</Context.Provider>
)
}
5 changes: 5 additions & 0 deletions packages/web-console/src/modules/Import/result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react"

export const Result = () => {
return <div>upload result</div>
}
5 changes: 5 additions & 0 deletions packages/web-console/src/modules/Import/settings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from "react"

export const Settings = () => {
return <div>upload settings</div>
}
8 changes: 5 additions & 3 deletions packages/web-console/src/scenes/Console/import.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from "react"
import { PaneContent } from "../../components/PaneContent"
import { PaneWrapper } from "../../components/PaneWrapper"
import { PaneContent, PaneWrapper } from "../../components"
import { ImportFile } from "../../modules/Import/import-file"

export const Import = () => (
<PaneWrapper>
<PaneContent>import</PaneContent>
<PaneContent>
<ImportFile />
</PaneContent>
</PaneWrapper>
)

0 comments on commit 0eca151

Please sign in to comment.