1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-22 08:47:22 +00:00

[dir view] the top toolbar for 1 selected dirent: display 'share' icon (remove 'share' from the downdown menu), replaced the 'vertical dots' icon with a 'horizontal dots' icon; other improvements (#7758)

This commit is contained in:
llj 2025-04-22 21:22:29 +08:00 committed by GitHub
parent 45c9411973
commit 1ba5c44839
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 21 deletions

View File

@ -133,12 +133,25 @@ class SelectedDirentsToolbar extends React.Component {
}); });
}; };
getDirentSharePerm = () => {
const { selectedDirentList, currentRepoInfo } = this.props;
const dirent = selectedDirentList[0];
return Utils.isHasPermissionToShare(currentRepoInfo, dirent.permission, dirent);
};
shareDirent = () => {
this.setState({
showLibContentViewDialogs: true,
showShareDialog: true
});
};
getDirentMenuList = (dirent) => { getDirentMenuList = (dirent) => {
const isRepoOwner = this.props.isRepoOwner; const isRepoOwner = this.props.isRepoOwner;
const currentRepoInfo = this.props.currentRepoInfo; const currentRepoInfo = this.props.currentRepoInfo;
const isContextmenu = true; const isContextmenu = true;
let opList = Utils.getDirentOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu); let opList = Utils.getDirentOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu);
const list = ['Move', 'Copy', 'Delete', 'Download']; const list = ['Move', 'Copy', 'Delete', 'Download', 'Share'];
if (dirent.type == 'dir') { if (dirent.type == 'dir') {
opList = opList.filter((item, index) => { opList = opList.filter((item, index) => {
return list.indexOf(item.key) == -1 && item != 'Divider'; return list.indexOf(item.key) == -1 && item != 'Divider';
@ -155,12 +168,6 @@ class SelectedDirentsToolbar extends React.Component {
const dirents = this.props.selectedDirentList; const dirents = this.props.selectedDirentList;
const dirent = dirents[0]; const dirent = dirents[0];
switch (operation) { switch (operation) {
case 'Share':
this.setState({
showLibContentViewDialogs: true,
showShareDialog: true,
});
break;
case 'Rename': case 'Rename':
this.setState({ this.setState({
showLibContentViewDialogs: true, showLibContentViewDialogs: true,
@ -344,29 +351,24 @@ class SelectedDirentsToolbar extends React.Component {
<span>{selectedLen}{' '}{gettext('selected')}</span> <span>{selectedLen}{' '}{gettext('selected')}</span>
</span> </span>
{canModify && {canModify &&
<span className="cur-view-path-btn" onClick={this.onMoveToggle}> <span className="cur-view-path-btn sf3-font-move1 sf3-font" aria-label={gettext('Move')} title={gettext('Move')} onClick={this.onMoveToggle}></span>
<span className="sf3-font-move1 sf3-font" aria-label={gettext('Move')} title={gettext('Move')}></span>
</span>
} }
{canCopy && {canCopy &&
<span className="cur-view-path-btn" onClick={this.onCopyToggle}> <span className="cur-view-path-btn sf3-font-copy1 sf3-font" aria-label={gettext('Copy')} title={gettext('Copy')} onClick={this.onCopyToggle}></span>
<span className="sf3-font-copy1 sf3-font" aria-label={gettext('Copy')} title={gettext('Copy')}></span>
</span>
} }
{canDelete && {canDelete &&
<span className="cur-view-path-btn" onClick={this.onItemsDelete}> <span className="cur-view-path-btn sf3-font-delete1 sf3-font" aria-label={gettext('Delete')} title={gettext('Delete')} onClick={this.onItemsDelete}></span>
<span className="sf3-font-delete1 sf3-font" aria-label={gettext('Delete')} title={gettext('Delete')}></span>
</span>
} }
{canDownload && {canDownload &&
<span className="cur-view-path-btn" onClick={this.onItemsDownload}> <span className="cur-view-path-btn sf3-font-download1 sf3-font" aria-label={gettext('Download')} title={gettext('Download')} onClick={this.onItemsDownload}></span>
<span className="sf3-font-download1 sf3-font" aria-label={gettext('Download')} title={gettext('Download')}></span> }
</span> {selectedLen == 1 && this.getDirentSharePerm() &&
<span className="cur-view-path-btn sf3-font-share sf3-font" aria-label={gettext('Share')} title={gettext('Share')} onClick={this.shareDirent}></span>
} }
{selectedLen === 1 && {selectedLen === 1 &&
<ItemDropdownMenu <ItemDropdownMenu
item={this.props.selectedDirentList[0]} item={this.props.selectedDirentList[0]}
toggleClass={'cur-view-path-btn sf3-font-more-vertical sf3-font'} toggleClass={'cur-view-path-btn sf3-font-more sf3-font'}
onMenuItemClick={this.onMenuItemClick} onMenuItemClick={this.onMenuItemClick}
getMenuList={this.getDirentMenuList} getMenuList={this.getDirentMenuList}
/> />

View File

@ -27,6 +27,6 @@
height: 24px; height: 24px;
} }
.cur-view-path .selected-dirents-toolbar .dropdown .sf3-font-more-vertical { .cur-view-path .selected-dirents-toolbar .dropdown .cur-view-path-btn {
margin-top: -4px; margin-top: -4px;
} }