-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from chytanka/develop
add hint-page
- Loading branch information
Showing
33 changed files
with
1,158 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CompositionEpisode, CompositionImage } from '../../common/common-read'; | ||
|
||
enum DownloadStatus { | ||
Downloading = "downloading", | ||
Paused = "paused", | ||
Error = "error", | ||
Done = "done", | ||
Queued = "queued" | ||
} | ||
|
||
type DownloadQueue<T> = { | ||
id: string; | ||
status: DownloadStatus; | ||
object: T; | ||
dateAdded: Date; | ||
dateDownloaded: Date | undefined; | ||
} | ||
|
||
interface DownloadCompositionImage extends CompositionImage { | ||
image: number[] | ||
status: DownloadStatus; | ||
} | ||
interface DowloadCompositionEpisode extends CompositionEpisode { | ||
images: DownloadCompositionImage[] | ||
} | ||
|
||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class DownloadService { | ||
/** | ||
* -[ ] add to queue | ||
* -[ ] dowload queue | ||
* -[ ] save to db | ||
* -[ ] | ||
*/ | ||
|
||
queue: DownloadQueue<CompositionEpisode>[] = [] | ||
|
||
constructor() { } | ||
|
||
map(ep: CompositionEpisode): DowloadCompositionEpisode { | ||
return { | ||
title: ep.title, | ||
chapter: ep.chapter, | ||
episode: ep.episode, | ||
extra: ep.extra, | ||
mangaId: ep.mangaId, | ||
nsfw: ep.nsfw, | ||
part: ep.part, | ||
volume: ep.volume, | ||
images: ep.images.map(img => { | ||
return { | ||
image: [], | ||
status: DownloadStatus.Queued, | ||
src: img.src, | ||
alt: img.alt, | ||
height: img.height, | ||
nsfw: img.nsfw, | ||
size: img.size, | ||
type: img.type, | ||
width: img.width | ||
} | ||
|
||
}) | ||
} | ||
} | ||
|
||
addToQueue(episode: CompositionEpisode, id: string) { | ||
const qi = this.getFromQueue(id) | ||
if (qi) return; | ||
this.queue.push( | ||
{ | ||
id, | ||
object: this.map(episode), | ||
status: DownloadStatus.Queued, | ||
dateAdded: new Date(), | ||
dateDownloaded: undefined | ||
}) | ||
} | ||
|
||
getFromQueue(id: string) { | ||
const result = this.queue.filter(e => e.id == id) | ||
|
||
return result[0] ?? undefined; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/app/shared/ui/manga-page/manga-page-even.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<section> | ||
<ng-content select="[frame=1]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=2]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=3]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=4]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=5]"></ng-content> | ||
</section> |
89 changes: 89 additions & 0 deletions
89
src/app/shared/ui/manga-page/manga-page-even.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
:host { | ||
display: grid; | ||
max-height: 100vh; | ||
aspect-ratio: 2/3; | ||
--side-gap: 2rem; | ||
|
||
background-color: #fff; | ||
color: #000; | ||
|
||
gap: 2ch 1ch; | ||
position: relative; | ||
|
||
grid-template-columns: var(--side-gap) repeat(4, 1fr); | ||
grid-template-rows: 1fr 2fr 1fr var(--side-gap); | ||
|
||
counter-reset: read-order; | ||
font-family: 'Troubleside'; | ||
} | ||
|
||
section { | ||
opacity: .8; | ||
border: .4ch solid; | ||
border-radius: .4ch; | ||
position: relative; | ||
display: grid; | ||
place-items: center; | ||
overflow: hidden; | ||
|
||
counter-increment: read-order; | ||
|
||
&:nth-child(1), | ||
&:nth-child(2) { | ||
border-top: 0; | ||
border-top-left-radius: unset; | ||
border-top-right-radius: unset; | ||
} | ||
|
||
&:nth-child(1) { | ||
grid-column: 2/span 2; | ||
} | ||
|
||
&:nth-child(2) { | ||
grid-column: 4/span 2; | ||
grid-row: 1; | ||
} | ||
|
||
&:nth-child(3) { | ||
grid-column: 2/span 4 | ||
} | ||
|
||
&:nth-child(4) { | ||
grid-column: 2/span 3; | ||
} | ||
|
||
&:nth-child(5) { | ||
grid-column: 5; | ||
} | ||
} | ||
|
||
|
||
:host[dir=rtl] { | ||
section { | ||
|
||
&:nth-child(2), | ||
&:nth-child(3), | ||
&:nth-child(5) { | ||
border-left: 0; | ||
border-bottom-left-radius: unset; | ||
border-top-left-radius: unset; | ||
} | ||
} | ||
} | ||
|
||
:host[dir=ltr] { | ||
section { | ||
&::after { | ||
right: unset; | ||
left: 1ch; | ||
} | ||
|
||
&:nth-child(2), | ||
&:nth-child(3), | ||
&:nth-child(5) { | ||
border-right: 0; | ||
border-top-right-radius: unset; | ||
border-bottom-right-radius: unset; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-manga-page-even', | ||
templateUrl: './manga-page-even.component.html', | ||
styleUrl: './manga-page-even.component.scss' | ||
}) | ||
export class MangaPageEvenComponent { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<section> | ||
<ng-content select="[frame=1]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=2]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=3]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=4]"></ng-content> | ||
</section> | ||
<section> | ||
<ng-content select="[frame=5]"></ng-content> | ||
</section> | ||
<!-- <section> | ||
<ng-content select="[frame=6]"></ng-content> | ||
</section> --> |
Oops, something went wrong.