Skip to content

Commit

Permalink
Private groups
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed May 1, 2024
1 parent 4e90fb0 commit 7615ffe
Show file tree
Hide file tree
Showing 18 changed files with 759 additions and 171 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"emoji-picker-element": "^1.10.1",
"formik": "https://gitpkg.now.sh/golos-blockchain/formik/packages/formik?b697b6ef3f13c795bb862b35589fffde442ab465",
"git-rev-sync": "^3.0.2",
"golos-lib-js": "^0.9.34",
"golos-lib-js": "^0.9.69",
"history": "4.10.1",
"immutable": "^4.0.0",
"koa": "^2.13.4",
Expand All @@ -43,7 +43,8 @@
"redux-logger": "^3.0.6",
"redux-modules": "0.0.5",
"redux-saga": "^1.1.3",
"sass": "^1.49.7"
"sass": "^1.49.7",
"speakingurl": "^14.0.1"
},
"devDependencies": {
"@red-mobile/cordova-plugin-shortcuts-android": "^1.0.1",
Expand Down
5 changes: 5 additions & 0 deletions src/assets/icons/chevron-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/info_o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

// modules
@import './modules/LoginForm.scss';
@import './modules/CreateGroup.scss';
@import './modules/Modals.scss';

@import "./pages/Messages";
3 changes: 2 additions & 1 deletion src/components/elements/Icon.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const icons = new Map([
// ['chevron-up-circle', require('app/assets/icons/chevron-up-circle.svg')],
// ['chevron-down-circle', require('app/assets/icons/chevron-down-circle.svg')],
['chevron-left', require('app/assets/icons/chevron-left.svg')],
['chevron-right', require('app/assets/icons/chevron-right.svg')],
// ['chatboxes', require('app/assets/icons/chatboxes.svg')],
['cross', require('app/assets/icons/cross.svg')],
// ['chatbox', require('app/assets/icons/chatbox.svg')],
Expand Down Expand Up @@ -42,7 +43,7 @@ const icons = new Map([
// ['eye_strike', require('app/assets/icons/eye_strike.svg')],
// ['eye_gray', require('app/assets/icons/eye_gray.svg')],
// ['location', require('app/assets/icons/location.svg')],
// ['info_o', require('app/assets/icons/info_o.svg')],
['info_o', require('app/assets/icons/info_o.svg')],
// ['feedback', require('app/assets/icons/feedback.svg')],
// ['cog', require('app/assets/icons/cog.svg')],
// ['enter', require('app/assets/icons/enter.svg')],
Expand Down
5 changes: 5 additions & 0 deletions src/components/elements/messages/StartPanel/StartPanel.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.msgs-start-panel {
.button {
display: block;
}
}
56 changes: 56 additions & 0 deletions src/components/elements/messages/StartPanel/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from 'react'
import tt from 'counterpart'
import {connect} from 'react-redux'

import user from 'app/redux/UserReducer'
import './StartPanel.scss'

class StartPanel extends React.Component {
constructor(props) {
super(props)
this.state = {
}
}

startChat = (e) => {
e.preventDefault()
const inp = document.getElementsByClassName('conversation-search-input')
if (!inp.length) {
console.error('startChat - no conversation-search-input')
return
}
if (inp.length > 1) {
console.error('startChat - multiple conversation-search-input:', inp)
return
}
inp[0].focus()
}

goCreateGroup = (e) => {
e.preventDefault()
this.props.showCreateGroup()
}

render() {
return (
<div>
<img className='msgs-empty-chat' src='/msg_empty.png' />
<div className='msgs-start-panel'>
<button className='button' onClick={this.startChat}>{tt('msgs_start_panel.start_chat')}</button>
<button className='button hollow' onClick={this.goCreateGroup}>{tt('msgs_start_panel.create_group')}</button>
</div>
</div>
)
}
}

export default connect(
(state, ownProps) => {
return { ...ownProps }
},
dispatch => ({
showCreateGroup() {
dispatch(user.actions.showCreateGroup())
},
})
)(StartPanel)
28 changes: 28 additions & 0 deletions src/components/elements/messages/Stepper/Stepper.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.Stepper {
width: 100%;

.step {
display: inline-block;
text-align: center;
color: gray;
font-size: 90%;
.bar {
background-color: gray;
height: 8px;
margin-top: 0.25rem;
margin-bottom: 0.25rem;
}

&.left {
.bar {
background-color: #0078C4;
}
}
&.current {
color: #0078C4;
.bar {
background-color: #0078C4;
}
}
}
}
57 changes: 57 additions & 0 deletions src/components/elements/messages/Stepper/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import React from 'react'

import './Stepper.scss'

class Stepper extends React.Component {
constructor(props) {
super(props)
const { steps, startStep } = this.props
const entr = Object.entries(steps)
this.state = {
currentStep: startStep || entr[0][0]
}
}

nextStep = () => {
const { steps } = this.props
const entr = Object.entries(steps)
const { currentStep } = this.state
let found
for (const [key, content] of entr) {
if (found) {
this.setState({
currentStep: key
})
return key
}
found = key === currentStep
}
return currentStep
}

render() {
const { steps } = this.props
let { currentStep } = this.state

const entr = Object.entries(steps)
currentStep = currentStep || entr[0][0]
const width = (100 / entr.length).toFixed(1)
const stepObjs = []
let foundCurrent
for (const [key, content] of entr) {
const isCurrent = key === currentStep
foundCurrent = foundCurrent || isCurrent
const cn = foundCurrent ? (isCurrent ? 'current' : '') : 'left'
stepObjs.push(<div className={'step ' + cn} style={{ minWidth: width + '%' }}>
<div className={'bar'}></div>
{content}
</div>)
}

return <div className='Stepper'>
{stepObjs}
</div>
}
}

export default Stepper
Loading

0 comments on commit 7615ffe

Please sign in to comment.