From 1fd61899eaea245a5844e33e21f04b2562f16e5e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 3 May 2021 11:06:19 +0200 Subject: Add ability to filter my videos by live --- .../advanced-input-filter.component.html | 22 ++++++++++++++++++ .../advanced-input-filter.component.scss | 10 ++++++++ .../advanced-input-filter.component.ts | 27 ++++++++++++++++++++++ client/src/app/shared/shared-forms/index.ts | 10 ++++---- .../app/shared/shared-forms/shared-form.module.ts | 9 ++++++-- 5 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 client/src/app/shared/shared-forms/advanced-input-filter.component.html create mode 100644 client/src/app/shared/shared-forms/advanced-input-filter.component.scss create mode 100644 client/src/app/shared/shared-forms/advanced-input-filter.component.ts (limited to 'client/src/app/shared/shared-forms') diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.html b/client/src/app/shared/shared-forms/advanced-input-filter.component.html new file mode 100644 index 000000000..03c4f127b --- /dev/null +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.html @@ -0,0 +1,22 @@ +
+
+
+ +
+ +
+ + + + {{ filter.label }} + + +
+
+ + + Clear filters +
diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.scss b/client/src/app/shared/shared-forms/advanced-input-filter.component.scss new file mode 100644 index 000000000..7c2198927 --- /dev/null +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.scss @@ -0,0 +1,10 @@ +@import '_variables'; +@import '_mixins'; + +input { + @include peertube-input-text(250px); +} + +.input-group-text { + background-color: transparent; +} diff --git a/client/src/app/shared/shared-forms/advanced-input-filter.component.ts b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts new file mode 100644 index 000000000..394090751 --- /dev/null +++ b/client/src/app/shared/shared-forms/advanced-input-filter.component.ts @@ -0,0 +1,27 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core' +import { Params } from '@angular/router' + +export type AdvancedInputFilter = { + label: string + queryParams: Params +} + +@Component({ + selector: 'my-advanced-input-filter', + templateUrl: './advanced-input-filter.component.html', + styleUrls: [ './advanced-input-filter.component.scss' ] +}) +export class AdvancedInputFilterComponent { + @Input() filters: AdvancedInputFilter[] = [] + + @Output() resetTableFilter = new EventEmitter() + @Output() search = new EventEmitter() + + onSearch (event: Event) { + this.search.emit(event) + } + + onResetTableFilter () { + this.resetTableFilter.emit() + } +} diff --git a/client/src/app/shared/shared-forms/index.ts b/client/src/app/shared/shared-forms/index.ts index 1d859b991..727416a40 100644 --- a/client/src/app/shared/shared-forms/index.ts +++ b/client/src/app/shared/shared-forms/index.ts @@ -1,12 +1,14 @@ -export * from './form-validator.service' +export * from './advanced-input-filter.component' export * from './form-reactive' -export * from './select' -export * from './input-toggle-hidden.component' +export * from './form-validator.service' +export * from './form-validator.service' export * from './input-switch.component' +export * from './input-toggle-hidden.component' export * from './markdown-textarea.component' export * from './peertube-checkbox.component' export * from './preview-upload.component' export * from './reactive-file.component' +export * from './select' +export * from './shared-form.module' export * from './textarea-autoresize.directive' export * from './timestamp-input.component' -export * from './shared-form.module' diff --git a/client/src/app/shared/shared-forms/shared-form.module.ts b/client/src/app/shared/shared-forms/shared-form.module.ts index 9bdd138a1..5417f7342 100644 --- a/client/src/app/shared/shared-forms/shared-form.module.ts +++ b/client/src/app/shared/shared-forms/shared-form.module.ts @@ -5,6 +5,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { NgSelectModule } from '@ng-select/ng-select' import { SharedGlobalIconModule } from '../shared-icons' import { SharedMainModule } from '../shared-main/shared-main.module' +import { AdvancedInputFilterComponent } from './advanced-input-filter.component' import { DynamicFormFieldComponent } from './dynamic-form-field.component' import { FormValidatorService } from './form-validator.service' import { InputSwitchComponent } from './input-switch.component' @@ -52,7 +53,9 @@ import { TimestampInputComponent } from './timestamp-input.component' SelectCheckboxComponent, SelectCustomValueComponent, - DynamicFormFieldComponent + DynamicFormFieldComponent, + + AdvancedInputFilterComponent ], exports: [ @@ -78,7 +81,9 @@ import { TimestampInputComponent } from './timestamp-input.component' SelectCheckboxComponent, SelectCustomValueComponent, - DynamicFormFieldComponent + DynamicFormFieldComponent, + + AdvancedInputFilterComponent ], providers: [ -- cgit v1.2.3