-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7a89337
commit a28df65
Showing
9 changed files
with
104 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...app/pages/send/send-crypto-asset-form/family/stacks/stacks-common-send-form-container.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { createContext, useContext, useState } from 'react'; | ||
|
||
import type { HasChildren } from '@app/common/has-children'; | ||
|
||
export interface StacksCommonSendFormContext { | ||
showHighFeeWarningDialog: boolean; | ||
setShowHighFeeWarningDialog(val: boolean): void; | ||
hasBypassedFeeWarning: boolean; | ||
setHasBypassedFeeWarning(val: boolean): void; | ||
} | ||
|
||
export const stacksCommonSendFormContext = createContext<StacksCommonSendFormContext | null>(null); | ||
|
||
export function useStacksCommonSendFormContext() { | ||
const ctx = useContext(stacksCommonSendFormContext); | ||
if (!ctx) throw new Error(`stacksCommonSendFormContext must be used within a context`); | ||
return ctx; | ||
} | ||
|
||
export const StacksCommonSendFormProvider = stacksCommonSendFormContext.Provider; | ||
|
||
interface StacksCommonSendFormContainerProps extends HasChildren {} | ||
export function StacksCommonSendFormContainer({ children }: StacksCommonSendFormContainerProps) { | ||
const [showHighFeeWarningDialog, setShowHighFeeWarningDialog] = useState(false); | ||
const [hasBypassedFeeWarning, setHasBypassedFeeWarning] = useState(false); | ||
return ( | ||
<StacksCommonSendFormProvider | ||
value={{ | ||
showHighFeeWarningDialog, | ||
setShowHighFeeWarningDialog, | ||
hasBypassedFeeWarning, | ||
setHasBypassedFeeWarning, | ||
}} | ||
> | ||
{children} | ||
</StacksCommonSendFormProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters