diff --git a/packages/next-common/components/coretime/salePanel/index.jsx b/packages/next-common/components/coretime/salePanel/index.jsx index 965a08667f..0e47be2bfd 100644 --- a/packages/next-common/components/coretime/salePanel/index.jsx +++ b/packages/next-common/components/coretime/salePanel/index.jsx @@ -1,7 +1,7 @@ import { NeutralPanel } from "../../styled/containers/neutralPanel"; import Divider from "../../styled/layout/divider"; import CoretimeSaleSummary from "./summary"; -import useCoretimeSale from "next-common/context/coretime/sale/hooks/useCoretimeSale"; +import useCoretimeSale from "next-common/context/coretime/sale/provider"; export default function CoretimeSalePanel() { const coretimeSale = useCoretimeSale(); diff --git a/packages/next-common/context/coretime/configuration.js b/packages/next-common/context/coretime/configuration.js index 08f6fd0e3b..d01d371485 100644 --- a/packages/next-common/context/coretime/configuration.js +++ b/packages/next-common/context/coretime/configuration.js @@ -3,10 +3,10 @@ import { usePageProps } from "next-common/context/page"; import useSubStorage from "next-common/hooks/common/useSubStorage"; import { useEffect } from "react"; -const [useCoretimeConfiguration, Provider] = createStateContext({}); +const [useSharedCoretimeConfiguration, Provider] = createStateContext({}); function DataUpdater({ children }) { - const [, setConfiguration] = useCoretimeConfiguration(); + const [, setConfiguration] = useSharedCoretimeConfiguration(); const { result: option } = useSubStorage("broker", "configuration"); useEffect(() => { @@ -29,3 +29,8 @@ export function CoretimeConfigurationProvider({ children }) { ); } + +export default function useCoretimeConfiguration() { + const [configuration] = useSharedCoretimeConfiguration(); + return configuration; +} diff --git a/packages/next-common/context/coretime/hooks/useCoretimePhase.js b/packages/next-common/context/coretime/hooks/useCoretimePhase.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/next-common/context/coretime/sale/hooks/useCoretimeSale.js b/packages/next-common/context/coretime/sale/hooks/useCoretimeSale.js deleted file mode 100644 index dd0e931bb0..0000000000 --- a/packages/next-common/context/coretime/sale/hooks/useCoretimeSale.js +++ /dev/null @@ -1,6 +0,0 @@ -import useCoretimeActiveSale from "next-common/context/coretime/sale/provider"; - -export default function useCoretimeSale() { - const [sale] = useCoretimeActiveSale(); - return sale; -} diff --git a/packages/next-common/context/coretime/sale/provider.js b/packages/next-common/context/coretime/sale/provider.js index cc32ff1c1d..79c6862cd0 100644 --- a/packages/next-common/context/coretime/sale/provider.js +++ b/packages/next-common/context/coretime/sale/provider.js @@ -1,6 +1,6 @@ import { createStateContext } from "react-use"; -const [useCoretimeActiveSale, Provider] = createStateContext({}); +const [useSharedCoretimeSale, Provider] = createStateContext({}); export function CoretimeSaleProvider({ value, children }) { return ( @@ -10,4 +10,7 @@ export function CoretimeSaleProvider({ value, children }) { ); } -export default useCoretimeActiveSale; +export default function useCoretimeSale() { + const [sale] = useSharedCoretimeSale(); + return sale; +}; diff --git a/packages/next-common/context/coretime/status.js b/packages/next-common/context/coretime/status.js index 34dca21d45..5f4ed0e4d4 100644 --- a/packages/next-common/context/coretime/status.js +++ b/packages/next-common/context/coretime/status.js @@ -3,10 +3,10 @@ import { usePageProps } from "next-common/context/page"; import useSubStorage from "next-common/hooks/common/useSubStorage"; import { useEffect } from "react"; -const [useCoretimeStatus, Provider] = createStateContext({}); +const [useSharedCoretimeStatus, Provider] = createStateContext({}); function DataUpdater({ children }) { - const [, setStatus] = useCoretimeStatus(); + const [, setStatus] = useSharedCoretimeStatus(); const { result: option } = useSubStorage("broker", "status"); useEffect(() => { @@ -28,3 +28,8 @@ export function CoretimeStatusProvider({ children }) { ); } + +export default function useCoretimeStatus() { + const [status] = useSharedCoretimeStatus(); + return status; +}