Skip to content

Commit

Permalink
Private groups, Mobile app - fixes (still WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Dec 13, 2024
1 parent aef0353 commit 309c9d1
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 25 deletions.
19 changes: 16 additions & 3 deletions src/app/default_cfg.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
module.exports = {
"app_version": "1.0.0",
"app_version": "1.0.1",
"nodes": [
{
"address": "wss://apibeta.golos.today/ws"
},
{
"address": "wss://api.golos.id/ws"
},
{
"address": "wss://api.aleksw.space/ws"
},
{
"address": "wss://api-golos.blckchnd.com/ws"
}
],
"images": {
Expand All @@ -16,12 +25,16 @@ module.exports = {
"custom_client": "blogs"
},
"notify_service": {
"host": "https://devnotify.golos.app"
"host": "https://devnotify.golos.app",
"host_ws": "wss://devnotify.golos.app/ws"
},
"blogs_service": {
"host": "https://beta.golos.today"
},
"wallet_service": {
"host": "https://devwallet.golos.today"
},
"app_updater": {
"host": "https://files.golos.app"
"host": "https://devfiles.golos.app"
}
}
16 changes: 12 additions & 4 deletions src/components/elements/MarkNotificationRead.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class MarkNotificationRead extends React.Component {
account: PropTypes.string,
update: PropTypes.func,
interval: PropTypes.number,
delay: PropTypes.number,
};

shouldComponentUpdate(nextProps) {
Expand All @@ -37,12 +38,19 @@ class MarkNotificationRead extends React.Component {
}

componentDidMount() {
const { account, fields, update, interval } = this.props;
const { account, fields, update, interval, delay } = this.props;
this.fields_array = fields.replace(/\s/g,'').split(',');
if (interval)
const firstMark = () => {
markNotificationRead(account, this.fields_array).then(nc => update(nc))
}
if (delay) {
setTimeout(firstMark, delay)
}
if (interval) {
this._activateInterval(interval);
else
markNotificationRead(account, this.fields_array).then(nc => update(nc));
} else if (!delay) {
firstMark()
}
}

componentDidUpdate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}

.conversation-info {
max-width: 98%;
width: calc(100% - 60px);
}

.conversation-snippet {
Expand Down
14 changes: 14 additions & 0 deletions src/components/elements/messages/Message/Message.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,17 @@
.msgs-message.mine .bubble-container.selected .quote-from {
color: white;
}

.msgs-adds {
display: flex;
}

@media screen and (max-width: 39.9375em) {
.msgs-adds {
display: block;

.msgs-donating {
margin-left: 3px;
}
}
}
19 changes: 15 additions & 4 deletions src/components/elements/messages/Message/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {connect} from 'react-redux'
import { Fade } from 'react-foundation-components/lib/global/fade'
import { LinkWithDropdown } from 'react-foundation-components/lib/global/dropdown'
import { withRouter } from 'react-router'
import { Link } from 'react-router-dom'
import tt from 'counterpart';
import cn from 'classnames'
Expand Down Expand Up @@ -43,7 +44,17 @@ class Message extends React.Component {
if (!node) break
href = node.href
} while (!href)
window.open(href, '_blank')
try {
let url = new URL(href)
if (url.host === location.host) {
const { history } = this.props
history.push(url.pathname)
return
}
} catch (err) {
console.error(err)
}
window.open(href, '_system')
}
}

Expand Down Expand Up @@ -195,14 +206,14 @@ class Message extends React.Component {
{ quoteHeader }
{ content }
</div>
{!isMine ? adds : null}
{!isMine ? <div className='msgs-adds'>{adds}</div> : null}
</div>
</div>
);
}
}

export default connect(
export default withRouter(connect(
(state, ownProps) => {
const accounts = state.global.get('accounts')

Expand All @@ -215,4 +226,4 @@ export default connect(
},
dispatch => ({
}),
)(Message)
)(Message))
12 changes: 9 additions & 3 deletions src/components/modules/Modals.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import LoginForm from 'app/components/modules/LoginForm';
import AppDownload from 'app/components/modules/app/AppDownload'
import user from 'app/redux/UserReducer'
//import tr from 'app/redux/Transaction';
import isScreenSmall from 'app/utils/isScreenSmall'

let keyIndex = 0;

Expand Down Expand Up @@ -76,11 +77,16 @@ class Modals extends React.Component {
return n;
}) : [];

const modalStyle = {
borderRadius: '8px',
boxShadow: '0 0 19px 3px rgba(0,0,0, 0.2)',
let modalStyle = {
overflowX: 'hidden',
}
if (!isScreenSmall()) {
modalStyle = {
borderRadius: '8px',
boxShadow: '0 0 19px 3px rgba(0,0,0, 0.2)',
...modalStyle,
}
}

const doHideLogin = (e) => {
const goBack = () => {
Expand Down
23 changes: 18 additions & 5 deletions src/components/modules/groups/MyGroups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import DropdownMenu from 'app/components/elements/DropdownMenu'
import Icon from 'app/components/elements/Icon'
import LoadingIndicator from 'app/components/elements/LoadingIndicator'
import MarkNotificationRead from 'app/components/elements/MarkNotificationRead'
import NotifiCounter from 'app/components/elements/NotifiCounter'
import { showLoginDialog } from 'app/components/dialogs/LoginDialog'
import { getGroupLogo, getGroupMeta, getRoleInGroup } from 'app/utils/groups'
import isScreenSmall from 'app/utils/isScreenSmall'
Expand Down Expand Up @@ -182,7 +183,7 @@ class MyGroups extends React.Component {
<Icon name='cross' size='0_95x' />
<span className='btn-title'>{amPending ? tt('msgs_group_dropdown.cancel') : tt('msgs_group_dropdown.retire')}</span>
</button> : null}
{(amModer && pendings) ? <button className='button hollow' onClick={e => {
{(amModer && pendings) ? <button className='button hollow alert' onClick={e => {
this.showGroupMembers(e, group, true)
}} title={tt('group_members_jsx.check_pending_hint')}>
<Icon name='voters' size='0_95x' />
Expand Down Expand Up @@ -221,17 +222,28 @@ class MyGroups extends React.Component {
let tabs = []
for (const key of ['pending', 'member', 'moder', 'own']) {
if (!stat[key]) continue
let counter
if (key === 'member') {
counter = 'group_member_mem'
} else if (key === 'moder') {
counter = 'join_request_mod,group_member_mod'
} else if (key === 'own') {
counter = 'join_request_own'
}
tabs.push(<div key={key} className={cn('label', { checked: (key === currentTab) })}
onClick={e => {
this.setState({
currentTab: key
})
}} >
{tt('my_groups_jsx.tab_' + key) + ' (' + stat[key] + ')'}
<span className='label-text'>
{tt('my_groups_jsx.tab_' + key) + ' (' + stat[key] + ')'}
</span>
{counter && <NotifiCounter fields={counter} />}
</div>)
}
if (tabs.length < 1) return null
return <div style={{ marginBottom: '1rem' }} title={tt('my_groups_jsx.tabs_title')}>
return <div style={{ marginBottom: '0.5rem' }} title={tt('my_groups_jsx.tabs_title')}>
{tabs}
</div>
}
Expand Down Expand Up @@ -285,9 +297,10 @@ class MyGroups extends React.Component {

let button
if (hasGroups) {
const isSmall = isScreenSmall()
button = <div>
<button className='button hollow create-group' onClick={this.createGroup}>
{tt('my_groups_jsx.create_more')}
{isSmall ? tt('my_groups_jsx.create_more2') : tt('my_groups_jsx.create_more')}
</button>
<button className='button hollow more-group' onClick={this.showTopGroups}>
<Icon name='search' />
Expand All @@ -305,7 +318,7 @@ class MyGroups extends React.Component {
{button}
{groups}
{hasGroups ? <div style={{ height: '50px' }}></div> : null}
{username ? <MarkNotificationRead fields='group_member,join_request' account={username}
{username ? <MarkNotificationRead delay={3000} interval={5000} fields='join_request_own,join_request_mod,group_member_mod,group_member_mem' account={username}
/> : null}
</div>
}
Expand Down
16 changes: 16 additions & 0 deletions src/components/modules/groups/MyGroups.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
}
.more-group {
float: right;
padding-top: 0.725em;
padding-bottom: 0.725em;
&:not(:hover) {
border-color: transparent;
}
Expand Down Expand Up @@ -46,13 +48,27 @@
}
.button.force-white {
color: #fefefe !important;
fill: #fefefe !important;
}
.label {
padding: 0.5rem;
padding-top: 0.6rem;
padding-bottom: 0.4rem;

transition: all .1s ease-in;
user-select: none;

margin-right: 0.5rem;
margin-bottom: 0.5rem;

.label-text {
display: inline-block;
height: 16px;
}
.NotifiCounter {
margin-left: 0.35rem;
vertical-align: top;
}

&:not(.disabled) {
cursor: pointer;
Expand Down
8 changes: 4 additions & 4 deletions src/components/pages/Messages.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -878,11 +878,11 @@ class Messages extends React.Component {
>
<a href="#" onClick={e => e.preventDefault()}>
<div className='msgs-curruser-notify-sink' style={{ marginRight: '0.2rem' }}>
<div style={{ marginRight: '0.5rem' }}>
<div style={{ marginRight: '0.5rem', paddingLeft: '0.2rem' }}>
<Icon name="new/more" />
</div>
<div className='TopRightMenu__notificounter'>
<NotifiCounter fields='mention,donate,send,receive,fill_order,delegate_vs,new_sponsor,sponsor_inactive,nft_receive,nft_token_sold,nft_buy_offer,referral,join_request,group_member' />
<NotifiCounter fields='mention,donate,send,receive,fill_order,delegate_vs,new_sponsor,sponsor_inactive,nft_receive,nft_token_sold,nft_buy_offer,referral,join_request_own,join_request_mod,group_member_mod,group_member_mem' />
</div>
</div>
</a>
Expand Down Expand Up @@ -940,7 +940,7 @@ class Messages extends React.Component {
}

let user_menu = [
{link: '#', onClick: openMyGroups, icon: 'voters', value: tt('g.groups') + (isSmall ? (' @' + username) : ''), addon: <NotifiCounter fields='join_request,group_member' /> },
{link: '#', onClick: openMyGroups, icon: 'voters', value: tt('g.groups') + (isSmall ? (' @' + username) : ''), addon: <NotifiCounter fields='join_request_own,join_request_mod,group_member_mod,group_member_mem' /> },
{link: accountLink, extLink: 'blogs', icon: 'new/blogging', value: tt('g.blog'), addon: <NotifiCounter fields='new_sponsor,sponsor_inactive,referral' />},
{link: mentionsLink, extLink: 'blogs', icon: 'new/mention', value: tt('g.mentions'), addon: <NotifiCounter fields='mention' />},
{link: donatesLink, extLink: 'wallet', icon: 'editor/coin', value: tt('g.rewards'), addon: <NotifiCounter fields='donate' />},
Expand Down Expand Up @@ -982,7 +982,7 @@ class Messages extends React.Component {
<div className='msgs-curruser-notify-sink'>
<Userpic account={username} title={isSmall ? username : null} width={40} height={40} />
<div className='TopRightMenu__notificounter'>
<NotifiCounter fields='mention,donate,send,receive,fill_order,delegate_vs,new_sponsor,sponsor_inactive,nft_receive,nft_token_sold,nft_buy_offer,referral,join_request,group_member' />
<NotifiCounter fields='mention,donate,send,receive,fill_order,delegate_vs,new_sponsor,sponsor_inactive,nft_receive,nft_token_sold,nft_buy_offer,referral,join_request_own,join_request_mod,group_member_mod,group_member_mem' />
</div>
</div>
{!isSmall ? <div className='msgs-curruser-name'>
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"create": "create",
"create2": "your own one",
"create_more": "+ Create a group",
"create_more2": "+ Create...",
"more_groups": "More groups...",
"edit": "Edit",
"login_hint_GROUP": "(delete \"%(GROUP)s\" group)",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
"find2": "интересную для себя группу",
"create": "создать",
"create2": "свою собственную",
"create_more": "+ Создать группу",
"create_more": "+ Создать группу",
"create_more2": "+ Создать...",
"more_groups": "Еще группы...",
"edit": "Изменить",
"login_hint_GROUP": "(удаления группы \"%(GROUP)s\")",
Expand Down

0 comments on commit 309c9d1

Please sign in to comment.