Skip to content

Commit

Permalink
Converted a few components
Browse files Browse the repository at this point in the history
  • Loading branch information
majora2007 committed Jul 29, 2023
1 parent ea49d67 commit 8fcab22
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ <h5 header>
<ng-template ngbNavContent>
<ul #subnav="ngbNav" ngbNav [(activeId)]="tocId" class="reader-pills nav nav-pills mb-2" [destroyOnHide]="false">
<li [ngbNavItem]="TabID.TableOfContents">
<a ngbNavLink>ToC</a>
<a ngbNavLink>{{t('toc-header')}}</a>
<ng-template ngbNavContent>
<app-table-of-contents [chapters]="chapters" [chapterId]="chapterId" [pageNum]="pageNum"
[currentPageAnchor]="currentPageAnchor" (loadChapter)="loadChapterPage($event)"></app-table-of-contents>
</ng-template>
</li>
<li [ngbNavItem]="TabID.PersonalTableOfContents">
<a ngbNavLink>Bookmarks</a>
<a ngbNavLink>{{t('bookmarks-header')}}</a>
<ng-template ngbNavContent>
<app-personal-table-of-contents [chapterId]="chapterId" [pageNum]="pageNum" (loadChapter)="loadChapterPart($event)"
[tocRefresh]="refreshPToC"></app-personal-table-of-contents>
Expand Down Expand Up @@ -126,7 +126,7 @@ <h5 header>
<div class="action-bar row g-0 justify-content-between" *ngIf="!immersiveMode || drawerOpen || actionBarVisible">
<button class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="movePage(readingDirection === ReadingDirection.LeftToRight ? PAGING_DIRECTION.BACKWARDS : PAGING_DIRECTION.FORWARD)"
[disabled]="readingDirection === ReadingDirection.LeftToRight ? IsPrevDisabled : IsNextDisabled"
title="{{readingDirection === ReadingDirection.LeftToRight ? 'Previous' : 'Next'}} Page">
title="{{readingDirection === ReadingDirection.LeftToRight ? t('previous') : t('next')}} Page">
<i class="fa {{(readingDirection === ReadingDirection.LeftToRight ? IsPrevChapter : IsNextChapter) ? 'fa-angle-double-left' : 'fa-angle-left'}} {{readingDirection === ReadingDirection.RightToLeft ? 'next-page-highlight' : ''}}" aria-hidden="true"></i>
</button>
<button *ngIf="!this.adhocPageHistory.isEmpty()" class="btn btn-outline-secondary btn-icon col-2 col-xs-1" (click)="goBack()" [title]="t('go-back')">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<div class="table-of-contents">
<div *ngIf="Pages.length === 0">
<em>Nothing Bookmarked yet</em>
<ng-container *transloco="let t; read: 'personal-table-of-contents'">
<div class="table-of-contents">
<div *ngIf="Pages.length === 0">
<em>{{t('no-data')}}}</em>
</div>
<ul>
<li *ngFor="let page of Pages">
<span (click)="loadChapterPage(page, '')">{{t('page', {value: page})}}</span>
<ul class="chapter-title">
<li class="ellipsis"
[ngbTooltip]="bookmark.title"
placement="right"
*ngFor="let bookmark of bookmarks[page]" (click)="loadChapterPage(bookmark.pageNumber, bookmark.bookScrollId); $event.stopPropagation();">
{{bookmark.title}}
<button class="btn btn-icon ms-1" (click)="removeBookmark(bookmark); $event.stopPropagation();">
<i class="fa-solid fa-trash" aria-hidden="true"></i>
<span class="visually-hidden">{{t('delete', {bookmarkName: bookmark.title})}}</span>
</button>
</li>
</ul>
</li>
</ul>
</div>
<ul>
<li *ngFor="let page of Pages">
<span (click)="loadChapterPage(page, '')">Page {{page}}</span>
<ul class="chapter-title">
<li class="ellipsis"
[ngbTooltip]="bookmark.title"
placement="right"
*ngFor="let bookmark of bookmarks[page]" (click)="loadChapterPage(bookmark.pageNumber, bookmark.bookScrollId); $event.stopPropagation();">
{{bookmark.title}}
<button class="btn btn-icon ms-1" (click)="removeBookmark(bookmark); $event.stopPropagation();">
<i class="fa-solid fa-trash" aria-hidden="true"></i>
<span class="visually-hidden">Delete {{bookmark.title}}</span>
</button>
</li>
</ul>
</li>
</ul>
</div>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {ReaderService} from "../../../_services/reader.service";
import {PersonalToC} from "../../../_models/readers/personal-toc";
import {takeUntilDestroyed} from "@angular/core/rxjs-interop";
import {NgbTooltip} from "@ng-bootstrap/ng-bootstrap";
import {TranslocoModule} from "@ngneat/transloco";

export interface PersonalToCEvent {
pageNum: number;
Expand All @@ -22,7 +23,7 @@ export interface PersonalToCEvent {
@Component({
selector: 'app-personal-table-of-contents',
standalone: true,
imports: [CommonModule, NgbTooltip],
imports: [CommonModule, NgbTooltip, TranslocoModule],
templateUrl: './personal-table-of-contents.component.html',
styleUrls: ['./personal-table-of-contents.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush
Expand Down
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@

<app-splash-container>
<ng-container *transloco="let t; read: 'confirm-email'">
<app-splash-container>
<ng-container title><h2>Register</h2></ng-container>
<ng-container body>
<p>Complete the form to complete your registration</p>
<div class="text-danger" *ngIf="errors.length > 0">
<p>Errors:</p>
<ul>
<li *ngFor="let error of errors">{{error}}</li>
</ul>
</div>
<form [formGroup]="registerForm" (ngSubmit)="submit()">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input id="username" class="form-control" formControlName="username" type="text"
[class.is-invalid]="registerForm.get('username')?.invalid && registerForm.get('username')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('username')?.errors?.required">
This field is required
</div>
</div>
<p>Complete the form to complete your registration</p>
<div class="text-danger" *ngIf="errors.length > 0">
<p>Errors:</p>
<ul>
<li *ngFor="let error of errors">{{error}}</li>
</ul>
</div>
<form [formGroup]="registerForm" (ngSubmit)="submit()">
<div class="mb-3">
<label for="username" class="form-label">{{t('username-label')}}</label>
<input id="username" class="form-control" formControlName="username" type="text"
aria-describeby="inviteForm-username-validations"
[class.is-invalid]="registerForm.get('username')?.invalid && registerForm.get('username')?.touched">
<div id="inviteForm-username-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('username')?.errors?.required">
{{t('required-field')}}
</div>
</div>
</div>

<div class="mb-3" style="width:100%">
<label for="email" class="form-label">Email</label>
<input class="form-control" type="email" inputmode="email" id="email" formControlName="email" required readonly
[class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
This field is required
</div>
<div *ngIf="registerForm.get('email')?.errors?.email">
This must be a valid email address
</div>
</div>
<div class="mb-3" style="width:100%">
<label for="email" class="form-label">{{t('email-label')}}</label>
<input class="form-control" type="email" inputmode="email" id="email" formControlName="email" required readonly
[class.is-invalid]="registerForm.get('email')?.invalid && registerForm.get('email')?.touched">
<div id="inviteForm-email-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('email')?.errors?.required">
{{t('required-field')}}
</div>

<div class="mb-3">
<label for="password" class="form-label">Password</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="passwordTooltip" role="button" tabindex="0"></i>
<ng-template #passwordTooltip>
Password must be between 6 and 32 characters in length
</ng-template>
<span class="visually-hidden" id="password-help"><ng-container [ngTemplateOutlet]="passwordTooltip"></ng-container></span>
<input id="password" class="form-control" maxlength="32" minlength="6" pattern="^.{6,32}$" formControlName="password" type="password" aria-describedby="password-help">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('password')?.errors?.required">
This field is required
</div>
<div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength || registerForm.get('password')?.errors?.pattern">
Password must be between 6 and 32 characters in length
</div>
</div>
<div *ngIf="registerForm.get('email')?.errors?.email">
{{t('valid-email')}}
</div>

<div class="float-end">
<button class="btn btn-secondary alt" type="submit">Register</button>
</div>
</div>

<div class="mb-3">
<label for="password" class="form-label">{{t('password-label')}}</label>&nbsp;<i class="fa fa-info-circle" placement="right" [ngbTooltip]="passwordTooltip" role="button" tabindex="0"></i>
<ng-template #passwordTooltip>
{{t('password-validation')}}
</ng-template>
<span class="visually-hidden" id="password-help"><ng-container [ngTemplateOutlet]="passwordTooltip"></ng-container></span>
<input id="password" class="form-control" maxlength="32" minlength="6" pattern="^.{6,32}$" formControlName="password" type="password" aria-describedby="password-help">
<div id="inviteForm-password-validations" class="invalid-feedback" *ngIf="registerForm.dirty || registerForm.touched">
<div *ngIf="registerForm.get('password')?.errors?.required">
{{t('required-field')}}
</div>
</form>
<div *ngIf="registerForm.get('password')?.errors?.minlength || registerForm.get('password')?.errors?.maxLength || registerForm.get('password')?.errors?.pattern">
{{t('password-validation')}}
</div>
</div>
</div>

<div class="float-end">
<button class="btn btn-secondary alt" type="submit">{{t('register')}}</button>
</div>
</form>
</ng-container>
</app-splash-container>
</app-splash-container>
</ng-container>
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import { NavService } from 'src/app/_services/nav.service';
import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap';
import { NgIf, NgFor, NgTemplateOutlet } from '@angular/common';
import { SplashContainerComponent } from '../splash-container/splash-container.component';
import {TranslocoModule} from "@ngneat/transloco";

@Component({
selector: 'app-confirm-email',
templateUrl: './confirm-email.component.html',
styleUrls: ['./confirm-email.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [SplashContainerComponent, NgIf, NgFor, ReactiveFormsModule, NgbTooltip, NgTemplateOutlet]
imports: [SplashContainerComponent, NgIf, NgFor, ReactiveFormsModule, NgbTooltip, NgTemplateOutlet, TranslocoModule]
})
export class ConfirmEmailComponent {
/**
Expand All @@ -35,8 +36,8 @@ export class ConfirmEmailComponent {
errors: Array<string> = [];


constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService,
private toastr: ToastrService, private themeService: ThemeService, private navService: NavService,
constructor(private route: ActivatedRoute, private router: Router, private accountService: AccountService,
private toastr: ToastrService, private themeService: ThemeService, private navService: NavService,
private readonly cdRef: ChangeDetectorRef) {
this.navService.hideSideNav();
this.themeService.setTheme(this.themeService.defaultTheme);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
id="password" type="password" pattern="^.{6,32}$" [placeholder]="t('password')">
<div id="inviteForm-validations" class="invalid-feedback" *ngIf="loginForm.get('password')?.errors?.pattern" >
<div class="" *ngIf="loginForm.get('password')?.errors?.pattern">
{{t('password-validation', {min: 6, max: 32})}}
{{t('password-validation')}}
</div>
</div>
</div>
Expand Down
23 changes: 22 additions & 1 deletion UI/Web/src/assets/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Login",
"username": "Username",
"password": "Password",
"password-validation": "Password must be between {{min}} and {{max}} characters in length",
"password-validation": "Password must be between 6 and 32 characters in length",
"forgot-password": "Forgot Password?",
"submit": "{{common.submit}}"
},
Expand Down Expand Up @@ -605,6 +605,7 @@
"settings-header": "Settings",
"table-of-contents-header": "Table of Contents",
"bookmarks-header": "Bookmarks",
"toc-header": "ToC",

"loading-books": "Loading book...",
"go-back": "Go Back",
Expand All @@ -615,6 +616,26 @@

},

"personal-table-of-contents": {
"no-data": "Nothing Bookmarked yet",
"page": "Page {{value}}",
"delete": "Delete {{bookmarkName}}"
},

"confirm-email": {
"title": "Register",
"description": "Complete the form to complete your registration",
"error-label": "Errors: ",
"username-label": "Username",
"password-label": "Password",
"email-label": "{{common.email}}",
"required-field": "{{common.required-field}}",
"valid-email": "{{common.valid-email}}",
"password-validation": "{{login.password-validation}}",
"register": "Register"

},

"validation": {
"required-field": "This field is required",
"valid-email": "This must be a valid email"
Expand Down

0 comments on commit 8fcab22

Please sign in to comment.