1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 04:10:47 +00:00

UI details (#6049)

* ['Files'] make the headings such as 'My Libraries' and the library star/unstar icons left-aligned

* ['dir view'] 'path bar' improvement: display the current side nav item(such as 'Files', 'My Libraries', groupname & etc.) in it

* [side nav] improvement: when visit the siteRoot page, highlight the 'Files' tab

* [border color] modified border color in tables & other UIs (so that they are same)
This commit is contained in:
llj
2024-05-01 21:13:56 +08:00
committed by GitHub
parent 3581712e1a
commit 20f2173c11
9 changed files with 48 additions and 33 deletions

View File

@@ -52,10 +52,10 @@ class App extends Component {
this.state = { this.state = {
isOpen: false, isOpen: false,
isSidePanelClosed: false, isSidePanelClosed: false,
currentTab: '/', currentTab: '',
pathPrefix: [], pathPrefix: [],
}; };
this.dirViewPanels = ['my-libs', 'shared-libs', 'org']; // and group this.dirViewPanels = ['libraries', 'my-libs', 'shared-libs', 'org']; // and group
window.onpopstate = this.onpopstate; window.onpopstate = this.onpopstate;
} }
@@ -88,9 +88,15 @@ class App extends Component {
// navigate to library page http://127.0.0.1:8000/library/34e7fb92-e91d-499d-bcde-c30ea8af9828/ // navigate to library page http://127.0.0.1:8000/library/34e7fb92-e91d-499d-bcde-c30ea8af9828/
this.navigateClientUrlToLib(); this.navigateClientUrlToLib();
// TODO: need refactor later let currentTab;
let href = window.location.href.split('/'); // when visit the siteRoot page, highlight the 'Files' tab in the side nav.
this.setState({currentTab: href[href.length - 2]}); if (location.pathname == siteRoot) {
currentTab = 'libraries';
} else {
let href = window.location.href.split('/');
currentTab = href[href.length - 2];
}
this.setState({currentTab: currentTab});
} }
onCloseSidePanel = () => { onCloseSidePanel = () => {
@@ -129,7 +135,7 @@ class App extends Component {
url = siteRoot + 'group/' + groupID + '/'; url = siteRoot + 'group/' + groupID + '/';
} }
else { else {
url = siteRoot + 'groups/'; url = siteRoot + 'libraries/';
} }
window.location = url.toString(); window.location = url.toString();
}, 1); }, 1);
@@ -155,20 +161,13 @@ class App extends Component {
generatorPrefix = (tabName, groupID) => { generatorPrefix = (tabName, groupID) => {
let pathPrefix = []; let pathPrefix = [];
if (groupID) { if (groupID) {
let navTab1 = { let navTab = {
url: siteRoot + 'groups/',
showName: 'Groups',
name: 'groups',
id: null,
};
let navTab2 = {
url: siteRoot + 'group/' + groupID + '/', url: siteRoot + 'group/' + groupID + '/',
showName: tabName, showName: tabName,
name: tabName, name: tabName,
id: groupID, id: groupID,
}; };
pathPrefix.push(navTab1); pathPrefix.push(navTab);
pathPrefix.push(navTab2);
} else { } else {
let navTab = { let navTab = {
url: siteRoot + tabName + '/', url: siteRoot + tabName + '/',
@@ -182,14 +181,19 @@ class App extends Component {
}; };
getTabShowName = (tabName) => { getTabShowName = (tabName) => {
if (tabName === 'my-libs') { switch (tabName) {
return 'Libraries'; case 'libraries': {
} return 'Files';
if (tabName === 'shared-libs') { }
return 'Shared with me'; case 'my-libs': {
} return 'My Libraries';
if (tabName === 'org') { }
return 'Shared with all'; case 'shared-libs': {
return 'Shared with me';
}
case 'org': {
return 'Shared with all';
}
} }
}; };

View File

@@ -88,13 +88,13 @@ class DirPath extends React.Component {
})} })}
{this.props.pathPrefix && this.props.pathPrefix.length === 0 && ( {this.props.pathPrefix && this.props.pathPrefix.length === 0 && (
<Fragment> <Fragment>
<Link to={siteRoot + 'my-libs/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'my-libs')}>{gettext('Libraries')}</Link> <Link to={siteRoot + 'libraries/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'libraries')}>{gettext('Files')}</Link>
<span className="path-split">/</span> <span className="path-split">/</span>
</Fragment> </Fragment>
)} )}
{!this.props.pathPrefix && ( {!this.props.pathPrefix && (
<Fragment> <Fragment>
<Link href={siteRoot + 'my-libs/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'my-libs')}>{gettext('Libraries')}</Link> <Link to={siteRoot + 'libraries/'} className="normal" onClick={(e) => this.onTabNavClick(e, 'libraries')}>{gettext('Files')}</Link>
<span className="path-split">/</span> <span className="path-split">/</span>
</Fragment> </Fragment>
)} )}

View File

@@ -0,0 +1,5 @@
#files-content-container td:first-child {
text-align: left!important;
padding-left: 20px;
}

View File

@@ -25,5 +25,5 @@
color: #a4a4a4; color: #a4a4a4;
text-align: center; text-align: center;
padding: 4px 0; padding: 4px 0;
border-bottom: 1px solid #e5e5e5; border-bottom: 1px solid #e8e8e8;
} }

View File

@@ -74,7 +74,7 @@ class GroupItem extends React.Component {
const emptyTip = <p className="group-item-empty-tip">{gettext('No libraries')}</p>; const emptyTip = <p className="group-item-empty-tip">{gettext('No libraries')}</p>;
return ( return (
<div className="pb-3"> <div className="pb-3">
<div className="d-flex justify-content-between mt-3 p-1 border-bottom"> <div className="d-flex justify-content-between mt-3 py-1 sf-border-bottom">
<h4 className="sf-heading m-0 ellipsis"> <h4 className="sf-heading m-0 ellipsis">
<span className="sf3-font-group sf3-font nav-icon" aria-hidden="true"></span> <span className="sf3-font-group sf3-font nav-icon" aria-hidden="true"></span>
<a href={`${siteRoot}group/${group.id}/`} title={group.name}>{group.name}</a> <a href={`${siteRoot}group/${group.id}/`} title={group.name}>{group.name}</a>

View File

@@ -19,6 +19,8 @@ import SharedLibs from '../../pages/shared-libs/shared-libs.js';
import SharedWithAll from '../../pages/shared-with-all'; import SharedWithAll from '../../pages/shared-with-all';
import GroupItem from '../../pages/groups/group-item'; import GroupItem from '../../pages/groups/group-item';
import '../../css/files.css';
const propTypes = { const propTypes = {
onShowSidePanel: PropTypes.func.isRequired, onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired onSearchedClick: PropTypes.func.isRequired
@@ -224,7 +226,7 @@ class Libraries extends Component {
<div className="cur-view-path"> <div className="cur-view-path">
<h3 className="sf-heading m-0">{gettext('Files')}</h3> <h3 className="sf-heading m-0">{gettext('Files')}</h3>
</div> </div>
<div className="cur-view-content"> <div className="cur-view-content" id="files-content-container">
<table aria-hidden={true} className="my-3"> <table aria-hidden={true} className="my-3">
<thead> <thead>
@@ -242,7 +244,7 @@ class Libraries extends Component {
{canAddRepo && ( {canAddRepo && (
<div className="pb-3"> <div className="pb-3">
<div className="d-flex justify-content-between mt-3 p-1 border-bottom"> <div className="d-flex justify-content-between mt-3 py-1 sf-border-bottom">
<h4 className="sf-heading m-0"> <h4 className="sf-heading m-0">
<span className="sf3-font-mine sf3-font nav-icon" aria-hidden="true"></span> <span className="sf3-font-mine sf3-font nav-icon" aria-hidden="true"></span>
{gettext('My Libraries')} {gettext('My Libraries')}

View File

@@ -478,7 +478,7 @@ class SharedLibraries extends Component {
<Fragment> <Fragment>
{inAllLibs ? ( {inAllLibs ? (
<> <>
<div className="d-flex justify-content-between mt-3 p-1 border-bottom"> <div className="d-flex justify-content-between mt-3 py-1 sf-border-bottom">
<h4 className="sf-heading m-0"> <h4 className="sf-heading m-0">
{inAllLibs && <span className="sf3-font-share-with-me sf3-font nav-icon" aria-hidden="true"></span>} {inAllLibs && <span className="sf3-font-share-with-me sf3-font nav-icon" aria-hidden="true"></span>}
{gettext('Shared with me')} {gettext('Shared with me')}

View File

@@ -154,7 +154,7 @@ class PublicSharedView extends React.Component {
if (inAllLibs) { if (inAllLibs) {
return ( return (
<> <>
<div className="d-flex justify-content-between mt-3 p-1 border-bottom"> <div className="d-flex justify-content-between mt-3 py-1 sf-border-bottom">
<h4 className="sf-heading m-0"> <h4 className="sf-heading m-0">
<span className="sf3-font-share-with-all sf3-font nav-icon" aria-hidden="true"></span> <span className="sf3-font-share-with-all sf3-font nav-icon" aria-hidden="true"></span>
{gettext('Shared with all')} {gettext('Shared with all')}

View File

@@ -163,6 +163,10 @@ a, a:hover { color: #ec8000; }
cursor: pointer; cursor: pointer;
} }
.sf-border-bottom {
border-bottom: 1px solid #e8e8e8;
}
.vh { .vh {
visibility: hidden; visibility: hidden;
} }
@@ -857,7 +861,7 @@ table tbody tr {
table th { table th {
padding: 0.3125rem 0.1875rem; padding: 0.3125rem 0.1875rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #e8e8e8;
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
font-size: 0.8125rem; font-size: 0.8125rem;
@@ -867,7 +871,7 @@ table th {
table td { table td {
padding: 0.5rem 0.1875rem; padding: 0.5rem 0.1875rem;
border-bottom: 1px solid #eee; border-bottom: 1px solid #e8e8e8;
color: #333; color: #333;
font-size: 0.875rem; font-size: 0.875rem;
word-break: break-all; word-break: break-all;