Skip to content

Commit

Permalink
version 2.0.0 prod
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-nyt committed Oct 15, 2020
1 parent 49c43ce commit 8be1942
Show file tree
Hide file tree
Showing 11 changed files with 712 additions and 62 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ src/**/*.js

# dependencies
/node_modules
electron-builder.json

# IDEs and editors
/.idea
Expand Down
501 changes: 489 additions & 12 deletions README.md

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,24 @@ ipc.on('app_version', (event) => {
event.sender.send('app_version', { version: app.getVersion() });
});

ipc.on('update-app', (event) => {
// Download Update
ipc.on('update-app', () => {
autoUpdater.downloadUpdate();
});

// Update available
autoUpdater.on('update-available', (event) => {
console.log('Updating...');
console.log(event);
win.webContents.send('update_available');
});

// Update is not available
autoUpdater.on('update-not-available', (event) => {
console.log(event);
win.webContents.send('update_available');
});

// Update has been downloaded
autoUpdater.on('update-downloaded', () => {
win.webContents.send('update_downloaded');
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"electron:serve": "wait-on tcp:4200 && npm run electron:serve-tsc && npx electron . --serve",
"electron:local": "npm run build:prod && npx electron .",
"electron:build": "npm run build:prod && electron-builder build",
"electron:deploy": "npm run build:prod && electron-builder build --windows --linux --publish always",
"electron:deploy": "npm run build:prod && electron-builder build --windows --publish always",
"test": "ng test --watch=false",
"test:watch": "ng test",
"e2e": "npm run build:prod && cross-env TS_NODE_PROJECT='e2e/tsconfig.e2e.json' mocha --timeout 300000 --require ts-node/register e2e/**/*.e2e.ts",
Expand Down
Binary file removed rsc/logo.png
Binary file not shown.
78 changes: 56 additions & 22 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,71 @@

<hr />

<div class="menuButtons">
<div
routerLink=""
id="home"
class="button active"
(click)="loadPage('home')"
>
<img src="assets/img/side-menu/Home.svg" draggable="false" />
<p>HOME</p>
<div class="menuContent">
<div class="menuButtons">
<div
routerLink=""
id="home"
class="button active"
(click)="loadPage('home')"
>
<img src="assets/img/side-menu/Home.svg" draggable="false" />
<p>HOME</p>
</div>

<div
routerLink="/sources"
id="sources"
class="button"
(click)="loadPage('sources')"
>
<img src="assets/img/side-menu/Source.svg" draggable="false" />
<p>SOURCES</p>
</div>

<div
routerLink="/library"
id="library"
class="button"
(click)="loadPage('library')"
>
<img src="assets/img/side-menu/Library.svg" draggable="false" />
<p>LIBRARY</p>
</div>
</div>

<p id="version">{{ version }}</p>
</div>
</div>

<div id="update" *ngIf="isUpdate">
<div class="updatePrompt">
<div
routerLink="/sources"
id="sources"
class="button"
(click)="loadPage('sources')"
class="promptWrapper"
[ngStyle]="{
opacity: isUpdating ? '0' : '1',
display: isUpdating ? 'none' : 'block'
}"
>
<img src="assets/img/side-menu/Source.svg" draggable="false" />
<p>SOURCES</p>
<p>AN UPDATE IS AVAILABLE. DO YOU WANT TO UPDATE NOW?</p>
<span>THE APP WILL RESTART AFTER UPDATING.</span>
<div class="buttons">
<button class="yes ans" (click)="downloadUpdate()">YES</button>
<button class="no ans" (click)="toggleUpdatePrompt()">
NO
</button>
</div>
</div>

<div
routerLink="/library"
id="library"
class="button"
(click)="loadPage('library')"
class="updating"
[ngStyle]="{
opacity: isUpdating ? '1' : '0',
display: isUpdating ? 'block' : 'none'
}"
>
<img src="assets/img/side-menu/Library.svg" draggable="false" />
<p>LIBRARY</p>
UPDATING
</div>
</div>
</div>

<router-outlet></router-outlet>
119 changes: 116 additions & 3 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ body {
#sideMenu {
user-select: none;
position: fixed;
top: $navHeight;
left: 0;
top: $navHeight * 2;
left: $navHeight;
bottom: $navHeight;
width: $sideMenuWidth;
height: 100%;
background: $primaryBG;
box-shadow: $primaryShadow;

Expand Down Expand Up @@ -103,6 +103,13 @@ body {
opacity: 0.1;
}

.menuContent {
display: flex;
flex-direction: column;
justify-content: space-between;
height: calc(100% - 90px);
}

.menuButtons {
width: 100%;
// margin-top: $primaryMargin * 4;
Expand Down Expand Up @@ -145,3 +152,109 @@ body {
}
}
}

#version {
z-index: 10;
text-align: center;
font-size: 12px;
margin-bottom: 0%;
}

#update {
z-index: 10;
position: absolute;
top: $navHeight;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
justify-content: center;
align-items: center;

.updatePrompt {
width: 600px;
padding: 10px;
background: white;
position: relative;

.promptWrapper {
display: flex;
justify-content: center;
text-align: center;
bottom: 0px;
border-radius: 5px;
padding: 10px;
box-shadow: inset 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
transition: all 1s;
}

.updating {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
top: 0;
left: 0;
right: 0;
bottom: 0;
border-radius: 5px;
padding: 10px;
box-shadow: inset 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
background: linear-gradient(
-45deg,
#74ccbc,
rgb(140, 255, 240),
#44beff,
#00a2ff
);
background-size: 400% 400%;
animation: load 5s ease infinite;
transition: all 1s;

color: white;
font-weight: bolder;
}

p {
font-weight: 600;
color: $secondaryAccent;
}

span {
font-size: 12px;
display: flex;
justify-content: center;
margin-top: 5px;
}

.buttons {
display: flex;
justify-content: center;

.ans {
padding: 5px 10px 5px 10px;
margin-top: 20px;
border: none;
border-radius: 0px;
cursor: pointer;
font-size: 15px;
}

.ans:hover {
box-shadow: 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
}

.yes {
background: $secondaryAccent;
color: white;
margin-right: 10px;
}

.no {
background: white;
margin-left: 10px;
}
}
}
}
14 changes: 12 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { ipcRenderer, remote } from 'electron';
})
export class AppComponent {
version = "UPDATING";
updating = false;
isUpdate = false;
isUpdating = false;

menuButtons: HTMLCollectionOf<Element> = document.getElementsByClassName("button");

Expand All @@ -29,7 +30,7 @@ export class AppComponent {
ipcRenderer.on('update_available', () => {
ipcRenderer.removeAllListeners('update_available');
zone.run(() => {
this.updating = true;
this.isUpdate = true;
});
});

Expand All @@ -48,6 +49,15 @@ export class AppComponent {
}
}

downloadUpdate(): void {
ipcRenderer.send('update-app');
this.isUpdating = true;
}

toggleUpdatePrompt(): void {
this.isUpdate = false;
}

// Minimize Window
minWindow(): void {
remote.getCurrentWindow().minimize();
Expand Down
9 changes: 5 additions & 4 deletions src/app/services/sources/readlightnovel-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ export class ReadlightnovelService extends sourceService {
const html = await this.getHtml(link); // Get HTML from the link

// Link
novel.link = link;
if (!updatingInfo) novel.link = link;

// Source
novel.source = source;
if (!updatingInfo) novel.source = source;

// InLibrary
if (!updatingInfo) novel.inLibrary = false; // Set as false to distinguish between novels already present
else novel.inLibrary = true;

//////////////////////// YOUR CODE STARTS HERE ///////////////////////////////

Expand Down Expand Up @@ -112,6 +111,7 @@ export class ReadlightnovelService extends sourceService {
this.pushOrUpdateNovel(novel, updatingInfo);
} catch (error) {
console.log(error);
this.errorMessage = "ERROR FETCHING NOVEL";
this.error = true;
}

Expand All @@ -120,7 +120,8 @@ export class ReadlightnovelService extends sourceService {
}

async searchWithName(name: string, source: string): Promise<void> {
// Can't search with name for this source
this.errorMessage = "THIS SOURCE REQUIRES A DIRECT LINK TO THE NOVEL YOU WANT TO SEARCH";
this.error = true;
}

async download(novel: novelObj, downloadID: number): Promise<void> {
Expand Down
Loading

0 comments on commit 8be1942

Please sign in to comment.