import React, { Component } from "react"; import ReactDOM from "react-dom"; //import axios from "axios"; import { ProSidebar, Menu, MenuItem, SubMenu, SidebarHeader, //SidebarFooter, SidebarContent } from "react-pro-sidebar"; //import "react-pro-sidebar/dist/css/styles.css"; import MenuPage from "../menu"; import "../../pages/style.css"; import FullCard from "../Cards/fullCard"; import UserProfilePage from "../../pages/profile"; //var view = false; class NavBar extends Component { user = { username: "Demo", userStatus: "Guest" }; ui = { menu: { text: "Меню" }, catalog: { text: "Каталог" } }; styles = { desktop: { background: "2e323f", //position: "ralative", display: "inline", //display: "none", //height: "100%", left: "-50px", //width: "", float: "left" }, mobile: { background: "2e323f", position: "fixed", display: "none", height: "100%", left: "300px", width: "200px" } }; viewMobile() { return (
Webport
( //(document.getElementById("backBtn").style.display = "block"), //(document.getElementById("container").style.display = "none"), (document.getElementById("containerInfo").style.display = "block"), ReactDOM.render( , document.getElementById("containerInfo") ) )} >
{this.user.username} {this.user.userStatus} {/* Online */}
{/* this.findPakg(e.target.value)} style={{ fontSize: "1.2em", margin: "10px", backgroundColor: "rgba(81, 81, 81, 0.5)", border: "none", padding: "5px", //ackground: "#2e233f", //borderRadius: "15px", //border: "3px inset #2e322f", color: "#c7c7c7" }} />*/}
{/*CATALOG */} {Object.keys(this.props.category).map((k, i) => ( { // } {this.props.category[k].map((pn, j) => ( this.viewPakegeInfo( this.props.category[k][i] + "/" + this.props.category[k][j] ) } style={{ //borderBottom: "1px solid red ",  width: "100%" }} > { // } {pn} ))} ))}
); } viewOther() { return ( {/*CATALOG {Object.keys(this.props.category).map((k, i) => ( { // } {this.props.category[k].map((pn, j) => ( this.viewPakegeInfo( this.props.category[k][i] + "/" + this.props.category[k][j] ) } style={{ //borderBottom: "1px solid red ",  width: "100%" }} > { // } {pn} ))} ))} */} ); } checkAlias(text) { //console.log( "aliases:\t" + this.props.aliases) //return text; if (text in this.props.aliases) { return this.props.aliases[text]; //console.log(this.props.aliases[text]); } else { return text; //console.log(e); } } viewPakegeInfo(pkgName) { const url = this.props.ServerAdress + "/find?pkg=" + pkgName; console.log(url, { mode: "no-cors" }); fetch(url, ["POST"]) .then((response) => response.json()) // .then(commits => alert(commits[0].author.login)) .catch((error) => { console.error("Error:", error); }); /*try { portage_list[pkgName]; } catch (e) {*/ document.getElementById("containerInfo").display = "block"; ReactDOM.render( , document.getElementById("containerInfo") ); console.log(pkgName); } findPakg(pkg) { this.viewPakegeInfo(pkg); } render() { return navigator.userAgentData.mobile ? this.viewMobile() : this.viewOther(); } } export default NavBar;