-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HF 30 - Private message groups - members
- Loading branch information
1 parent
58e7238
commit cb399b7
Showing
16 changed files
with
548 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from 'react' | ||
import tt from 'counterpart' | ||
import AsyncSelect from 'react-select/async' | ||
import { api } from 'golos-lib-js' | ||
|
||
import Userpic from 'app/components/elements/Userpic' | ||
|
||
class AccountName extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
} | ||
|
||
lookupAccounts = async (value) => { | ||
try { | ||
const accNames = await api.lookupAccountsAsync(value.toLowerCase(), 6, true) | ||
const accs = await api.lookupAccountNamesAsync(accNames) | ||
return accs | ||
} catch (err) { | ||
console.error(err) | ||
return [] | ||
} | ||
} | ||
|
||
onChange = (acc) => { | ||
const { onChange } = this.props | ||
if (onChange) { | ||
const e = { target: { value: acc.name, account: acc } } | ||
onChange(e, acc) | ||
} | ||
} | ||
|
||
render() { | ||
const { onChange, className, ...rest } = this.props | ||
return <AsyncSelect | ||
placeholder={tt('g.name')} | ||
loadingMessage={tt('account_name_jsx.loading')} | ||
noOptionsMessage={tt('account_name_jsx.no_options')} | ||
|
||
loadOptions={this.lookupAccounts} | ||
defaultOptions={true} | ||
cacheOptions={true} | ||
|
||
className={'AccountName ' + (className || ' ')} | ||
getOptionLabel={(option) => { | ||
return <span className='name-item'> | ||
<Userpic account={option.name} width={24} height={24} /> | ||
<span className='title' style={{ verticalAlign: 'top' }}>{`${option.name}`}</span> | ||
</span> | ||
}} | ||
controlShouldRenderValue={false} | ||
onChange={this.onChange} | ||
{...rest} | ||
/> | ||
} | ||
} | ||
|
||
export default AccountName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.AccountName { | ||
input { | ||
box-shadow: none !important; | ||
line-height: 1 !important; | ||
height: 1.8rem !important; | ||
} | ||
.name-item { | ||
margin-top: 0.45rem; | ||
display: inline-block; | ||
.title { | ||
margin-left: 0.25rem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.