Skip to content

Commit

Permalink
hotfix: fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aaashir committed Dec 31, 2023
1 parent 5aef2c7 commit 4649a44
Show file tree
Hide file tree
Showing 12 changed files with 217 additions and 110 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ REACT_APP_PRICE_CHART_API=
REACT_APP_DEFAULT_RPC_NODE=
REACT_APP_STAGING_VERSION=
REACT_APP_FLEEK_BUCKET=
REACT_APP_HIVE_API_NODE=
REACT_APP_ENV=dev
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ REACT_APP_DATABASE_AUTH_KEY=
REACT_APP_PRICE_CHART_API=
REACT_APP_DEFAULT_RPC_NODE=
REACT_APP_FLEEK_BUCKET=
REACT_APP_HIVE_API_NODE=
REACT_APP_ENV=prod
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "d.buzz-client",
"homepage": ".",
"version": "3.44.8",
"version": "3.44.10",
"private": true,
"dependencies": {
"3id-blockchain-utils": "^1.3.1",
Expand Down
4 changes: 2 additions & 2 deletions src/components/elements/Images/Avatar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ const Avatar = React.memo((props) => {
id={`${id}`}
onLoad={loadProfileImage}
onClick={onClick}
src={`${`${avatar_src}?timestamp=${new Date().getTime()}`}`}
src={avatar_src}
roundedCircle
height={height}
width={height}
className={classNames(className, 'user-avatar-image', classes.avatarStyles)}
style={{
border: border ? '5px solid white' : 'none',
backgroundColor: 'none',
backgroundImage: `url(${avatar_src})`,
objectFit : avatarUrl ? "cover" : "inherit",
...style,
}}
Expand Down
19 changes: 5 additions & 14 deletions src/components/modals/SettingsModal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { bindActionCreators } from 'redux'
import { getUserCustomData, updateUserCustomData } from 'services/database/api'
import { CircularProgress } from '@material-ui/core'
import { setRPCNode } from 'services/api'
import { hiveAPIUrls } from 'services/helper'

const useStyles = createUseStyles(theme => ({
modal: {
Expand Down Expand Up @@ -394,21 +395,11 @@ const SettingsModal = (props) => {
<span className='title'>HIVE API Node</span>
<select className={classes.hiveNodeSelect} onChange={handleUpdateHiveNode} value={activeHiveNode}>
<option value="default">Default</option>
<option value="https://api.hive.blog">api.hive.blog</option>
<option value="https://rpc.ecency.com">rpc.ecency.com</option>
<option value="https://hive-api.3speak.tv">hive-api.3speak.tv</option>
<option value="https://rpc.ausbit.dev">rpc.ausbit.dev</option>
<option value="https://hived.privex.io">hived.privex.io</option>
<option value="https://anyx.io">anyx.io</option>
<option value="https://api.deathwing.me">api.deathwing.me</option>
<option value="https://hived.emre.sh">hived.emre.sh</option>
<option value="https://hive-api.arcange.eu">hive-api.arcange.eu</option>
<option value="https://api.openhive.network">api.openhive.network</option>
<option value="https://techcoderx.com">techcoderx.com</option>
<option value="https://hive-api.arcange.eu">hive-api.arcange.eu</option>
<option value="https://hive.roelandp.nl">hive.roelandp.nl</option>
<option value="https://api.c0ff33a.uk">api.c0ff33a.uk</option>
{hiveAPIUrls.map(url => (
<option key={url} value={url}>{url}</option>
))}
</select>

</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ const Content = (props) => {
{!checkForCeramicAccount(user.username) && <MenuItem onClick={handleTipClick} target='_blank' className={classes.menuText}>Tip</MenuItem>}
</React.Fragment>
)}
{!isAuthor() && user.username === 'dbuzz' && !user.useKeychain && !isCensored && (<MenuItem onClick={handleClickCensorDialog} className={classes.menuText}>Censor Buzz</MenuItem>)}
{!isAuthor() && user.username === 'dbuzz' && !isCensored && (<MenuItem onClick={handleClickCensorDialog} className={classes.menuText}>Censor Buzz</MenuItem>)}
{hasUpdateAuthority && (
<React.Fragment>
{!checkForCeramicAccount(user.username) && <MenuItem target='_blank' className={classes.menuText} onClick={handleAddToPocket}>Add to a Pocket</MenuItem>}
Expand Down
96 changes: 96 additions & 0 deletions src/components/pages/Latest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,46 @@ import { pending } from 'redux-saga-thunk'
import { anchorTop } from 'services/helper'
import { InfiniteList, HelmetGenerator } from 'components'
import { clearScrollIndex, clearRefreshRouteStatus } from 'store/interface/actions'
import { createUseStyles } from 'react-jss'
import { isUserAlreadyVotedForProposal } from 'services/api'
import IconButton from '@material-ui/core/IconButton'
import { CloseIcon } from 'components/elements'
import Cookies from 'js-cookie'

const useStyles = createUseStyles(theme => ({
opensourceWrapper: {
position: 'relative',
padding: '25px 0px 25px 0px',
width: '100%',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
backgroundColor: '#e6ecf0',

'& .title': {
width: 'fit-content',
fontSize: 20,
fontWeight: 'bold',
},

'& .button': {
marginTop: 15,
borderRadius: 15,
width: 'fit-content',
padding: '5px 15px 5px 15px',
fontSize: 18,
fontWeight: 'bold',
background: '#E61C34',
color: '#FFFFFF',
cursor: 'pointer',
userSelect: 'none',

'&:hover': {
opacity: 0.85,
},
},
},
}))

const Latest = (props) => {
const {
Expand Down Expand Up @@ -53,8 +93,13 @@ const Latest = (props) => {
clearLatestPosts,
refreshRouteStatus,
clearRefreshRouteStatus,
user,
} = props

const classes = useStyles()

const [isUserVotedForProposal, setIsUserVotedForProposal] = useState(true)

useEffect(() => {
setPageFrom('latest')
if (!isVisited) {
Expand Down Expand Up @@ -109,16 +154,67 @@ const Latest = (props) => {
}
}, [isLatestPostsLoaded, items.length, loadMorePosts, loading])

const handleReirectToProposal = () => {
return window.location = 'https://vote.d.buzz'
}

useEffect(() =>{
if(user.username) {
const showProposalBannerString = Cookies.get('showProposalBanner')

if (showProposalBannerString) {
const showProposalBanner = JSON.parse(showProposalBannerString)

if(showProposalBanner.visibility === true) {
isUserAlreadyVotedForProposal(user.username)
.then((response) => {
setIsUserVotedForProposal(response)
})
} else {
setIsUserVotedForProposal(true)
}
} else {
isUserAlreadyVotedForProposal(user.username)
.then((response) => {
setIsUserVotedForProposal(response)
})
}
} else {
setIsUserVotedForProposal(false)
}
}, [user])

const handleHideProposalBanner = () => {
const showProposalBanner = {
visibility: false,
}

const showProposalBannerString = JSON.stringify(showProposalBanner)

Cookies.set('showProposalBanner', showProposalBannerString, { expires: 10 })

setIsUserVotedForProposal(true)
}

return (
<React.Fragment>
{/* disable banner */}
{!isUserVotedForProposal &&
<div className={classes.opensourceWrapper}>
<IconButton style={{ position: 'absolute', right: 0, top: 15, marginLeft: 'auto', marginRight: 15 }} onClick={handleHideProposalBanner}>
<CloseIcon />
</IconButton>
{<span className='title'>Vote for DBuzz - Proposal #2</span>}
<span className='button' onClick={handleReirectToProposal}>Vote for DBuzz Proposal</span>
</div>}
<HelmetGenerator page='Latest' />
<InfiniteList loading={loading} items={items} onScroll={loadMorePosts} />
</React.Fragment>
)
}

const mapStateToProps = (state) => ({
user: state.auth.get('user'),
loading: pending(state, 'GET_LATEST_POSTS_REQUEST'),
items: state.posts.get('latest'),
isVisited: state.posts.get('isLatestVisited'),
Expand Down
Loading

0 comments on commit 4649a44

Please sign in to comment.