Finish BAPS menu design.

This commit is contained in:
Matthew Stratford 2021-05-01 01:02:14 +01:00
parent de5c13172e
commit 582f48ed56
7 changed files with 132 additions and 45 deletions

View file

@ -122,16 +122,17 @@ $number-of-channels: 3;
writing-mode: vertical-rl; writing-mode: vertical-rl;
height: 100%; height: 100%;
} }
.fa-spin { }
animation: fa-spin 2s infinite linear;
.fa-spin {
animation: fa-spin 2s infinite linear;
}
@keyframes fa-spin {
0% {
transform: rotate(0deg);
} }
@keyframes fa-spin { 100% {
0% { transform: rotate(359deg);
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
} }
} }

View file

@ -322,6 +322,8 @@ export interface Timeslot {
time: number; time: number;
start_time: string; start_time: string;
title: string; title: string;
duration: string;
credits_string: string;
} }
export function getCurrentApiTimeslot(): Promise<Timeslot> { export function getCurrentApiTimeslot(): Promise<Timeslot> {

View file

@ -0,0 +1,6 @@
.loading {
margin: 4em;
}
.logo {
max-width: 70%;
}

View file

@ -4,6 +4,8 @@ import Modal from "react-modal";
import { Button } from "reactstrap"; import { Button } from "reactstrap";
import { LoadShowDialogue } from "./loadshow"; import { LoadShowDialogue } from "./loadshow";
import "./BAPSicleModal.scss";
import { SidebarDialogue } from "./sidebar";
interface BAPSicleModalProps { interface BAPSicleModalProps {
isOpen: boolean; isOpen: boolean;
@ -13,7 +15,7 @@ interface BAPSicleModalProps {
export function BAPSicleModal(props: BAPSicleModalProps) { export function BAPSicleModal(props: BAPSicleModalProps) {
return ( return (
<Modal isOpen={props.isOpen} onRequestClose={props.close}> <Modal isOpen={props.isOpen} onRequestClose={props.close}>
<h1 className="d-inline">Load a Show</h1> <h1 className="d-inline">Menu</h1>
<Button <Button
onClick={props.close} onClick={props.close}
className="float-right pt-1" className="float-right pt-1"
@ -22,7 +24,14 @@ export function BAPSicleModal(props: BAPSicleModalProps) {
<FaTimes /> <FaTimes />
</Button> </Button>
<hr className="mt-1 mb-3" /> <hr className="mt-1 mb-3" />
<LoadShowDialogue close={props.close} /> <div className="row">
<div className="col-8">
<LoadShowDialogue close={props.close} />
</div>
<div className="col-4">
<SidebarDialogue />
</div>
</div>
</Modal> </Modal>
); );
} }

View file

@ -12,7 +12,7 @@ import { closeAlert } from "./state";
import { BAPSicleModal } from "./BAPSicleModal"; import { BAPSicleModal } from "./BAPSicleModal";
export function NavBarMain() { export function NavBarMain() {
const [showBAPSicleModal, setShowBAPSicleModal] = useState(false); const [showBAPSicleModal, setShowBAPSicleModal] = useState(true);
return ( return (
<> <>
@ -48,7 +48,7 @@ export function NavBarMain() {
}} }}
> >
<FaCompactDisc size={16} className="mr-2" /> <FaCompactDisc size={16} className="mr-2" />
<b>Load Show</b> <b>Menu</b>
</li> </li>
</ul> </ul>
</div> </div>

View file

@ -1,11 +1,15 @@
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
import { getTimeslots, Timeslot } from "../api"; import { getTimeslots, Timeslot } from "../api";
import { FaCog, FaSearch, FaTimesCircle } from "react-icons/fa"; import {
FaCog,
FaDownload,
FaSearch,
FaTimesCircle,
FaTrashAlt,
} from "react-icons/fa";
import { sendBAPSicleChannel } from "../bapsicle"; import { sendBAPSicleChannel } from "../bapsicle";
//import "./libraries.scss";
type searchingStateEnum = "searching" | "results" | "no-results" | "error"; type searchingStateEnum = "searching" | "results" | "no-results" | "error";
export function LoadShowDialogue(close: any) { export function LoadShowDialogue(close: any) {
@ -31,46 +35,72 @@ export function LoadShowDialogue(close: any) {
}); });
}, [state]); }, [state]);
return ( return (
<div className=""> <>
<div className="border-top mt-2"></div>
<ResultsPlaceholder state={state} /> <ResultsPlaceholder state={state} />
<div className="timeslot-item-list"> {state !== "searching" && (
<ul> <div
{items.map((item, index) => ( className="btn btn-outline-danger outline float-right"
<li onClick={() => {
key={index} sendBAPSicleChannel({
onClick={() => { command: "CLEAR",
sendBAPSicleChannel({ });
command: "GET_PLAN", }}
timeslotId: item.timeslot_id, >
}); <FaTrashAlt size={16} /> Clear All Channels
}} </div>
> )}
{item.start_time} - {item.title} <h2>Load Show</h2>
</li> <div className="loadshow-list">
))} {items.map((item, index) => (
</ul> <div className="loadshow-result card text-dark" key={index}>
<div className="card-body">
<span
className="btn btn-outline-primary float-right"
onClick={() => {
sendBAPSicleChannel({
command: "GET_PLAN",
timeslotId: item.timeslot_id,
});
}}
>
<FaDownload size={15} /> Load Show Plan
</span>
<h5 className="card-title">{item.title}</h5>
<h6 className="card-subtitle mb-2 text-muted">
{item.start_time} - Duration: {item.duration}
</h6>
<p className="card-text">
<i>with {item.credits_string}</i>
</p>
</div>
</div>
))}
</div> </div>
</div> </>
); );
} }
// <Item key={itemId(item)} item={item} index={index} column={-1} /> // <Item key={itemId(item)} item={item} index={index} column={-1} />
export function ResultsPlaceholder({ state }: { state: string }) { export function ResultsPlaceholder({ state }: { state: string }) {
return ( return (
<span <div
className={state !== "results" ? "mt-5 text-center text-muted" : "d-none"} className={
"loading " + (state !== "results" ? "text-center text-muted" : "d-none")
}
> >
{state === "not-searching" && <FaSearch size={56} />} {state === "not-searching" && <FaSearch size={56} />}
{state === "searching" && <FaCog size={56} className="fa-spin" />} {state === "searching" && <FaCog size={56} className="fa-spin" />}
{state === "no-results" && <FaTimesCircle size={56} />} {state === "no-results" && <FaTimesCircle size={56} />}
<br /> <br />
{state === "not-searching" <span className="ml-3">
? "Enter a search term." {state === "not-searching"
: state === "searching" ? ""
? "Searching..." : state === "searching"
: state === "no-results" ? "Searching..."
? "No results." : state === "no-results"
: "An error has occurred while getting shows."} ? "No results."
</span> : "An error has occurred while getting shows."}
</span>
</div>
); );
} }

39
src/navbar/sidebar.tsx Normal file
View file

@ -0,0 +1,39 @@
import React from "react";
import { FaCog } from "react-icons/fa";
import appLogo from "../assets/images/presenterlogo.png";
export function SidebarDialogue(close: any) {
return (
<div className="mt-3 text-center">
<img className="logo px-5 mb-3" src={appLogo} alt="BAPS3" />
<h2 className="display-4">BAPS3</h2>
<h3 className="h3">Presenter</h3>
<p>
<strong>Broadcast And Presenting Suite</strong>
</p>
<hr />
<a href="/" target="_blank">
<div className="btn btn-outline-dark">
<FaCog size={15} /> Server Settings
</div>
</a>
<hr />
<p>
Brought to you by
<br />
<strong>The URY Computing Team</strong>
<br />
since 2020.
</p>
<hr />
<p>
Based on the legendary BAPS 1 &amp; 2
<br />
<strong>2004 - 2021</strong>
<br />
Build upon the ideas and learnings of the many previous attempts of
BAPS3.
</p>
</div>
);
}