Merge pull request #582 from adityachandelgit/develop
Merge Develop into Master for Release
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 121 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 274 B |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 918 B |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg width="577" height="126" viewBox="0 0 577 126" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M189.08 83.28C191.107 83.6 192.947 84.4267 194.6 85.76C196.307 87.0933 197.64 88.7467 198.6 90.72C199.613 92.6933 200.12 94.8 200.12 97.04C200.12 99.8667 199.4 102.427 197.96 104.72C196.52 106.96 194.413 108.747 191.64 110.08C188.92 111.36 185.693 112 181.96 112H161.16V56.24H181.16C184.947 56.24 188.173 56.88 190.84 58.16C193.507 59.3867 195.507 61.0667 196.84 63.2C198.173 65.3333 198.84 67.7333 198.84 70.4C198.84 73.7067 197.933 76.4533 196.12 78.64C194.36 80.7733 192.013 82.32 189.08 83.28ZM168.44 80.32H180.68C184.093 80.32 186.733 79.52 188.6 77.92C190.467 76.32 191.4 74.1067 191.4 71.28C191.4 68.4533 190.467 66.24 188.6 64.64C186.733 63.04 184.04 62.24 180.52 62.24H168.44V80.32ZM181.32 106C184.947 106 187.773 105.147 189.8 103.44C191.827 101.733 192.84 99.36 192.84 96.32C192.84 93.2267 191.773 90.8 189.64 89.04C187.507 87.2267 184.653 86.32 181.08 86.32H168.44V106H181.32ZM229.343 112.72C225.236 112.72 221.503 111.787 218.143 109.92C214.836 108.053 212.223 105.413 210.303 102C208.436 98.5333 207.503 94.5333 207.503 90C207.503 85.52 208.463 81.5733 210.383 78.16C212.356 74.6933 215.023 72.0533 218.383 70.24C221.743 68.3733 225.503 67.44 229.663 67.44C233.823 67.44 237.583 68.3733 240.943 70.24C244.303 72.0533 246.943 74.6667 248.863 78.08C250.836 81.4933 251.823 85.4667 251.823 90C251.823 94.5333 250.809 98.5333 248.783 102C246.809 105.413 244.116 108.053 240.703 109.92C237.289 111.787 233.503 112.72 229.343 112.72ZM229.343 106.32C231.956 106.32 234.409 105.707 236.703 104.48C238.996 103.253 240.836 101.413 242.223 98.96C243.663 96.5067 244.383 93.52 244.383 90C244.383 86.48 243.689 83.4933 242.303 81.04C240.916 78.5867 239.103 76.7733 236.863 75.6C234.623 74.3733 232.196 73.76 229.583 73.76C226.916 73.76 224.463 74.3733 222.223 75.6C220.036 76.7733 218.276 78.5867 216.943 81.04C215.609 83.4933 214.943 86.48 214.943 90C214.943 93.5733 215.583 96.5867 216.863 99.04C218.196 101.493 219.956 103.333 222.143 104.56C224.329 105.733 226.729 106.32 229.343 106.32ZM280.514 112.72C276.408 112.72 272.674 111.787 269.314 109.92C266.008 108.053 263.394 105.413 261.474 102C259.608 98.5333 258.674 94.5333 258.674 90C258.674 85.52 259.634 81.5733 261.554 78.16C263.528 74.6933 266.194 72.0533 269.554 70.24C272.914 68.3733 276.674 67.44 280.834 67.44C284.994 67.44 288.754 68.3733 292.114 70.24C295.474 72.0533 298.114 74.6667 300.034 78.08C302.008 81.4933 302.994 85.4667 302.994 90C302.994 94.5333 301.981 98.5333 299.954 102C297.981 105.413 295.288 108.053 291.874 109.92C288.461 111.787 284.674 112.72 280.514 112.72ZM280.514 106.32C283.128 106.32 285.581 105.707 287.874 104.48C290.168 103.253 292.008 101.413 293.394 98.96C294.834 96.5067 295.554 93.52 295.554 90C295.554 86.48 294.861 83.4933 293.474 81.04C292.088 78.5867 290.274 76.7733 288.034 75.6C285.794 74.3733 283.368 73.76 280.754 73.76C278.088 73.76 275.634 74.3733 273.394 75.6C271.208 76.7733 269.448 78.5867 268.114 81.04C266.781 83.4933 266.114 86.48 266.114 90C266.114 93.5733 266.754 96.5867 268.034 99.04C269.368 101.493 271.128 103.333 273.314 104.56C275.501 105.733 277.901 106.32 280.514 106.32ZM337.046 112L319.846 92.64V112H312.566V52.8H319.846V87.6L336.726 68.16H346.886L326.246 90L346.966 112H337.046Z" fill="white"/>
|
||||
<path d="M361.018 52.8V112H353.738V52.8H361.018ZM392.546 112.72C388.439 112.72 384.706 111.787 381.346 109.92C378.039 108.053 375.426 105.413 373.506 102C371.639 98.5333 370.706 94.5333 370.706 90C370.706 85.52 371.666 81.5733 373.586 78.16C375.559 74.6933 378.226 72.0533 381.586 70.24C384.946 68.3733 388.706 67.44 392.866 67.44C397.026 67.44 400.786 68.3733 404.146 70.24C407.506 72.0533 410.146 74.6667 412.066 78.08C414.039 81.4933 415.026 85.4667 415.026 90C415.026 94.5333 414.012 98.5333 411.986 102C410.012 105.413 407.319 108.053 403.906 109.92C400.492 111.787 396.706 112.72 392.546 112.72ZM392.546 106.32C395.159 106.32 397.612 105.707 399.906 104.48C402.199 103.253 404.039 101.413 405.426 98.96C406.866 96.5067 407.586 93.52 407.586 90C407.586 86.48 406.892 83.4933 405.506 81.04C404.119 78.5867 402.306 76.7733 400.066 75.6C397.826 74.3733 395.399 73.76 392.786 73.76C390.119 73.76 387.666 74.3733 385.426 75.6C383.239 76.7733 381.479 78.5867 380.146 81.04C378.812 83.4933 378.146 86.48 378.146 90C378.146 93.5733 378.786 96.5867 380.066 99.04C381.399 101.493 383.159 103.333 385.346 104.56C387.532 105.733 389.932 106.32 392.546 106.32ZM431.878 75.28C433.158 72.7733 434.971 70.8267 437.318 69.44C439.718 68.0533 442.624 67.36 446.038 67.36V74.88H444.118C435.958 74.88 431.878 79.3067 431.878 88.16V112H424.598V68.16H431.878V75.28ZM494.441 88.4C494.441 89.7867 494.361 91.2533 494.201 92.8H459.161C459.428 97.12 460.895 100.507 463.561 102.96C466.281 105.36 469.561 106.56 473.401 106.56C476.548 106.56 479.161 105.84 481.241 104.4C483.375 102.907 484.868 100.933 485.721 98.48H493.561C492.388 102.693 490.041 106.133 486.521 108.8C483.001 111.413 478.628 112.72 473.401 112.72C469.241 112.72 465.508 111.787 462.201 109.92C458.948 108.053 456.388 105.413 454.521 102C452.655 98.5333 451.721 94.5333 451.721 90C451.721 85.4667 452.628 81.4933 454.441 78.08C456.255 74.6667 458.788 72.0533 462.041 70.24C465.348 68.3733 469.135 67.44 473.401 67.44C477.561 67.44 481.241 68.3467 484.441 70.16C487.641 71.9733 490.095 74.48 491.801 77.68C493.561 80.8267 494.441 84.4 494.441 88.4ZM486.921 86.88C486.921 84.1067 486.308 81.7333 485.081 79.76C483.855 77.7333 482.175 76.2133 480.041 75.2C477.961 74.1333 475.641 73.6 473.081 73.6C469.401 73.6 466.255 74.7733 463.641 77.12C461.081 79.4667 459.615 82.72 459.241 86.88H486.921Z" fill="#10B981"/>
|
||||
<path d="M59 4.79297C71.5051 11.5557 80 24.7854 80 40C80 40.5959 79.987 41.1888 79.9609 41.7783C79.8609 44.0406 81.7355 46 84 46C106.091 46 124 63.9086 124 86C124 108.091 106.091 126 84 126H10C4.47715 126 0 121.523 0 116V39.0068L0.0126953 38.9941C0.357624 25.0252 7.86506 12.8347 19 5.95215V63.832C19 64.8345 20.0676 65.4391 20.9121 64.9902L21.0771 64.8867L38.2227 52.3428C38.6819 52.0068 39.3064 52.0068 39.7656 52.3428L56.9229 64.8945L57.0879 64.998C57.9324 65.447 59 64.8423 59 63.8398V4.79297Z" fill="#10B981"/>
|
||||
<path d="M40 0C43.8745 0 47.6199 0.552381 51.1631 1.58008V50.9697L44.3926 46.0176L44.0879 45.8037C40.9061 43.6679 36.7098 43.7393 33.5957 46.0176L26.8369 50.9619V2.21875C30.9593 0.782634 35.3881 0 40 0Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,4 @@
|
||||
<svg width="126" height="126" viewBox="0 0 126 126" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M59 4.79297C71.5051 11.5557 80 24.7854 80 40C80 40.5959 79.987 41.1888 79.9609 41.7783C79.8609 44.0406 81.7355 46 84 46C106.091 46 124 63.9086 124 86C124 108.091 106.091 126 84 126H10C4.47715 126 0 121.523 0 116V39.0068L0.0126953 38.9941C0.357624 25.0252 7.86506 12.8347 19 5.95215V63.832C19 64.8345 20.0676 65.4391 20.9121 64.9902L21.0771 64.8867L38.2227 52.3428C38.6819 52.0068 39.3064 52.0068 39.7656 52.3428L56.9229 64.8945L57.0879 64.998C57.9324 65.447 59 64.8423 59 63.8398V4.79297Z" fill="#818cf8"/>
|
||||
<path d="M40 0C43.8745 0 47.6199 0.552381 51.1631 1.58008V50.9697L44.3926 46.0176L44.0879 45.8037C40.9061 43.6679 36.7098 43.7393 33.5957 46.0176L26.8369 50.9619V2.21875C30.9593 0.782634 35.3881 0 40 0Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 842 B |
@@ -93,7 +93,9 @@ public class BookLoreUser {
|
||||
public static class EpubReaderSetting {
|
||||
private String theme;
|
||||
private String font;
|
||||
private int fontSize;
|
||||
private Integer fontSize;
|
||||
private Float letterSpacing;
|
||||
private Float lineHeight;
|
||||
private String flow;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,4 +11,6 @@ public class EpubViewerPreferences {
|
||||
private String font;
|
||||
private String flow;
|
||||
private Integer fontSize;
|
||||
private Float letterSpacing;
|
||||
private Float lineHeight;
|
||||
}
|
||||
@@ -33,6 +33,12 @@ public class EpubViewerPreferencesEntity {
|
||||
@Column(name = "font_size")
|
||||
private Integer fontSize;
|
||||
|
||||
@Column(name = "letter_spacing")
|
||||
private Float letterSpacing;
|
||||
|
||||
@Column(name = "line_height")
|
||||
private Float lineHeight;
|
||||
|
||||
@Column(name = "flow")
|
||||
private String flow;
|
||||
}
|
||||
@@ -138,6 +138,8 @@ public class BookService {
|
||||
.fontSize(epubPref.getFontSize())
|
||||
.theme(epubPref.getTheme())
|
||||
.flow(epubPref.getFlow())
|
||||
.letterSpacing(epubPref.getLetterSpacing())
|
||||
.lineHeight(epubPref.getLineHeight())
|
||||
.build()));
|
||||
} else if (bookEntity.getBookType() == BookFileType.PDF) {
|
||||
pdfViewerPreferencesRepository.findByBookIdAndUserId(bookId, user.getId())
|
||||
@@ -215,6 +217,8 @@ public class BookService {
|
||||
epubPrefs.setFontSize(epubSettings.getFontSize());
|
||||
epubPrefs.setTheme(epubSettings.getTheme());
|
||||
epubPrefs.setFlow(epubSettings.getFlow());
|
||||
epubPrefs.setLetterSpacing(epubSettings.getLetterSpacing());
|
||||
epubPrefs.setLineHeight(epubSettings.getLineHeight());
|
||||
epubViewerPreferencesRepository.save(epubPrefs);
|
||||
|
||||
} else if (bookEntity.getBookType() == BookFileType.CBX) {
|
||||
|
||||
@@ -62,8 +62,10 @@ public class DefaultUserSettingsProvider {
|
||||
private BookLoreUser.UserSettings.EpubReaderSetting buildDefaultEpubReaderSetting() {
|
||||
return BookLoreUser.UserSettings.EpubReaderSetting.builder()
|
||||
.theme("white")
|
||||
.font("serif")
|
||||
.fontSize(150)
|
||||
.font(null)
|
||||
.fontSize(100)
|
||||
.letterSpacing(null)
|
||||
.lineHeight(null)
|
||||
.flow("paginated")
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE epub_viewer_preference
|
||||
ADD COLUMN letter_spacing FLOAT NULL,
|
||||
ADD COLUMN line_height FLOAT NULL;
|
||||
@@ -33,7 +33,6 @@
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"inlineStyleLanguage": "scss",
|
||||
"assets": [
|
||||
"src/favicon.ico",
|
||||
"src/assets",
|
||||
{
|
||||
"glob": "**/*",
|
||||
|
||||
@@ -146,7 +146,6 @@
|
||||
<p-button
|
||||
class="pr-2"
|
||||
icon="pi pi-chevron-right"
|
||||
size="large"
|
||||
[outlined]="true"
|
||||
[rounded]="true"
|
||||
(click)="toggleFilterSidebar()"
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
.virtual-scroller {
|
||||
width: 100%;
|
||||
height: calc(100vh - 11.5rem);
|
||||
height: calc(100vh - 10.9rem);
|
||||
padding: 1rem;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -131,9 +131,9 @@
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
height: 5px;
|
||||
z-index: 1;
|
||||
opacity: 0.8;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.series-number-overlay {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@if (showFilters) {
|
||||
<div class="w-[225px] ml-4 h-[calc(100vh-6.5rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
||||
<div class="w-[225px] ml-4 h-[calc(100vh-6.1rem)] rounded-xl bg-[var(--card-background)] overflow-hidden">
|
||||
<div class="flex items-center justify-between px-4 py-4">
|
||||
<span class="text font-semibold">Filter Mode</span>
|
||||
<p-selectButton
|
||||
|
||||
@@ -30,23 +30,106 @@
|
||||
<div>
|
||||
<p-button size="small" class="settings-toggle-button" (click)="toggleSettingsDrawer()" icon="pi pi-cog" severity="secondary"></p-button>
|
||||
<p-drawer [(visible)]="isSettingsDrawerVisible" [modal]="false" [position]="'right'" header="Settings">
|
||||
<div class="flex flex-col">
|
||||
<div class="settings-content">
|
||||
<p>Font Size: {{ fontSize }}%</p>
|
||||
<div class="flex flex-row gap-4">
|
||||
<p-button icon="pi pi-minus" (click)="decreaseFontSize()" severity="info"></p-button>
|
||||
<p-button icon="pi pi-plus" (click)="increaseFontSize()" severity="info"></p-button>
|
||||
<div class="flex flex-col gap-4 max-w-md mx-auto">
|
||||
|
||||
<div class="flex items-center gap-4">
|
||||
<span class="font-semibold text-gray-700 dark:text-gray-200">Font Size:</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<p-button size="small" icon="pi pi-minus" (click)="decreaseFontSize()" severity="info"></p-button>
|
||||
<span class="text-gray-800 dark:text-gray-100">{{ fontSize }}%</span>
|
||||
<p-button size="small" icon="pi pi-plus" (click)="increaseFontSize()" severity="info"></p-button>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
<label for="font-type">Font Type:</label>
|
||||
<p-select id="font-type" [options]="fontTypes" [(ngModel)]="selectedFontType" (onChange)="changeFontType()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="theme">Theme:</label>
|
||||
<p-select id="theme" [options]="themes" [(ngModel)]="selectedTheme" (onChange)="changeThemes()"></p-select>
|
||||
<p-divider></p-divider>
|
||||
<label for="flow">Flow:</label>
|
||||
<p-select id="flow" [options]="flows" [(ngModel)]="selectedFlow" (onChange)="changeScrollMode()"></p-select>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="font-type" class="block font-semibold text-gray-700 dark:text-gray-200">Font:</label>
|
||||
<p-select
|
||||
id="font-type"
|
||||
[options]="fontTypes"
|
||||
[(ngModel)]="selectedFontType"
|
||||
(onChange)="changeFontType()"
|
||||
class="w-full"
|
||||
placeholder="Select font type">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex gap-2 items-center">
|
||||
<label class="block font-semibold text-gray-700 dark:text-gray-200">Theme:</label>
|
||||
<div class="flex gap-3 mt-1" role="radiogroup" aria-label="Theme selection">
|
||||
@for (theme of themes; track theme) {
|
||||
<button
|
||||
type="button"
|
||||
class="w-8 h-8 rounded-full border-2 transition-all"
|
||||
[class.border-blue-600]="selectedTheme === theme.value"
|
||||
[style.background-color]="getThemeColor(theme.value)"
|
||||
(click)="selectTheme(theme.value)"
|
||||
[attr.aria-pressed]="selectedTheme === theme.value"
|
||||
[attr.aria-label]="theme.label">
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<label id="flow-label" class="block font-semibold text-gray-700 dark:text-gray-200">Flow:</label>
|
||||
<div class="flex gap-4" role="radiogroup" aria-labelledby="flow-label">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<p-radioButton
|
||||
name="flow"
|
||||
[value]="'paginated'"
|
||||
[(ngModel)]="selectedFlow"
|
||||
(onClick)="changeScrollMode()"
|
||||
inputId="flow-paginated">
|
||||
</p-radioButton>
|
||||
<label for="flow-paginated" class="cursor-pointer select-none text-gray-700 dark:text-gray-200">Paginated</label>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5">
|
||||
<p-radioButton
|
||||
name="flow"
|
||||
[value]="'scrolled'"
|
||||
[(ngModel)]="selectedFlow"
|
||||
(onClick)="changeScrollMode()"
|
||||
inputId="flow-scrolled">
|
||||
</p-radioButton>
|
||||
<label for="flow-scrolled" class="cursor-pointer select-none text-gray-700 dark:text-gray-200">Scrolled</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div>
|
||||
<label class="block mb-1 font-semibold text-gray-700 dark:text-gray-200 pb-2">Line Height: {{ lineHeight }}</label>
|
||||
<p-slider
|
||||
[(ngModel)]="lineHeight"
|
||||
[min]="1"
|
||||
[max]="2.5"
|
||||
[step]="0.1"
|
||||
(onSlideEnd)="updateThemeStyle()"
|
||||
class="w-full"
|
||||
aria-label="Line Height">
|
||||
</p-slider>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block mb-1 font-semibold text-gray-700 dark:text-gray-200 pb-2 pt-2">Letter Spacing: {{ letterSpacing }}em</label>
|
||||
<p-slider
|
||||
[(ngModel)]="letterSpacing"
|
||||
[min]="0"
|
||||
[max]="0.2"
|
||||
[step]="0.01"
|
||||
(onSlideEnd)="updateThemeStyle()"
|
||||
class="w-full"
|
||||
aria-label="Letter Spacing">
|
||||
</p-slider>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</p-drawer>
|
||||
</div>
|
||||
|
||||
@@ -95,26 +95,11 @@
|
||||
background-color: var(--card-background);
|
||||
}
|
||||
|
||||
.settings-content {
|
||||
padding: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.settings-content label {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.settings-content input[type="range"] {
|
||||
width: 100%;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.location-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 0.5rem;
|
||||
|
||||
.dot {
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
@@ -136,3 +121,7 @@
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
::ng-deep .p-divider.p-divider-horizontal {
|
||||
margin: 0.25rem 0 0.5rem 0 !important;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import {Component, ElementRef, inject, OnDestroy, OnInit, ViewChild} from '@angular/core';
|
||||
import ePub, {EpubCFI} from 'epubjs';
|
||||
import ePub from 'epubjs';
|
||||
import {Drawer} from 'primeng/drawer';
|
||||
import {Button} from 'primeng/button';
|
||||
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {Book, BookSetting} from '../../../model/book.model';
|
||||
import {BookService} from '../../../service/book.service';
|
||||
@@ -14,59 +13,17 @@ import {UserService} from '../../../../settings/user-management/user.service';
|
||||
import {ProgressSpinner} from 'primeng/progressspinner';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
|
||||
const FALLBACK_EPUB_SETTINGS = {
|
||||
fontSize: 150,
|
||||
fontType: 'serif',
|
||||
theme: 'white',
|
||||
flow: 'paginated',
|
||||
maxFontSize: 300,
|
||||
minFontSize: 50,
|
||||
};
|
||||
|
||||
function flatten(chapters: any) {
|
||||
return [].concat.apply([], chapters.map((chapter: any) => [].concat.apply([chapter], flatten(chapter.subitems))));
|
||||
}
|
||||
|
||||
export function getCfiFromHref(book: any, href: string): string | null {
|
||||
const [_, id] = href.split('#');
|
||||
const section = book.spine.get(href);
|
||||
|
||||
if (!section || !section.document) {
|
||||
console.warn('Section or section.document is undefined for href:', href);
|
||||
return null;
|
||||
}
|
||||
|
||||
const el = id ? section.document.getElementById(id) : section.document.body;
|
||||
if (!el) {
|
||||
console.warn('Element not found in section.document for href:', href);
|
||||
return null;
|
||||
}
|
||||
|
||||
return section.cfiFromElement(el);
|
||||
}
|
||||
|
||||
export function getChapter(book: any, location: any) {
|
||||
const locationHref = location.start.href;
|
||||
return flatten(book.navigation.toc)
|
||||
.filter((chapter: any) => {
|
||||
return book.canonical(chapter.href).includes(book.canonical(locationHref));
|
||||
})
|
||||
.reduce((result: any | null, chapter: any) => {
|
||||
const chapterCfi = getCfiFromHref(book, chapter.href);
|
||||
if (!chapterCfi) {
|
||||
return result;
|
||||
}
|
||||
const locationAfterChapter = EpubCFI.prototype.compare(location.start.cfi, chapterCfi) > 0;
|
||||
return locationAfterChapter ? chapter : result;
|
||||
}, null);
|
||||
}
|
||||
import {Slider} from 'primeng/slider';
|
||||
import {FALLBACK_EPUB_SETTINGS, getChapter} from '../epub-reader-helper';
|
||||
import {EpubThemeUtil} from '../epub-theme-util';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {Divider} from 'primeng/divider';
|
||||
|
||||
@Component({
|
||||
selector: 'app-epub-viewer',
|
||||
templateUrl: './epub-viewer.component.html',
|
||||
styleUrls: ['./epub-viewer.component.scss'],
|
||||
imports: [Drawer, Button, FormsModule, Divider, Select, ProgressSpinner, Tooltip],
|
||||
imports: [Drawer, Button, FormsModule, Select, ProgressSpinner, Tooltip, Slider, RadioButton, Divider],
|
||||
standalone: true
|
||||
})
|
||||
export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
@@ -87,10 +44,15 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
private keyListener: (e: KeyboardEvent) => void = () => {
|
||||
};
|
||||
|
||||
fontSize = FALLBACK_EPUB_SETTINGS.fontSize;
|
||||
fontSize?: number = 100;
|
||||
selectedFlow?: string = 'paginated';
|
||||
selectedTheme?: string = 'white';
|
||||
selectedFontType?: string | null = null;
|
||||
lineHeight?: number;
|
||||
letterSpacing?: number;
|
||||
|
||||
selectedFontType = FALLBACK_EPUB_SETTINGS.fontType;
|
||||
fontTypes: any[] = [
|
||||
{label: "Book's Internal", value: null},
|
||||
{label: 'Serif', value: 'serif'},
|
||||
{label: 'Sans Serif', value: 'sans-serif'},
|
||||
{label: 'Roboto', value: 'roboto'},
|
||||
@@ -98,7 +60,6 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
{label: 'Monospace', value: 'monospace'},
|
||||
];
|
||||
|
||||
selectedTheme = FALLBACK_EPUB_SETTINGS.theme;
|
||||
themes: any[] = [
|
||||
{label: 'White', value: 'white'},
|
||||
{label: 'Black', value: 'black'},
|
||||
@@ -106,12 +67,6 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
{label: 'Sepia', value: 'sepia'},
|
||||
];
|
||||
|
||||
selectedFlow = FALLBACK_EPUB_SETTINGS.flow;
|
||||
flows: any[] = [
|
||||
{label: 'Scrolled', value: 'scrolled'},
|
||||
{label: 'Paginated', value: 'paginated'}
|
||||
];
|
||||
|
||||
private route = inject(ActivatedRoute);
|
||||
private userService = inject(UserService);
|
||||
private bookService = inject(BookService);
|
||||
@@ -130,13 +85,9 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
const bookSetting$ = this.bookService.getBookSetting(bookId);
|
||||
|
||||
forkJoin([myself$, epub$, epubData$, bookSetting$]).subscribe({
|
||||
next: (results) => {
|
||||
const myself = results[0];
|
||||
const epub = results[1];
|
||||
const epubData = results[2];
|
||||
const individualSetting = results[3]?.epubSettings;
|
||||
|
||||
next: ([myself, epub, epubData, bookSetting]) => {
|
||||
this.epub = epub;
|
||||
const individualSetting = bookSetting?.epubSettings;
|
||||
const fileReader = new FileReader();
|
||||
|
||||
fileReader.onload = () => {
|
||||
@@ -149,44 +100,55 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
}));
|
||||
});
|
||||
|
||||
let globalOrIndividual = myself.userSettings.perBookSetting.epub;
|
||||
const settingScope = myself.userSettings.perBookSetting.epub;
|
||||
const globalSettings = myself.userSettings.epubReaderSetting;
|
||||
|
||||
const flow = globalOrIndividual === 'Global'
|
||||
? myself.userSettings.epubReaderSetting.flow || 'paginated'
|
||||
: individualSetting?.flow || myself.userSettings.epubReaderSetting.flow || 'paginated';
|
||||
const resolvedFlow = settingScope === 'Global' ? globalSettings.flow : individualSetting?.flow;
|
||||
const resolvedFontSize = settingScope === 'Global' ? globalSettings.fontSize : individualSetting?.fontSize;
|
||||
const resolvedFontFamily = settingScope === 'Global' ? globalSettings.font : individualSetting?.font;
|
||||
const resolvedTheme = settingScope === 'Global' ? globalSettings.theme : individualSetting?.theme;
|
||||
const resolvedLineHeight = settingScope === 'Global' ? globalSettings.lineHeight : individualSetting?.lineHeight;
|
||||
const resolvedLetterSpacing = settingScope === 'Global' ? globalSettings.letterSpacing : individualSetting?.letterSpacing;
|
||||
|
||||
if (resolvedTheme != null) this.selectedTheme = resolvedTheme;
|
||||
if (resolvedFontFamily != null) this.selectedFontType = resolvedFontFamily;
|
||||
if (resolvedFontSize != null) this.fontSize = resolvedFontSize;
|
||||
if (resolvedLineHeight != null) this.lineHeight = resolvedLineHeight;
|
||||
if (resolvedLetterSpacing != null) this.letterSpacing = resolvedLetterSpacing;
|
||||
if (resolvedFlow != null) this.selectedFlow = resolvedFlow;
|
||||
|
||||
this.rendition = this.book.renderTo(this.epubContainer.nativeElement, {
|
||||
flow,
|
||||
manager: flow === 'scrolled' ? 'continuous' : 'default',
|
||||
flow: this.selectedFlow ?? 'paginated',
|
||||
manager: this.selectedFlow === 'scrolled' ? 'continuous' : 'default',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
allowScriptedContent: true,
|
||||
});
|
||||
|
||||
const baseTheme = EpubThemeUtil.themesMap.get(this.selectedTheme ?? 'black') || {};
|
||||
const combinedTheme = {
|
||||
...baseTheme,
|
||||
body: {
|
||||
...baseTheme.body,
|
||||
...(this.selectedFontType ? {'font-family': this.selectedFontType} : {}),
|
||||
...(this.fontSize != null ? {'font-size': `${this.fontSize}%`} : {}),
|
||||
...(this.lineHeight != null ? {'line-height': this.lineHeight} : {}),
|
||||
...(this.letterSpacing != null ? {'letter-spacing': `${this.letterSpacing}em`} : {}),
|
||||
},
|
||||
'*': {
|
||||
...baseTheme['*'],
|
||||
...(this.lineHeight != null ? {'line-height': this.lineHeight} : {}),
|
||||
...(this.letterSpacing != null ? {'letter-spacing': `${this.letterSpacing}em`} : {}),
|
||||
},
|
||||
};
|
||||
|
||||
this.rendition.themes.register('custom', combinedTheme);
|
||||
this.rendition.themes.select('custom');
|
||||
|
||||
const displayPromise = this.epub?.epubProgress?.cfi
|
||||
? this.rendition.display(this.epub.epubProgress.cfi)
|
||||
: this.rendition.display();
|
||||
|
||||
this.themesMap.forEach((theme, name) => {
|
||||
this.rendition.themes.register(name, theme);
|
||||
});
|
||||
|
||||
if (globalOrIndividual === 'Global') {
|
||||
this.selectedTheme = myself.userSettings.epubReaderSetting.theme || FALLBACK_EPUB_SETTINGS.theme;
|
||||
this.selectedFontType = myself.userSettings.epubReaderSetting.font || FALLBACK_EPUB_SETTINGS.fontType;
|
||||
this.fontSize = myself.userSettings.epubReaderSetting.fontSize || FALLBACK_EPUB_SETTINGS.fontSize;
|
||||
this.selectedFlow = myself.userSettings.epubReaderSetting.flow || FALLBACK_EPUB_SETTINGS.flow;
|
||||
} else {
|
||||
this.selectedTheme = individualSetting?.theme || myself.userSettings.epubReaderSetting.theme || FALLBACK_EPUB_SETTINGS.theme;
|
||||
this.selectedFontType = individualSetting?.font || myself.userSettings.epubReaderSetting.font || FALLBACK_EPUB_SETTINGS.fontType;
|
||||
this.fontSize = individualSetting?.fontSize || myself.userSettings.epubReaderSetting.fontSize || FALLBACK_EPUB_SETTINGS.fontSize;
|
||||
this.selectedFlow = individualSetting?.flow || myself.userSettings.epubReaderSetting.flow || FALLBACK_EPUB_SETTINGS.flow;
|
||||
}
|
||||
|
||||
this.rendition.themes.select(this.selectedTheme);
|
||||
this.rendition.themes.fontSize(`${this.fontSize}%`);
|
||||
this.rendition.themes.font(this.selectedFontType);
|
||||
|
||||
displayPromise.then(() => {
|
||||
this.setupKeyListener();
|
||||
this.trackProgress();
|
||||
@@ -197,13 +159,22 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
fileReader.readAsArrayBuffer(epubData);
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to load the book'});
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: 'Failed to load the book',
|
||||
});
|
||||
this.isLoading = false;
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
updateThemeStyle(): void {
|
||||
this.applyCombinedTheme();
|
||||
this.updateViewerSetting();
|
||||
}
|
||||
|
||||
changeScrollMode(): void {
|
||||
if (!this.rendition || !this.book) return;
|
||||
|
||||
@@ -218,10 +189,7 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
allowScriptedContent: true,
|
||||
});
|
||||
|
||||
this.themesMap.forEach((theme, name) => this.rendition.themes.register(name, theme));
|
||||
this.rendition.themes.select(this.selectedTheme);
|
||||
this.rendition.themes.font(this.selectedFontType);
|
||||
this.rendition.themes.fontSize(`${this.fontSize}%`);
|
||||
this.applyCombinedTheme();
|
||||
|
||||
this.setupKeyListener();
|
||||
this.rendition.display(cfi || undefined);
|
||||
@@ -229,12 +197,19 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
changeThemes(): void {
|
||||
if (this.rendition) {
|
||||
this.rendition.themes.select(this.selectedTheme);
|
||||
this.rendition.clear();
|
||||
this.rendition.start();
|
||||
this.updateViewerSetting();
|
||||
}
|
||||
this.applyCombinedTheme();
|
||||
this.updateViewerSetting();
|
||||
}
|
||||
|
||||
private applyCombinedTheme(): void {
|
||||
EpubThemeUtil.applyTheme(
|
||||
this.rendition,
|
||||
this.selectedTheme ?? 'white',
|
||||
this.selectedFontType ?? undefined,
|
||||
this.fontSize,
|
||||
this.lineHeight,
|
||||
this.letterSpacing
|
||||
);
|
||||
}
|
||||
|
||||
updateFontSize(): void {
|
||||
@@ -246,7 +221,11 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
|
||||
changeFontType(): void {
|
||||
if (this.rendition) {
|
||||
this.rendition.themes.font(this.selectedFontType);
|
||||
if (this.selectedFontType) {
|
||||
this.rendition.themes.font(this.selectedFontType);
|
||||
} else {
|
||||
this.rendition.themes.font('');
|
||||
}
|
||||
this.updateViewerSetting();
|
||||
}
|
||||
}
|
||||
@@ -262,14 +241,19 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private updateViewerSetting(): void {
|
||||
const epubSettings: any = {};
|
||||
|
||||
if (this.selectedTheme) epubSettings.theme = this.selectedTheme;
|
||||
if (this.selectedFontType) epubSettings.font = this.selectedFontType;
|
||||
if (this.fontSize) epubSettings.fontSize = this.fontSize;
|
||||
if (this.selectedFlow) epubSettings.flow = this.selectedFlow;
|
||||
if (this.lineHeight) epubSettings.lineHeight = this.lineHeight;
|
||||
if (this.letterSpacing) epubSettings.letterSpacing = this.letterSpacing;
|
||||
|
||||
const bookSetting: BookSetting = {
|
||||
epubSettings: {
|
||||
theme: this.selectedTheme,
|
||||
font: this.selectedFontType,
|
||||
fontSize: this.fontSize,
|
||||
flow: this.selectedFlow
|
||||
}
|
||||
}
|
||||
epubSettings: epubSettings
|
||||
};
|
||||
|
||||
this.bookService.updateViewerSetting(bookSetting, this.epub.id).subscribe();
|
||||
}
|
||||
|
||||
@@ -351,57 +335,23 @@ export class EpubViewerComponent implements OnInit, OnDestroy {
|
||||
document.removeEventListener('keyup', this.keyListener);
|
||||
}
|
||||
|
||||
themesMap = new Map<string, any>([
|
||||
[
|
||||
'black', {
|
||||
"body": {"background-color": "#000000", "color": "#f9f9f9"},
|
||||
"p": {"color": "#f9f9f9"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#f9f9f9"},
|
||||
"a": {"color": "#f9f9f9"},
|
||||
"img": {
|
||||
"-webkit-filter": "invert(1) hue-rotate(180deg)",
|
||||
"filter": "invert(1) hue-rotate(180deg)"
|
||||
},
|
||||
"code": {"color": "#00ff00", "background-color": "black"}
|
||||
getThemeColor(themeKey: string | undefined): string {
|
||||
switch (themeKey) {
|
||||
case 'white':
|
||||
return '#ffffff';
|
||||
case 'black':
|
||||
return '#000000';
|
||||
case 'grey':
|
||||
return '#808080';
|
||||
case 'sepia':
|
||||
return '#704214';
|
||||
default:
|
||||
return '#ffffff';
|
||||
}
|
||||
],
|
||||
[
|
||||
'sepia', {
|
||||
"body": {"background-color": "#f4ecd8", "color": "#6e4b3a"},
|
||||
"p": {"color": "#6e4b3a"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#6e4b3a"},
|
||||
"a": {"color": "#8b4513"},
|
||||
"img": {
|
||||
"-webkit-filter": "sepia(1) contrast(1.5)",
|
||||
"filter": "sepia(1) contrast(1.5)"
|
||||
},
|
||||
"code": {"color": "#8b0000", "background-color": "#f4ecd8"}
|
||||
}
|
||||
],
|
||||
[
|
||||
'white', {
|
||||
"body": {"background-color": "#ffffff", "color": "#000000"},
|
||||
"p": {"color": "#000000"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#000000"},
|
||||
"a": {"color": "#000000"},
|
||||
"img": {
|
||||
"-webkit-filter": "none",
|
||||
"filter": "none"
|
||||
},
|
||||
"code": {"color": "#d14", "background-color": "#f5f5f5"}
|
||||
}
|
||||
],
|
||||
[
|
||||
'grey', {
|
||||
"body": {"background-color": "#404040", "color": "#d3d3d3"},
|
||||
"p": {"color": "#d3d3d3"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#d3d3d3"},
|
||||
"a": {"color": "#1e90ff"},
|
||||
"img": {
|
||||
"filter": "none"
|
||||
},
|
||||
"code": {"color": "#d14", "background-color": "#585858"}
|
||||
}
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
selectTheme(themeKey: string): void {
|
||||
this.selectedTheme = themeKey;
|
||||
this.changeThemes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import {EpubCFI} from 'epubjs';
|
||||
|
||||
export const FALLBACK_EPUB_SETTINGS = {
|
||||
maxFontSize: 300,
|
||||
minFontSize: 50
|
||||
};
|
||||
|
||||
export function flatten(chapters: any) {
|
||||
return [].concat.apply([], chapters.map((chapter: any) => [].concat.apply([chapter], flatten(chapter.subitems))));
|
||||
}
|
||||
|
||||
export function getCfiFromHref(book: any, href: string): string | null {
|
||||
const [_, id] = href.split('#');
|
||||
const section = book.spine.get(href);
|
||||
|
||||
if (!section || !section.document) {
|
||||
console.warn('Section or section.document is undefined for href:', href);
|
||||
return null;
|
||||
}
|
||||
|
||||
const el = id ? section.document.getElementById(id) : section.document.body;
|
||||
if (!el) {
|
||||
console.warn('Element not found in section.document for href:', href);
|
||||
return null;
|
||||
}
|
||||
|
||||
return section.cfiFromElement(el);
|
||||
}
|
||||
|
||||
export function getChapter(book: any, location: any) {
|
||||
const locationHref = location.start.href;
|
||||
return flatten(book.navigation.toc)
|
||||
.filter((chapter: any) => {
|
||||
return book.canonical(chapter.href).includes(book.canonical(locationHref));
|
||||
})
|
||||
.reduce((result: any | null, chapter: any) => {
|
||||
const chapterCfi = getCfiFromHref(book, chapter.href);
|
||||
if (!chapterCfi) {
|
||||
return result;
|
||||
}
|
||||
const locationAfterChapter = EpubCFI.prototype.compare(location.start.cfi, chapterCfi) > 0;
|
||||
return locationAfterChapter ? chapter : result;
|
||||
}, null);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
export class EpubThemeUtil {
|
||||
static readonly themesMap = new Map<string, any>([
|
||||
['black', {
|
||||
"body": {"background-color": "#000000", "color": "#f9f9f9"},
|
||||
"p": {"color": "#f9f9f9"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#f9f9f9"},
|
||||
"a": {"color": "#f9f9f9"},
|
||||
"img": {"-webkit-filter": "invert(1) hue-rotate(180deg)", "filter": "invert(1) hue-rotate(180deg)"},
|
||||
"code": {"color": "#00ff00", "background-color": "black"}
|
||||
}],
|
||||
['sepia', {
|
||||
"body": {"background-color": "#f4ecd8", "color": "#6e4b3a"},
|
||||
"p": {"color": "#6e4b3a"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#6e4b3a"},
|
||||
"a": {"color": "#8b4513"},
|
||||
"img": {"-webkit-filter": "sepia(1) contrast(1.5)", "filter": "sepia(1) contrast(1.5)"},
|
||||
"code": {"color": "#8b0000", "background-color": "#f4ecd8"}
|
||||
}],
|
||||
['white', {
|
||||
"body": {"background-color": "#ffffff", "color": "#000000"},
|
||||
"p": {"color": "#000000"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#000000"},
|
||||
"a": {"color": "#000000"},
|
||||
"img": {"-webkit-filter": "none", "filter": "none"},
|
||||
"code": {"color": "#d14", "background-color": "#f5f5f5"}
|
||||
}],
|
||||
['grey', {
|
||||
"body": {"background-color": "#404040", "color": "#d3d3d3"},
|
||||
"p": {"color": "#d3d3d3"},
|
||||
"h1, h2, h3, h4, h5, h6": {"color": "#d3d3d3"},
|
||||
"a": {"color": "#1e90ff"},
|
||||
"img": {"filter": "none"},
|
||||
"code": {"color": "#d14", "background-color": "#585858"}
|
||||
}]
|
||||
]);
|
||||
|
||||
static applyTheme(rendition: any, themeKey: string, fontFamily?: string, fontSize?: number, lineHeight?: number, letterSpacing?: number): void {
|
||||
if (!rendition) return;
|
||||
|
||||
const baseTheme = this.themesMap.get(themeKey ?? 'black') ?? {};
|
||||
const combined = {
|
||||
...baseTheme,
|
||||
body: {
|
||||
...baseTheme.body,
|
||||
'font-family': fontFamily,
|
||||
'font-size': `${fontSize ?? 100}%`,
|
||||
'line-height': lineHeight,
|
||||
'letter-spacing': `${letterSpacing}em`
|
||||
},
|
||||
'*': {
|
||||
...baseTheme['*'],
|
||||
'line-height': lineHeight,
|
||||
'letter-spacing': `${letterSpacing}em`
|
||||
}
|
||||
};
|
||||
|
||||
rendition.themes.register('custom', combined);
|
||||
rendition.themes.select('custom');
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
@if (book$ | async; as book) {
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full">
|
||||
<form [formGroup]="metadataForm" (ngSubmit)="onSave()" class="flex flex-col h-full min-w-[80rem]">
|
||||
@if (isLoading) {
|
||||
<div class="absolute inset-0 bg-black opacity-25 z-10 "></div>
|
||||
}
|
||||
|
||||
@@ -110,6 +110,8 @@ export interface EpubViewerSetting {
|
||||
font: string;
|
||||
fontSize: number;
|
||||
flow: string;
|
||||
lineHeight: number;
|
||||
letterSpacing: number;
|
||||
}
|
||||
|
||||
export interface CbxViewerSetting {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<div class="layout-topbar">
|
||||
|
||||
<a class="layout-topbar-logo pl-3" routerLink="">
|
||||
<span class="flex items-center">
|
||||
<a class="layout-topbar-logo pl-5 pr-3 flex gap-2" routerLink="">
|
||||
<svg class="w-[1.875rem] h-[1.875rem] half-title" viewBox="0 0 126 126" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M59 4.79297C71.5051 11.5557 80 24.7854 80 40C80 40.5959 79.987 41.1888 79.9609 41.7783C79.8609 44.0406 81.7355 46 84 46C106.091 46 124 63.9086 124 86C124 108.091 106.091 126 84 126H10C4.47715 126 0 121.523 0 116V39.0068L0.0126953 38.9941C0.357624 25.0252 7.86506 12.8347 19 5.95215V63.832C19 64.8345 20.0676 65.4391 20.9121 64.9902L21.0771 64.8867L38.2227 52.3428C38.6819 52.0068 39.3064 52.0068 39.7656 52.3428L56.9229 64.8945L57.0879 64.998C57.9324 65.447 59 64.8423 59 63.8398V4.79297Z"/>
|
||||
<path d="M40 0C43.8745 0 47.6199 0.552381 51.1631 1.58008V50.9697L44.3926 46.0176L44.0879 45.8037C40.9061 43.6679 36.7098 43.7393 33.5957 46.0176L26.8369 50.9619V2.21875C30.9593 0.782634 35.3881 0 40 0Z" fill="white"/>
|
||||
</svg>
|
||||
<span class="flex items-center pt-2">
|
||||
<p>Book</p>
|
||||
<p class="half-title text-3xl">lore</p>
|
||||
</span>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<div class="p-4 pb-12">
|
||||
<p class="text-lg pb-6 pt-4 ">
|
||||
CBX Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Configure global PDF reading options such as page spread, zoom level, and sidebar visibility that apply to all PDFs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
<p class="py-1">Page Spread:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (spread of cbxSpreads; track spread) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="spread.key"
|
||||
name="spread"
|
||||
[value]="spread.key"
|
||||
[(ngModel)]="selectedCbxSpread">
|
||||
</p-radiobutton>
|
||||
<label [for]="spread.key">{{ spread.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">Page Zoom:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (mode of cbxViewModes; track mode) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="mode.key"
|
||||
name="zoom"
|
||||
[value]="mode.key"
|
||||
[(ngModel)]="selectedCbxViewMode">
|
||||
</p-radiobutton>
|
||||
<label [for]="mode.key">{{ mode.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,50 @@
|
||||
import {Component, inject, Input} from '@angular/core';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {CbxPageSpread, CbxPageViewMode} from '../../../book/model/book.model';
|
||||
import {UserSettings} from '../../user-management/user.service';
|
||||
import {ReaderPreferencesService} from '../reader-preferences-service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cbx-reader-preferences-component',
|
||||
imports: [
|
||||
RadioButton,
|
||||
Tooltip,
|
||||
FormsModule
|
||||
],
|
||||
templateUrl: './cbx-reader-preferences-component.html',
|
||||
styleUrl: './cbx-reader-preferences-component.scss'
|
||||
})
|
||||
export class CbxReaderPreferencesComponent {
|
||||
|
||||
@Input() userSettings!: UserSettings;
|
||||
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
readonly cbxSpreads = [
|
||||
{ name: 'Even', key: 'EVEN' },
|
||||
{ name: 'Odd', key: 'ODD' }
|
||||
];
|
||||
|
||||
readonly cbxViewModes = [
|
||||
{ name: 'Single Page', key: 'SINGLE_PAGE' },
|
||||
{ name: 'Two Page', key: 'TWO_PAGE' },
|
||||
];
|
||||
|
||||
get selectedCbxSpread(): CbxPageSpread {
|
||||
return this.userSettings.cbxReaderSetting.pageSpread;
|
||||
}
|
||||
set selectedCbxSpread(value: CbxPageSpread) {
|
||||
this.userSettings.cbxReaderSetting.pageSpread = value;
|
||||
this.readerPreferencesService.updatePreference(['cbxReaderSetting', 'pageSpread'], value);
|
||||
}
|
||||
|
||||
get selectedCbxViewMode(): CbxPageViewMode {
|
||||
return this.userSettings.cbxReaderSetting.pageViewMode;
|
||||
}
|
||||
set selectedCbxViewMode(value: CbxPageViewMode) {
|
||||
this.userSettings.cbxReaderSetting.pageViewMode = value;
|
||||
this.readerPreferencesService.updatePreference(['cbxReaderSetting', 'pageViewMode'], value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-6 pt-4">
|
||||
Epub Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Set global EPUB reader options such as themes, font families, font sizes, and spacing applied to all EPUBs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
|
||||
<p>Theme:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="themes"
|
||||
[(ngModel)]="selectedTheme"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Theme"
|
||||
class="w-full md:w-44">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p>Font:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="fonts"
|
||||
[(ngModel)]="selectedFont"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Font"
|
||||
class="w-full md:w-44">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p>Flow:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="flowOptions"
|
||||
[(ngModel)]="selectedFlow"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Flow"
|
||||
class="w-full md:w-44">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p class="py-1">Font Size:</p>
|
||||
<div class="flex gap-4 justify-start items-center">
|
||||
<p-button icon="pi pi-minus" size="small" (click)="decreaseFontSize()"></p-button>
|
||||
<p>{{ fontSize }}%</p>
|
||||
<p-button icon="pi pi-plus" size="small" (click)="increaseFontSize()"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,102 @@
|
||||
import {Component, inject, Input} from '@angular/core';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Select} from 'primeng/select';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {ReaderPreferencesService} from '../reader-preferences-service';
|
||||
import {UserSettings} from '../../user-management/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-epub-reader-preferences-component',
|
||||
imports: [
|
||||
Button,
|
||||
Select,
|
||||
Tooltip,
|
||||
FormsModule
|
||||
],
|
||||
templateUrl: './epub-reader-preferences-component.html',
|
||||
styleUrl: './epub-reader-preferences-component.scss'
|
||||
})
|
||||
export class EpubReaderPreferencesComponent {
|
||||
|
||||
@Input() userSettings!: UserSettings;
|
||||
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
readonly fonts = [
|
||||
{name: 'Book Default', key: null},
|
||||
{name: 'Serif', key: 'serif'},
|
||||
{name: 'Sans Serif', key: 'sans-serif'},
|
||||
{name: 'Roboto', key: 'roboto'},
|
||||
{name: 'Cursive', key: 'cursive'},
|
||||
{name: 'Monospace', key: 'monospace'}
|
||||
];
|
||||
|
||||
readonly flowOptions = [
|
||||
{name: 'Book Default', key: null},
|
||||
{name: 'Paginated', key: 'paginated'},
|
||||
{name: 'Scrolled', key: 'scrolled'}
|
||||
];
|
||||
|
||||
readonly themes = [
|
||||
{name: 'Book Default', key: null},
|
||||
{name: 'White', key: 'white'},
|
||||
{name: 'Black', key: 'black'},
|
||||
{name: 'Grey', key: 'grey'},
|
||||
{name: 'Sepia', key: 'sepia'}
|
||||
];
|
||||
|
||||
get selectedTheme(): string | null {
|
||||
return this.userSettings.epubReaderSetting.theme;
|
||||
}
|
||||
|
||||
set selectedTheme(value: string | null) {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.epubReaderSetting.theme = value;
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['epubReaderSetting', 'theme'], value);
|
||||
}
|
||||
|
||||
get selectedFont(): string | null {
|
||||
return this.userSettings.epubReaderSetting.font;
|
||||
}
|
||||
|
||||
set selectedFont(value: string | null) {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.epubReaderSetting.font = value;
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['epubReaderSetting', 'font'], value);
|
||||
}
|
||||
|
||||
get selectedFlow(): string | null {
|
||||
return this.userSettings.epubReaderSetting.flow;
|
||||
}
|
||||
|
||||
set selectedFlow(value: string | null) {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.epubReaderSetting.flow = value;
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['epubReaderSetting', 'flow'], value);
|
||||
}
|
||||
|
||||
get fontSize(): number {
|
||||
return this.userSettings.epubReaderSetting.fontSize;
|
||||
}
|
||||
|
||||
set fontSize(value: number) {
|
||||
this.userSettings.epubReaderSetting.fontSize = value;
|
||||
this.readerPreferencesService.updatePreference(['epubReaderSetting', 'fontSize'], value);
|
||||
}
|
||||
|
||||
increaseFontSize() {
|
||||
if (this.fontSize < 250) {
|
||||
this.fontSize += 10;
|
||||
}
|
||||
}
|
||||
|
||||
decreaseFontSize() {
|
||||
if (this.fontSize > 50) {
|
||||
this.fontSize -= 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-6 pt-4 ">
|
||||
PDF Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Configure global PDF reading options such as page spread, zoom level, and sidebar visibility that apply to all PDFs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
<p class="py-1">Page Spread:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (spread of spreads; track spread) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="spread.key"
|
||||
name="spread"
|
||||
[value]="spread.key"
|
||||
[(ngModel)]="selectedSpread">
|
||||
</p-radiobutton>
|
||||
<label [for]="spread.key">{{ spread.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">Page Zoom:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (zoom of zooms; track zoom) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="zoom.key"
|
||||
name="zoom"
|
||||
[value]="zoom.key"
|
||||
[(ngModel)]="selectedZoom">
|
||||
</p-radiobutton>
|
||||
<label [for]="zoom.key">{{ zoom.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,53 @@
|
||||
import {Component, inject, Input} from '@angular/core';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {ReaderPreferencesService} from '../reader-preferences-service';
|
||||
import {UserSettings} from '../../user-management/user.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-pdf-reader-preferences-component',
|
||||
imports: [
|
||||
RadioButton,
|
||||
FormsModule,
|
||||
Tooltip
|
||||
],
|
||||
templateUrl: './pdf-reader-preferences-component.html',
|
||||
styleUrl: './pdf-reader-preferences-component.scss'
|
||||
})
|
||||
export class PdfReaderPreferencesComponent {
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
@Input() userSettings!: UserSettings;
|
||||
|
||||
readonly spreads = [
|
||||
{name: 'Even', key: 'even'},
|
||||
{name: 'Odd', key: 'odd'},
|
||||
{name: 'None', key: 'off'}
|
||||
];
|
||||
|
||||
readonly zooms = [
|
||||
{name: 'Auto Zoom', key: 'auto'},
|
||||
{name: 'Page Fit', key: 'page-fit'},
|
||||
{name: 'Page Width', key: 'page-width'},
|
||||
{name: 'Actual Size', key: 'page-actual'}
|
||||
];
|
||||
|
||||
get selectedSpread(): 'even' | 'odd' | 'off' {
|
||||
return this.userSettings.pdfReaderSetting.pageSpread;
|
||||
}
|
||||
|
||||
set selectedSpread(value: 'even' | 'odd' | 'off') {
|
||||
this.userSettings.pdfReaderSetting.pageSpread = value;
|
||||
this.readerPreferencesService.updatePreference(['pdfReaderSetting', 'pageSpread'], value);
|
||||
}
|
||||
|
||||
get selectedZoom(): string {
|
||||
return this.userSettings.pdfReaderSetting.pageZoom;
|
||||
}
|
||||
|
||||
set selectedZoom(value: string) {
|
||||
this.userSettings.pdfReaderSetting.pageZoom = value;
|
||||
this.readerPreferencesService.updatePreference(['pdfReaderSetting', 'pageZoom'], value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {User, UserService, UserSettings} from '../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ReaderPreferencesService {
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly messageService = inject(MessageService);
|
||||
private currentUser: User | null = null;
|
||||
|
||||
constructor() {
|
||||
this.userService.userState$.subscribe(user => this.currentUser = user);
|
||||
}
|
||||
|
||||
updatePreference(path: string[], value: any): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target: any = this.currentUser.userSettings;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
const [rootKey] = path;
|
||||
const updatedValue = this.currentUser.userSettings[rootKey as keyof UserSettings];
|
||||
|
||||
this.userService.updateUserSetting(this.currentUser.id, rootKey, updatedValue);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Preferences Updated',
|
||||
detail: 'Your preferences have been saved successfully.',
|
||||
life: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
<div class="w-full h-[calc(100vh-12.1rem)] overflow-y-auto border rounded-lg enclosing-container">
|
||||
|
||||
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-4 pt-4 ">
|
||||
Book Reader Settings: Global or Per-Book
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Select whether to apply the same reader settings (font, theme, spread, zoom, etc.) globally for all books or individually per book."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;">
|
||||
pTooltip="Select whether to apply the same reader settings (font, theme, spread, zoom, etc.) globally for all books or individually per book."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;">
|
||||
</i>
|
||||
</p>
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
@@ -26,7 +24,6 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">Epub:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (item of scopeOptions; track item) {
|
||||
@@ -42,7 +39,6 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">CBX:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (item of scopeOptions; track item) {
|
||||
@@ -60,159 +56,22 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p-divider></p-divider>
|
||||
|
||||
<app-epub-reader-preferences-component
|
||||
[userSettings]="userSettings">
|
||||
</app-epub-reader-preferences-component>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-6 pt-4 ">
|
||||
PDF Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Configure global PDF reading options such as page spread, zoom level, and sidebar visibility that apply to all PDFs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
<p class="py-1">Page Spread:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (spread of spreads; track spread) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="spread.key"
|
||||
name="spread"
|
||||
[value]="spread.key"
|
||||
[(ngModel)]="selectedSpread"
|
||||
(ngModelChange)="onSpreadChange()">
|
||||
</p-radiobutton>
|
||||
<label [for]="spread.key">{{ spread.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">Page Zoom:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (zoom of zooms; track zoom) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="zoom.key"
|
||||
name="zoom"
|
||||
[value]="zoom.key"
|
||||
[(ngModel)]="selectedZoom"
|
||||
(ngModelChange)="onZoomChange()">
|
||||
</p-radiobutton>
|
||||
<label [for]="zoom.key">{{ zoom.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<app-pdf-reader-preferences-component
|
||||
[userSettings]="userSettings">
|
||||
</app-pdf-reader-preferences-component>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-6 pt-4 ">
|
||||
Epub Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Set global EPUB reader options such as themes, font families, and font sizes applied to all EPUBs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i></p>
|
||||
<app-cbx-reader-preferences-component
|
||||
[userSettings]="userSettings">
|
||||
</app-cbx-reader-preferences-component>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
<p>Theme:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="themes"
|
||||
[(ngModel)]="selectedTheme"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Theme"
|
||||
class="w-full md:w-32"
|
||||
(ngModelChange)="onThemeChange()">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p>Font:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="fonts"
|
||||
[(ngModel)]="selectedFont"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Font"
|
||||
class="w-full md:w-32"
|
||||
(ngModelChange)="onFontChange()">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p>Flow:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
<p-select
|
||||
size="small"
|
||||
[options]="flowOptions"
|
||||
[(ngModel)]="selectedFlow"
|
||||
optionLabel="name"
|
||||
optionValue="key"
|
||||
placeholder="Select a Flow"
|
||||
class="w-full md:w-32"
|
||||
(ngModelChange)="onFlowChange()">
|
||||
</p-select>
|
||||
</div>
|
||||
|
||||
<p class="py-1">Font Size:</p>
|
||||
<div class="flex gap-4 justify-start items-center">
|
||||
<p-button icon="pi pi-minus" size="small" (click)="decreaseFontSize()"></p-button>
|
||||
<p>{{ fontSize }}%</p>
|
||||
<p-button icon="pi pi-plus" size="small" (click)="increaseFontSize()"></p-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p-divider></p-divider>
|
||||
|
||||
<div class="p-4">
|
||||
<p class="text-lg pb-6 pt-4 ">
|
||||
CBX Reader: Global Preferences
|
||||
<i class="pi pi-info-circle text-sky-600"
|
||||
pTooltip="Configure global PDF reading options such as page spread, zoom level, and sidebar visibility that apply to all PDFs."
|
||||
tooltipPosition="right"
|
||||
style="cursor: pointer;"></i>
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-[auto,1fr] pl-6 gap-y-4 gap-x-4 items-center">
|
||||
<p class="py-1">Page Spread:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (spread of cbxSpreads; track spread) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="spread.key"
|
||||
name="spread"
|
||||
[value]="spread.key"
|
||||
[(ngModel)]="selectedCbxSpread"
|
||||
(ngModelChange)="onCbxSpreadChange()">
|
||||
</p-radiobutton>
|
||||
<label [for]="spread.key">{{ spread.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<p class="py-1">Page Zoom:</p>
|
||||
<div class="flex gap-4 justify-start">
|
||||
@for (mode of cbxViewModes; track mode) {
|
||||
<div class="flex items-center gap-2">
|
||||
<p-radiobutton
|
||||
[inputId]="mode.key"
|
||||
name="zoom"
|
||||
[value]="mode.key"
|
||||
[(ngModel)]="selectedCbxViewMode"
|
||||
(ngModelChange)="onCbxViewModeChange()">
|
||||
</p-radiobutton>
|
||||
<label [for]="mode.key">{{ mode.name }}</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,96 +2,40 @@ import {Component, inject, OnDestroy, OnInit} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
|
||||
import {Observable, Subscription} from 'rxjs';
|
||||
import {Select} from 'primeng/select';
|
||||
import {RadioButton} from 'primeng/radiobutton';
|
||||
import {Divider} from 'primeng/divider';
|
||||
import {Button} from 'primeng/button';
|
||||
import {Tooltip} from 'primeng/tooltip';
|
||||
import {User, UserService, UserSettings} from '../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {CbxPageSpread, CbxPageViewMode} from '../../book/model/book.model';
|
||||
import {EpubReaderPreferencesComponent} from './epub-reader-preferences-component/epub-reader-preferences-component';
|
||||
import {PdfReaderPreferencesComponent} from './pdf-reader-preferences-component/pdf-reader-preferences-component';
|
||||
import {CbxReaderPreferencesComponent} from './cbx-reader-preferences-component/cbx-reader-preferences-component';
|
||||
import {ReaderPreferencesService} from './reader-preferences-service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-reader-preferences',
|
||||
templateUrl: './reader-preferences.component.html',
|
||||
standalone: true,
|
||||
styleUrls: ['./reader-preferences.component.scss'],
|
||||
imports: [Select, FormsModule, RadioButton, Divider, Button, Tooltip]
|
||||
imports: [FormsModule, RadioButton, Divider, Tooltip, EpubReaderPreferencesComponent, PdfReaderPreferencesComponent, CbxReaderPreferencesComponent]
|
||||
})
|
||||
export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
|
||||
readonly cbxSpreads = [
|
||||
{name: 'Even', key: 'EVEN'},
|
||||
{name: 'Odd', key: 'ODD'}
|
||||
];
|
||||
|
||||
readonly cbxViewModes = [
|
||||
{name: 'Single Page', key: 'SINGLE_PAGE'},
|
||||
{name: 'Two Page', key: 'TWO_PAGE'},
|
||||
];
|
||||
|
||||
|
||||
readonly spreads = [
|
||||
{name: 'Even', key: 'even'},
|
||||
{name: 'Odd', key: 'odd'},
|
||||
{name: 'None', key: 'off'}
|
||||
];
|
||||
|
||||
readonly zooms = [
|
||||
{name: 'Auto Zoom', key: 'auto'},
|
||||
{name: 'Page Fit', key: 'page-fit'},
|
||||
{name: 'Page Width', key: 'page-width'},
|
||||
{name: 'Actual Size', key: 'page-actual'}
|
||||
];
|
||||
|
||||
readonly themes = [
|
||||
{name: 'White', key: 'white'},
|
||||
{name: 'Black', key: 'black'},
|
||||
{name: 'Grey', key: 'grey'},
|
||||
{name: 'Sepia', key: 'sepia'}
|
||||
];
|
||||
|
||||
readonly fonts = [
|
||||
{name: 'Serif', key: 'serif'},
|
||||
{name: 'Sans Serif', key: 'sans-serif'},
|
||||
{name: 'Roboto', key: 'roboto'},
|
||||
{name: 'Cursive', key: 'cursive'},
|
||||
{name: 'Monospace', key: 'monospace'}
|
||||
];
|
||||
|
||||
readonly flowOptions = [
|
||||
{name: 'Paginated', key: 'paginated'},
|
||||
{name: 'Scrolled', key: 'scrolled'}
|
||||
];
|
||||
|
||||
readonly scopeOptions = ['Global', 'Individual'];
|
||||
|
||||
selectedCbxSpread!: CbxPageSpread;
|
||||
selectedCbxViewMode!: CbxPageViewMode;
|
||||
|
||||
selectedSpread!: 'even' | 'odd' | 'off';
|
||||
selectedZoom!: string;
|
||||
selectedTheme!: string;
|
||||
selectedFont!: string;
|
||||
selectedFlow!: string;
|
||||
fontSize = 100;
|
||||
showSidebar = false;
|
||||
|
||||
selectedPdfScope!: string;
|
||||
selectedEpubScope!: string;
|
||||
selectedCbxScope!: string;
|
||||
|
||||
private readonly userService = inject(UserService);
|
||||
private readonly messageService = inject(MessageService);
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
userData$: Observable<User | null> = this.userService.userState$;
|
||||
private subscription?: Subscription;
|
||||
private currentUser: User | null = null;
|
||||
userSettings!: UserSettings;
|
||||
|
||||
ngOnInit(): void {
|
||||
this.subscription = this.userData$.subscribe(user => {
|
||||
if (user) {
|
||||
this.currentUser = user;
|
||||
this.userSettings = user.userSettings;
|
||||
this.loadPreferences(user.userSettings);
|
||||
}
|
||||
});
|
||||
@@ -105,94 +49,17 @@ export class ReaderPreferences implements OnInit, OnDestroy {
|
||||
this.selectedPdfScope = settings.perBookSetting.pdf;
|
||||
this.selectedEpubScope = settings.perBookSetting.epub;
|
||||
this.selectedCbxScope = settings.perBookSetting.cbx;
|
||||
|
||||
this.selectedSpread = settings.pdfReaderSetting.pageSpread;
|
||||
this.selectedZoom = settings.pdfReaderSetting.pageZoom;
|
||||
this.showSidebar = settings.pdfReaderSetting.showSidebar;
|
||||
|
||||
this.selectedTheme = settings.epubReaderSetting.theme;
|
||||
this.selectedFlow = settings.epubReaderSetting.flow;
|
||||
this.fontSize = settings.epubReaderSetting.fontSize;
|
||||
this.selectedFont = settings.epubReaderSetting.font;
|
||||
|
||||
this.selectedCbxSpread = settings.cbxReaderSetting.pageSpread;
|
||||
this.selectedCbxViewMode = settings.cbxReaderSetting.pageViewMode;
|
||||
}
|
||||
|
||||
private updatePreference(path: string[], value: any): void {
|
||||
if (!this.currentUser) return;
|
||||
let target: any = this.currentUser.userSettings;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
const [rootKey] = path;
|
||||
const updatedValue = this.currentUser.userSettings[rootKey as keyof UserSettings];
|
||||
this.userService.updateUserSetting(this.currentUser.id, rootKey, updatedValue);
|
||||
this.messageService.add({
|
||||
severity: 'success',
|
||||
summary: 'Preferences Updated',
|
||||
detail: 'Your preferences have been saved successfully.',
|
||||
life: 2000
|
||||
});
|
||||
}
|
||||
|
||||
onThemeChange() {
|
||||
this.updatePreference(['epubReaderSetting', 'theme'], this.selectedTheme);
|
||||
}
|
||||
|
||||
onFontChange() {
|
||||
this.updatePreference(['epubReaderSetting', 'font'], this.selectedFont);
|
||||
}
|
||||
|
||||
onFlowChange() {
|
||||
this.updatePreference(['epubReaderSetting', 'flow'], this.selectedFlow);
|
||||
}
|
||||
|
||||
onFontSizeChange() {
|
||||
this.updatePreference(['epubReaderSetting', 'fontSize'], this.fontSize);
|
||||
}
|
||||
|
||||
onSpreadChange() {
|
||||
this.updatePreference(['pdfReaderSetting', 'pageSpread'], this.selectedSpread);
|
||||
}
|
||||
|
||||
onCbxSpreadChange() {
|
||||
this.updatePreference(['cbxReaderSetting', 'pageSpread'], this.selectedCbxSpread);
|
||||
}
|
||||
|
||||
onCbxViewModeChange() {
|
||||
this.updatePreference(['cbxReaderSetting', 'pageViewMode'], this.selectedCbxViewMode);
|
||||
}
|
||||
|
||||
onZoomChange() {
|
||||
this.updatePreference(['pdfReaderSetting', 'pageZoom'], this.selectedZoom);
|
||||
}
|
||||
|
||||
onPdfScopeChange() {
|
||||
this.updatePreference(['perBookSetting', 'pdf'], this.selectedPdfScope);
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'pdf'], this.selectedPdfScope);
|
||||
}
|
||||
|
||||
onEpubScopeChange() {
|
||||
this.updatePreference(['perBookSetting', 'epub'], this.selectedEpubScope);
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'epub'], this.selectedEpubScope);
|
||||
}
|
||||
|
||||
onCbxScopeChange() {
|
||||
this.updatePreference(['perBookSetting', 'cbx'], this.selectedCbxScope);
|
||||
}
|
||||
|
||||
increaseFontSize() {
|
||||
if (this.fontSize < 250) {
|
||||
this.fontSize += 10;
|
||||
this.onFontSizeChange();
|
||||
}
|
||||
}
|
||||
|
||||
decreaseFontSize() {
|
||||
if (this.fontSize > 50) {
|
||||
this.fontSize -= 10;
|
||||
this.onFontSizeChange();
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['perBookSetting', 'cbx'], this.selectedCbxScope);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,9 @@ export interface EpubReaderSetting {
|
||||
font: string;
|
||||
fontSize: number;
|
||||
flow: string;
|
||||
lineHeight: number;
|
||||
margin: number;
|
||||
letterSpacing: number;
|
||||
}
|
||||
|
||||
export interface CbxReaderSetting {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<svg viewBox="0 0 126 126" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M59 4.79297C71.5051 11.5557 80 24.7854 80 40C80 40.5959 79.987 41.1888 79.9609 41.7783C79.8609 44.0406 81.7355 46 84 46C106.091 46 124 63.9086 124 86C124 108.091 106.091 126 84 126H10C4.47715 126 0 121.523 0 116V39.0068L0.0126953 38.9941C0.357624 25.0252 7.86506 12.8347 19 5.95215V63.832C19 64.8345 20.0676 65.4391 20.9121 64.9902L21.0771 64.8867L38.2227 52.3428C38.6819 52.0068 39.3064 52.0068 39.7656 52.3428L56.9229 64.8945L57.0879 64.998C57.9324 65.447 59 64.8423 59 63.8398V4.79297Z" fill="#818cf8"/>
|
||||
<path d="M40 0C43.8745 0 47.6199 0.552381 51.1631 1.58008V50.9697L44.3926 46.0176L44.0879 45.8037C40.9061 43.6679 36.7098 43.7393 33.5957 46.0176L26.8369 50.9619V2.21875C30.9593 0.782634 35.3881 0 40 0Z" fill="white"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 825 B |
@@ -1,7 +0,0 @@
|
||||
<svg width="85" height="63" viewBox="0 0 85 63" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.017 30.3135C27.0057 30.5602 27 30.8085 27 31.0581C27 39.9267 34.1894 47.1161 43.0581 47.1161C51.9267 47.1161 59.1161 39.9267 59.1161 31.0581C59.1161 30.8026 59.1102 30.5485 59.0984 30.2959C60.699 30.0511 62.2954 29.7696 63.8864 29.4515L64.0532 29.4181C64.0949 29.9593 64.1161 30.5062 64.1161 31.0581C64.1161 42.6881 54.6881 52.1161 43.0581 52.1161C31.428 52.1161 22 42.6881 22 31.0581C22 30.514 22.0206 29.9747 22.0612 29.441L22.1136 29.4515C23.7428 29.7773 25.3777 30.0646 27.017 30.3135ZM52.4613 18.0397C49.8183 16.1273 46.5698 15 43.0581 15C39.54 15 36.2862 16.1313 33.6406 18.05C31.4938 17.834 29.3526 17.5435 27.221 17.1786C31.0806 12.7781 36.7449 10 43.0581 10C49.3629 10 55.0207 12.7708 58.8799 17.1612C56.7487 17.5285 54.6078 17.8214 52.4613 18.0397ZM68.9854 28.4316C69.0719 29.2954 69.1161 30.1716 69.1161 31.0581C69.1161 45.4495 57.4495 57.1161 43.0581 57.1161C28.6666 57.1161 17 45.4495 17 31.0581C17 30.1793 17.0435 29.3108 17.1284 28.4544L12.2051 27.4697C12.0696 28.6471 12 29.8444 12 31.0581C12 48.211 25.9052 62.1161 43.0581 62.1161C60.211 62.1161 74.1161 48.211 74.1161 31.0581C74.1161 29.8366 74.0456 28.6317 73.9085 27.447L68.9854 28.4316ZM69.6705 15.0372L64.3929 16.0927C59.6785 9.38418 51.8803 5 43.0581 5C34.2269 5 26.4218 9.39306 21.7089 16.1131L16.4331 15.0579C21.867 6.03506 31.7578 0 43.0581 0C54.3497 0 64.234 6.02581 69.6705 15.0372Z" fill="black"/>
|
||||
<mask id="path-2-inside-1" fill="white">
|
||||
<path d="M42.5 28.9252C16.5458 30.2312 0 14 0 14C0 14 26 22.9738 42.5 22.9738C59 22.9738 85 14 85 14C85 14 68.4542 27.6193 42.5 28.9252Z"/>
|
||||
</mask>
|
||||
<path d="M0 14L5.87269 -3.01504L-12.6052 26.8495L0 14ZM42.5 28.9252L41.5954 10.948L42.5 28.9252ZM85 14L96.4394 27.8975L79.1273 -3.01504L85 14ZM0 14C-12.6052 26.8495 -12.5999 26.8546 -12.5946 26.8598C-12.5928 26.8617 -12.5874 26.8669 -12.5837 26.8706C-12.5762 26.8779 -12.5685 26.8854 -12.5605 26.8932C-12.5445 26.9088 -12.5274 26.9254 -12.5092 26.943C-12.4729 26.9782 -12.4321 27.0174 -12.387 27.0605C-12.2969 27.1467 -12.1892 27.2484 -12.0642 27.3646C-11.8144 27.5968 -11.4949 27.8874 -11.1073 28.2273C-10.3332 28.9063 -9.28165 29.7873 -7.96614 30.7967C-5.34553 32.8073 -1.61454 35.3754 3.11693 37.872C12.5592 42.8544 26.4009 47.7581 43.4046 46.9025L41.5954 10.948C32.6449 11.3983 25.2366 8.83942 19.9174 6.03267C17.2682 4.63475 15.2406 3.22667 13.9478 2.23478C13.3066 1.74283 12.8627 1.366 12.6306 1.16243C12.5151 1.06107 12.4538 1.00422 12.4485 0.999363C12.446 0.996981 12.4576 1.00773 12.4836 1.03256C12.4966 1.04498 12.5132 1.06094 12.5334 1.08055C12.5436 1.09035 12.5546 1.10108 12.5665 1.11273C12.5725 1.11855 12.5787 1.12461 12.5852 1.13091C12.5884 1.13405 12.5934 1.13895 12.595 1.14052C12.6 1.14548 12.6052 1.15049 0 14ZM43.4046 46.9025C59.3275 46.1013 72.3155 41.5302 81.3171 37.1785C85.8337 34.9951 89.4176 32.8333 91.9552 31.151C93.2269 30.3079 94.2446 29.5794 94.9945 29.0205C95.3698 28.7409 95.6788 28.503 95.92 28.3138C96.0406 28.2192 96.1443 28.1366 96.2309 28.067C96.2742 28.0321 96.3133 28.0005 96.348 27.9723C96.3654 27.9581 96.3817 27.9448 96.3969 27.9323C96.4045 27.9261 96.4119 27.9201 96.419 27.9143C96.4225 27.9114 96.4276 27.9072 96.4294 27.9057C96.4344 27.9016 96.4394 27.8975 85 14C73.5606 0.102497 73.5655 0.0985097 73.5703 0.0945756C73.5718 0.0933319 73.5765 0.0894438 73.5795 0.0869551C73.5856 0.0819751 73.5914 0.077195 73.597 0.0726136C73.6082 0.0634509 73.6185 0.055082 73.6278 0.0474955C73.6465 0.0323231 73.6614 0.0202757 73.6726 0.0112606C73.695 -0.00676378 73.7026 -0.0126931 73.6957 -0.00726687C73.6818 0.00363418 73.6101 0.0596753 73.4822 0.154983C73.2258 0.346025 72.7482 0.691717 72.0631 1.14588C70.6873 2.05798 68.5127 3.38259 65.6485 4.7672C59.8887 7.55166 51.6267 10.4432 41.5954 10.948L43.4046 46.9025ZM85 14C79.1273 -3.01504 79.1288 -3.01557 79.1303 -3.01606C79.1306 -3.01618 79.1319 -3.01664 79.1326 -3.01688C79.134 -3.01736 79.135 -3.0177 79.1356 -3.01791C79.1369 -3.01834 79.1366 -3.01823 79.1347 -3.01759C79.131 -3.01633 79.1212 -3.01297 79.1055 -3.00758C79.0739 -2.99681 79.0185 -2.97794 78.9404 -2.95151C78.7839 -2.89864 78.5366 -2.81564 78.207 -2.7068C77.5472 -2.48895 76.561 -2.16874 75.3165 -1.78027C72.8181 -1.00046 69.3266 0.039393 65.3753 1.07466C57.0052 3.26771 48.2826 4.97383 42.5 4.97383V40.9738C53.2174 40.9738 65.7448 38.193 74.4997 35.8992C79.1109 34.691 83.1506 33.4874 86.0429 32.5846C87.4937 32.1318 88.6676 31.7509 89.4942 31.478C89.9077 31.3414 90.2351 31.2317 90.4676 31.1531C90.5839 31.1138 90.6765 31.0823 90.7443 31.0591C90.7783 31.0475 90.806 31.038 90.8275 31.0306C90.8382 31.0269 90.8473 31.0238 90.8549 31.0212C90.8586 31.0199 90.862 31.0187 90.865 31.0177C90.8665 31.0172 90.8684 31.0165 90.8691 31.0163C90.871 31.0156 90.8727 31.015 85 14ZM42.5 4.97383C36.7174 4.97383 27.9948 3.26771 19.6247 1.07466C15.6734 0.039393 12.1819 -1.00046 9.68352 -1.78027C8.43897 -2.16874 7.4528 -2.48895 6.79299 -2.7068C6.46337 -2.81564 6.21607 -2.89864 6.05965 -2.95151C5.98146 -2.97794 5.92606 -2.99681 5.89453 -3.00758C5.87876 -3.01297 5.86897 -3.01633 5.86528 -3.01759C5.86344 -3.01823 5.86312 -3.01834 5.86435 -3.01791C5.86497 -3.0177 5.86597 -3.01736 5.86736 -3.01688C5.86805 -3.01664 5.86939 -3.01618 5.86973 -3.01606C5.87116 -3.01557 5.87269 -3.01504 0 14C-5.87269 31.015 -5.87096 31.0156 -5.86914 31.0163C-5.8684 31.0165 -5.86647 31.0172 -5.86498 31.0177C-5.86201 31.0187 -5.85864 31.0199 -5.85486 31.0212C-5.84732 31.0238 -5.83818 31.0269 -5.82747 31.0306C-5.80603 31.038 -5.77828 31.0475 -5.74435 31.0591C-5.67649 31.0823 -5.58388 31.1138 -5.46761 31.1531C-5.23512 31.2317 -4.9077 31.3414 -4.49416 31.478C-3.66764 31.7509 -2.49366 32.1318 -1.04289 32.5846C1.84938 33.4874 5.88908 34.691 10.5003 35.8992C19.2552 38.193 31.7826 40.9738 42.5 40.9738V4.97383Z" fill="black" mask="url(#path-2-inside-1)"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -1,7 +0,0 @@
|
||||
<svg width="85" height="63" viewBox="0 0 85 63" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.017 30.3135C27.0057 30.5602 27 30.8085 27 31.0581C27 39.9267 34.1894 47.1161 43.0581 47.1161C51.9267 47.1161 59.1161 39.9267 59.1161 31.0581C59.1161 30.8026 59.1102 30.5485 59.0984 30.2959C60.699 30.0511 62.2954 29.7696 63.8864 29.4515L64.0532 29.4181C64.0949 29.9593 64.1161 30.5062 64.1161 31.0581C64.1161 42.6881 54.6881 52.1161 43.0581 52.1161C31.428 52.1161 22 42.6881 22 31.0581C22 30.514 22.0206 29.9747 22.0612 29.441L22.1136 29.4515C23.7428 29.7773 25.3777 30.0646 27.017 30.3135ZM52.4613 18.0397C49.8183 16.1273 46.5698 15 43.0581 15C39.54 15 36.2862 16.1313 33.6406 18.05C31.4938 17.834 29.3526 17.5435 27.221 17.1786C31.0806 12.7781 36.7449 10 43.0581 10C49.3629 10 55.0207 12.7708 58.8799 17.1612C56.7487 17.5285 54.6078 17.8214 52.4613 18.0397ZM68.9854 28.4316C69.0719 29.2954 69.1161 30.1716 69.1161 31.0581C69.1161 45.4495 57.4495 57.1161 43.0581 57.1161C28.6666 57.1161 17 45.4495 17 31.0581C17 30.1793 17.0435 29.3108 17.1284 28.4544L12.2051 27.4697C12.0696 28.6471 12 29.8444 12 31.0581C12 48.211 25.9052 62.1161 43.0581 62.1161C60.211 62.1161 74.1161 48.211 74.1161 31.0581C74.1161 29.8366 74.0456 28.6317 73.9085 27.447L68.9854 28.4316ZM69.6705 15.0372L64.3929 16.0927C59.6785 9.38418 51.8803 5 43.0581 5C34.2269 5 26.4218 9.39306 21.7089 16.1131L16.4331 15.0579C21.867 6.03506 31.7578 0 43.0581 0C54.3497 0 64.234 6.02581 69.6705 15.0372Z" fill="white"/>
|
||||
<mask id="path-2-inside-1" fill="white">
|
||||
<path d="M42.5 28.9252C16.5458 30.2312 0 14 0 14C0 14 26 22.9738 42.5 22.9738C59 22.9738 85 14 85 14C85 14 68.4542 27.6193 42.5 28.9252Z"/>
|
||||
</mask>
|
||||
<path d="M0 14L5.87269 -3.01504L-12.6052 26.8495L0 14ZM42.5 28.9252L41.5954 10.948L42.5 28.9252ZM85 14L96.4394 27.8975L79.1273 -3.01504L85 14ZM0 14C-12.6052 26.8495 -12.5999 26.8546 -12.5946 26.8598C-12.5928 26.8617 -12.5874 26.8669 -12.5837 26.8706C-12.5762 26.8779 -12.5685 26.8854 -12.5605 26.8932C-12.5445 26.9088 -12.5274 26.9254 -12.5092 26.943C-12.4729 26.9782 -12.4321 27.0174 -12.387 27.0605C-12.2969 27.1467 -12.1892 27.2484 -12.0642 27.3646C-11.8144 27.5968 -11.4949 27.8874 -11.1073 28.2273C-10.3332 28.9063 -9.28165 29.7873 -7.96614 30.7967C-5.34553 32.8073 -1.61454 35.3754 3.11693 37.872C12.5592 42.8544 26.4009 47.7581 43.4046 46.9025L41.5954 10.948C32.6449 11.3983 25.2366 8.83942 19.9174 6.03267C17.2682 4.63475 15.2406 3.22667 13.9478 2.23478C13.3066 1.74283 12.8627 1.366 12.6306 1.16243C12.5151 1.06107 12.4538 1.00422 12.4485 0.999363C12.446 0.996981 12.4576 1.00773 12.4836 1.03256C12.4966 1.04498 12.5132 1.06094 12.5334 1.08055C12.5436 1.09035 12.5546 1.10108 12.5665 1.11273C12.5725 1.11855 12.5787 1.12461 12.5852 1.13091C12.5884 1.13405 12.5934 1.13895 12.595 1.14052C12.6 1.14548 12.6052 1.15049 0 14ZM43.4046 46.9025C59.3275 46.1013 72.3155 41.5302 81.3171 37.1785C85.8337 34.9951 89.4176 32.8333 91.9552 31.151C93.2269 30.3079 94.2446 29.5794 94.9945 29.0205C95.3698 28.7409 95.6788 28.503 95.92 28.3138C96.0406 28.2192 96.1443 28.1366 96.2309 28.067C96.2742 28.0321 96.3133 28.0005 96.348 27.9723C96.3654 27.9581 96.3817 27.9448 96.3969 27.9323C96.4045 27.9261 96.4119 27.9201 96.419 27.9143C96.4225 27.9114 96.4276 27.9072 96.4294 27.9057C96.4344 27.9016 96.4394 27.8975 85 14C73.5606 0.102497 73.5655 0.0985097 73.5703 0.0945756C73.5718 0.0933319 73.5765 0.0894438 73.5795 0.0869551C73.5856 0.0819751 73.5914 0.077195 73.597 0.0726136C73.6082 0.0634509 73.6185 0.055082 73.6278 0.0474955C73.6465 0.0323231 73.6614 0.0202757 73.6726 0.0112606C73.695 -0.00676378 73.7026 -0.0126931 73.6957 -0.00726687C73.6818 0.00363418 73.6101 0.0596753 73.4822 0.154983C73.2258 0.346025 72.7482 0.691717 72.0631 1.14588C70.6873 2.05798 68.5127 3.38259 65.6485 4.7672C59.8887 7.55166 51.6267 10.4432 41.5954 10.948L43.4046 46.9025ZM85 14C79.1273 -3.01504 79.1288 -3.01557 79.1303 -3.01606C79.1306 -3.01618 79.1319 -3.01664 79.1326 -3.01688C79.134 -3.01736 79.135 -3.0177 79.1356 -3.01791C79.1369 -3.01834 79.1366 -3.01823 79.1347 -3.01759C79.131 -3.01633 79.1212 -3.01297 79.1055 -3.00758C79.0739 -2.99681 79.0185 -2.97794 78.9404 -2.95151C78.7839 -2.89864 78.5366 -2.81564 78.207 -2.7068C77.5472 -2.48895 76.561 -2.16874 75.3165 -1.78027C72.8181 -1.00046 69.3266 0.039393 65.3753 1.07466C57.0052 3.26771 48.2826 4.97383 42.5 4.97383V40.9738C53.2174 40.9738 65.7448 38.193 74.4997 35.8992C79.1109 34.691 83.1506 33.4874 86.0429 32.5846C87.4937 32.1318 88.6676 31.7509 89.4942 31.478C89.9077 31.3414 90.2351 31.2317 90.4676 31.1531C90.5839 31.1138 90.6765 31.0823 90.7443 31.0591C90.7783 31.0475 90.806 31.038 90.8275 31.0306C90.8382 31.0269 90.8473 31.0238 90.8549 31.0212C90.8586 31.0199 90.862 31.0187 90.865 31.0177C90.8665 31.0172 90.8684 31.0165 90.8691 31.0163C90.871 31.0156 90.8727 31.015 85 14ZM42.5 4.97383C36.7174 4.97383 27.9948 3.26771 19.6247 1.07466C15.6734 0.039393 12.1819 -1.00046 9.68352 -1.78027C8.43897 -2.16874 7.4528 -2.48895 6.79299 -2.7068C6.46337 -2.81564 6.21607 -2.89864 6.05965 -2.95151C5.98146 -2.97794 5.92606 -2.99681 5.89453 -3.00758C5.87876 -3.01297 5.86897 -3.01633 5.86528 -3.01759C5.86344 -3.01823 5.86312 -3.01834 5.86435 -3.01791C5.86497 -3.0177 5.86597 -3.01736 5.86736 -3.01688C5.86805 -3.01664 5.86939 -3.01618 5.86973 -3.01606C5.87116 -3.01557 5.87269 -3.01504 0 14C-5.87269 31.015 -5.87096 31.0156 -5.86914 31.0163C-5.8684 31.0165 -5.86647 31.0172 -5.86498 31.0177C-5.86201 31.0187 -5.85864 31.0199 -5.85486 31.0212C-5.84732 31.0238 -5.83818 31.0269 -5.82747 31.0306C-5.80603 31.038 -5.77828 31.0475 -5.74435 31.0591C-5.67649 31.0823 -5.58388 31.1138 -5.46761 31.1531C-5.23512 31.2317 -4.9077 31.3414 -4.49416 31.478C-3.66764 31.7509 -2.49366 32.1318 -1.04289 32.5846C1.84938 33.4874 5.88908 34.691 10.5003 35.8992C19.2552 38.193 31.7826 40.9738 42.5 40.9738V4.97383Z" fill="white" mask="url(#path-2-inside-1)"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.8 KiB |
@@ -5,7 +5,7 @@
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
justify-content: space-between;
|
||||
padding: 5.2rem 1.2rem 2rem 3.6rem;
|
||||
padding: 5rem 1.1rem 2rem 3.6rem;
|
||||
transition: margin-left variables.$transitionDuration;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
.layout-sidebar {
|
||||
position: fixed;
|
||||
width: 225px;
|
||||
height: calc(100vh - 6.5rem);
|
||||
height: calc(100vh - 6rem);
|
||||
z-index: 999;
|
||||
overflow-y: auto;
|
||||
user-select: none;
|
||||
top: 5.2rem;
|
||||
left: 1.2rem;
|
||||
top: 4.9rem;
|
||||
left: 1.1rem;
|
||||
transition: transform variables.$transitionDuration, left variables.$transitionDuration;
|
||||
background-color: var(--card-background);
|
||||
border-radius: variables.$borderRadius;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
color: var(--surface-900);
|
||||
font-size: 1.7rem;
|
||||
font-weight: 500;
|
||||
width: 200px;
|
||||
width: 265px;
|
||||
border-radius: 12px;
|
||||
|
||||
img {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<title>BookLore</title>
|
||||
<base href="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
<link rel="icon" type="image/svg+xml" href="assets/favicon.svg" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -19,6 +19,11 @@ import {initializeAuthFactory} from './app/auth-initializer';
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: themeInitializer,
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: websocketInitializer,
|
||||
@@ -52,3 +57,10 @@ bootstrapApplication(AppComponent, {
|
||||
})
|
||||
]
|
||||
}).catch(err => console.error(err));
|
||||
|
||||
export function themeInitializer(): () => void {
|
||||
return () => {
|
||||
document.documentElement.classList.add('p-dark');
|
||||
document.body.classList.add('p-dark');
|
||||
};
|
||||
}
|
||||
|
||||