diff --git a/frontend/src/pages/linked-devices/linked-devices.js b/frontend/src/pages/linked-devices/linked-devices.js index f610ec528d..d04de8173f 100644 --- a/frontend/src/pages/linked-devices/linked-devices.js +++ b/frontend/src/pages/linked-devices/linked-devices.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { Dropdown, DropdownToggle, DropdownItem } from 'reactstrap'; import moment from 'moment'; import { seafileAPI } from '../../utils/seafile-api'; import { gettext, loginUrl } from '../../utils/constants'; @@ -18,8 +19,8 @@ class Content extends Component { } else { const emptyTip = ( -

{gettext("You do not have connected devices")}

-

{gettext("Your clients (Desktop/Android/iOS) will be listed here.")}

+

{gettext('You do not have connected devices')}

+

{gettext('Your clients (Desktop/Android/iOS) will be listed here.')}

); @@ -37,15 +38,14 @@ class Content extends Component { const mobileThead = ( - {gettext('Platform')} - {gettext('Device Name')} - + + ); return items.length ? ( - +
= 768 ? '': 'table-thead-hidden'}`}> {window.innerWidth >= 768 ? desktopThead : mobileThead}
@@ -80,28 +80,31 @@ class Item extends Component { constructor(props) { super(props); this.state = { + isOpMenuOpen: false, // for mobile showOpIcon: false, unlinked: false }; - - this.handleMouseOver = this.handleMouseOver.bind(this); - this.handleMouseOut = this.handleMouseOut.bind(this); - this.handleClick = this.handleClick.bind(this); } - handleMouseOver() { + toggleOpMenu = () => { + this.setState({ + isOpMenuOpen: !this.state.isOpMenuOpen + }); + } + + handleMouseOver = () => { this.setState({ showOpIcon: true }); } - handleMouseOut() { + handleMouseOut = () => { this.setState({ showOpIcon: false }); } - handleClick(e) { + handleClick = (e) => { e.preventDefault(); const data = this.props.data; @@ -147,10 +150,28 @@ class Item extends Component { const mobileItem = ( - {data.platform} - {data.device_name} - + {data.device_name}
+ {data.last_login_ip} + {moment(data.last_accessed).fromNow()} + {data.platform} + + + + +
+
+
+ {gettext('Unlink')} +
+
+
); @@ -175,7 +196,6 @@ class LinkedDevices extends Component { componentDidMount() { seafileAPI.listLinkedDevices().then((res) => { - //res: {data: Array(2), status: 200, statusText: "OK", headers: {…}, config: {…}, …} this.setState({ loading: false, items: res.data