Skip to content

Commit

Permalink
Web: Files: Removed the jump to the beginning of the list when the re…
Browse files Browse the repository at this point in the history
…covery process is over.
  • Loading branch information
TatianaLopaeva committed Nov 3, 2021
1 parent 033b958 commit 4160ddc
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 89 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import styled from "styled-components";

const StyledVersionList = styled.div`
.row_context-menu-wrapper {
.expandButton {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
svg {
path {
${(props) =>
props.isRestoreProcess &&
`
fill: #d0d5da;
`};
}
}
}
}
.row_content {
.version_link,
.version-link-file,
.version_content-length,
.version_link-action,
.row_context-menu-wrapper,
.version_text {
${(props) =>
props.isRestoreProcess &&
`
color: #d0d5da;
touch-action: none;
pointer-events: none;
`}
}
.versioned, .not-versioned {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
}
.versioned {
svg {
path {
${(props) =>
props.isRestoreProcess &&
`
fill: #d0d5da;
`};
}
}
}
.not-versioned{
svg {
path {
${(props) =>
props.isRestoreProcess &&
`
stroke: #d0d5da;
`};
}
}
}
}
.icon-link {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
svg {
path {
${(props) => props.isRestoreProcess && " fill: #d0d5da"}
}
}
}
}
`;

export default StyledVersionList;
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,7 @@ const StyledVersionRow = styled(Row)`
display: none;
right: 16px !important;
.expandButton {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
svg {
path {
${(props) =>
props.isRestoreProcess &&
`
fill: #d0d5da;
`};
}
}
}
@media ${tablet} {
display: block;
position: absolute;
Expand All @@ -162,54 +146,6 @@ const StyledVersionRow = styled(Row)`
.row_content {
display: block;
.version_link,
.version-link-file,
.version_content-length,
.version_link-action,
.row_context-menu-wrapper,
.version_text {
${(props) =>
props.isRestoreProcess &&
`
color: #d0d5da;
touch-action: none;
pointer-events: none;
`}
}
.version_badge {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
svg {
path {
${(props) =>
props.isVersion &&
props.isRestoreProcess &&
`
fill: #d0d5da;
`};
}
}
}
.icon-link {
${(props) =>
props.isRestoreProcess &&
`
touch-action: none;
pointer-events: none;
`}
svg {
path {
${(props) => props.isRestoreProcess && " fill: #d0d5da"}
}
}
}
}
.modal-dialog-aside-footer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ const VersionRow = (props) => {
restoreVersion,
updateCommentVersion,
onSetRestoreProcess,
isRestoreProcess,
isTabletView,
onUpdateHeight,
versionsListLength,
Expand Down Expand Up @@ -108,21 +107,21 @@ const VersionRow = (props) => {
newRowHeight && onUpdateHeight(index, newRowHeight);
}, [showEditPanel, versionsListLength]);

console.log("updating");
//console.log("updating");

return (
<StyledVersionRow
showEditPanel={showEditPanel}
contextOptions={contextOptions}
canEdit={canEdit}
isRestoreProcess={isRestoreProcess}
isVersion={isVersion}
isTabletView={isTabletView}
>
<div className={`version-row_${index}`}>
<Box displayProp="flex">
<VersionBadge
className="version_badge"
className={`version_badge ${
isVersion ? "versioned" : "not-versioned"
}`}
isVersion={isVersion}
index={index}
versionGroup={info.versionGroup}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { inject, observer } from "mobx-react";
import { VariableSizeList as List, areEqual } from "react-window";
import AutoSizer from "react-virtualized-auto-sizer";
import CustomScrollbarsVirtualList from "@appserver/components/scrollbar/custom-scrollbars-virtual-list";

import StyledVersionList from "./StyledVersionList";
class SectionBodyContent extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -37,8 +37,6 @@ class SectionBodyContent extends React.Component {
onSetRestoreProcess = (isRestoreProcess) => {
console.log("onSetRestoreProcess", isRestoreProcess);

this.listKey += 1;

this.setState({
isRestoreProcess,
});
Expand All @@ -62,14 +60,14 @@ class SectionBodyContent extends React.Component {

renderRow = memo(({ index, style }) => {
const { versions, culture } = this.props;
const { isRestoreProcess } = this.state;

const prevVersion = versions[index > 0 ? index - 1 : index].versionGroup;
let isVersion = true;

if (index > 0 && prevVersion === versions[index].versionGroup) {
isVersion = false;
}
console.log("render row", this.state, "versions.length", versions.length);

return (
<div style={style}>
Expand All @@ -81,7 +79,6 @@ class SectionBodyContent extends React.Component {
versionsListLength={versions.length}
index={index}
culture={culture}
isRestoreProcess={isRestoreProcess}
onSetRestoreProcess={this.onSetRestoreProcess}
onUpdateHeight={this.onUpdateHeight}
/>
Expand All @@ -92,23 +89,30 @@ class SectionBodyContent extends React.Component {
const { versions, isLoading } = this.props;

const renderList = ({ height, width }) => {
console.log(
"render list",
this.state,
"versions.length",
versions.length
);
return (
<List
key={this.listKey}
ref={this.listRef}
className="List"
height={height}
width={width}
itemSize={this.getSize}
itemCount={versions.length}
itemData={versions}
outerElementType={CustomScrollbarsVirtualList}
>
{this.renderRow}
</List>
<StyledVersionList isRestoreProcess={this.state.isRestoreProcess}>
<List
ref={this.listRef}
className="List"
height={height}
width={width}
itemSize={this.getSize}
itemCount={versions.length}
itemData={versions}
outerElementType={CustomScrollbarsVirtualList}
>
{this.renderRow}
</List>
</StyledVersionList>
);
};

console.log("versions", versions);
return versions && !isLoading ? (
<div style={{ height: "100%", width: "100%" }}>
<AutoSizer>{renderList}</AutoSizer>
Expand Down

0 comments on commit 4160ddc

Please sign in to comment.