import React from 'react'; import { Link } from '@reach/router'; import { gettext, siteRoot } from './constants'; import { seafileAPI } from '../utils/seafile-api'; class MainSideNav extends React.Component { constructor(props) { super(props); let currentTab = this.props.currentTab || ''; this.state = { groupsExtended: false, sharedExtended: false, closeSideBar:false, groupItems: [], currentTab: currentTab, }; this.listHeight = 24; //for caculate tabheight this.groupsHeight = 0; this.adminHeight = 0; } grpsExtend = () => { this.setState({ groupsExtended: !this.state.groupsExtended, }) this.loadGroups(); } shExtend = () => { this.setState({ sharedExtended: !this.state.sharedExtended, }) } loadGroups = () => { let _this = this; seafileAPI.listGroups().then(res =>{ let data = res.data.groups; this.groupsHeight = (data.length + 1) * _this.listHeight; _this.setState({ groupItems: data }) }) } tabItemClick = (param) => { this.setState({ currentTab: param }) } renderSharedGroups() { let style = {height: 0}; if (this.state.groupsExtended) { style = {height: this.groupsHeight}; } return ( ) } renderSharedAdmin() { let height = 0; if (this.state.sharedExtended) { if (!this.adminHeight) { this.adminHeight = 3 * this.listHeight; } height = this.adminHeight; } let style = {height: height}; return ( ) } render() { return (

Files

Tools

) } } export default MainSideNav;