about summary refs log tree commit diff
path: root/src/components/Dialog
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2025-05-06 22:50:28 +0300
committerGitHub <noreply@github.com>2025-05-06 22:50:28 +0300
commit4c8fd006f6a994783a43e4744a3167db7aefc159 (patch)
tree0b8350774438cbbc2b8c6e77b844ce6b677381d3 /src/components/Dialog
parent3f7dc9a8e5c9225ef20ce996543a1c3cfa991eb7 (diff)
downloadvoidsky-4c8fd006f6a994783a43e4744a3167db7aefc159.tar.zst
New Edit Profile dialog on web, use new Edit Image dialog everywhere (#8220)
Diffstat (limited to 'src/components/Dialog')
-rw-r--r--src/components/Dialog/context.ts21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/components/Dialog/context.ts b/src/components/Dialog/context.ts
index eb892403f..2ecf5ba61 100644
--- a/src/components/Dialog/context.ts
+++ b/src/components/Dialog/context.ts
@@ -1,4 +1,11 @@
-import React from 'react'
+import {
+  createContext,
+  useContext,
+  useEffect,
+  useId,
+  useMemo,
+  useRef,
+} from 'react'
 
 import {useDialogStateContext} from '#/state/dialogs'
 import {
@@ -8,7 +15,7 @@ import {
 } from '#/components/Dialog/types'
 import {BottomSheetSnapPoint} from '../../../modules/bottom-sheet/src/BottomSheet.types'
 
-export const Context = React.createContext<DialogContextProps>({
+export const Context = createContext<DialogContextProps>({
   close: () => {},
   isNativeDialog: false,
   nativeSnapPoint: BottomSheetSnapPoint.Hidden,
@@ -18,18 +25,18 @@ export const Context = React.createContext<DialogContextProps>({
 })
 
 export function useDialogContext() {
-  return React.useContext(Context)
+  return useContext(Context)
 }
 
 export function useDialogControl(): DialogOuterProps['control'] {
-  const id = React.useId()
-  const control = React.useRef<DialogControlRefProps>({
+  const id = useId()
+  const control = useRef<DialogControlRefProps>({
     open: () => {},
     close: () => {},
   })
   const {activeDialogs} = useDialogStateContext()
 
-  React.useEffect(() => {
+  useEffect(() => {
     activeDialogs.current.set(id, control)
     return () => {
       // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -37,7 +44,7 @@ export function useDialogControl(): DialogOuterProps['control'] {
     }
   }, [id, activeDialogs])
 
-  return React.useMemo<DialogOuterProps['control']>(
+  return useMemo<DialogOuterProps['control']>(
     () => ({
       id,
       ref: control,