Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit b3d8aa8

Browse files
committed
mvp
1 parent 7a58ec7 commit b3d8aa8

20 files changed

Lines changed: 10132 additions & 15910 deletions

package-lock.json

Lines changed: 9935 additions & 15767 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
{
22
"name": "bingsu",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"description": "prevents linkrot in your documents",
55
"license": "GPLv3",
66
"author": "Huey Lee <hello@huey.xyz>",
7-
"main": "./webpack.config.js",
7+
"main": ".webpack/main",
88
"scripts": {
9-
"build:webpack": "webpack",
10-
"build:windows": "npm run build:webpack && electron-forge make --targets @electron-forge/maker-squirrel",
11-
"build:debian": "npm run build:webpack && electron-forge make --targets @electron-forge/maker-deb",
12-
"build:macos": "npm run build:webpack && electron-forge make --targets @electron-forge/maker-dmg",
13-
"react:dev": "webpack serve --mode=development",
14-
"electron:dev": "nodemon",
15-
"start:prod": "npm run build && electron ./dist/main.js",
16-
"start:dev": "concurrently --kill-others \"npm run react:dev\" \"npm run electron:dev\"",
9+
"build:windows": "electron-forge make --targets @electron-forge/maker-squirrel",
10+
"build:debian": "electron-forge make --targets @electron-forge/maker-deb",
11+
"build:macos": "electron-forge make --targets @electron-forge/maker-dmg",
1712
"test": "echo \"Error: no test specified\" && exit 1",
1813
"prepare": "husky install",
1914
"package": "electron-forge package",
20-
"make": "electron-forge make"
15+
"make": "electron-forge make",
16+
"start": "electron-forge start"
2117
},
2218
"lint-staged": {
2319
"*.{js,ts,json}": [
@@ -49,38 +45,32 @@
4945
"@electron-forge/maker-deb": "^6.0.0-beta.59",
5046
"@electron-forge/maker-dmg": "^6.0.0-beta.59",
5147
"@electron-forge/maker-squirrel": "^6.0.0-beta.59",
48+
"@electron-forge/plugin-webpack": "^6.0.0-beta.59",
5249
"@types/adm-zip": "^0.4.34",
5350
"@types/node": "^16.0.0",
5451
"@types/react": "^17.0.14",
5552
"@types/react-dom": "^17.0.9",
5653
"@types/xml2js": "^0.4.9",
5754
"@typescript-eslint/eslint-plugin": "^4.28.1",
5855
"@typescript-eslint/parser": "^4.28.1",
59-
"concurrently": "^6.2.0",
60-
"copy-webpack-plugin": "^9.0.1",
6156
"css-loader": "^6.1.0",
6257
"dotenv": "^10.0.0",
63-
"electron": "^13.1.6",
58+
"electron": "^13.1.8",
6459
"electron-is-dev": "^2.0.0",
6560
"eslint": "^7.30.0",
6661
"eslint-plugin-import": "^2.23.4",
6762
"eslint-plugin-node": "^11.1.0",
6863
"eslint-plugin-sonarjs": "^0.8.0-125",
6964
"eslint-plugin-sort-keys-fix": "^1.1.1",
7065
"eslint-plugin-unicorn": "^34.0.1",
71-
"html-webpack-plugin": "^5.3.2",
66+
"fork-ts-checker-webpack-plugin": "^6.3.1",
7267
"husky": "^7.0.0",
7368
"lint-staged": "^11.0.0",
74-
"nodemon": "^2.0.12",
75-
"react-hot-loader": "^4.13.0",
7669
"sass": "^1.35.2",
7770
"sass-loader": "^12.1.0",
7871
"style-loader": "^3.1.0",
7972
"ts-loader": "^9.2.3",
80-
"typescript": "^4.3.5",
81-
"webpack": "^5.45.1",
82-
"webpack-cli": "^4.7.2",
83-
"webpack-dev-server": "^3.11.2"
73+
"typescript": "^4.3.5"
8474
},
8575
"engines": {
8676
"node": ">=14.17.2"
@@ -121,6 +111,28 @@
121111
"name": "Bingsu"
122112
}
123113
}
114+
],
115+
"plugins": [
116+
[
117+
"@electron-forge/plugin-webpack",
118+
{
119+
"mainConfig": "./webpack.main.config.js",
120+
"renderer": {
121+
"config": "./webpack.renderer.config.js",
122+
"entryPoints": [
123+
{
124+
"html": "./src/index.html",
125+
"js": "./src/renderer.tsx",
126+
"name": "main_window",
127+
"preload": {
128+
"js": "./src/electron/preload.ts"
129+
}
130+
}
131+
]
132+
},
133+
"devContentSecurityPolicy": "default-src 'self' 'unsafe-inline' data:; script-src 'self' 'unsafe-eval' 'unsafe-inline' data:"
134+
}
135+
]
124136
]
125137
}
126138
}

src/app/app.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
border: 0;
77
vertical-align: baseline;
88
box-sizing: border-box;
9+
user-select: none;
910
}
1011

1112
html,
@@ -28,4 +29,8 @@ body {
2829
color: var(--text-colour);
2930
background-color: var(--app-colour);
3031
height: inherit;
32+
}
33+
34+
::selection {
35+
background: var(--selection-colour);
3136
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#archiving-page {
2+
display: flex;
3+
flex-direction: column;
4+
justify-content: center;
5+
align-items: center;
6+
height: 100%;
7+
width: 100%;
8+
9+
> h1 {
10+
margin-bottom: 1rem;
11+
}
12+
13+
> p + p {
14+
margin-top: 1rem;
15+
}
16+
17+
> p > a {
18+
text-decoration: none;
19+
user-select: text;
20+
}
21+
}

src/app/pages/Archiving/Archiving.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React, { useEffect, useCallback } from 'react'
2-
import { useHistory } from 'react-router-dom'
32
import { MessageType } from '../../../utils/Constants'
43
import Logger from '../../../utils/Logger'
4+
import Navigator from '../../../utils/Navigator'
5+
import { cleanURL } from '../../../utils/Utils'
56
import useFiles from '../../hooks/useFiles'
67
import useHyperlinkStats from '../../hooks/useHyperlinkStats'
8+
import './Archiving.scss'
79

810
const Archiving = () => {
9-
const history = useHistory()
1011
const { file, isLoading, setHyperlink } = useFiles()
1112
const {
1213
file: {
@@ -60,7 +61,7 @@ const Archiving = () => {
6061

6162
useEffect(() => {
6263
if (progressPercentage === 100) {
63-
history.push(`/output`)
64+
Navigator.navigateTo(`output`)
6465
}
6566
}, [progressPercentage])
6667

@@ -73,8 +74,10 @@ const Archiving = () => {
7374
<>
7475
<h1>{fileName}</h1>
7576
<p>{erroredHyperlinks} errors</p>
76-
<p>{progressPercentage}%</p>
77-
<p>{url}</p>
77+
<p>{Number(progressPercentage).toFixed(1)}%</p>
78+
<p>
79+
<a href={url}>{cleanURL(url)}</a>
80+
</p>
7881
</>
7982
)
8083
}

src/app/pages/Output/Output.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#output-page {
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
flex-direction: column;
6+
justify-content: center;
7+
align-content: center;
8+
align-items: center;
9+
10+
> h1 {
11+
margin-bottom: 1rem;
12+
}
13+
14+
> a {
15+
margin-top: 1rem;
16+
background-color: var(--app-colour-dark);
17+
font-size: var(--font-size-normal);
18+
padding: 0.5rem;
19+
color: var(--text-colour);
20+
text-decoration: none;
21+
}
22+
}

src/app/pages/Output/Output.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useEffect } from 'react'
22
import Storage from '../../../utils/Storage'
33
import useFiles from '../../hooks/useFiles'
44
import useHyperlinkStats from '../../hooks/useHyperlinkStats'
5+
import './Output.scss'
56

67
const Output = () => {
78

@@ -27,7 +28,7 @@ const Output = () => {
2728
<>
2829
<h1>Done</h1>
2930
<p>Archived {totalHyperlinks} hyperlinks. There were {erroredHyperlinks} errors.</p>
30-
<a href="/#/">Another file?</a>
31+
<a href="#/">Another file?</a>
3132
</>
3233
)
3334
}

src/app/pages/ProcessConfirmation/ProcessConfirmation.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
.file-info {
1212
margin-bottom: 2rem;
13+
14+
> h1 {
15+
margin-bottom: 0.5rem;
16+
}
1317
}
1418

1519
.links-list {
@@ -29,6 +33,15 @@
2933
> thead {
3034
font-weight: bold;
3135
}
36+
37+
> tbody td,
38+
> tbody td * {
39+
user-select: text;
40+
}
41+
42+
> tbody td a {
43+
text-decoration: none;
44+
}
3245
}
3346
}
3447
}

src/app/pages/ProcessConfirmation/ProcessConfirmation.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react'
2+
import { cleanURL } from '../../../utils/Utils'
23
import useFiles from '../../hooks/useFiles'
34
import './ProcessConfirmation.scss'
45

@@ -36,26 +37,24 @@ const ProcessConfirmationPage = () => {
3637
<td>No.</td>
3738
<td>Text</td>
3839
<td>URL</td>
39-
<td>Location</td>
4040
</tr>
4141
</thead>
4242
<tbody>
43-
{hyperlinks.map(({ text, url, location }, index) => (
43+
{hyperlinks.map(({ text, url }, index) => (
4444
<tr key={`${text}-${url}-${index}`}>
4545
<td>{index + 1}</td>
4646
<td>{text}</td>
4747
<td>
48-
<a href={url} target="_blank">{url}</a>
48+
<a href={url} target="_blank">{cleanURL(url)}</a>
4949
</td>
50-
<td>{location}</td>
5150
</tr>
5251
))}
5352
</tbody>
5453
</table>
5554
</div>
5655
</div>
5756
<div className="action-bar">
58-
<a href="/#/archiving">
57+
<a href="#/archiving">
5958
PROCEED
6059
</a>
6160
</div>

src/app/styles/core.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
--app-colour: #ffd04d;
44
--app-colour-dark: #ffbc00;
55
--text-colour: black;
6+
--selection-colour: #ffff00;
67

78
--title-bar-height: 32px;
89

0 commit comments

Comments
 (0)