added "no file" screen on start

pull/2/head
Michael Ochmann 3 years ago
parent acd2b4b0ed
commit df6de5a32b
  1. 26
      src/ui/src/assets/css/_noFile.scss
  2. 5
      src/ui/src/assets/css/ation.scss
  3. 9
      src/ui/src/components/Ation.js
  4. 21
      src/ui/src/components/NoFile.js
  5. 1
      src/ui/src/shared/SlideContext.js

@ -0,0 +1,26 @@
.no-file {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
.inner {
width: 60%;
height: auto;
opacity: 0.4;
background: color(sidebarBackground);
border-radius: 1rem;
border: dashed 6px color(scrollbar);
padding: 2rem 4rem;
text-align: center;
max-width: 500px;
max-height: 300px;
svg {
&.big {
font-size: 4rem;
}
}
}
}

@ -2,8 +2,11 @@
@import "variables"; @import "variables";
@import "mixins"; @import "mixins";
@import "scrollbars"; @import "scrollbars";
@import "forms";
@import "toolbar";
@import "window"; @import "window";
@import "noFile";
@import "slidesList"; @import "slidesList";
@import "slide"; @import "slide";
@import "blackout"; @import "blackout";
@ -20,4 +23,6 @@ body {
margin: 0; margin: 0;
padding: 0; padding: 0;
background: color(background); background: color(background);
color: color(foreground);
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
} }

@ -5,6 +5,8 @@ import Mode from "../models/Mode";
import Slide from "./Slide"; import Slide from "./Slide";
import KeyboardControl from "./KeyboardControl"; import KeyboardControl from "./KeyboardControl";
import Blackout from "./Blackout"; import Blackout from "./Blackout";
import NoFile from "./NoFile";
import Toolbar from "./Toolbar";
import SlideContext from "../shared/SlideContext"; import SlideContext from "../shared/SlideContext";
@ -21,13 +23,16 @@ const Ation = () => {
setDeck(slideDeck); setDeck(slideDeck);
} }
if (deck.length < 1)
return <NoFile openFile={openFile} />;
return ( return (
<SlideContext.Provider value={{slide, setSlide, mode}}> <SlideContext.Provider value={{slide, setSlide, mode, setMode}}>
<section className={`window${mode === Mode.PRESENT ? " fullscreen" : ""}`}> <section className={`window${mode === Mode.PRESENT ? " fullscreen" : ""}`}>
<Toolbar openFile={openFile} />
<SlidesList deck={deck} /> <SlidesList deck={deck} />
<main className="main"> <main className="main">
<Slide data={deck[slide] || null} /> <Slide data={deck[slide] || null} />
<button onClick={openFile}>open</button>
</main> </main>
</section> </section>
<Blackout show={mode === Mode.BLACKOUT} /> <Blackout show={mode === Mode.BLACKOUT} />

@ -0,0 +1,21 @@
import React from "react";
import {Easel, Folder2Open} from "react-bootstrap-icons";
const NoFile = ({openFile}) => {
return (
<section className="no-file">
<section className="inner">
<p>
<Easel className="big" />
</p>
<i>No presentation loaded</i><br />
<p>
<button onClick={openFile}><Folder2Open /> open</button>
</p>
</section>
</section>
);
};
export default NoFile;

@ -5,6 +5,7 @@ import Mode from "../models/Mode";
const SlideContext = createContext({ const SlideContext = createContext({
slide : 0, slide : 0,
mode : Mode.NORMAL, mode : Mode.NORMAL,
setMode : () => {},
setSlide : () => {} setSlide : () => {}
}); });

Loading…
Cancel
Save