* client: add icons for table buttons

This commit is contained in:
Ildar Kamalov 2019-05-23 12:32:51 +03:00 committed by Simon Zolin
parent bd2c4269db
commit cbef338592
10 changed files with 55 additions and 24 deletions

View File

@ -270,11 +270,12 @@
"clients_desc": "Configure devices connected to AdGuard Home",
"settings_global": "Global",
"settings_custom": "Custom",
"add_client": "Add Client",
"table_client": "Client",
"table_name": "Name",
"save_btn": "Save",
"client_add": "Add Client",
"client_new": "New Client",
"client_edit": "Edit Client",
"client_identifier": "Identifier",
"ip_address": "IP address",
"client_identifier_desc": "Clients can be identified by the IP address or MAC address. Please note, that using MAC as identifier is possible only if AdGuard Home is also a <0>DHCP server</0>",

View File

@ -21,6 +21,7 @@ import Status from '../ui/Status';
import UpdateTopline from '../ui/UpdateTopline';
import UpdateOverlay from '../ui/UpdateOverlay';
import EncryptionTopline from '../ui/EncryptionTopline';
import Icons from '../ui/Icons';
import i18n from '../../i18n';
class App extends Component {
@ -103,6 +104,7 @@ class App extends Component {
</div>
<Footer />
<Toasts />
<Icons />
</Fragment>
</HashRouter>
);

View File

@ -1,13 +0,0 @@
.remove-icon {
position: relative;
top: 2px;
display: inline-block;
width: 20px;
height: 18px;
opacity: 0.6;
}
.remove-icon:hover {
cursor: pointer;
opacity: 1;
}

View File

@ -6,7 +6,6 @@ import Modal from '../ui/Modal';
import PageTitle from '../ui/PageTitle';
import Card from '../ui/Card';
import UserRules from './UserRules';
import './Filters.css';
class Filters extends Component {
componentDidMount() {
@ -59,7 +58,18 @@ class Filters extends Component {
}, {
Header: <Trans>actions_table_header</Trans>,
accessor: 'url',
Cell: ({ value }) => (<span title={ this.props.t('delete_table_action') } className='remove-icon fe fe-trash-2' onClick={() => this.props.removeFilter(value)}/>),
Cell: ({ value }) => (
<button
type="button"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.props.removeFilter(value)}
title={this.props.t('delete_table_action')}
>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
),
className: 'text-center',
width: 80,
sortable: false,

View File

@ -103,7 +103,9 @@ let Form = (props) => {
</div>
<div className="mb-4">
<strong>Settings</strong>
<strong>
<Trans>settings</Trans>
</strong>
</div>
<div className="form__group">

View File

@ -3,11 +3,13 @@ import PropTypes from 'prop-types';
import { Trans, withNamespaces } from 'react-i18next';
import ReactModal from 'react-modal';
import { MODAL_TYPE } from '../../../helpers/constants';
import Form from './Form';
const Modal = (props) => {
const {
isModalOpen,
modalType,
currentClientData,
handleSubmit,
toggleClientModal,
@ -25,7 +27,11 @@ const Modal = (props) => {
<div className="modal-content">
<div className="modal-header">
<h4 className="modal-title">
<Trans>client_new</Trans>
{modalType === MODAL_TYPE.EDIT ? (
<Trans>client_edit</Trans>
) : (
<Trans>client_new</Trans>
)}
</h4>
<button type="button" className="close" onClick={() => toggleClientModal()}>
<span className="sr-only">Close</span>
@ -47,6 +53,7 @@ const Modal = (props) => {
Modal.propTypes = {
isModalOpen: PropTypes.bool.isRequired,
modalType: PropTypes.string.isRequired,
currentClientData: PropTypes.object.isRequired,
handleSubmit: PropTypes.func.isRequired,
toggleClientModal: PropTypes.func.isRequired,

View File

@ -139,19 +139,21 @@ class Clients extends Component {
{
Header: this.props.t('actions_table_header'),
accessor: 'actions',
maxWidth: 150,
Cell: (row) => {
const clientName = row.original.name;
const {
toggleClientModal,
processingDeleting,
processingUpdating,
t,
} = this.props;
return (
<div className="logs__row logs__row--center">
<button
type="button"
className="btn btn-outline-primary btn-sm mr-2"
className="btn btn-icon btn-outline-primary btn-sm mr-2"
onClick={() =>
toggleClientModal({
type: MODAL_TYPE.EDIT,
@ -159,16 +161,22 @@ class Clients extends Component {
})
}
disabled={processingUpdating}
title={t('edit_table_action')}
>
<Trans>edit_table_action</Trans>
<svg className="icons">
<use xlinkHref="#edit" />
</svg>
</button>
<button
type="button"
className="btn btn-outline-secondary btn-sm"
className="btn btn-icon btn-outline-secondary btn-sm"
onClick={() => this.handleDelete({ name: clientName })}
disabled={processingDeleting}
title={t('delete_table_action')}
>
<Trans>delete_table_action</Trans>
<svg className="icons">
<use xlinkHref="#delete" />
</svg>
</button>
</div>
);
@ -181,6 +189,7 @@ class Clients extends Component {
t,
clients,
isModalOpen,
modalType,
modalClientName,
toggleClientModal,
processingAdding,
@ -203,7 +212,6 @@ class Clients extends Component {
showPagination={true}
defaultPageSize={10}
minRows={5}
resizable={false}
previousText={t('previous_btn')}
nextText={t('next_btn')}
loadingText={t('loading_table_status')}
@ -218,11 +226,12 @@ class Clients extends Component {
onClick={() => toggleClientModal(MODAL_TYPE.ADD)}
disabled={processingAdding}
>
<Trans>add_client</Trans>
<Trans>client_add</Trans>
</button>
<Modal
isModalOpen={isModalOpen}
modalType={modalType}
toggleClientModal={toggleClientModal}
currentClientData={currentClientData}
handleSubmit={this.handleSubmit}

View File

@ -76,3 +76,11 @@
.encryption__list li {
list-style: inside;
}
.btn-icon {
display: inline-flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
}

View File

@ -0,0 +1,5 @@
.icons {
display: inline-block;
vertical-align: middle;
height: 100%;
}

Binary file not shown.