Skip to content

Commit

Permalink
Show is blocked button if user is blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jul 2, 2024
1 parent d8f2ac2 commit d7a245a
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/modules/chat/HomePage/ChatContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Meme2EarnIntroModal, {
hasOpenedMeme2EarnIntroStorage,
} from '@/components/modals/Meme2EarnIntroModal'
import Modal, { ModalFunctionalityProps } from '@/components/modals/Modal'
import { useIsAddressBlockedInApp } from '@/hooks/useIsAddressBlockedInApp'
import PointsWidget from '@/modules/points/PointsWidget'
import { getPostQuery } from '@/services/api/query'
import { getTokenomicsMetadataQuery } from '@/services/datahub/content-staking/query'
Expand Down Expand Up @@ -100,6 +101,9 @@ function PostMemeButton() {
const { data: tokenomics, isLoading: loadingTokenomics } =
getTokenomicsMetadataQuery.useQuery(null)

const { isBlocked, isLoading: loadingIsBlocked } =
useIsAddressBlockedInApp(myAddress)

const [timeLeft, setTimeLeft] = useState<number>(Infinity)
useEffect(() => {
if (typeof timeLeftFromApi === 'number') {
Expand All @@ -126,11 +130,23 @@ function PostMemeButton() {
const isTimeConstrained =
!loadingTimeLeft && timeLeft !== Infinity && (timeLeft ?? 0) > 0

if (isBlocked) {
return (
<Button variant='muted' disabled>
You are blocked in this chat
</Button>
)
}

return (
<>
<Button
disabled={
isLoading || loadingTokenomics || loadingTimeLeft || isTimeConstrained
isLoading ||
loadingTokenomics ||
loadingTimeLeft ||
isTimeConstrained ||
loadingIsBlocked
}
type='button'
className='flex items-center justify-center gap-2 px-0 disabled:border-none disabled:bg-background-light/30 disabled:text-text-muted/50 disabled:!brightness-100'
Expand Down

0 comments on commit d7a245a

Please sign in to comment.