Skip to content

Commit

Permalink
Web: Files: added className for tree root folders
Browse files Browse the repository at this point in the history
  • Loading branch information
gopienkonikita committed Nov 12, 2021
1 parent 549a0ab commit 0bd634d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 24 deletions.
46 changes: 24 additions & 22 deletions packages/asc-web-common/api/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,28 @@ export function getFolder(folderId, filter) {
return request(options);
}

// const getFolderNameByType = (folderType) => {
// switch (folderType) {
// case FolderType.USER:
// return "@my";
// case FolderType.SHARE:
// return "@share";
// case FolderType.COMMON:
// return "@common";
// case FolderType.Projects:
// return "@projects";
// case FolderType.Favorites:
// return "@favorites";
// case FolderType.Recent:
// return "@recent";
// case FolderType.TRASH:
// return "@trash";
// default:
// return "";
// }
// }; //TODO: need get from settings
const getFolderClassNameByType = (folderType) => {
switch (folderType) {
case FolderType.USER:
return "tree-node-my";
case FolderType.SHARE:
return "tree-node-share";
case FolderType.COMMON:
return "tree-node-common";
case FolderType.Projects:
return "tree-node-projects";
case FolderType.Favorites:
return "tree-node-favorites";
case FolderType.Recent:
return "tree-node-recent";
case FolderType.Privacy:
return "tree-node-privacy";
case FolderType.TRASH:
return "tree-node-trash";
default:
return "";
}
};

const sortInDisplayOrder = (folders) => {
const sorted = [];
Expand Down Expand Up @@ -145,15 +147,15 @@ export function getFoldersTree() {
const folders = sortInDisplayOrder(response);
return folders.map((data, index) => {
const type = +data.current.rootFolderType;
//const name = getFolderNameByType(type);
const name = getFolderClassNameByType(type);
const isRecycleBinFolder = type === FolderType.TRASH;
return {
id: data.current.id,
key: `0-${index}`,
parentId: data.current.parentId,
title: data.current.title,
rootFolderType: type,
//rootFolderName: name,
folderClassName: name,
// folders: !isRecycleBinFolder
// ? data.folders.map((folder) => {
// return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class TreeFolders extends React.Component {
<TreeNode
id={item.id}
key={item.id}
className="tree-drag"
className={item.folderClassName}
data-value={value}
title={item.title}
icon={this.getFolderIcon(item)}
Expand Down Expand Up @@ -253,7 +253,7 @@ class TreeFolders extends React.Component {
<TreeNode
id={item.id}
key={item.id}
className="tree-drag"
className={item.folderClassName}
data-value={value}
title={item.title}
needTopMargin={item.rootFolderType === FolderType.TRASH}
Expand Down

0 comments on commit 0bd634d

Please sign in to comment.