You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

280 lines
11 KiB

import React from "react";
import NavBar from "./NavList/navList";
import MainPage from "../pages/main";
import FullCard from "../Componets/Cards/fullCard";
//import OverlaPage from "../pages/overlays";
import "./style.css";
import ReactDOM from "react-dom";
import { useState } from "react";
export default class AppConteiner extends React.Component {
ui = {
BackButton: {
text: "Назад"
},
button: {
sync: {
text: "Обновить",
icon:
"https://im0-tub-ru.yandex.net/i?id=82aba01eaa9844244dfae87e7a7e5583&n=13%22"
}
}
};
title = () => this.viewSideBar();
findPakg(pkg) {
this.viewPakegeInfo(pkg);
}
viewPakegeInfo(pkgName) {
const url = this.props.ServerAdress + "/find?pkg=" + pkgName;
const response = fetch(url);
/*try {
portage_list[pkgName];
} catch (e) {*/
if (response.ok) {
// если HTTP-статус в диапазоне 200-299
// получаем тело ответа (см. про этот метод ниже)
let res = response.json();
ReactDOM.render(
<FullCard
PackageName={res}
PropMain={this.props.rec}
icons={this.props.icons}
/>,
document.getElementById("HomePage")
);
document.getElementById("inS").value = "";
} else {
console.log("Ошибка HTTP: " + response.status);
//}
}
console.log(pkgName);
}
toBack() {
document.getElementById("backBtn").style.display = "none";
//document.getElementById("conteinerInfo").style.display = "none";
document.getElementById("container").style.display = "block";
document.getElementById("pTitle").textContent = this.ViewTitle();
//document.getElementById("pTitle").textContent = "Рекомендации";
ReactDOM.render(
<MainPage
icons={this.props.icons}
rec={this.props.rec}
useDes={this.props.useDes}
/>,
document.getElementById("HomePage")
);
//window.location.reload();
//this.ViewTitle();
//document.getElementById('pTitle').textContent = this.props.menuItems[]
}
viewSideBar() {
if (!this.VVSB) {
document.getElementById("MainContent").style.paddingLeft = "300px";
document.getElementById("btn-toggle").style.paddingLeft = "270px";
document.getElementById("btn-toggle").style.float = "right";
document.getElementById("navBar").style.left = "0px";
this.VVSB = true;
} else {
document.getElementById("MainContent").style.paddingLeft = "0px";
document.getElementById("btn-toggle").style.paddingLeft = "0px";
document.getElementById("navBar").style.left = "-300px";
this.VVSB = false;
}
}
ViewTitle() {
for (let i = 0; i > this.props.menuItems.length; i++) {
if (
//this.props.menuItems[i].url ==
window.location.href.split(window.location.host)[1] ===
this.props.menuItems[i].url
//window.location.href.split(window.location.host)[1]
) {
//document.getElementById("pTitle").textContent = this.props.menuItems[i].text;
this.title = this.props.menuItems[i].text;
}
console.log(this.title);
return (this.title = this.props.menuItems[i].text);
}
}
render() {
this.ViewTitle();
return (
<div>
<NavBar
ServerAdress={this.props.ServerAdress}
category={this.props.category}
menuItem={this.props.menuItems}
aliases={this.props.aliases}
Ipkgs={this.props.Ipkg}
/>
<div className="page-wrapper chiller-theme toggled">
<ul
id="btn-toggle"
class="btn-toggle"
style={{
display: "inline",
padding: "20px",
margin: "0px",
borderBottom: "1px solid #AAA",
width: "100%",
background: "#2e323f",
//"1d1d1d",
// "#2e323f",
position: "fixed",
top: "0",
color: "#FFF",
zIndex: "1"
}}
>
<svg
c
style={{
float: "left",
paddingLeft: "20px",
paddingRight: "10px"
}}
onClick={() => this.viewSideBar()}
stroke="currentColor"
fill="currentColor"
stroke-width="0"
viewBox="0 0 448 512"
height="1.4em"
width="1.4em"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"></path>
</svg>
<div
id="backBtn"
style={{ paddingLeft: "20px", float: "left", display: "none" }}
onClick={() => this.toBack()}
>
<img
style={{ width: "1.4em", height: "1.4em" }}
src="https://cdn-icons-png.flaticon.com/512/189/189254.png"
/>
</div>
<b>
<div
id="pTitle"
style={{
float: "left",
width: "50vw",
marginleft: "20px",
textAlign: "center",
fontSize: "1.4em",
color: "#FFF"
}}
>
{this.title}
</div>
</b>
{
//this.ViewTitle()
}
<div
className="d6"
style={{ position: "realative", float: "right", right: "20px" }}
>
<form>
<input
id="inS"
name="inS"
classname="form-control"
type="text"
placeholder="Введите имя пакета"
onChange={(e) => 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"
}}
/>
{/*}
<div className="button">
<svg
style={{ color: "#FFF" }}
class="l-ss-c-element"
width="18"
height="27"
viewBox="0 0 18 27"
xmlns="http://www.w3.org/2000/svg"
>
{" "}
<path
class="l-ss-c-element"
fill="#FFF"
fill-rule="#FFF"
clip-rull="#FFF"
//fill-rule="evenodd"
//clip-rule="evenodd"
d="M11.1897 5.44196V11.9907C11.1897 13.1717 10.2323 14.1291 9.05126 14.1291C7.87025 14.1291 6.91286 13.1717 6.91286 11.9907V5.44196C6.91286 4.26095 7.87026 3.30355 9.05126 3.30355C10.2323 3.30355 11.1897 4.26095 11.1897 5.44196ZM4.37359 5.44196C4.37359 2.85855 6.46786 0.764282 9.05126 0.764282C11.6347 0.764282 13.7289 2.85855 13.7289 5.44196V11.9907C13.7289 14.5741 11.6347 16.6684 9.05126 16.6684C6.46786 16.6684 4.37359 14.5741 4.37359 11.9907V5.44196ZM2.83614 11.0551C2.83614 10.3539 2.26771 9.78547 1.56651 9.78547C0.865309 9.78547 0.296875 10.3539 0.296875 11.0551V12.9262C0.296875 17.3295 3.548 20.9735 7.78077 21.5886V23.8185H6.712C6.0108 23.8185 5.44236 24.387 5.44236 25.0882C5.44236 25.7894 6.0108 26.3578 6.712 26.3578H11.3897C12.0909 26.3578 12.6593 25.7894 12.6593 25.0882C12.6593 24.387 12.0909 23.8185 11.3897 23.8185H10.32V21.5887C14.5532 20.9739 17.8047 17.3298 17.8047 12.9262V11.0551C17.8047 10.3539 17.2363 9.78547 16.5351 9.78547C15.8339 9.78547 15.2654 10.3539 15.2654 11.0551V12.9262C15.2654 16.3584 12.483 19.1408 9.05079 19.1408C5.61853 19.1408 2.83614 16.3584 2.83614 12.9262V11.0551Z"
></path>{" "}
</svg>
</div>*/}
<div className="button" style={{ justifyContent: "center" }}>
<svg
class="l-ss-c-element"
width="19"
height="20"
viewBox="0 0 19 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
{" "}
<path
class="l-ss-c-element"
fill-rule="evenodd"
clip-rule="evenodd"
d="M14.3074 8.03846C14.3074 11.3734 11.6039 14.0769 8.26893 14.0769C4.93398 14.0769 2.23047 11.3734 2.23047 8.03846C2.23047 4.70351 4.93398 2 8.26893 2C11.6039 2 14.3074 4.70351 14.3074 8.03846ZM12.331 14.9766C11.139 15.6759 9.75081 16.0769 8.26893 16.0769C3.82941 16.0769 0.230469 12.478 0.230469 8.03846C0.230469 3.59894 3.82941 0 8.26893 0C12.7085 0 16.3074 3.59894 16.3074 8.03846C16.3074 10.2703 15.3978 12.2897 13.9291 13.7463L18.4758 18.2929C18.8663 18.6834 18.8663 19.3166 18.4758 19.7071C18.0853 20.0977 17.4521 20.0977 17.0616 19.7071L12.331 14.9766Z"
fill="white"
></path>{" "}
</svg>
</div>
</form>
</div>
</ul>
<main
id="MainContent"
className="page-content"
style={{
paddingLeft: "10px",
margin: "10px",
//background: "#1d1d1d",
color: "#000"
}}
>
<div
id="conteinerInfo"
style={{
position: "relative",
width: "100%",
height: "100vw",
display: "none"
//background: "#2e323f"
//color: "#AAA"
}}
></div>
<div id="container" className="container">
{this.props.children}
</div>
</main>
</div>
</div>
);
}
}