Skip to content

Commit

Permalink
chore(passport): Reflect overriden profile in Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Cosmin-Parvulescu committed Dec 20, 2023
1 parent 292a870 commit 3eafea3
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 160 deletions.
11 changes: 0 additions & 11 deletions apps/passport/app/components/EditProfileModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { Input } from '@proofzero/design-system/src/atoms/form/Input'
import { captureFormSubmitAndReplaceImages } from '@proofzero/design-system/src/utils/form-cf-images'
import { Loader } from '@proofzero/design-system/src/molecules/loader/Loader'
import { HiOutlineUpload } from 'react-icons/hi'
import { ToastType, toast } from '@proofzero/design-system/src/atoms/toast'

const EditProfileModal: React.FC<{
isOpen: boolean
Expand All @@ -27,16 +26,6 @@ const EditProfileModal: React.FC<{
useEffect(() => {
if (fetcher.state === 'idle' && fetcher.type === 'done') {
setIsOpen(false)

if (!fetcher.data?.error) {
toast(ToastType.Success, {
message: fetcher.data.message,
})
} else if (fetcher.data?.error) {
toast(ToastType.Error, {
message: fetcher.data.message,
})
}
}
}, [fetcher])

Expand Down
21 changes: 21 additions & 0 deletions apps/passport/app/routes/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { usePostHog } from 'posthog-js/react'
import { useEffect, useState } from 'react'
import { InternalServerError } from '@proofzero/errors'
import { ToastType, toast } from '@proofzero/design-system/src/atoms/toast'

export type AuthorizedAppsModel = {
clientId: string
Expand Down Expand Up @@ -174,6 +175,22 @@ export default function SettingsLayout() {
}, [isIdentified])

const editProfileFetcher = useFetcher()
useEffect(() => {
if (
editProfileFetcher.state === 'idle' &&
editProfileFetcher.type === 'done'
) {
if (!editProfileFetcher.data?.error) {
toast(ToastType.Success, {
message: editProfileFetcher.data.message,
})
} else if (editProfileFetcher.data?.error) {
toast(ToastType.Error, {
message: editProfileFetcher.data.message,
})
}
}
}, [editProfileFetcher])

return (
<Popover className="bg-white lg:bg-gray-50 min-h-[100dvh] relative">
Expand Down Expand Up @@ -212,6 +229,10 @@ export default function SettingsLayout() {
connectedProfiles,
primaryAccountURN,
CONSOLE_URL,
pfpUrl,
displayName,
isProfileCustomized,
editProfileFetcher,
}}
/>
</div>
Expand Down
Loading

0 comments on commit 3eafea3

Please sign in to comment.