import * as React from "react";
import * as Strings from "~/common/strings";
import * as Constants from "~/common/constants";
import * as SVG from "~/common/svg";
import { css } from "@emotion/react";
import Pill from "~/components/core/Pill";
import DataMeter from "~/components/core/DataMeter";
const IconMap = {
HOME: ,
FILE: ,
FOLDER: ,
WALLET: ,
CHANNELS: ,
DEALS: ,
PEERS: ,
DEALS: ,
STATUS: ,
STATS: ,
DATA_TRANSFER: ,
LOGS: ,
MINERS: ,
STORAGE_MARKET: ,
SLATES: ,
SLATE: ,
LOCAL_DATA: ,
PROFILE_PAGE: ,
SETTINGS_DEVELOPER: ,
};
const STYLES_NAVIGATION = css`
width: 100%;
display; block;
padding: 24px 0 0 0;
font-size: 18px;
`;
const STYLES_NAVIGATION_ITEM = css`
display: flex;
align-items: flex-start;
justify-content: space-between;
cursor: pointer;
color: ${Constants.system.black};
:hover {
color: ${Constants.system.brand};
}
`;
const STYLES_EXPANDER = css`
flex-shrink: 0;
`;
const STYLES_ICON = css`
flex-shrink: 0;
position: relative;
`;
const STYLES_CHILDREN = css`
min-width: 10%;
width: 100%;
height: 100%;
overflow-wrap: break-word;
padding: 11px 0px 14px 8px;
font-family: ${Constants.font.semiBold};
font-weight: 400;
font-size: 14px;
line-height: 1.225;
position: relative;
display: flex;
align-items: flex-start;
justify-content: flex-start;
`;
const STYLES_ICON_ELEMENT = css`
height: 40px;
width: 40px;
display: inline-flex;
align-items: center;
justify-content: center;
user-select: none;
svg {
transform: rotate(0deg);
transition: 200ms ease transform;
}
`;
const Item = ({
data,
id,
activeId,
activeIds,
level,
children,
showActive,
treeChildren,
decorator,
onToggleShow,
onNavigateTo,
}) => {
return (
{onToggleShow ? (
) : null}
onNavigateTo({ id }, data)}>
{IconMap[decorator]}
{decorator === "LOGS" ? (
56
) : null}
onNavigateTo({ id }, data)}
style={{
fontFamily: decorator === "FILE" ? Constants.font.text : null,
color: activeIds[id] ? Constants.system.brand : null,
}}
>
{children}
);
};
class NodeReference extends React.Component {
state = {
showTreeChildren: false,
};
_handleToggleShow = () => {
this.setState({ showTreeChildren: !this.state.showTreeChildren });
};
render() {
const {
id,
activeId,
activeIds,
level,
children,
treeChildren,
activePage,
decorator,
onNavigateTo,
data,
} = this.props;
const { showTreeChildren } = this.state;
let showActive = showTreeChildren || activeIds[id];
let showChildren = showActive && treeChildren && treeChildren.length;
return (
-
{children}
{showChildren
? treeChildren.map((child) => {
if (!child) {
return null;
}
if (child.ignore) {
return null;
}
return (
{child.name}
);
})
: null}
);
}
}
export default class ApplicationNavigation extends React.Component {
render() {
// TODO(jim):
// Calculate this idea elsewhere if you keep it.
let bytes = 0;
this.props.viewer.library[0].children.forEach((each) => {
bytes = each.size + bytes;
});
return (
);
}
}