11import React , { useState } from 'react' ;
22import { FormattedMessage } from 'react-intl' ;
3- import { useRouter } from 'next/router ' ;
3+ import Link from 'next/link ' ;
44import classNames from 'classnames' ;
55import PageHeader from 'components/layout/PageHeader' ;
66import Button from 'components/common/Button' ;
@@ -16,11 +16,10 @@ import Pen from 'assets/pen.svg';
1616import Plus from 'assets/plus.svg' ;
1717import Trash from 'assets/trash.svg' ;
1818import Check from 'assets/check.svg' ;
19- import List from 'assets/list-ul .svg' ;
19+ import LinkIcon from 'assets/external-link .svg' ;
2020import styles from './AccountSettings.module.css' ;
2121
2222export default function AccountSettings ( ) {
23- const router = useRouter ( ) ;
2423 const [ addAccount , setAddAccount ] = useState ( ) ;
2524 const [ editAccount , setEditAccount ] = useState ( ) ;
2625 const [ deleteAccount , setDeleteAccount ] = useState ( ) ;
@@ -30,16 +29,18 @@ export default function AccountSettings() {
3029
3130 const Checkmark = ( { is_admin } ) => ( is_admin ? < Icon icon = { < Check /> } size = "medium" /> : null ) ;
3231
32+ const DashboardLink = row =>
33+ row . is_admin ? null : (
34+ < Link href = { `/dashboard/${ row . user_id } /${ row . username } ` } >
35+ < a >
36+ < Icon icon = { < LinkIcon /> } />
37+ </ a >
38+ </ Link >
39+ ) ;
40+
3341 const Buttons = row =>
3442 row . username !== 'admin' ? (
3543 < ButtonLayout >
36- < Button
37- icon = { < List /> }
38- size = "small"
39- tooltip = { < FormattedMessage id = "button.websites" defaultMessage = "Websites" /> }
40- tooltipId = { `button-websites-${ row . username } ` }
41- onClick = { ( ) => router . push ( `/dashboard/${ row . user_id } /${ row . username } ` ) }
42- />
4344 < Button icon = { < Pen /> } size = "small" onClick = { ( ) => setEditAccount ( row ) } >
4445 < div >
4546 < FormattedMessage id = "button.edit" defaultMessage = "Edit" />
@@ -57,17 +58,23 @@ export default function AccountSettings() {
5758 {
5859 key : 'username' ,
5960 label : < FormattedMessage id = "label.username" defaultMessage = "Username" /> ,
60- className : 'col-6 col-md-4 ' ,
61+ className : 'col-4 col-md-3 ' ,
6162 } ,
6263 {
6364 key : 'is_admin' ,
6465 label : < FormattedMessage id = "label.administrator" defaultMessage = "Administrator" /> ,
65- className : 'col-6 col-md-4 ' ,
66+ className : 'col-4 col-md-3 ' ,
6667 render : Checkmark ,
6768 } ,
69+ {
70+ key : 'dashboard' ,
71+ label : < FormattedMessage id = "label.dashboard" defaultMessage = "Dashboard" /> ,
72+ className : 'col-4 col-md-3' ,
73+ render : DashboardLink ,
74+ } ,
6875 {
6976 key : 'actions' ,
70- className : classNames ( styles . buttons , 'col-12 col-md-4 pt-2 pt-md-0' ) ,
77+ className : classNames ( styles . buttons , 'col-12 col-md-3 pt-2 pt-md-0' ) ,
7178 render : Buttons ,
7279 } ,
7380 ] ;
0 commit comments