Skip to content

Commit

Permalink
🔥 CRT marketplace hotfix (#58)
Browse files Browse the repository at this point in the history
* fix arrow direction on latest crt trades

* Replace withdraw action for revenue split for non token channels
  • Loading branch information
ikprk committed Jul 26, 2024
1 parent de9e8ea commit 3ea6e5d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'

import { AmmTransactionOrderByInput } from '@/api/queries/__generated__/baseTypes.generated'
import { useGetAmmTransactionsQuery } from '@/api/queries/__generated__/creatorTokens.generated'
import { SvgActionArrowTop } from '@/assets/icons'
import { SvgActionArrowBottom, SvgActionArrowTop } from '@/assets/icons'
import { Avatar } from '@/components/Avatar'
import { FlexBox } from '@/components/FlexBox'
import { Text } from '@/components/Text'
Expand Down Expand Up @@ -32,7 +32,7 @@ export const LastestCrtTrades = () => {
${tx.amm.token.symbol}
</Text>
<AmountBox isBuy={tx.transactionType === 'BUY'} alignItems="center">
<SvgActionArrowTop />
{tx.transactionType === 'BUY' ? <SvgActionArrowTop /> : <SvgActionArrowBottom />}
<Text
variant="h200"
as="h1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { useNavigate } from 'react-router'
import { CSSTransition } from 'react-transition-group'
import useResizeObserver from 'use-resize-observer'

import { useGetFullCreatorTokenQuery } from '@/api/queries/__generated__/creatorTokens.generated'
import { StartRevenueShare } from '@/components/_crt/StartRevenueShareModal'
import { absoluteRoutes } from '@/config/routes'
import { useAuth } from '@/providers/auth/auth.hooks'
import { useAuthStore } from '@/providers/auth/auth.store'
Expand Down Expand Up @@ -37,9 +39,16 @@ export const MemberDropdown = forwardRef<HTMLDivElement, MemberDropdownProps>(
} = useAuthStore()
const [showWithdrawDialog, setShowWithdrawDialog] = useState(false)
const [disableScrollDuringAnimation, setDisableScrollDuringAnimation] = useState(true)
const [openRevenueShareModal, setOpenRevenueShareModal] = useState(false)

const [showSendDialog, setShowSendDialog] = useState(false)
const selectedChannel = activeMembership?.channels.find((chanel) => chanel.id === channelId)
const { data: tokenData } = useGetFullCreatorTokenQuery({
variables: {
id: activeChannel?.creatorToken?.token.id ?? '',
},
skip: !activeChannel?.creatorToken?.token.id,
})
const memoizedChannelStateBloatBond = useMemo(() => {
return new BN(selectedChannel?.channelStateBloatBond || 0)
}, [selectedChannel?.channelStateBloatBond])
Expand Down Expand Up @@ -131,6 +140,13 @@ export const MemberDropdown = forwardRef<HTMLDivElement, MemberDropdownProps>(
totalBalance={totalBalance}
channelId={channelId}
/>
{tokenData?.creatorTokenById ? (
<StartRevenueShare
show={openRevenueShareModal}
token={tokenData.creatorTokenById}
onClose={() => setOpenRevenueShareModal(false)}
/>
) : null}
<SendFundsDialog show={showSendDialog} onExitClick={toggleSendDialog} accountBalance={accountBalance} />

<CSSTransition classNames={transitions.names.dropdown} in={isActive} timeout={0} mountOnEnter unmountOnExit>
Expand Down Expand Up @@ -161,9 +177,14 @@ export const MemberDropdown = forwardRef<HTMLDivElement, MemberDropdownProps>(
channelId={channelId}
unseenNotificationsCounts={unseenNotificationsCounts}
onSignOut={handleLogout}
onShowFundsDialog={() =>
onShowFundsDialog={() => {
if (activeChannel?.creatorToken?.token.id) {
setOpenRevenueShareModal(true)
return
}

dropdownType === 'channel' ? setShowWithdrawDialog(true) : setShowSendDialog(true)
}
}}
accountBalance={accountBalance}
onAddNewChannel={handleAddNewChannel}
channelBalance={channelBalance}
Expand Down

0 comments on commit 3ea6e5d

Please sign in to comment.