Skip to content

Commit

Permalink
remove staking from identity rows on list detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalsine85 committed Nov 15, 2024
1 parent f1ec3fc commit c8a3fab
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 50 deletions.
24 changes: 8 additions & 16 deletions apps/portal/app/components/list/tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { ClaimPresenter, SortColumn } from '@0xintuition/api'

import { ListHeader } from '@components/list/list-header'
import { saveListModalAtom, stakeModalAtom } from '@lib/state/store'
import { saveListModalAtom } from '@lib/state/store'
import {
formatBalance,
getAtomDescription,
Expand Down Expand Up @@ -51,7 +51,6 @@ export function TagsList({
]

const setSaveListModalActive = useSetAtom(saveListModalAtom)
const setStakeModalActive = useSetAtom(stakeModalAtom)

return (
<>
Expand All @@ -71,17 +70,17 @@ export function TagsList({
]}
/>
)}
{claims.map((claim) => {
{claims.map((claim, index) => {
const identity = claim.subject
// TODO: ENG-0000: Show filled save if user has a position on claim
// TODO: ENG-0000: Show only user position if user is on filtering by you.

return (
<div
key={claim.claim_id}
className={`grow shrink basis-0 self-stretch bg-background first:border-t-px first:rounded-t-xl last:rounded-b-xl theme-border border-t-0 flex-col justify-start hover:bg-secondary/10 transition-colors duration-200 items-start gap-5 inline-flex`}
className={`grow shrink basis-0 self-stretch bg-primary/5 first:border-t-px first:rounded-t-xl last:rounded-b-xl theme-border border-t-0 flex-col justify-start items-start inline-flex gap-8`}
>
<div className="flex flex-row gap-2 w-full">
<div className="flex flex-row gap-2 w-full pr-4">
<IdentityRow
variant={
claim.subject?.is_user ? Identity.user : Identity.nonUser
Expand All @@ -105,17 +104,10 @@ export function TagsList({
numPositions={claim?.num_positions || 0}
link={getAtomLink(identity, readOnly)}
ipfsLink={getAtomIpfsLink(identity)}
onStakeClick={() =>
setStakeModalActive((prevState) => ({
...prevState,
mode: 'deposit',
modalType: 'identity',
isOpen: true,
identity: identity ?? undefined,
vaultId: identity?.vault_id ?? null,
}))
}
className={`w-full hover:bg-transparent ${readOnly ? '' : 'pr-0'}`}
className={`w-full border-none rounded-none bg-transparent ${readOnly ? '' : 'pr-0'}`}
isFirst={!enableHeader && index === 0}
isLast={index === claims.length - 1}
hideContextMenu={true}
/>
{readOnly === false && (
<Button
Expand Down
74 changes: 40 additions & 34 deletions packages/1ui/src/components/IdentityRow/IdentityRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface IdentityRowProps extends React.HTMLAttributes<HTMLDivElement> {
onStakeClick?: () => void
isFirst?: boolean
isLast?: boolean
hideContextMenu?: boolean
}

const IdentityRow = ({
Expand All @@ -61,6 +62,7 @@ const IdentityRow = ({
onStakeClick,
isFirst = true,
isLast = true,
hideContextMenu = false,
}: IdentityRowProps) => {
const { isMobileView } = useSidebarLayoutContext()

Expand Down Expand Up @@ -115,21 +117,23 @@ const IdentityRow = ({
</div>
</HoverCardContent>
</HoverCard>
<ContextMenu>
<ContextMenuTrigger className="sm:hidden ml-auto">
<Button variant={ButtonVariant.text} size={ButtonSize.icon}>
<Icon
name={IconName.context}
className="text-secondary/70 h-4 w-4"
/>
</Button>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Settings</ContextMenuItem>
<ContextMenuItem>Logout</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
{!hideContextMenu && (
<ContextMenu>
<ContextMenuTrigger className="sm:hidden ml-auto">
<Button variant={ButtonVariant.text} size={ButtonSize.icon}>
<Icon
name={IconName.context}
className="text-secondary/70 h-4 w-4"
/>
</Button>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Settings</ContextMenuItem>
<ContextMenuItem>Logout</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
)}
</div>
<Separator className="md:hidden" />
<div className="flex items-center gap-3 max-sm:justify-between max-sm:w-full">
Expand All @@ -142,25 +146,27 @@ const IdentityRow = ({
className="w-full"
/>
)}
<ContextMenu>
<ContextMenuTrigger disabled className="max-sm:hidden">
<Button
variant={ButtonVariant.text}
size={ButtonSize.icon}
disabled
>
<Icon
name={IconName.context}
className="text-secondary/70 h-4 w-4"
/>
</Button>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Settings</ContextMenuItem>
<ContextMenuItem>Logout</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
{!hideContextMenu && (
<ContextMenu>
<ContextMenuTrigger disabled className="max-sm:hidden">
<Button
variant={ButtonVariant.text}
size={ButtonSize.icon}
disabled
>
<Icon
name={IconName.context}
className="text-secondary/70 h-4 w-4"
/>
</Button>
</ContextMenuTrigger>
<ContextMenuContent>
<ContextMenuItem>Profile</ContextMenuItem>
<ContextMenuItem>Settings</ContextMenuItem>
<ContextMenuItem>Logout</ContextMenuItem>
</ContextMenuContent>
</ContextMenu>
)}
</div>
</div>
{userPosition && userPosition !== '0' && (
Expand Down

0 comments on commit c8a3fab

Please sign in to comment.