Skip to content

Commit 7399408

Browse files
committed
Update various dependencies, add toast about exiting full screen
(I hate how the toast looks but wow it's too much work to customize at the moment)
1 parent a6f3153 commit 7399408

File tree

10 files changed

+5677
-5458
lines changed

10 files changed

+5677
-5458
lines changed

.babelrc

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,52 @@
66
[
77
"@babel/preset-env",
88
{
9-
"targets": { "node": 12 }
9+
"targets": {
10+
"node": 12
11+
}
1012
}
1113
]
1214
],
13-
"plugins": ["istanbul"]
15+
"plugins": [
16+
"istanbul"
17+
]
1418
},
1519
"main": {
1620
"presets": [
1721
[
1822
"@babel/preset-env",
1923
{
20-
"targets": { "node": 12 }
24+
"targets": {
25+
"node": 12
26+
}
2127
}
2228
]
2329
]
2430
},
2531
"renderer": {
26-
"presets": ["@babel/preset-typescript", "@babel/preset-react"],
27-
"plugins": ["react-hot-loader/babel"]
32+
"presets": [
33+
"@babel/preset-typescript",
34+
[
35+
"@babel/preset-react",
36+
{
37+
"runtime": "automatic",
38+
"importSource": "@emotion/react"
39+
}
40+
]
41+
],
42+
"plugins": [
43+
"react-hot-loader/babel",
44+
"@emotion"
45+
]
2846
},
29-
3047
"web": {
48+
"plugins": [
49+
"@emotion"
50+
],
3151
"presets": [
3252
"@babel/preset-env",
3353
"@babel/preset-typescript",
34-
"@babel/preset-react"
54+
"@babel/preset-react",
3555
]
3656
}
3757
},
@@ -40,4 +60,4 @@
4060
"@babel/proposal-class-properties",
4161
"@babel/proposal-object-rest-spread"
4262
]
43-
}
63+
}

.eslintrc.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,9 @@ parserOptions:
1515
plugins:
1616
- react
1717
- "@typescript-eslint"
18-
rules: { "react/prop-types": 0 }
18+
- "@emotion"
19+
rules:
20+
{
21+
"react/prop-types": 0,
22+
"react/no-unknown-property": ["error", { "ignore": ["css"] }],
23+
}

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ yarn dev
1414

1515
## Releasing
1616

17-
1. Update the `version` in package.json.
18-
1. Commit.
19-
1. Add a tag of the form "v1.2.3" to your commit and push them both to github, e.g. `git push --atomic origin master v1.2.3`.
20-
1. A Github Action will build the app and create a draft release.
17+
1. Change the version in `package.json`
18+
1. Commit, push. A github action will build an installer Windows and create an unpublished "Release" on github.
2119
1. Go to https://github.com/BloomBooks/bloompub-viewer/releases/ , edit that draft, and publish it.
2220
1. Users will be notified of the new version via toast on the next run.

package.json

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bloompub-viewer",
3-
"version": "0.4.0",
3+
"version": "1.0.0",
44
"author": "Bloom Devs",
55
"description": "Viewer for Bloom Digital books",
66
"license": "MIT",
@@ -12,13 +12,10 @@
1212
"build:web": "cross-env BUILD_TARGET=web node .electron-react/build.js",
1313
"release": "yarn build -p always",
1414
"dev": "node .electron-react/dev-runner.js",
15-
"lintx": "eslint --ext .ts,.tsx -f ./node_modules/eslint-friendly-formatter src",
16-
"lint": "",
17-
"lint:fix": "eslint --ext .ts,.tsx -f ./node_modules/eslint-friendly-formatter --fix src",
15+
"lint": "eslint \"./**/!(*.d).ts{,x}\"",
1816
"pack": "yarn run pack:main && yarn run pack:renderer",
1917
"pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-react/webpack.main.config.js",
2018
"pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-react/webpack.renderer.config.js",
21-
"postinstall": "yarn run lint:fix",
2219
"test": "yarn run test:unit && yarn run test:e2e",
2320
"test:unit": "jest -c jest.unit.config.js",
2421
"test:e2e": "yarn run pack && jest -c jest.e2e.config.js"
@@ -101,21 +98,21 @@
10198
"deb": {}
10299
},
103100
"dependencies": {
104-
"@emotion/core": "^10.3.0",
101+
"@emotion/react": "^11.10.6",
105102
"@octokit/rest": "^18.0.0",
106103
"@types/archiver": "^3.0.0",
107104
"@types/temp": "^0.8.34",
108105
"@types/unzipper": "^0.10.3",
109106
"archiver": "^3.1.1",
110-
"bloom-player": "^2.1.8",
107+
"bloom-player": "^2.1.25",
111108
"compare-versions": "^3.6.0",
112109
"electron-log": "^4.2.2",
113110
"electron-updater": "^4.3.1",
114111
"fs": "^0.0.1-security",
115112
"path": "^0.12.7",
116113
"react": "^18.2.0",
117114
"react-dom": "^18.2.0",
118-
"react-toastify": "^6.0.6",
115+
"react-toastify": "9.0.3",
119116
"temp": "^0.9.1",
120117
"unzipper": "^0.10.8"
121118
},
@@ -128,15 +125,17 @@
128125
"@babel/preset-env": "^7.8.4",
129126
"@babel/preset-react": "^7.8.3",
130127
"@babel/preset-typescript": "^7.8.3",
128+
"@emotion/babel-plugin": "^11.10.6",
129+
"@emotion/eslint-plugin": "^11.10.0",
131130
"@types/electron": "^1.6.10",
132131
"@types/enzyme": "^3.10.4",
133132
"@types/enzyme-adapter-react-16": "^1.0.5",
134-
"@types/jest": "^25.1.1",
133+
"@types/jest": "^29.4.0",
135134
"@types/node": "^12.12.27",
136135
"@types/react": "^18.0.17",
137136
"@types/react-dom": "^18.0.6",
138-
"@typescript-eslint/eslint-plugin": "^3.4.0",
139-
"@typescript-eslint/parser": "^3.4.0",
137+
"@typescript-eslint/eslint-plugin": "^5.54.1",
138+
"@typescript-eslint/parser": "^5.54.1",
140139
"ajv": "^6.11.0",
141140
"babel-loader": "^8.0.6",
142141
"babel-plugin-istanbul": "^6.0.0",
@@ -156,16 +155,11 @@
156155
"enzyme": "^3.11.0",
157156
"enzyme-adapter-react-16": "^1.15.2",
158157
"enzyme-to-json": "^3.4.4",
159-
"eslint": "^7.3.1",
160-
"eslint-config-standard": "^14.1.1",
161-
"eslint-friendly-formatter": "^4.0.1",
162-
"eslint-loader": "^4.0.2",
163-
"eslint-plugin-html": "^6.0.2",
164-
"eslint-plugin-import": "^2.21.2",
165-
"eslint-plugin-node": "^11.1.0",
166-
"eslint-plugin-promise": "^4.2.1",
167-
"eslint-plugin-react": "^7.20.0",
168-
"eslint-plugin-standard": "^4.0.1",
158+
"eslint": "^8.35.0",
159+
"eslint-config-prettier": "^8.5.0",
160+
"eslint-plugin-prettier": "^4.0.0",
161+
"eslint-plugin-react": "^7.30.0",
162+
"eslint-plugin-react-hooks": "^4.6.0",
169163
"file-loader": "^5.0.2",
170164
"fork-ts-checker-webpack-plugin": "^4.0.3",
171165
"html-webpack-plugin": "^3.2.0",
@@ -181,10 +175,10 @@
181175
"spectron": "^10.0.0",
182176
"style-loader": "^1.1.3",
183177
"terser-webpack-plugin": "^2.3.4",
184-
"ts-jest": "^25.1.0",
178+
"ts-jest": "^29.0.5",
185179
"ts-loader": "^6.2.1",
186180
"tslint": "^6.0.0",
187-
"typescript": "^3.7.5",
181+
"typescript": "^4.9.5",
188182
"url-loader": "^3.0.0",
189183
"webpack": "^4.41.5",
190184
"webpack-cli": "^3.3.10",

src/main/index.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,12 @@ app.on("activate", () => {
177177
}
178178
});
179179

180-
ipcMain.on("toggleFullScreen", () => {
181-
mainWindow!.setMenuBarVisibility(mainWindow!.isFullScreen());
182-
mainWindow!.setFullScreen(!mainWindow!.isFullScreen());
180+
ipcMain.on("toggleFullScreen", (event) => {
181+
console.log("xxxx");
182+
const makeFullScreen = !mainWindow!.isFullScreen();
183+
mainWindow!.setMenuBarVisibility(!makeFullScreen);
184+
mainWindow!.setFullScreen(makeFullScreen);
185+
event.returnValue = makeFullScreen;
183186
});
184187

185188
ipcMain.on("exitFullScreen", () => {

src/preload.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,14 @@ import { contextBridge, ipcRenderer, remote, shell } from "electron";
55
contextBridge.exposeInMainWorld("electronApi", {
66
sendSync: (channel: string, data) => {
77
// whitelist channels
8-
let validChannels = ["get-file-that-launched-me"];
8+
let validChannels = ["get-file-that-launched-me", "toggleFullScreen"];
99
if (validChannels.includes(channel)) {
1010
return ipcRenderer.sendSync(channel, data);
1111
}
1212
},
1313
send: (channel: string, data) => {
1414
// whitelist channels
15-
let validChannels = [
16-
"unpack-zip-file",
17-
"toggleFullScreen",
18-
"exitFullScreen",
19-
];
15+
let validChannels = ["unpack-zip-file", "exitFullScreen"];
2016
if (validChannels.includes(channel)) {
2117
ipcRenderer.send(channel, data);
2218
}

src/renderer/StartScreen.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import { css } from "@emotion/core";
2-
// these two lines make the css prop work on react elements
3-
import { jsx } from "@emotion/core";
4-
/** @jsx jsx */
1+
import { css } from "@emotion/react";
52

6-
import React, { useEffect, useState } from "react";
3+
import React from "react";
74
import { showOpenFile } from ".";
85
import wordmark from "../../build/wordmark.svg";
9-
import logo from "../../build/icon.svg";
106
import search from "../../build/Search.svg";
117
import open from "../../build/Open.svg";
128

src/renderer/index.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import ReactDOM from "react-dom";
33
import { createRoot } from "react-dom/client";
44
import "./index.css";
55
import App, { showBook } from "./App";
6+
import { toast } from "react-toastify";
67

78
updateMainMenu();
89
const zipFilePath = window.electronApi.sendSync("get-file-that-launched-me");
@@ -51,7 +52,21 @@ function updateMainMenu() {
5152
label: "&" + `Full Screen`,
5253
accelerator: "F11",
5354
click: () => {
54-
window.electronApi.send("toggleFullScreen");
55+
const isNowFullScreen =
56+
window.electronApi.sendSync("toggleFullScreen");
57+
58+
if (isNowFullScreen) {
59+
toast.info(`Press F11 or ESC to exit full screen`, {
60+
position: "top-left",
61+
icon: false,
62+
autoClose: 3000,
63+
hideProgressBar: true,
64+
closeOnClick: true,
65+
pauseOnHover: true,
66+
draggable: false,
67+
progress: undefined,
68+
});
69+
}
5570
},
5671
},
5772
{

tsconfig.json

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,33 @@
33
"target": "es5",
44
"module": "commonjs",
55
"sourceMap": true,
6-
"jsx": "react",
7-
"lib": ["dom", "es6", "scripthost", "es2017.object"],
6+
"jsx": "react-jsx",
7+
"jsxImportSource": "@emotion/react",
8+
"types": [
9+
/*"@emotion/react",
10+
"@emotion/react/types/css-prop"*/
11+
"jest"
12+
],
13+
"lib": [
14+
"dom",
15+
"es6",
16+
"scripthost",
17+
"es2017.object"
18+
],
819
"experimentalDecorators": true,
920
"alwaysStrict": true,
1021
"noImplicitReturns": true,
1122
"strictNullChecks": true,
12-
"outDir": "lib",
1323
"resolveJsonModule": true,
1424
"esModuleInterop": true
1525
},
16-
"exclude": ["node_modules", "typings", "lib"]
17-
}
26+
"paths": {
27+
"react": [
28+
"./node_modules/@types/react"
29+
]
30+
},
31+
"exclude": [
32+
"node_modules",
33+
"typings",
34+
]
35+
}

0 commit comments

Comments
 (0)