Skip to content

Commit

Permalink
Merge pull request #8 from astronomersiva/more-components
Browse files Browse the repository at this point in the history
More components
  • Loading branch information
astronomersiva authored Oct 29, 2019
2 parents 977d8a7 + cbb86d2 commit 6d78381
Show file tree
Hide file tree
Showing 51 changed files with 407 additions and 765 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This was built as a demo for my talk on using WebSockets with Ember.
If you would like to use this, feel free to fork this repo and add
your slides as components.

## Features

* Create interactive EmberJS presentations.
* Sync your presentation across all screens.
* Speaker mode with notes, timer and previews of the next and previous slides.
* Export all slides as PDF.
* Write slides and notes in markdown.

## Prerequisites

You will need the following things properly installed on your computer.
Expand All @@ -21,15 +29,15 @@ You will need the following things properly installed on your computer.
## Running / Development

* `ember serve`
* For the speaker view, visit `publicip:4200/?speaker=true`.
* For the speaker view, visit `publicip:4200/?speaker`.
* For the audience view, click on the `Open Presenter View icon` and drag the popup
window to the screen that is being shared.

### Usage

![ember-keynote](screenshots/app.jpg)

You can switch between the slides by making use of the arrow keys
You can switch between the slides by making use of the `arrow keys`
or the `A` and `D` keys. You can also use the control buttons on the screen.

Use the Full Screen icon to toggle fullscreen view. This is also possible in the
Expand All @@ -42,6 +50,12 @@ resume the presentation.

You can add slide notes by adding them to the respective slide component's class.

To export the presentation as a PDF, use the `download` query parameter. You can then
use the browser's `Save as PDF` feature to download the presentation. Please ensure
that the `Background graphics` option is checked.

![Background graphics option in Save as PDF dialog](screenshots/download.jpg)

### Deploying

This app makes use of WebSockets. You will have to deploy a Node.js
Expand Down
11 changes: 11 additions & 0 deletions app/components/background.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{!-- template-lint-disable no-inline-styles --}}
<div
...attributes
style={{this.style}}
class="
bg-center
bg-cover
"
>
{{yield}}
</div>
23 changes: 23 additions & 0 deletions app/components/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Component from '@glimmer/component';

export default class BackgroundComponent extends Component {
get style() {
if (this.args.image) {
return `background-image: url(${this.args.image})`;
}

if (this.args.color) {
return `background-color: ${this.args.color}`;
}

if (this.args.gradient) {
return `background-image: linear-gradient(${this.args.gradient})`;
}

if (this.args.radialGradient) {
return `background-image: radial-gradient(${this.args.radialGradient})`;
}

return `background-color: black`;
}
}
10 changes: 10 additions & 0 deletions app/components/code.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{#let (get-code-snippet @snippet) as |snippet|}}
{{!-- ember-prism renders an empty string if an unsupported language is passed --}}
{{#if this.language}}
<CodeBlock
@language={{this.language}}
@code={{snippet.source}} />
{{else}}
<CodeBlock @code={{snippet.source}} />
{{/if}}
{{/let}}
17 changes: 17 additions & 0 deletions app/components/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Component from '@glimmer/component';

export default class CodeComponent extends Component {
get language() {
let snippet = this.args.snippet;
let languages = {
js: 'javascript',
html: 'html',
// while this is supported by prism,
// ember-prism is returning an empty string, need to check
// hbs: 'handlebars'
};

let extension = snippet.split('.').pop();
return languages[extension] || '';
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions app/components/controls/speaker-controls.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div
...attributes
class="relative flex flex-col min-h-screen w-full md:w-1/4 border-gray-300 border-4">
<Controls::SlideNotes @notes={{@notes}} />

<div class="flex flex-col flex-grow w-full bg-gray-200 border-gray-300 border-t-2">
<Controls::Navigation />

<div class="flex flex-row flex-grow items-center">
<Controls::FullScreen @speaker={{true}} />
<Controls::PresentationView />
<Controls::AdjacentSlidesToggle />
<Controls::Clock />
<Controls::Pause />
</div>
</div>
</div>
21 changes: 21 additions & 0 deletions app/components/presentation-container.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{#let (concat "slides/slide-" @slide) as |Slide|}}
<Slide
@speaker={{@speaker}}
class="
{{concat "slide-" @slide}}
{{if @speaker "hidden md:flex w-3/4" "flex"}}
{{if @isExport "min-h-full"}}
" as |slide|
>
{{#if @speaker}}
{{#unless @hasStarted}}
<div class="timer-overlay w-full md:w-3/4 md:h-full bottom-26 md:top-0">
<button class="underline" {{on "click" @startTicking}}>Start Presentation</button>
</div>
{{/unless}}

<Controls::AdjacentSlides />
<Controls::SpeakerControls @notes={{slide.notes}} />
{{/if}}
</Slide>
{{/let}}
8 changes: 6 additions & 2 deletions app/components/slides/slide-1.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<div ...attributes>
<Background
class="border-none"
@image="/images/lights.jpg"
...attributes
>
<h1 class="text-6xl text-center text-gray-400 p-2">
ember-keynote
</h1>
</div>
</Background>

{{yield this}}
8 changes: 4 additions & 4 deletions app/components/slides/slide-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export default class SlidesSlide1Component extends Component {
* Built the Octane way.
* Uses websockets(with socket.io) to sync slides across the audience.
* Code Embeds
* Supports Presenter Notes. Use even markdown!
* Styled with Tailwind.
* A Clock to keep track of your progress.
* Code Embeds
* Speaker mode with notes, timer and previews of the next and previous slides.
* Write slides and notes in markdown.
* Export slides as PDF.
* Supports pausing the presentation for the audience.
* Control the slides with your phone!
`;
}
11 changes: 8 additions & 3 deletions app/components/slides/slide-2.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div ...attributes>
<h1 class="text-black p-3 px-8 text-6xl rounded">Want to try this out?</h1>
</div>
<Background
@image="/images/party.jpg"
...attributes
>
<h1 class="text-black p-3 px-8 text-6xl rounded">
Want to try this out?
</h1>
</Background>

{{yield this}}
2 changes: 1 addition & 1 deletion app/components/slides/slide-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default class SlidesSlide2Component extends Component {
* Write templates as you please.
* Run \`ember s\`.
* Visit the app using the public IP address. Remember to add the
\`speaker=true\` query param.
\`speaker\` query param.
* Click on the \`Open Presenter View\` icon to toggle the Presentation view. Drag
and drop the popup window on the projector display.
* Just make sure you have the slides numbered sequentially.
Expand Down
9 changes: 5 additions & 4 deletions app/components/slides/slide-3.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div ...attributes>
{{#let (get-code-snippet "slide.hbs") as |snippet|}}
<CodeBlock @code={{snippet.source}} />
{{/let}}
<div
...attributes
class="slide-bordered"
>
<Code @snippet="slide.hbs" />
</div>

{{yield this}}
9 changes: 5 additions & 4 deletions app/components/slides/slide-4.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<div ...attributes>
{{#let (get-code-snippet "slide.js") as |snippet|}}
<CodeBlock @language="javascript" @code={{snippet.source}} />
{{/let}}
<div
...attributes
class="slide-bordered"
>
<Code @snippet="slide.js" />
</div>

{{yield this}}
11 changes: 8 additions & 3 deletions app/components/slides/slide-5.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div ...attributes>
<h1 class="text-black p-3 px-8 text-6xl rounded">Thank you!</h1>
</div>
<Background
@image="/images/clouds.jpg"
...attributes
>
<h1 class="text-black p-3 px-8 text-6xl rounded">
Thank you!
</h1>
</Background>

{{yield this}}
17 changes: 0 additions & 17 deletions app/components/speaker-controls.hbs

This file was deleted.

4 changes: 3 additions & 1 deletion app/controllers/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { inject as service } from '@ember/service';
export default class ApplicationController extends Controller {
queryParams = [
'slide',
'speaker'
'speaker',
'download'
];

@service socketManager;
Expand All @@ -16,6 +17,7 @@ export default class ApplicationController extends Controller {

@tracked speaker;
@tracked slide;
@tracked download;

init() {
super.init(...arguments);
Expand Down
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

{{content-for "head-footer"}}
</head>
<body class="flex h-screen">
<body>
{{content-for "body"}}

<script src="{{rootURL}}assets/vendor.js"></script>
Expand Down
Loading

0 comments on commit 6d78381

Please sign in to comment.