Skip to content

Commit

Permalink
Merge branch 'main' into improvement/events
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Mar 7, 2024
2 parents 8e4b077 + 6a8b65b commit 70eec6f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/components/posts/view-post/PostRewardStat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import clsx from 'clsx'
import capitalize from 'lodash/capitalize'
import { ComponentProps } from 'react'
import { TbCoins } from 'react-icons/tb'
import { useIsMyAddress } from 'src/components/auth/MyAccountsContext'
import { FormatBalance, formatBalanceToJsx } from 'src/components/common/balances'
import { MINIMUM_LOCK } from 'src/config/constants'
import { useSelectPost } from 'src/rtk/app/hooks'
Expand Down Expand Up @@ -57,6 +58,7 @@ export default function PostRewardStat({ postId, ...props }: PostRewardStatProps
const post = useSelectPost(postId)
const isComment = post?.post.struct.isComment
const owner = post?.post.struct.ownerId
const isMyPost = useIsMyAddress(post?.post.struct.ownerId)

const { data: totalStake } = useFetchTotalStake(owner || '')
if (!reward?.isNotZero) return null
Expand All @@ -66,7 +68,7 @@ export default function PostRewardStat({ postId, ...props }: PostRewardStatProps
return (
<div {...props} className={clsx(props.className)}>
<div className='d-flex align-items-center GapMini FontWeightMedium ColorMuted'>
{totalStakeAmount.isZero() ? (
{totalStakeAmount.isZero() && isMyPost ? (
<Tooltip
className='d-flex align-items-center GapMini'
title={
Expand Down Expand Up @@ -162,7 +164,9 @@ export default function PostRewardStat({ postId, ...props }: PostRewardStatProps
value={reward.reward}
/>
</span>
<span className='d-flex align-items-center GapMini'>earned</span>
<span className='d-flex align-items-center GapMini'>
{totalStakeAmount.isZero() ? 'could earn' : 'earned'}
</span>
</Tooltip>
</>
)}
Expand Down
5 changes: 3 additions & 2 deletions src/components/substrate/SubstrateTxButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function TxButton({
children,
parentProxyAddress,
customNodeApi,
canUseProxy,
...antdProps
}: TxButtonProps) {
const { api: subsocialApi } = useSubstrate()
Expand Down Expand Up @@ -308,7 +309,7 @@ function TxButton({
let account: AnyAccountId | KeyringSigner = accountId

try {
if (accountId === useMyAccount.getState().address) {
if (accountId === useMyAccount.getState().address && canUseProxy) {
// use proxy signer
signer = undefined
const keypairSigner = useMyAccount.getState().signer
Expand Down Expand Up @@ -457,8 +458,8 @@ function TxButton({
{...antdProps}
onClick={() => {
if (!customNodeApi && !isFreeTx && !getIsUsingKeypairSigner(accountId ?? '')) {
openSignInModal(false)
if (!accountId) {
openSignInModal(false)
return setIsSending(false)
}
if (!hasTokens) {
Expand Down
7 changes: 6 additions & 1 deletion src/components/utils/TxButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ function ResolvedTxButton({ canUseProxy = true, ...props }: TxButtonProps) {
const { isStorybook = false } = useStorybookContext()
const parentProxyAddress = useMyAccount(state => state.parentProxyAddress)
const address = useMyAccount(state => state.address)
const usedAddress = props.accountId || address || ''
let usedAddress = props.accountId || address || ''
if (props.accountId === parentProxyAddress && canUseProxy) {
usedAddress = address || ''
} else if (!canUseProxy) {
usedAddress = parentProxyAddress || address || ''
}

return isStorybook ? (
<AntdButton {...props} onClick={mockSendTx} />
Expand Down
2 changes: 1 addition & 1 deletion src/pages/legal/content-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Content related to prohibited substances or weapons is not allowed.

Content with the intention to harm the community, project, or other users is prohibited.

**Report Violations**
### Report Violations

If you’ve seen a post, message or comment which violates this code of conduct, please report it to the Grill moderators or administrators as soon as possible. We rely on our community to help keep the discussions respectful and productive.

Expand Down
2 changes: 1 addition & 1 deletion src/pages/legal/content-policy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ import React from 'react'
import HtmlPage from 'src/components/utils/HtmlPage'
import html from './content-policy.md'

export default React.memo(() => <HtmlPage html={html} title='Understand Tokens' />)
export default React.memo(() => <HtmlPage html={html} title='Grill Content Policy' />)

0 comments on commit 70eec6f

Please sign in to comment.