Skip to content

Commit 4a7fe33

Browse files
Merge pull request #58 from justinhartman/develop
Merge cinema mode layout into main branch
2 parents 158159b + 2f61416 commit 4a7fe33

File tree

5 files changed

+64
-18
lines changed

5 files changed

+64
-18
lines changed

README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ To install and set up the basic project, follow these steps:
6868

6969
1. Clone the repository to your local machine.
7070
2. Navigate to the project directory in your terminal.
71-
3. Install the required dependencies by running `yarn install`.
71+
3. Install the required dependencies by running `bun install`.
7272
4. Rename `.env.example` to simply `.env` in the project root directory and change the following lines:
7373
- [ ] `OMDB_API_KEY=your_api_key_here` - replace `your_api_key_here` with your actual OMDB API key.
7474
- [ ] `API_PORT=3000` - replace `3000` with the port you want the node server to run on.
7575
- [ ] `APP_URL=binger.uk` - replace `binger.uk` with your website/app's live URL.
76-
5. Start the application by running `yarn start`.
76+
5. Start the application by running `bun start`.
7777

7878
### Nginx and Systemd Server Setup
7979

@@ -98,8 +98,8 @@ To get the authentication and user functionality working, make sure you've follo
9898
Application and then follow these steps.
9999

100100
1. Install and configure MongoDB. There are detailed instructions here:
101-
- [Install for Debian Bookworm](./docs/mongodb/INSTALL_DEBIAN.md) found at `./docs/mongodb/INSTALL_DEBIAN.md`
102-
- [Install for Ubuntu 20.04](./docs/mongodb/INSTALL_UBUNTU.md) found at `./docs/mongodb/INSTALL_UBUNTU.md` - note
101+
- [Install for Debian Bookworm][install-bookworm] found at `./docs/mongodb/INSTALL_DEBIAN.md`
102+
- [Install for Ubuntu 20.04][install-ubuntu] found at `./docs/mongodb/INSTALL_UBUNTU.md` - note
103103
that these instructions come from ChatGPT and I haven't tested them.
104104
I have a Debian server so please correct the instructions if you find any are incorrect and submit a PR.
105105

@@ -127,15 +127,15 @@ Application and then follow these steps.
127127
3. You need to run the MongoDB migrations once you've added your MongoDB details to your `.env` file.
128128
Open up a terminal and in the project root run the following:
129129
```bash
130-
yarn db:migrate
130+
bun db:migrate
131131
```
132132
Or if you are using NPM:
133133
```bash
134134
npm run db:migrate
135135
```
136136

137137
4. With the MongoDB collection now migrated, you can begin using your app. Simply restart your node server so your
138-
latest configs are loaded. If you've used the [systemd service file](./system/systemd/binger.service) I've supplied
138+
latest configs are loaded. If you've used the [systemd service file][service] I've supplied
139139
at `./system/systemd/binger.service` then all you need to do is restart the service with:
140140
```bash
141141
sudo systemctl restart binger.service
@@ -148,21 +148,21 @@ Application and then follow these steps.
148148

149149
[![code coverage][codecov-ice]][codecov-lnk]
150150

151-
- Run `yarn test` to execute the test suite.
152-
- Run `yarn test:coverage` to generate coverage for the entire project. A summary will be printed to the console and full reports will be written to the `coverage/` folder (HTML, lcov, text).
151+
- Run `bun run test` to execute the test suite.
152+
- Run `bun test:coverage` to generate coverage for the entire project. A summary will be printed to the console and full reports will be written to the `coverage/` folder (HTML, lcov, text).
153153

154154
## Linting
155155

156-
- Run `yarn lint` to type-check all TypeScript files using the TypeScript compiler in no-emit mode and lint EJS templates.
157-
- Run `yarn lint:ts` to type-check only the TypeScript files.
158-
- Run `yarn lint:ejs` to lint EJS templates.
156+
- Run `bun lint` to type-check all TypeScript files using the TypeScript compiler in no-emit mode and lint EJS templates.
157+
- Run `bun lint:ts` to type-check only the TypeScript files.
158+
- Run `bun lint:ejs` to lint EJS templates.
159159

160160
## OMDb API
161161

162-
Included in this repository is a [RapidAPI](https://rapidapi.com) file created by the macOS app RapidAPI which is free.
162+
Included in this repository is a [RapidAPI][rapidapi] file created by the macOS app RapidAPI which is free.
163163
There is also a VSCode extension which should be able to work with this file but YMMV.
164164

165-
The file is located at [/docs/api/OMDb_API.paw](/docs/api/OMDb_API.paw) and contains a working implementation of the
165+
The file is located at [/docs/api/OMDb_API.paw][pawapi] and contains a working implementation of the
166166
OMDb API used in this project. Open the file and begin testing the API to see responses.
167167

168168
## Known Issues
@@ -223,3 +223,8 @@ I want a way to kill this because there's known malware in these popups!
223223
[badge-relcom]: https://img.shields.io/github/commits-since/justinhartman/imdb-app/latest
224224
[badge-tots]: https://img.shields.io/github/commit-activity/t/justinhartman/imdb-app
225225
[badge-reldate]: https://img.shields.io/github/release-date/justinhartman/imdb-app
226+
[install-bookworm]: ./docs/mongodb/INSTALL_DEBIAN.md
227+
[install-ubuntu]: ./docs/mongodb/INSTALL_UBUNTU.md
228+
[pawapi]: /docs/api/OMDb_API.paw
229+
[rapidapi]: https://rapidapi.com
230+
[service]: ./system/systemd/binger.service

public/css/style.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ a.btn-primary:hover {
2626
display: flex;
2727
flex-direction: column;
2828
}
29+
.series-controls {
30+
width: 100%;
31+
}
2932

3033
/* Home page scrolling containers with buttons. */
3134
.scroll-row {
@@ -60,11 +63,22 @@ a.btn-primary:hover {
6063
grid-template-columns: 2fr 1fr;
6164
grid-template-areas:
6265
"player episodes"
66+
"controls episodes"
6367
"seasons episodes"
6468
"info episodes";
6569
column-gap: 1rem;
6670
}
71+
.series-layout.cinema-mode {
72+
grid-template-columns: 3fr 2fr;
73+
grid-template-areas:
74+
"player player"
75+
"controls controls"
76+
"seasons episodes"
77+
"info episodes";
78+
row-gap: 1rem;
79+
}
6780
.series-player { grid-area: player; }
81+
.series-controls { grid-area: controls; }
6882
.series-episodes { grid-area: episodes; }
6983
.series-seasons { grid-area: seasons; }
7084
.series-info { grid-area: info; }

views/partials/footer.ejs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,27 @@
9191
applyServer(next);
9292
});
9393
})();
94+
95+
(function() {
96+
const cinemaToggle = document.getElementById('cinema-toggle');
97+
const seriesLayout = document.querySelector('.series-layout');
98+
if (!cinemaToggle || !seriesLayout) return;
99+
100+
const updateCinemaToggle = (enabled) => {
101+
cinemaToggle.innerHTML = `<i class="bi bi-camera-reels"></i> ${enabled ? 'Cinema Off' : 'Cinema On'}`;
102+
cinemaToggle.classList.toggle('bg-info', enabled);
103+
cinemaToggle.classList.toggle('text-dark', enabled);
104+
cinemaToggle.classList.toggle('bg-info-subtle', !enabled);
105+
seriesLayout.classList.toggle('cinema-mode', enabled);
106+
};
107+
108+
updateCinemaToggle(seriesLayout.classList.contains('cinema-mode'));
109+
110+
cinemaToggle.addEventListener('click', (event) => {
111+
event.preventDefault();
112+
const enableCinema = !seriesLayout.classList.contains('cinema-mode');
113+
updateCinemaToggle(enableCinema);
114+
});
115+
})();
94116
</script>
95117
</html>

views/partials/series-buttons.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ if (episodeNum >= maxEpisodes) {
3131
<div id="series-buttons" class="px-1 w-100">
3232
<div class="btn-group mb-2 w-100">
3333
<a href="<%= prevLink %>" class="btn bg-primary border border-primary-subtle btn-sm p-2 <%= prevDisabled ? 'disabled' : '' %>"><i class="bi bi-caret-left-square"></i> Previous</a>
34+
<button type="button" id="cinema-toggle" class="btn btn-sm p-2 bg-info-subtle border border-gray-subtle">
35+
<i class="bi bi-camera-reels"></i> Cinema On
36+
</button>
3437
<% if (server2Src && server2Src.trim() !== '') { -%>
3538
<a href="#" id="server-toggle" data-current="<%= currentServer %>" data-server1="<%= server1Src %>" data-server2="<%= server2Src %>" data-preference-key="<%= preferenceKeySeries %>" class="btn text-secondary bg-secondary-subtle border border-secondary-subtle btn-sm p-2">
3639
<i class="bi bi-hdd-stack"></i> Server <%= currentServer === '1' ? '2' : '1' %>

views/view.ejs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@
6060
<iframe id="player" src="<%= iframeSrc %>" referrerpolicy="origin" allow="autoplay; fullscreen" class="w-100"></iframe>
6161
</div>
6262
</div>
63-
<div class="series-episodes d-flex flex-wrap flex-md-column mt-2 mt-md-0">
63+
<div class="series-controls mt-2 mt-md-0">
6464
<%- include('./partials/series-buttons.ejs') -%>
65-
<% const currentSeason = seriesDetail.currentSeason || { episodes: [] }; %>
66-
<% currentSeason.episodes.forEach(ep => { %>
67-
<a href="<%= `${APP_URL}/view/${id}/${type}/${season}/${ep.episode}` %>" class="btn btn-outline-info btn-sm text-start m-1 <%= Number(episode) === ep.episode ? 'active' : '' %>"><%= ep.episode %>. <%= ep.title || `Episode ${ep.episode}` %></a>
68-
<% }) %>
6965
</div>
7066
<div class="series-seasons d-flex flex-wrap mt-2 h-25">
7167
<% for (let s = 1; s <= seriesDetail.totalSeasons; s++) { %>
@@ -94,6 +90,12 @@
9490
</div>
9591
</div>
9692
<% } -%>
93+
<div class="series-episodes d-flex flex-wrap flex-md-column mt-2 mt-md-0">
94+
<% const currentSeason = seriesDetail.currentSeason || { episodes: [] }; %>
95+
<% currentSeason.episodes.forEach(ep => { %>
96+
<a href="<%= `${APP_URL}/view/${id}/${type}/${season}/${ep.episode}` %>" class="btn btn-outline-info btn-sm text-start m-1 <%= Number(episode) === ep.episode ? 'active' : '' %>"><%= ep.episode %>. <%= ep.title || `Episode ${ep.episode}` %></a>
97+
<% }) %>
98+
</div>
9799
</div>
98100
<% } else { %>
99101
<div class="row">

0 commit comments

Comments
 (0)