Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-4769 feat(portal,graphql): user profile metadata left panel #940

Merged
3 changes: 2 additions & 1 deletion apps/portal/app/components/edit-profile/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { UserPresenter } from '@0xintuition/api'
import { EditProfileForm } from './form'

export interface EditProfileModalProps {
userObject: UserPresenter
// eslint-disable-next-line @typescript-eslint/no-explicit-any
userObject: any //TODO: (ENG-4782) Fix once we have the correct types
open?: boolean
setUserObject?: (userObject: UserPresenter) => void
onClose: () => void
Expand Down
9 changes: 6 additions & 3 deletions apps/portal/app/components/tags/add-tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import { useAtom } from 'jotai'
import { TagsListInputPortal } from './tags-list-input-portal'

interface AddTagsProps {
selectedTags: IdentityPresenter[]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
selectedTags: any // TODO: (ENG-4782) temporary type fix until we lock in final types
existingTagIds: string[]
identity: IdentityPresenter
// eslint-disable-next-line @typescript-eslint/no-explicit-any
identity: any // TODO: (ENG-4782) temporary type fix until we lock in final types
userWallet: string
onAddTag: (newTag: IdentityPresenter) => void
onRemoveTag: (id: string) => void
Expand All @@ -47,7 +49,8 @@ export function AddTags({
invalidTags,
setInvalidTags,
}: AddTagsProps) {
const formattedTags = selectedTags?.map((tag) => ({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const formattedTags = selectedTags?.map((tag: any) => ({
name: tag.display_name,
id: tag.vault_id,
tagCount: tag.tag_count,
Expand Down
33 changes: 18 additions & 15 deletions apps/portal/app/components/tags/tags-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TabsTrigger,
Trunctacular,
} from '@0xintuition/1ui'
import { ClaimPresenter, IdentityPresenter } from '@0xintuition/api'
import { IdentityPresenter } from '@0xintuition/api'

import { TransactionState } from '@components/transaction-state'
import {
Expand All @@ -35,8 +35,9 @@ import TagsReview from './tags-review'
import { TagSearchCombobox } from './tags-search-combo-box'

interface TagsFormProps {
identity: IdentityPresenter
tagClaims: ClaimPresenter[]
identity: IdentityPresenter | undefined // TODO: (ENG-4782) temporary type fix until we lock in final types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tagClaims: any[] // TODO: (ENG-4782) temporary type fix until we lock in final types
userWallet: string
mode: 'view' | 'add'
readOnly?: boolean
Expand All @@ -56,9 +57,9 @@ export function TagsForm({
const navigate = useNavigate()
const [currentTab, setCurrentTab] = useState(mode)

const existingTagIds = tagClaims
? tagClaims.map((tagClaim) => tagClaim.vault_id)
: []
logger('tags in tag form', tagClaims)
logger('identity in tags-form', identity)
const existingTagIds = tagClaims ? tagClaims.map((tag) => tag.id) : []

const { state, dispatch } = useTransactionState<
TransactionStateType,
Expand Down Expand Up @@ -94,11 +95,13 @@ export function TagsForm({

const setSaveListModalActive = useSetAtom(saveListModalAtom)

const handleTagClick = (tagClaim: ClaimPresenter) => {
// TODO: (ENG-4782) temporary type fix until we lock in final types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const handleTagClick = (tag: any) => {
setSaveListModalActive({
isOpen: true,
id: tagClaim.vault_id,
tag: tagClaim.object,
id: tag.id,
tag: tag.object,
})
}

Expand Down Expand Up @@ -164,7 +167,7 @@ export function TagsForm({
dispatch={dispatch}
onRemoveTag={handleRemoveTag}
onRemoveInvalidTag={handleRemoveInvalidTag}
subjectVaultId={identity.vault_id}
subjectVaultId={identity?.id ?? ''}
invalidTags={invalidTags}
setInvalidTags={setInvalidTags}
/>
Expand Down Expand Up @@ -201,7 +204,7 @@ export function TagsForm({
<div className="h-full flex flex-col">
<TagsReview
dispatch={dispatch}
subjectVaultId={identity.vault_id}
subjectVaultId={identity?.id ?? ''}
tags={selectedTags}
/>
</div>
Expand All @@ -222,15 +225,15 @@ export function TagsForm({
className="w-40"
onClick={() => {
navigate(
identity.is_user
? `${PATHS.PROFILE}/${identity.identity_id}`
: `${PATHS.IDENTITY}/${identity.vault_id}`,
identity?.is_user
? `${PATHS.PROFILE}/${identity?.id}`
: `${PATHS.IDENTITY}/${identity?.id}`,
)

onClose()
}}
>
View {identity.is_user ? 'profile' : 'identity'}
View {identity?.is_user ? 'profile' : 'identity'}
</Button>
)
}
Expand Down
7 changes: 4 additions & 3 deletions apps/portal/app/components/tags/tags-modal.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Dialog, DialogContent } from '@0xintuition/1ui'
import { ClaimPresenter, IdentityPresenter } from '@0xintuition/api'

import { TagsForm } from './tags-form'

export interface TagsModalProps {
identity: IdentityPresenter
tagClaims: ClaimPresenter[]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
identity: any // TODO: (ENG-4782) temporary type fix until we lock in final types
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tagClaims: any[] // TODO: (ENG-4782) temporary type fix until we lock in final types
userWallet: string
open?: boolean
mode: 'view' | 'add'
Expand Down
2 changes: 2 additions & 0 deletions apps/portal/app/components/tags/tags-search-combo-box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { ClaimPresenter } from '@0xintuition/api'

import { IdentitySearchComboboxItem } from '@components/identity/identity-search-combo-box-item'
import logger from '@lib/utils/logger'
import { formatBalance, getAtomIpfsLink, truncateString } from '@lib/utils/misc'

export interface TagSearchComboboxProps
Expand All @@ -32,6 +33,7 @@ const TagSearchCombobox = ({
onTagClick = () => {},
...props
}: TagSearchComboboxProps) => {
logger('tagClaims in tags-search-combo-box', tagClaims)
return (
<div className="min-w-96" {...props}>
<Command className="border-none">
Expand Down
Loading
Loading