1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 01:12:03 +00:00

Change dir others content (#6320)

* change dir others content

* optimise css codes

* remove this.refs

* lib-others always show repo trashUrl
This commit is contained in:
Michael An
2024-07-09 21:45:51 +08:00
committed by GitHub
parent 2a312e02fe
commit a378b243e6
5 changed files with 25 additions and 14 deletions

View File

@@ -0,0 +1,15 @@
.dir-column-file {
padding-right: 10px;
padding-left: 10px;
flex-direction: column;
align-items: center;
}
.dir-column-file .dir-column-file-top {
width: 100%;
height: 10px;
z-index: 7;
transform: translateZ(1000px);
position: relative;
background: #ffffff;
}

View File

@@ -5,6 +5,8 @@ import { Utils } from '../../utils/utils';
import { gettext, siteRoot, lang, mediaUrl } from '../../utils/constants';
import SeafileMarkdownViewer from '../seafile-markdown-viewer';
import './dir-column-file.css';
const propTypes = {
path: PropTypes.string.isRequired,
repoID: PropTypes.string.isRequired,
@@ -59,8 +61,8 @@ class DirColumnFile extends React.Component {
};
return (
<div className="w-100 h-100 o-hidden d-flex" style={{ paddingRight: 10, paddingLeft: 10, flexDirection: 'column', alignItems: 'center' }}>
<div className="" style={{ width: '100%', height: 10, zIndex: 7, transform: 'translateZ(1000px)', position: 'relative', background: '#fff' }}></div>
<div className="dir-column-file w-100 h-100 o-hidden d-flex">
<div className="dir-column-file-top"></div>
<SeafileMetadata repoID={this.props.repoID} currentRepoInfo={this.props.currentRepoInfo} />
</div>
);

View File

@@ -279,7 +279,6 @@ class DirColumnNav extends React.Component {
/>
<DirOthers
repoID={this.props.repoID}
currentPath={this.props.currentPath}
userPerm={this.props.userPerm}
/>
</>

View File

@@ -86,6 +86,7 @@ class DirColumnView extends React.Component {
this.containerWidth = null;
this.resizeRef = null;
this.dragHandler = null;
this.viewModeContainer = React.createRef();
}
onResizeMouseUp = () => {
@@ -98,7 +99,7 @@ class DirColumnView extends React.Component {
};
onResizeMouseDown = () => {
this.containerWidth = this.refs.viewModeContainer.clientWidth;
this.containerWidth = this.viewModeContainer.current.clientWidth;
this.setState({
inResizing: true
});
@@ -172,7 +173,7 @@ class DirColumnView extends React.Component {
const select = inResizing ? 'none' : '';
const mainFlex = '1 0 ' + (1 - navRate) * 100 + '%';
return (
<div className="dir-column-view" onMouseMove={onResizeMove} onMouseUp={this.onResizeMouseUp} ref="viewModeContainer">
<div className="dir-column-view" onMouseMove={onResizeMove} onMouseUp={this.onResizeMouseUp} ref={this.viewModeContainer}>
{isTreePanelShown && (
<>
<DirColumnNav

View File

@@ -1,19 +1,14 @@
import React from 'react';
import PropTypes from 'prop-types';
import { gettext, siteRoot } from '../../utils/constants';
import { Utils } from '../../utils/utils';
import TreeSection from '../tree-section';
const DirOthers = ({ userPerm, repoID, currentPath }) => {
const DirOthers = ({ userPerm, repoID }) => {
let trashUrl = null;
const historyUrl = siteRoot + 'repo/history/' + repoID + '/';
if (userPerm === 'rw' && !Utils.isMarkdownFile(currentPath)) {
if (Utils.getFileName(currentPath)) {
trashUrl = siteRoot + 'repo/' + repoID + '/trash/?path=' + encodeURIComponent(currentPath);
} else {
trashUrl = siteRoot + 'repo/' + repoID + '/trash/';
}
if (userPerm === 'rw') {
trashUrl = siteRoot + 'repo/' + repoID + '/trash/';
}
return (
@@ -43,7 +38,6 @@ const DirOthers = ({ userPerm, repoID, currentPath }) => {
DirOthers.propTypes = {
userPerm: PropTypes.string,
repoID: PropTypes.string,
currentPath: PropTypes.string,
};
export default DirOthers;