New Edit Profile dialog on web, use new Edit Image dialog everywhere (#8220)

This commit is contained in:
Samuel Newman
2025-05-06 22:50:28 +03:00
committed by GitHub
parent 3f7dc9a8e5
commit 4c8fd006f6
21 changed files with 532 additions and 441 deletions
+1 -40
View File
@@ -1,14 +1,7 @@
import React from 'react'
import {type AppBskyActorDefs, type AppBskyGraphDefs} from '@atproto/api'
import {type AppBskyGraphDefs} from '@atproto/api'
import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback'
import {type PickerImage} from '#/lib/media/picker.shared'
export interface EditProfileModal {
name: 'edit-profile'
profile: AppBskyActorDefs.ProfileViewDetailed
onUpdate?: () => void
}
export interface CreateOrEditListModal {
name: 'create-or-edit-list'
@@ -26,15 +19,6 @@ export interface UserAddRemoveListsModal {
onRemove?: (listUri: string) => void
}
export interface CropImageModal {
name: 'crop-image'
uri: string
dimensions?: {width: number; height: number}
aspect?: number
circular?: boolean
onSelect: (img?: PickerImage) => void
}
export interface DeleteAccountModal {
name: 'delete-account'
}
@@ -71,9 +55,6 @@ export type Modal =
| DeleteAccountModal
| ChangePasswordModal
// Temp
| EditProfileModal
// Curation
| ContentLanguagesSettingsModal
| PostLanguagesSettingsModal
@@ -82,9 +63,6 @@ export type Modal =
| CreateOrEditListModal
| UserAddRemoveListsModal
// Posts
| CropImageModal
// Bluesky access
| WaitlistModal
| InviteCodesModal
@@ -110,20 +88,6 @@ const ModalControlContext = React.createContext<{
closeAllModals: () => false,
})
/**
* @deprecated DO NOT USE THIS unless you have no other choice.
*/
export let unstable__openModal: (modal: Modal) => void = () => {
throw new Error(`ModalContext is not initialized`)
}
/**
* @deprecated DO NOT USE THIS unless you have no other choice.
*/
export let unstable__closeModal: () => boolean = () => {
throw new Error(`ModalContext is not initialized`)
}
export function Provider({children}: React.PropsWithChildren<{}>) {
const [activeModals, setActiveModals] = React.useState<Modal[]>([])
@@ -145,9 +109,6 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
return wasActive
})
unstable__openModal = openModal
unstable__closeModal = closeModal
const state = React.useMemo(
() => ({
isModalActive: activeModals.length > 0,