-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
123 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ent/src/app/modules/media/components/audio-input-enable/audio-input-enable.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../src/app/modules/settings/components/recognition-engine/recognition-engine.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<div class="card bg-base-100 shadow-xl flex flex-col max-w-xl" *ngIf="isLoggedIn(); else loginRequired"> | ||
<div class="card-body"> | ||
<div class="card-title"><span translate>SETTINGS.PROVIDER.title</span></div> | ||
<div class="text-sm mb-3" translate>SETTINGS.PROVIDER.description</div> | ||
|
||
<app-recognition-engine-select></app-recognition-engine-select> | ||
<ng-container *ngIf="provider() as p"> | ||
<div class="text-md mt-3">{{'SETTINGS.PROVIDER.' + p + '.label' | translate}}</div> | ||
<p>{{'SETTINGS.PROVIDER.' + p + '.description' | translate }}</p> | ||
<div class="flex flex-row flex-wrap justify-between"> | ||
<div class="text-sm">{{'SETTINGS.PROVIDER.' + p + '.cost' | translate }}</div> | ||
<div class="text-sm" *ngIf="p !== 'web'"><span translate>SETTINGS.PROVIDER.balance</span>: {{balance()}}</div> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</div> | ||
|
||
<ng-template #loginRequired> | ||
<div class="badge badge-warning p-3 cursor-pointer" [routerLink]="['..','auth']" translate>SETTINGS.SHARING.loginRequired</div> | ||
</ng-template> |
Empty file.
21 changes: 21 additions & 0 deletions
21
...c/app/modules/settings/components/recognition-engine/recognition-engine.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { RecognitionEngineComponent } from './recognition-engine.component'; | ||
|
||
describe('RecognitionEngineComponent', () => { | ||
let component: RecognitionEngineComponent; | ||
let fixture: ComponentFixture<RecognitionEngineComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [RecognitionEngineComponent], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(RecognitionEngineComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
31 changes: 31 additions & 0 deletions
31
...nt/src/app/modules/settings/components/recognition-engine/recognition-engine.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Component, computed, Signal } from '@angular/core'; | ||
import { toSignal } from '@angular/core/rxjs-interop'; | ||
import { Store, select } from '@ngrx/store'; | ||
import { AppState } from '../../../../models/app.model'; | ||
import { RecognitionEngineState } from '../../../../models/recognition.model'; | ||
import { selectRecognitionEngine } from '../../../../selectors/recognition.selector'; | ||
import { map } from 'rxjs'; | ||
import { selectUserBalance } from '../../../../selectors/user.selector'; | ||
import { selectUserLoggedIn } from '../../../../selectors/auth.selectors'; | ||
|
||
@Component({ | ||
selector: 'app-recognition-engine', | ||
templateUrl: './recognition-engine.component.html', | ||
styleUrls: ['./recognition-engine.component.scss'], | ||
}) | ||
export class RecognitionEngineComponent { | ||
public provider: Signal<RecognitionEngineState['provider'] | undefined>; | ||
public balance: Signal<number | undefined>; | ||
public isLoggedIn: Signal<boolean | undefined>; | ||
constructor(private store: Store<AppState>) { | ||
this.provider = toSignal(this.store.pipe( | ||
select(selectRecognitionEngine), | ||
map((e) => e?.provider ) | ||
)); | ||
|
||
this.isLoggedIn = toSignal(this.store.select(selectUserLoggedIn)); | ||
const balance = toSignal(this.store.select(selectUserBalance)); | ||
this.balance = computed(() => this.isLoggedIn() ? balance() : undefined) | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { Routes } from '@angular/router' | ||
import { SettingsComponent } from './components/settings/settings.component' | ||
import { unsavedChangesGuard } from '../../guards/unsaved-changes/unsaved-changes.guard' | ||
|
||
export const routes: Routes = [ | ||
{ path: '', component: SettingsComponent, canDeactivate: [ unsavedChangesGuard ] }, | ||
{ path: '', component: SettingsComponent }, | ||
] |
18 changes: 1 addition & 17 deletions
18
packages/client/src/app/modules/user/components/user-home/user-home.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters