1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

[share dialog] 'share link' panel: redesigned the link items (#5598)

* removed the underline for the link when hover on it
* removed the 'edit' icon
* show 'pointer' cursor for the whole link item
* click the link item to visit the link details(into the 'details'
panel')
* adjusted width of the columns
This commit is contained in:
llj
2023-08-22 00:03:32 +08:00
committed by GitHub
parent c93a654c1c
commit c056c9d01e
2 changed files with 32 additions and 12 deletions

View File

@@ -43,22 +43,32 @@ class LinkItem extends React.Component {
return link.slice(0, 9) + '...' + link.slice(length-5); return link.slice(0, 9) + '...' + link.slice(length-5);
} }
onDeleteIconClicked = (e) => {
e.preventDefault();
e.stopPropagation();
this.toggleDeleteShareLinkDialog();
}
toggleDeleteShareLinkDialog = () => { toggleDeleteShareLinkDialog = () => {
this.setState({isDeleteShareLinkDialogOpen: !this.state.isDeleteShareLinkDialogOpen}); this.setState({isDeleteShareLinkDialogOpen: !this.state.isDeleteShareLinkDialogOpen});
} }
copyLink = (e) => { onCopyIconClicked = (e) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation();
const { item } = this.props; const { item } = this.props;
copy(item.link); copy(item.link);
toaster.success(gettext('Share link is copied to the clipboard.')); toaster.success(gettext('Share link is copied to the clipboard.'));
} }
viewDetails = (e) => { clickItem = (e) => {
e.preventDefault();
this.props.showLinkDetails(this.props.item); this.props.showLinkDetails(this.props.item);
} }
onCheckboxClicked = (e) => {
e.stopPropagation();
}
toggleSelectLink = (e) => { toggleSelectLink = (e) => {
const { item } = this.props; const { item } = this.props;
this.props.toggleSelectLink(item, e.target.checked); this.props.toggleSelectLink(item, e.target.checked);
@@ -76,12 +86,23 @@ class LinkItem extends React.Component {
const currentPermission = Utils.getShareLinkPermissionStr(permissions); const currentPermission = Utils.getShareLinkPermissionStr(permissions);
return ( return (
<Fragment> <Fragment>
<tr onMouseOver={this.onMouseOver} onMouseOut={this.onMouseOut} className={isSelected ? 'tr-highlight' : ''}> <tr
onClick={this.clickItem}
onMouseOver={this.onMouseOver}
onMouseOut={this.onMouseOut}
className={`cursor-pointer ${isSelected ? 'tr-highlight' : ''}`}
>
<td className="text-center"> <td className="text-center">
<input type="checkbox" checked={isSelected} onChange={this.toggleSelectLink} className="vam" /> <input
type="checkbox"
checked={isSelected}
className="vam"
onClick={this.onCheckboxClicked}
onChange={this.toggleSelectLink}
/>
</td> </td>
<td> <td>
<a href="#" onClick={this.viewDetails} className="text-inherit">{this.cutLink(link)}</a> {this.cutLink(link)}
</td> </td>
<td> <td>
{(isPro && permissions) && ( {(isPro && permissions) && (
@@ -98,9 +119,8 @@ class LinkItem extends React.Component {
{expire_date ? moment(expire_date).format('YYYY-MM-DD HH:mm') : '--'} {expire_date ? moment(expire_date).format('YYYY-MM-DD HH:mm') : '--'}
</td> </td>
<td> <td>
<a href="#" role="button" onClick={this.copyLink} className={`sf2-icon-copy action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Copy')} aria-label={gettext('Copy')}></a> <a href="#" role="button" onClick={this.onCopyIconClicked} className={`sf2-icon-copy action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Copy')} aria-label={gettext('Copy')}></a>
<a href="#" role="button" onClick={this.viewDetails} className={`fa fa-pencil-alt attr-action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Edit')} aria-label={gettext('Edit')}></a> <a href="#" role="button" onClick={this.onDeleteIconClicked} className={`sf2-icon-delete action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Delete')} aria-label={gettext('Delete')}></a>
<a href="#" role="button" onClick={this.toggleDeleteShareLinkDialog} className={`sf2-icon-delete action-icon ${isItemOpVisible ? '' : 'invisible'}`} title={gettext('Delete')} aria-label={gettext('Delete')}></a>
</td> </td>
</tr> </tr>
{this.state.isDeleteShareLinkDialogOpen && ( {this.state.isDeleteShareLinkDialogOpen && (

View File

@@ -80,10 +80,10 @@ class LinkList extends React.Component {
<th width="5%" className="text-center"> <th width="5%" className="text-center">
<input type="checkbox" checked={isAllLinksSelected} className="vam" onChange={this.toggleSelectAllLinks} /> <input type="checkbox" checked={isAllLinksSelected} className="vam" onChange={this.toggleSelectAllLinks} />
</th> </th>
<th width="23%">{gettext('Link')}</th> <th width="26%">{gettext('Link')}</th>
<th width="30%">{gettext('Permission')}</th> <th width="30%">{gettext('Permission')}</th>
<th width="24%">{gettext('Expiration')}</th> <th width="25%">{gettext('Expiration')}</th>
<th width="18%"></th> <th width="14%"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>