refactor(frontend): rename booklore-ui to frontend
- Frontend path: - rename the tracked Angular app tree from `booklore-ui/` to `frontend/` - preserve file contents during the move so this commit stays focused on the path change itself - Frontend docs: - update the moved frontend README and contribution guide where they refer to the renamed folder - keep those edits limited to path references introduced by the directory rename
This commit is contained in:
+125
@@ -0,0 +1,125 @@
|
||||
<ng-container *transloco="let t; prefix: 'settingsReader.cbx'">
|
||||
<div class="cbx-preferences-container">
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">{{ t('pageSpread') }}</label>
|
||||
<div class="button-group">
|
||||
@for (spread of cbxSpreads; track spread) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxSpread === spread.key"
|
||||
(click)="selectedCbxSpread = spread.key">
|
||||
<i [class]="spread.icon"></i>
|
||||
<span class="option-text">{{ t(spread.translationKey) }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
{{ t('pageSpreadDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">{{ t('pageLayout') }}</label>
|
||||
<div class="button-group">
|
||||
@for (mode of cbxViewModes; track mode) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxViewMode === mode.key"
|
||||
(click)="selectedCbxViewMode = mode.key">
|
||||
<i [class]="mode.icon"></i>
|
||||
<span class="option-text">{{ t(mode.translationKey) }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
{{ t('pageLayoutDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">{{ t('fitMode') }}</label>
|
||||
<div class="button-group">
|
||||
@for (mode of cbxFitModes; track mode) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxFitMode === mode.key"
|
||||
(click)="selectedCbxFitMode = mode.key"
|
||||
[pTooltip]="t(mode.translationKey)"
|
||||
tooltipPosition="bottom">
|
||||
<i [class]="mode.icon"></i>
|
||||
<span class="option-text">{{ t(mode.translationKey) }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
{{ t('fitModeDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">{{ t('scrollMode') }}</label>
|
||||
<div class="button-group">
|
||||
@for (mode of cbxScrollModes; track mode) {
|
||||
<button
|
||||
type="button"
|
||||
class="option-button"
|
||||
[class.selected]="selectedCbxScrollMode === mode.key"
|
||||
(click)="selectedCbxScrollMode = mode.key">
|
||||
<i [class]="mode.icon"></i>
|
||||
<span class="option-text">{{ t(mode.translationKey) }}</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
{{ t('scrollModeDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="setting-item">
|
||||
<div class="setting-info">
|
||||
<div class="setting-label-row">
|
||||
<label class="setting-label">{{ t('backgroundColor') }}</label>
|
||||
<div class="theme-selector">
|
||||
@for (color of cbxBackgroundColors; track color) {
|
||||
<button
|
||||
type="button"
|
||||
class="theme-option"
|
||||
[class.selected]="selectedCbxBackgroundColor === color.key"
|
||||
[style.background-color]="color.color"
|
||||
(click)="selectedCbxBackgroundColor = color.key"
|
||||
[attr.aria-label]="t(color.translationKey)"
|
||||
[pTooltip]="t(color.translationKey)"
|
||||
tooltipPosition="bottom">
|
||||
@if (selectedCbxBackgroundColor === color.key) {
|
||||
<i class="pi pi-check"></i>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<p class="setting-description">
|
||||
{{ t('backgroundColorDesc') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
@use '../../../../shared/styles/settings-shared' as settings;
|
||||
|
||||
.cbx-preferences-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.setting-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 2rem;
|
||||
padding: 0.25rem 0;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.setting-label {
|
||||
display: block;
|
||||
font-weight: settings.$settings-section-title-weight;
|
||||
color: var(--p-text-color);
|
||||
font-size: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.setting-label-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.setting-label {
|
||||
margin-bottom: 0;
|
||||
flex-shrink: 0;
|
||||
min-width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.setting-description {
|
||||
color: var(--p-text-muted-color);
|
||||
font-size: settings.$settings-section-description-size;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.button-group {
|
||||
@include settings.settings-button-group;
|
||||
}
|
||||
|
||||
.theme-selector {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.theme-option {
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border-radius: 0.375rem;
|
||||
border: 1.5px solid transparent;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
i {
|
||||
color: white;
|
||||
font-size: settings.$settings-section-description-size;
|
||||
font-weight: bold;
|
||||
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
&:hover {
|
||||
transform: scale(1.1);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
&.selected {
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color) 25%, transparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
import {Component, inject, Input} from '@angular/core';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {TranslocoDirective} from '@jsverse/transloco';
|
||||
import {CbxBackgroundColor, CbxFitMode, CbxPageSpread, CbxPageViewMode, CbxScrollMode, UserSettings} from '../../user-management/user.service';
|
||||
import {ReaderPreferencesService} from '../reader-preferences.service';
|
||||
import {TooltipModule} from 'primeng/tooltip';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cbx-reader-preferences-component',
|
||||
imports: [
|
||||
FormsModule,
|
||||
TranslocoDirective,
|
||||
TooltipModule
|
||||
],
|
||||
templateUrl: './cbx-reader-preferences-component.html',
|
||||
styleUrl: './cbx-reader-preferences-component.scss'
|
||||
})
|
||||
export class CbxReaderPreferencesComponent {
|
||||
|
||||
@Input() userSettings!: UserSettings;
|
||||
|
||||
private readonly readerPreferencesService = inject(ReaderPreferencesService);
|
||||
|
||||
private static readonly SETTING_ROOT = 'cbxReaderSetting';
|
||||
private static readonly PROP_PAGE_SPREAD = 'pageSpread';
|
||||
private static readonly PROP_PAGE_VIEW_MODE = 'pageViewMode';
|
||||
private static readonly PROP_FIT_MODE = 'fitMode';
|
||||
private static readonly PROP_SCROLL_MODE = 'scrollMode';
|
||||
private static readonly PROP_BACKGROUND_COLOR = 'backgroundColor';
|
||||
|
||||
readonly cbxSpreads = [
|
||||
{name: 'Even', key: CbxPageSpread.EVEN, icon: 'pi pi-align-left', translationKey: 'even'},
|
||||
{name: 'Odd', key: CbxPageSpread.ODD, icon: 'pi pi-align-right', translationKey: 'odd'}
|
||||
];
|
||||
|
||||
readonly cbxViewModes = [
|
||||
{name: 'Single Page', key: CbxPageViewMode.SINGLE_PAGE, icon: 'pi pi-book', translationKey: 'singlePage'},
|
||||
{name: 'Two Page', key: CbxPageViewMode.TWO_PAGE, icon: 'pi pi-copy', translationKey: 'twoPage'},
|
||||
];
|
||||
|
||||
readonly cbxFitModes = [
|
||||
{name: 'Fit Page', key: CbxFitMode.FIT_PAGE, icon: 'pi pi-window-maximize', translationKey: 'fitPage'},
|
||||
{name: 'Fit Width', key: CbxFitMode.FIT_WIDTH, icon: 'pi pi-arrows-h', translationKey: 'fitWidth'},
|
||||
{name: 'Fit Height', key: CbxFitMode.FIT_HEIGHT, icon: 'pi pi-arrows-v', translationKey: 'fitHeight'},
|
||||
{name: 'Actual Size', key: CbxFitMode.ACTUAL_SIZE, icon: 'pi pi-expand', translationKey: 'actualSize'},
|
||||
{name: 'Automatic', key: CbxFitMode.AUTO, icon: 'pi pi-sparkles', translationKey: 'automatic'}
|
||||
];
|
||||
|
||||
readonly cbxScrollModes = [
|
||||
{name: 'Paginated', key: CbxScrollMode.PAGINATED, icon: 'pi pi-book', translationKey: 'paginated'},
|
||||
{name: 'Infinite', key: CbxScrollMode.INFINITE, icon: 'pi pi-sort-alt', translationKey: 'infinite'}
|
||||
];
|
||||
|
||||
readonly cbxBackgroundColors = [
|
||||
{name: 'Gray', key: CbxBackgroundColor.GRAY, color: '#808080', translationKey: 'gray'},
|
||||
{name: 'Black', key: CbxBackgroundColor.BLACK, color: '#000000', translationKey: 'black'},
|
||||
{name: 'White', key: CbxBackgroundColor.WHITE, color: '#FFFFFF', translationKey: 'white'}
|
||||
];
|
||||
|
||||
get selectedCbxSpread(): CbxPageSpread {
|
||||
return this.userSettings.cbxReaderSetting.pageSpread ?? CbxPageSpread.EVEN;
|
||||
}
|
||||
|
||||
set selectedCbxSpread(value: CbxPageSpread) {
|
||||
this.userSettings.cbxReaderSetting.pageSpread = value;
|
||||
this.readerPreferencesService.updatePreference([CbxReaderPreferencesComponent.SETTING_ROOT, CbxReaderPreferencesComponent.PROP_PAGE_SPREAD], value);
|
||||
}
|
||||
|
||||
get selectedCbxViewMode(): CbxPageViewMode {
|
||||
return this.userSettings.cbxReaderSetting.pageViewMode ?? CbxPageViewMode.SINGLE_PAGE;
|
||||
}
|
||||
|
||||
set selectedCbxViewMode(value: CbxPageViewMode) {
|
||||
this.userSettings.cbxReaderSetting.pageViewMode = value;
|
||||
this.readerPreferencesService.updatePreference([CbxReaderPreferencesComponent.SETTING_ROOT, CbxReaderPreferencesComponent.PROP_PAGE_VIEW_MODE], value);
|
||||
}
|
||||
|
||||
get selectedCbxFitMode(): CbxFitMode {
|
||||
return this.userSettings.cbxReaderSetting.fitMode ?? CbxFitMode.FIT_PAGE;
|
||||
}
|
||||
|
||||
set selectedCbxFitMode(value: CbxFitMode) {
|
||||
this.userSettings.cbxReaderSetting.fitMode = value;
|
||||
this.readerPreferencesService.updatePreference([CbxReaderPreferencesComponent.SETTING_ROOT, CbxReaderPreferencesComponent.PROP_FIT_MODE], value);
|
||||
}
|
||||
|
||||
get selectedCbxScrollMode(): CbxScrollMode {
|
||||
return this.userSettings.cbxReaderSetting.scrollMode ?? CbxScrollMode.PAGINATED;
|
||||
}
|
||||
|
||||
set selectedCbxScrollMode(value: CbxScrollMode) {
|
||||
this.userSettings.cbxReaderSetting.scrollMode = value;
|
||||
this.readerPreferencesService.updatePreference([CbxReaderPreferencesComponent.SETTING_ROOT, CbxReaderPreferencesComponent.PROP_SCROLL_MODE], value);
|
||||
}
|
||||
|
||||
get selectedCbxBackgroundColor(): CbxBackgroundColor {
|
||||
return this.userSettings.cbxReaderSetting.backgroundColor ?? CbxBackgroundColor.GRAY;
|
||||
}
|
||||
|
||||
set selectedCbxBackgroundColor(value: CbxBackgroundColor) {
|
||||
this.userSettings.cbxReaderSetting.backgroundColor = value;
|
||||
this.readerPreferencesService.updatePreference([CbxReaderPreferencesComponent.SETTING_ROOT, CbxReaderPreferencesComponent.PROP_BACKGROUND_COLOR], value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user