Added the error area to the InstallSoftware.jsx if the backend is not available

This commit is contained in:
Mathias Wagner 2023-06-02 14:49:47 +02:00
parent 4f98138df2
commit fadcbaffb0
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -1,14 +1,17 @@
import InfoArea from "@/common/components/InfoArea";
import Button from "@/common/components/Button";
import {faGear} from "@fortawesome/free-solid-svg-icons";
import {useState} from "react";
import {useContext, useState} from "react";
import Software from "./software.jsx";
import SoftwareGrid from "@/pages/tools/linux/InstallSoftware/components/SoftwareGrid";
import ConfigurationArea from "@/pages/tools/linux/InstallSoftware/components/ConfigurationArea";
import "./styles.sass";
import ErrorArea from "@/common/components/ErrorArea/index.js";
import {StatusContext} from "@/common/contexts/Status/index.js";
export const InstallSoftware = () => {
const [currentItem, setCurrentItem] = useState(Software[0].name);
const backendAvailable = !(useContext(StatusContext));
return (
<>
@ -17,7 +20,9 @@ export const InstallSoftware = () => {
<Button icon={faGear} text="Konfigurieren" onClick={() => {}}/>
</InfoArea>
<div className="install-area">
{!backendAvailable && <ErrorArea error="Es konnte keine Verbindung zum Backend-Server hergestellt werden."/>}
<div className={"install-area" + (!backendAvailable ? " not-available" : "")}>
<SoftwareGrid currentItem={currentItem} setCurrentItem={setCurrentItem} />
{Software.map((s) => {if (s.name === currentItem) return <ConfigurationArea current={s} key={s.name} />})}