From a00045a2184e4cb24b838e95937e7ffedcd66b2b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 27 Aug 2019 09:59:36 +0200 Subject: [PATCH] Improve features table --- .../instance/feature-boolean.component.html | 3 + .../instance/feature-boolean.component.scss | 10 +++ .../instance/feature-boolean.component.ts | 10 +++ .../instance-features-table.component.html | 65 +++++++++++++++++-- .../instance-features-table.component.scss | 26 ++++++-- .../instance-features-table.component.ts | 36 +--------- client/src/app/shared/shared.module.ts | 2 + 7 files changed, 105 insertions(+), 47 deletions(-) create mode 100644 client/src/app/shared/instance/feature-boolean.component.html create mode 100644 client/src/app/shared/instance/feature-boolean.component.scss create mode 100644 client/src/app/shared/instance/feature-boolean.component.ts diff --git a/client/src/app/shared/instance/feature-boolean.component.html b/client/src/app/shared/instance/feature-boolean.component.html new file mode 100644 index 000000000..ac208fc13 --- /dev/null +++ b/client/src/app/shared/instance/feature-boolean.component.html @@ -0,0 +1,3 @@ + + + diff --git a/client/src/app/shared/instance/feature-boolean.component.scss b/client/src/app/shared/instance/feature-boolean.component.scss new file mode 100644 index 000000000..56d08af06 --- /dev/null +++ b/client/src/app/shared/instance/feature-boolean.component.scss @@ -0,0 +1,10 @@ +@import '_variables'; +@import '_mixins'; + +.glyphicon-ok { + color: $green; +} + +.glyphicon-remove { + color: $red; +} diff --git a/client/src/app/shared/instance/feature-boolean.component.ts b/client/src/app/shared/instance/feature-boolean.component.ts new file mode 100644 index 000000000..d02d513d6 --- /dev/null +++ b/client/src/app/shared/instance/feature-boolean.component.ts @@ -0,0 +1,10 @@ +import { Component, Input } from '@angular/core' + +@Component({ + selector: 'my-feature-boolean', + templateUrl: './feature-boolean.component.html', + styleUrls: [ './feature-boolean.component.scss' ] +}) +export class FeatureBooleanComponent { + @Input() value: boolean +} diff --git a/client/src/app/shared/instance/instance-features-table.component.html b/client/src/app/shared/instance/instance-features-table.component.html index 2987bd00e..845876f55 100644 --- a/client/src/app/shared/instance/instance-features-table.component.html +++ b/client/src/app/shared/instance/instance-features-table.component.html @@ -1,22 +1,43 @@
- +
- + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Default NSFW/sensitive videos policy (can be redefined by the users) +
Default NSFW/sensitive videos policy
+
can be redefined by the users
+
{{ buildNSFWLabel() }}
{{ feature.label }}
User registration allowed - - +
Video quotaVideo uploads
Transcoding in multiple resolutions + +
Video uploads + Requires manual validation by moderators + Automatically published +
Video quota @@ -30,5 +51,35 @@
Import
HTTP import (YouTube, Vimeo, direct URL...) + +
Torrent import + +
Player
P2P enabled + +
diff --git a/client/src/app/shared/instance/instance-features-table.component.scss b/client/src/app/shared/instance/instance-features-table.component.scss index f9bec038d..67f2b6c84 100644 --- a/client/src/app/shared/instance/instance-features-table.component.scss +++ b/client/src/app/shared/instance/instance-features-table.component.scss @@ -5,16 +5,28 @@ table { font-size: 14px; color: var(--mainForegroundColor); - .label { - font-weight: $font-semibold; + .label, + .sub-label { min-width: 330px; - } - .glyphicon-ok { - color: $green; + &.label { + font-weight: $font-semibold; + } + + &.sub-label { + padding-left: 30px; + } + + .more-info { + font-style: italic; + font-weight: initial; + font-size: 14px + } } - .glyphicon-remove { - color: $red; + td { + vertical-align: middle; } } + + diff --git a/client/src/app/shared/instance/instance-features-table.component.ts b/client/src/app/shared/instance/instance-features-table.component.ts index a53082a93..46df4d0b2 100644 --- a/client/src/app/shared/instance/instance-features-table.component.ts +++ b/client/src/app/shared/instance/instance-features-table.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core' import { ServerService } from '@app/core' import { I18n } from '@ngx-translate/i18n-polyfill' +import { ServerConfig } from '@shared/models' @Component({ selector: 'my-instance-features-table', @@ -8,8 +9,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill' styleUrls: [ './instance-features-table.component.scss' ] }) export class InstanceFeaturesTableComponent implements OnInit { - features: { label: string, value?: boolean }[] = [] quotaHelpIndication = '' + config: ServerConfig constructor ( private i18n: I18n, @@ -28,7 +29,7 @@ export class InstanceFeaturesTableComponent implements OnInit { ngOnInit () { this.serverService.configLoaded .subscribe(() => { - this.buildFeatures() + this.config = this.serverService.getConfig() this.buildQuotaHelpIndication() }) } @@ -41,37 +42,6 @@ export class InstanceFeaturesTableComponent implements OnInit { if (policy === 'display') return this.i18n('Displayed') } - private buildFeatures () { - const config = this.serverService.getConfig() - - this.features = [ - { - label: this.i18n('User registration allowed'), - value: config.signup.allowed - }, - { - label: this.i18n('Video uploads require manual validation by moderators'), - value: config.autoBlacklist.videos.ofUsers.enabled - }, - { - label: this.i18n('Transcode your videos in multiple resolutions'), - value: config.transcoding.enabledResolutions.length !== 0 - }, - { - label: this.i18n('HTTP import (YouTube, Vimeo, direct URL...)'), - value: config.import.videos.http.enabled - }, - { - label: this.i18n('Torrent import'), - value: config.import.videos.torrent.enabled - }, - { - label: this.i18n('P2P enabled'), - value: config.tracker.enabled - } - ] - } - private getApproximateTime (seconds: number) { const hours = Math.floor(seconds / 3600) let pluralSuffix = '' diff --git a/client/src/app/shared/shared.module.ts b/client/src/app/shared/shared.module.ts index d71f6357b..65e0f21a4 100644 --- a/client/src/app/shared/shared.module.ts +++ b/client/src/app/shared/shared.module.ts @@ -92,6 +92,7 @@ import { VideoReportComponent } from '@app/shared/video/modals/video-report.comp import { ClipboardModule } from 'ngx-clipboard' import { FollowService } from '@app/shared/instance/follow.service' import { MultiSelectModule } from 'primeng/multiselect' +import { FeatureBooleanComponent } from '@app/shared/instance/feature-boolean.component' @NgModule({ imports: [ @@ -156,6 +157,7 @@ import { MultiSelectModule } from 'primeng/multiselect' SubscribeButtonComponent, RemoteSubscribeComponent, InstanceFeaturesTableComponent, + FeatureBooleanComponent, UserBanModalComponent, UserModerationDropdownComponent, TopMenuDropdownComponent, -- 2.25.1