Web: Files: added view saving to localStorage, refactoring

This commit is contained in:
Artem Tarasov 2021-04-12 18:40:27 +03:00
parent 352cfaf2f1
commit fbbb5a34ef
4 changed files with 18 additions and 15 deletions

View File

@ -591,7 +591,7 @@ class FilesContent extends React.Component {
/>
</div>
{viewAs !== "tile" && (
{viewAs !== "tile" ? (
<Text
containerMinWidth="120px"
containerWidth="15%"
@ -605,8 +605,8 @@ class FilesContent extends React.Component {
>
{fileOwner}
</Text>
)}
{viewAs !== "tile" && (
) : null}
{viewAs !== "tile" ? (
<Text
containerMinWidth="200px"
containerWidth="15%"
@ -618,8 +618,8 @@ class FilesContent extends React.Component {
>
{(fileExst || !providerKey) && updatedDate && updatedDate}
</Text>
)}
{viewAs !== "tile" && (
) : null}
{viewAs !== "tile" ? (
<Text
containerMinWidth="90px"
containerWidth="10%"
@ -639,7 +639,7 @@ class FilesContent extends React.Component {
)}: ${foldersCount}`
: ""}
</Text>
)}
) : null}
</Content>
</>
);

View File

@ -109,12 +109,14 @@ const getSideInfo = (content) => {
const lastIndex = content.length - 1;
content.forEach((element, index) => {
const delimiter = index === lastIndex ? "" : " | ";
if (index > 1) {
info +=
element.props && element.props.children
? element.props.children + delimiter
: "";
if (element) {
const delimiter = index === lastIndex ? "" : " | ";
if (index > 1) {
info +=
element.props && element.props.children
? element.props.children + delimiter
: "";
}
}
});
@ -158,7 +160,7 @@ const TileContent = (props) => {
<MainIcons className="mainIcons">{children[1]}</MainIcons>
</MainContainerWrapper>
{children.map((element, index) => {
if (index > 1) {
if (index > 1 && element) {
return (
<SideContainerWrapper
disableSideInfo={disableSideInfo}

View File

@ -45,7 +45,7 @@ const Badges = (props) => {
onShowVersionHistory,
onBadgeClick,
} = props;
const { id, locked, fileStatus, versionGroup, access, title } = item;
const { id, locked, fileStatus, versionGroup, title } = item;
const { fileExst } = item;
const showNew = !!newItems;

View File

@ -26,7 +26,7 @@ class FilesStore {
isLoaded = false;
isLoading = false;
viewAs = "row";
viewAs = localStorage.getItem("viewAs") || "row";
dragging = false;
privacyInstructions = "https://www.onlyoffice.com/private-rooms.aspx";
isInit = false;
@ -71,6 +71,7 @@ class FilesStore {
setViewAs = (viewAs) => {
this.viewAs = viewAs;
localStorage.setItem("viewAs", viewAs);
};
setDragging = (dragging) => {