add account selection, settings, login modal
Change-Id: Ica6d38270c783de070bf1d5bb30603173dbeb0df
diff --git a/jaas-client/src/components/AccountList.js b/jaas-client/src/components/AccountList.js
new file mode 100644
index 0000000..6f38c3c
--- /dev/null
+++ b/jaas-client/src/components/AccountList.js
@@ -0,0 +1,29 @@
+import React from 'react';
+
+import List from '@material-ui/core/List';
+import ListItem from '@material-ui/core/ListItem';
+import ListItemText from '@material-ui/core/ListItemText';
+import ListItemAvatar from '@material-ui/core/ListItemAvatar';
+import Avatar from '@material-ui/core/Avatar';
+import PersonRoundedIcon from '@material-ui/icons/PersonRounded';
+
+class AccountList extends React.Component {
+ render() {
+ return (
+ <List>
+ {
+ this.props.accounts.map(account => <ListItem button key={account.getId()} onClick={() => this.props.onClick(account)}>
+ <ListItemAvatar>
+ <Avatar>
+ <PersonRoundedIcon />
+ </Avatar>
+ </ListItemAvatar>
+ <ListItemText primary={account.getDisplayName()} secondary={account.getDisplayUri()} />
+ </ListItem>
+ )
+ }
+ </List>)
+ }
+}
+
+export default AccountList;
\ No newline at end of file
diff --git a/jaas-client/src/components/AccountPreferences.js b/jaas-client/src/components/AccountPreferences.js
new file mode 100644
index 0000000..f486dd9
--- /dev/null
+++ b/jaas-client/src/components/AccountPreferences.js
@@ -0,0 +1,63 @@
+import React from 'react';
+
+import Typography from '@material-ui/core/Typography';
+
+import JamiIdCard from './JamiIdCard';
+import List from '@material-ui/core/List';
+import ListItem from '@material-ui/core/ListItem';
+import ListItemIcon from '@material-ui/core/ListItemIcon';
+import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
+import ListItemText from '@material-ui/core/ListItemText';
+import ListSubheader from '@material-ui/core/ListSubheader';
+import Switch from '@material-ui/core/Switch';
+import PhoneCallbackIcon from '@material-ui/icons/PhoneCallback';
+import GroupRoundedIcon from '@material-ui/icons/GroupRounded';
+import Account from '../../../model/Account';
+
+class AccountPreferences extends React.Component {
+
+ render() {
+ const account = this.props.account
+ const isJamiAccount = account.getType() === Account.TYPE_JAMI
+ return (
+ <React.Fragment>
+ <Typography variant="h2" component="h2">Jami account</Typography>
+
+ {isJamiAccount &&
+ <JamiIdCard account={account} />}
+
+ <List subheader={<ListSubheader>Settings</ListSubheader>}>
+ <ListItem>
+ <ListItemIcon>
+ <GroupRoundedIcon />
+ </ListItemIcon>
+ <ListItemText id="switch-list-label-rendezvous" primary="Rendez-Vous point" />
+ <ListItemSecondaryAction>
+ <Switch
+ edge="end"
+ /*onChange={handleToggle('wifi')}*/
+ checked={account.isRendezVous()}
+ inputProps={{ 'aria-labelledby': 'switch-list-label-wifi' }}
+ />
+ </ListItemSecondaryAction>
+ </ListItem>
+ <ListItem>
+ <ListItemIcon>
+ <PhoneCallbackIcon />
+ </ListItemIcon>
+ <ListItemText id="switch-list-label-publicin" primary="Allow connection from unkown peers" />
+ <ListItemSecondaryAction>
+ <Switch
+ edge="end"
+ /*onChange={handleToggle('bluetooth')}*/
+ checked={account.isPublicIn()}
+ inputProps={{ 'aria-labelledby': 'switch-list-label-bluetooth' }}
+ />
+ </ListItemSecondaryAction>
+ </ListItem>
+ </List>
+ </React.Fragment>)
+ }
+}
+
+export default AccountPreferences;
\ No newline at end of file
diff --git a/jaas-client/src/components/Header.js b/jaas-client/src/components/Header.js
index 22a6c74..d245976 100644
--- a/jaas-client/src/components/Header.js
+++ b/jaas-client/src/components/Header.js
@@ -2,10 +2,11 @@
import Button from '@material-ui/core/Button';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
-import { useHistory } from "react-router-dom";
+//import { useHistory } from "react-router-dom";
+import authManager from '../AuthManager'
export default function Header() {
- const history = useHistory();
+ //const history = useHistory();
const [anchorEl, setAnchorEl] = React.useState(null);
@@ -18,15 +19,16 @@
};
const disconnect = () => {
- let path = `/`;
- history.push(path);
+ authManager.disconnect()
+ //let path = `/`;
+ //history.push(path);
}
return (
<div>
<Button aria-controls="simple-menu" aria-haspopup="true" onClick={handleClick}>
Menu
- </Button>
+ </Button>
<Menu
id="simple-menu"
anchorEl={anchorEl}
diff --git a/jaas-client/src/components/JamiIdCard.js b/jaas-client/src/components/JamiIdCard.js
new file mode 100644
index 0000000..eb31a26
--- /dev/null
+++ b/jaas-client/src/components/JamiIdCard.js
@@ -0,0 +1,25 @@
+import React from 'react';
+
+import Card from '@material-ui/core/Card';
+import CardContent from '@material-ui/core/CardContent';
+import Typography from '@material-ui/core/Typography';
+
+class JamiIdCard extends React.Component {
+ render() {
+ const account = this.props.account
+ const registeredName = account.getRegisteredName()
+ return (
+ <Card style={{marginBottom:16}}>
+ <CardContent>
+ <Typography variant="h6">Jami key ID</Typography>
+ <Typography variant="body1">{account.getUri()}</Typography>
+ {registeredName && <div>
+ <Typography variant="h6">Jami username</Typography>
+ <Typography variant="body1">{registeredName}</Typography></div>
+ }
+ </CardContent>
+ </Card>)
+ }
+}
+
+export default JamiIdCard;
\ No newline at end of file
diff --git a/jaas-client/src/components/SendMessageForm.js b/jaas-client/src/components/SendMessageForm.js
index e52635d..43a4998 100644
--- a/jaas-client/src/components/SendMessageForm.js
+++ b/jaas-client/src/components/SendMessageForm.js
@@ -1,5 +1,6 @@
import React from 'react'
-import InputEmoji from "react-input-emoji";
+import TextField from '@material-ui/core/TextField'
+//import InputEmoji from "react-input-emoji";
class SendMessageForm extends React.Component {
@@ -25,7 +26,6 @@
this.setState({
message: ''
})
-
}
render() {
@@ -33,7 +33,7 @@
<div
//onSubmit={this.handleSubmit}
className="send-message-form">
- <InputEmoji
+ <TextField
disabled={this.props.disabled}
onChange={this.handleChange}
value={this.state.message}