Skip to content

Commit

Permalink
prepare form to handle format behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-daniel committed Nov 7, 2023
1 parent 71320c5 commit d336c23
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/web-console/src/modules/Import/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ type FormSchema = {
table_name: string
partitionBy: keyof typeof PartitionBy
delimiter: string
formats: {
behavior: "ADD" | "OVERRIDE"
}
}

export const Settings = () => {
Expand Down
19 changes: 18 additions & 1 deletion packages/web-console/src/modules/Import/timestamps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Panel } from "../../components/Panel"
import { TimestampFormatList } from "../../components/TimestampFormat/list"
import { Nav, NavGroup, Subheader } from "./panel"
import { ArrowRightS } from "@styled-icons/remix-line"
import { useFormContext } from "react-hook-form"

type Props = {
open: boolean
Expand All @@ -16,11 +17,27 @@ const Wrapper = styled(PaneWrapper)``
const Content = styled(PaneContent)``

export const GlobalTimestampsPanel = ({ open = true, toggle }: Props) => {
const { watch, setValue } = useFormContext()
const override = watch("formats.behavior", "ADD") === "OVERRIDE"
return (
<Wrapper>
<Subheader>
<NavGroup>
<Nav>dummy</Nav>
{open && (
<Nav
onClick={(e) => {
e.preventDefault()
setValue("formats.behavior", override ? "ADD" : "OVERRIDE")
}}
>
<span>Override builtins</span>{" "}
<small
style={{
opacity: +override,
}}
></small>
</Nav>
)}
</NavGroup>
<NavGroup>
<Nav
Expand Down

0 comments on commit d336c23

Please sign in to comment.