ActivityPub-federated video streaming platform using P2P directly in your web browser
Add unavailable info in manage video menu
Chocobozzza256b543719b
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.htmlindex d5e6510c97..990460e3d5 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html+++ b/client/src/app/+admin/config/edit-custom-config/edit-advanced-configuration.component.html@@ -86,12 +86,10 @@<div class="form-group"><label i18n for="customizationJavascript">JavaScript</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>- <p class="mb-2">Write JavaScript code directly. Example:</p>- <pre>console.log('my instance is amazing');</pre>- </ng-container>- </ng-template>+ <ng-container i18n>+ <p class="mb-2">Write JavaScript code directly. Example:</p>+ <pre>console.log('my instance is amazing');</pre>+ </ng-container></my-help><textarea@@ -106,8 +104,7 @@<label for="customizationCSS">CSS</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>+ <ng-container i18n><p class="mb-2">Write CSS code directly. Example:</p><pre>#custom-css {{ '{' }}@@ -120,8 +117,7 @@color: red;{{ '}' }}</pre>- </ng-container>- </ng-template>+ </ng-container></my-help><textareadiff --git a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.htmlindex cc4c0f2f23..daaeef7d0a 100644--- a/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html+++ b/client/src/app/+admin/config/edit-custom-config/edit-instance-information.component.html@@ -202,11 +202,9 @@<label i18n for="instanceDefaultNSFWPolicy">Policy on videos containing sensitive content</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>- With <strong>Hide</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video.- </ng-container>- </ng-template>+ <ng-container i18n>+ With <strong>Hide</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video.+ </ng-container></my-help><div class="peertube-select-container">diff --git a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html b/client/src/app/+admin/overview/users/user-edit/user-edit.component.htmlindex 674569849c..f111ddd0b5 100644--- a/client/src/app/+admin/overview/users/user-edit/user-edit.component.html+++ b/client/src/app/+admin/overview/users/user-edit/user-edit.component.html@@ -124,11 +124,9 @@<label i18n for="password">Password</label><my-help *ngIf="isPasswordOptional()">- <ng-template ptTemplate="customHtml">- <ng-container i18n>- If you leave the password empty, an email will be sent to the user.- </ng-container>- </ng-template>+ <ng-container i18n>+ If you leave the password empty, an email will be sent to the user.+ </ng-container></my-help><my-input-text formControlName="password" inputId="password" [formError]="formErrors['password']" autocomplete="new-password"></my-input-text>diff --git a/client/src/app/+video-watch/shared/comment/video-comment-add.component.html b/client/src/app/+video-watch/shared/comment/video-comment-add.component.htmlindex 7f53cffcd7..116fde4bbd 100644--- a/client/src/app/+video-watch/shared/comment/video-comment-add.component.html+++ b/client/src/app/+video-watch/shared/comment/video-comment-add.component.html@@ -16,28 +16,26 @@[ngClass]="{ 'is-rtl': isRTL() }" class="markdown-guide" helpType="custom" iconName="markdown"tooltipPlacement="left auto" autoClose="true" i18n-title title="Markdown compatible">- <ng-template ptTemplate="customHtml">- <span i18n>Markdown compatible that supports:</span>+ <span i18n>Markdown compatible that supports:</span>- <ul>- <li><span i18n>Auto generated links</span></li>- <li><span i18n>Break lines</span></li>- <li><span i18n>Lists</span></li>- <li>- <span i18n>Emphasis</span>- <code>**<strong i18n>bold</strong>** _<i i18n>italic</i>_</code>- </li>- <li>- <span i18n>Emoji shortcuts</span>- <code>:) <3</code>- </li>- <li>- <span i18n>Emoji markup</span>- <code>:smile:</code>- <div><a href="" (click)="openEmojiModal($event)" i18n>See complete list</a></div>- </li>- </ul>- </ng-template>+ <ul>+ <li><span i18n>Auto generated links</span></li>+ <li><span i18n>Break lines</span></li>+ <li><span i18n>Lists</span></li>+ <li>+ <span i18n>Emphasis</span>+ <code>**<strong i18n>bold</strong>** _<i i18n>italic</i>_</code>+ </li>+ <li>+ <span i18n>Emoji shortcuts</span>+ <code>:) <3</code>+ </li>+ <li>+ <span i18n>Emoji markup</span>+ <code>:smile:</code>+ <div><a href="" (click)="openEmojiModal($event)" i18n>See complete list</a></div>+ </li>+ </ul></my-help><div *ngIf="formErrors.text" class="form-error" role="alert">{{ formErrors.text }}diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.html b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.htmlindex 54d8029f4e..93c9a4d0fe 100644--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.html+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-torrent.component.html@@ -16,12 +16,10 @@<div class="form-group form-group-magnet-uri"><label i18n for="magnetUri">Paste magnet URI</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>- You can import any torrent file that points to a media file.- You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance.- </ng-container>- </ng-template>+ <ng-container i18n>+ You can import any torrent file that points to a media file.+ You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance.+ </ng-container></my-help><input type="text" id="magnetUri" [(ngModel)]="firstStepMagnetUri" class="form-control" />diff --git a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.html b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.htmlindex 839d4c182c..0bc75ba4af 100644--- a/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.html+++ b/client/src/app/+videos-publish-manage/+video-publish/import/video-import-url.component.html@@ -7,13 +7,11 @@<label i18n for="targetUrl">URL</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>- You can import any URL <a href='https://rg3.github.io/youtube-dl/supportedsites.html' target='_blank' rel='noopener noreferrer'>supported by youtube-dl</a>- or URL that points to a media file.- You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance.- </ng-container>- </ng-template>+ <ng-container i18n>+ You can import any URL <a href='https://rg3.github.io/youtube-dl/supportedsites.html' target='_blank' rel='noopener noreferrer'>supported by youtube-dl</a>+ or URL that points to a media file.+ You should make sure you have diffusion rights over the content it points to, otherwise it could cause legal trouble to yourself and your instance.+ </ng-container></my-help><input type="text" id="targetUrl" [(ngModel)]="targetUrl" class="form-control" />diff --git a/client/src/app/+videos-publish-manage/shared-manage/common/unavailable-features.ts b/client/src/app/+videos-publish-manage/shared-manage/common/unavailable-features.tsnew file mode 100644index 0000000000..91842a248b--- /dev/null+++ b/client/src/app/+videos-publish-manage/shared-manage/common/unavailable-features.ts@@ -0,0 +1,46 @@+import { canVideoFileBeEdited } from '@peertube/peertube-core-utils'+import { VideoState, VideoStateType } from '@peertube/peertube-models'++export function getReplaceFileUnavailability (options: {+ isLive: boolean+ replaceFileEnabled: boolean+ state: VideoStateType+ instanceName: string+}) {+ const { isLive, replaceFileEnabled, state, instanceName } = options++ if (!replaceFileEnabled) return $localize`File replacement is not enabled on ${instanceName}.`++ if (!canVideoFileBeEdited(state)) {+ if (isLive) return $localize`File replacement is not available on a live.`+ if (state === VideoState.TO_TRANSCODE) return $localize`File replacement is not available while the video is being transcoding.`+ if (state === VideoState.TO_EDIT) return $localize`File replacement is not available while the video is being edited.`+ if (state === VideoState.TO_IMPORT) return $localize`File replacement is not available while the video is being imported.`++ return $localize`File replacement is not available.`+ }++ return ''+}++export function getStudioUnavailability (options: {+ isLive: boolean+ studioEnabled: boolean+ state: VideoStateType+ instanceName: string+}) {+ const { isLive, studioEnabled, state, instanceName } = options++ if (!studioEnabled) return $localize`Studio is not enabled on ${instanceName}.`++ if (!canVideoFileBeEdited(state)) {+ if (isLive) return $localize`Studio is not available on a live.`+ if (state === VideoState.TO_TRANSCODE) return $localize`Studio is not available while the video is being transcoding.`+ if (state === VideoState.TO_EDIT) return $localize`Studio is not available while the video is being edited.`+ if (state === VideoState.TO_IMPORT) return $localize`Studio is not available while the video is being imported.`++ return $localize`Studio is not available.`+ }++ return ''+}diff --git a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.html b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.htmlindex 455577d92b..bc3fa254e2 100644--- a/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.html+++ b/client/src/app/+videos-publish-manage/shared-manage/main-info/video-main-info.component.html@@ -60,7 +60,7 @@<my-markdown-textareainputId="support" formControlName="support" markdownType="enhanced"- [formError]="formErrors['support']"+ [formError]="formErrors['support']" withEmoji="true" withHtml="true"></my-markdown-textarea><div class="form-group-description mt-3" i18n>diff --git a/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.html b/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.htmlindex 24a7193eb2..1b9a4121d0 100644--- a/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.html+++ b/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.html@@ -4,20 +4,8 @@<ng-container i18n>Replace file</ng-container></h2>-@if (!replaceFileEnabled) {- <my-alert type="primary" i18n>File replacement is not enabled on {{ instanceName }}.</my-alert>-} @else if (!canFileBeReplaced()) {- @if (isLive()) {- <my-alert type="primary" i18n>File replacement is not available on a live.</my-alert>- } @else if (isTranscoding()) {- <my-alert type="primary" i18n>File replacement is not available while the video is being transcoding.</my-alert>- } @else if (isEditing()) {- <my-alert type="primary" i18n>File replacement is not available while the video is being edited.</my-alert>- } @else if (isImporting()) {- <my-alert type="primary" i18n>File replacement is not available while the video is being imported.</my-alert>- } @else {- <my-alert type="primary" i18n>File replacement is not available.</my-alert>- }+@if (getUnavailability()) {+ <my-alert type="primary" i18n>{{ getUnavailability() }}</my-alert>} @else {<div [formGroup]="form"><div class="form-columns reverse">diff --git a/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.ts b/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.tsindex 3bf8491baf..39596b889e 100644--- a/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.ts+++ b/client/src/app/+videos-publish-manage/shared-manage/replace-file/video-replace-file.component.ts@@ -4,13 +4,12 @@ import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angulimport { ServerService } from '@app/core'import { BuildFormArgument } from '@app/shared/form-validators/form-validator.model'import { FormReactiveErrors, FormReactiveService, FormReactiveValidationMessages } from '@app/shared/shared-forms/form-reactive.service'-import { canVideoFileBeEdited } from '@peertube/peertube-core-utils'-import { VideoState } from '@peertube/peertube-models'import debug from 'debug'import { Subscription } from 'rxjs'import { ReactiveFileComponent } from '../../../shared/shared-forms/reactive-file.component'import { GlobalIconComponent } from '../../../shared/shared-icons/global-icon.component'import { AlertComponent } from '../../../shared/shared-main/common/alert.component'+import { getReplaceFileUnavailability } from '../common/unavailable-features'import { VideoEdit } from '../common/video-edit.model'import { VideoUploadService } from '../common/video-upload.service'import { VideoManageController } from '../video-manage-controller.service'@@ -97,23 +96,12 @@ export class VideoReplaceFileComponent implements OnInit, OnDestroy {return this.videoUploadService.getVideoExtensions()}- canFileBeReplaced () {- return canVideoFileBeEdited(this.videoEdit.getVideoAttributes().state)- }-- isLive () {- return this.videoEdit.getVideoAttributes().isLive- }-- isTranscoding () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_TRANSCODE- }-- isEditing () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_EDIT- }+ getUnavailability () {+ return getReplaceFileUnavailability({+ ...this.videoEdit.getVideoAttributes(),- isImporting () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_IMPORT+ instanceName: this.instanceName,+ replaceFileEnabled: this.replaceFileEnabled+ })}}diff --git a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.html b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.htmlindex 95e6d52d23..31d267f3a8 100644--- a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.html+++ b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.html@@ -11,7 +11,7 @@{{ card.label }}<my-help *ngIf="card.help">- <ng-template ptTemplate="customHtml">{{ card.help }}</ng-template>+ {{ card.help }}</my-help></div><div class="value">{{ card.value }}</div>diff --git a/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.html b/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.htmlindex b2f33ff381..ba55d4d1c2 100644--- a/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.html+++ b/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.html@@ -4,20 +4,8 @@<ng-container i18n>Studio</ng-container></h2>-@if (!studioEnabled) {- <my-alert type="primary" i18n>Studio is not enabled on {{ instanceName }}.</my-alert>-} @else if (!canFileBeReplaced()) {- @if (isLive()) {- <my-alert type="primary" i18n>Studio is not available on a live.</my-alert>- } @else if (isTranscoding()) {- <my-alert type="primary" i18n>Studio is not available while the video is being transcoding.</my-alert>- } @else if (isEditing()) {- <my-alert type="primary" i18n>Studio is not available while the video is being edited.</my-alert>- } @else if (isImporting()) {- <my-alert type="primary" i18n>Studio is not available while the video is being imported.</my-alert>- } @else {- <my-alert type="primary" i18n>Studio is not available.</my-alert>- }+@if (getUnavailability()) {+ <my-alert type="primary">{{ getUnavailability() }}</my-alert>} @else {<div class="grid-container"><form [formGroup]="form">diff --git a/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.ts b/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.tsindex 85dbb0f106..56725a13be 100644--- a/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.ts+++ b/client/src/app/+videos-publish-manage/shared-manage/studio/video-studio.component.ts@@ -7,13 +7,12 @@ import { ReactiveFileComponent } from '@app/shared/shared-forms/reactive-file.coimport { TimestampInputComponent } from '@app/shared/shared-forms/timestamp-input.component'import { GlobalIconComponent } from '@app/shared/shared-icons/global-icon.component'import { EmbedComponent } from '@app/shared/shared-main/video/embed.component'-import { canVideoFileBeEdited } from '@peertube/peertube-core-utils'-import { VideoState } from '@peertube/peertube-models'import debug from 'debug'import { Subscription } from 'rxjs'+import { AlertComponent } from '../../../shared/shared-main/common/alert.component'+import { getStudioUnavailability } from '../common/unavailable-features'import { VideoEdit } from '../common/video-edit.model'import { VideoManageController } from '../video-manage-controller.service'-import { AlertComponent } from '../../../shared/shared-main/common/alert.component'const debugLogger = debug('peertube:video-manage')@@ -128,23 +127,12 @@ export class VideoStudioEditComponent implements OnInit, OnDestroy {return this.videoEdit.getStudioTasks().length === 0}- canFileBeReplaced () {- return canVideoFileBeEdited(this.videoEdit.getVideoAttributes().state)- }-- isLive () {- return this.videoEdit.getVideoAttributes().isLive- }-- isTranscoding () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_TRANSCODE- }+ getUnavailability () {+ return getStudioUnavailability({+ ...this.videoEdit.getVideoAttributes(),- isEditing () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_EDIT- }-- isImporting () {- return this.videoEdit.getVideoAttributes().state === VideoState.TO_IMPORT+ instanceName: this.instanceName,+ studioEnabled: this.studioEnabled+ })}}diff --git a/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.html b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.htmlnew file mode 100644index 0000000000..c31424dfaa--- /dev/null+++ b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.html@@ -0,0 +1,17 @@+<div class="unavailable d-flex align-items-center">+ <ng-content select=".icon"></ng-content>++ <div>+ <div>+ <ng-content select=".label"></ng-content>+ </div>++ <div>+ <div class="pt-badge badge-secondary-on-secondary me-1" i18n>UNAVAILABLE</div>++ <my-help i18n-helpTitle helpTitle="Feature unavailable" container="body">+ {{ help() }}+ </my-help>+ </div>+ </div>+</div>diff --git a/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.scss b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.scssnew file mode 100644index 0000000000..7ec0beaae9--- /dev/null+++ b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.scss@@ -0,0 +1,11 @@+@use '_variables' as *;+@use '_mixins' as *;+@use '_form-mixins' as *;++.unavailable {+ display: flex;++ my-help {+ color: pvar(--fg-200);+ }+}diff --git a/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.ts b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.tsnew file mode 100644index 0000000000..1d7952169c--- /dev/null+++ b/client/src/app/+videos-publish-manage/shared-manage/unavailable-menu-entry.component.ts@@ -0,0 +1,23 @@+import { CommonModule } from '@angular/common'+import { Component, input } from '@angular/core'+import { FormsModule, ReactiveFormsModule } from '@angular/forms'+import { RouterModule } from '@angular/router'+import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'+import { HelpComponent } from '../../shared/shared-main/buttons/help.component'++@Component({+ selector: 'my-unavailable-menu-entry',+ templateUrl: './unavailable-menu-entry.component.html',+ styleUrls: [ './unavailable-menu-entry.component.scss' ],+ imports: [+ CommonModule,+ RouterModule,+ FormsModule,+ ReactiveFormsModule,+ NgbTooltipModule,+ HelpComponent+ ]+})+export class UnavailableMenuEntryComponent {+ readonly help = input.required<string>()+}diff --git a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.html b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.htmlindex 1f44e9af8e..7fbb8f3732 100644--- a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.html+++ b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.html@@ -72,23 +72,51 @@</div><li>- <a routerLink="studio" queryParamsHandling="merge" routerLinkActive="active">+ <ng-template #iconStudio><div class="global-icon-wrapper"><my-global-icon iconName="studio"></my-global-icon></div>+ </ng-template>+ <ng-template #labelStudio><span i18n>Studio</span>- </a>+ </ng-template>++ @if (studioUnavailable()) {+ <my-unavailable-menu-entry [help]="studioUnavailable()">+ <span class="icon" *ngTemplateOutlet="iconStudio"></span>+ <span class="label" *ngTemplateOutlet="labelStudio"></span>+ </my-unavailable-menu-entry>+ } @else {+ <a routerLink="studio" queryParamsHandling="merge" routerLinkActive="active">+ <ng-container *ngTemplateOutlet="iconStudio"></ng-container>+ <ng-container *ngTemplateOutlet="labelStudio"></ng-container>+ </a>+ }</li><li>- <a routerLink="replace-file" queryParamsHandling="merge" routerLinkActive="active">+ <ng-template #iconReplaceFile><div class="global-icon-wrapper"><my-global-icon iconName="upload"></my-global-icon></div>+ </ng-template>+ <ng-template #labelReplaceFile><span i18n>Replace file</span>- </a>+ </ng-template>++ @if (replaceFileUnavailable()) {+ <my-unavailable-menu-entry [help]="replaceFileUnavailable()">+ <span class="icon" *ngTemplateOutlet="iconReplaceFile"></span>+ <span class="label" *ngTemplateOutlet="labelReplaceFile"></span>+ </my-unavailable-menu-entry>+ } @else {+ <a routerLink="replace-file" queryParamsHandling="merge" routerLinkActive="active">+ <ng-container *ngTemplateOutlet="iconReplaceFile"></ng-container>+ <ng-container *ngTemplateOutlet="labelReplaceFile"></ng-container>+ </a>+ }</li>}diff --git a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.scss b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.scssindex 0969395903..7b1482ac97 100644--- a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.scss+++ b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.scss@@ -29,73 +29,87 @@ h1 {background-color: pvar(--bg-secondary-400);border-radius: 14px;overflow: auto;+}- .global-icon-wrapper {- display: inline-block;- border-radius: 100%;- padding: 5px;- background-color: pvar(--bg);- line-height: 1;- width: fit-content;+.global-icon-wrapper {+ display: inline-block;+ border-radius: 100%;+ padding: 5px;+ background-color: pvar(--bg);+ line-height: 1;+ width: fit-content;+ height: fit-content;- @include margin-right(0.75rem);+ @include margin-right(0.75rem);- my-global-icon {- color: pvar(--primary);+ my-global-icon {+ color: pvar(--primary);- @include global-icon-size(22px);- }+ @include global-icon-size(22px);}+}- li {- list-style: none;- }+li {+ list-style: none;+}- a,- .separator {- @include padding-left(1.5rem);+a,+my-unavailable-menu-entry,+.separator {+ @include padding-left(1.5rem);+}++my-unavailable-menu-entry {+ color: pvar(--secondary-icon-color);++ .global-icon-wrapper my-global-icon {+ color: pvar(--secondary-icon-color) !important;}+}- a {- display: block;- padding-top: 0.5rem;- padding-bottom: 0.5rem;- color: pvar(--fg-350);+a,+my-unavailable-menu-entry {+ display: block;+ padding-top: 0.5rem;+ padding-bottom: 0.5rem;+}- @include disable-default-a-behaviour;+a {+ color: pvar(--fg-350);- &:hover {- opacity: 1;- color: pvar(--fg-400);- }+ @include disable-default-a-behaviour;- &.active {- color: pvar(--fg-400);- font-weight: $font-bold;- background-color: pvar(--bg-secondary-350);+ &:hover {+ opacity: 1;+ color: pvar(--fg-400);+ }++ &.active {+ color: pvar(--fg-400);+ font-weight: $font-bold;+ background-color: pvar(--bg-secondary-350);- .global-icon-wrapper {- background-color: pvar(--primary);+ .global-icon-wrapper {+ background-color: pvar(--primary);- my-global-icon {- color: pvar(--bg);- }+ my-global-icon {+ color: pvar(--bg);}}}+}- .separator {- padding-top: 1rem;- padding-bottom: 1rem;+.separator {+ padding-top: 1rem;+ padding-bottom: 1rem;- @include padding-right(1.5rem);+ @include padding-right(1.5rem);- > div {- height: 2px;- width: 100%;- background-color: pvar(--bg-secondary-500);- border-radius: 14px;- }+ > div {+ height: 2px;+ width: 100%;+ background-color: pvar(--bg-secondary-500);+ border-radius: 14px;}}@@ -124,33 +138,33 @@ h1 {border-bottom: 0;border-end-end-radius: 0;border-end-start-radius: 0;+ }- a {- display: flex;- flex-direction: column;- text-align: center;- align-items: center;+ a {+ display: flex;+ flex-direction: column;+ text-align: center;+ align-items: center;- &.active {- background-color: inherit;- }+ &.active {+ background-color: inherit;}+ }- a,- .separator {- font-size: 12px;- line-height: 1.2;- padding: 0 0.5rem;- }+ a,+ .separator {+ font-size: 12px;+ line-height: 1.2;+ padding: 0 0.5rem;+ }- .separator > div {- width: 2px;- height: 100%;- }+ .separator > div {+ width: 2px;+ height: 100%;+ }- .global-icon-wrapper {- margin: 0 0 0.25rem;- }+ .global-icon-wrapper {+ margin: 0 0 0.25rem;}}diff --git a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.ts b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.tsindex 6ecf26f943..affacd283b 100644--- a/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.ts+++ b/client/src/app/+videos-publish-manage/shared-manage/video-manage-menu.component.ts@@ -2,10 +2,14 @@ import { CommonModule } from '@angular/common'import { booleanAttribute, Component, inject, input, OnInit } from '@angular/core'import { FormsModule, ReactiveFormsModule } from '@angular/forms'import { RouterModule } from '@angular/router'+import { ServerService } from '@app/core'import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap'import { GlobalIconComponent } from '../../shared/shared-icons/global-icon.component'+import { getReplaceFileUnavailability, getStudioUnavailability } from './common/unavailable-features'import { VideoEdit } from './common/video-edit.model'import { VideoManageController } from './video-manage-controller.service'+import { HelpComponent } from '../../shared/shared-main/buttons/help.component'+import { UnavailableMenuEntryComponent } from './unavailable-menu-entry.component'@Component({selector: 'my-video-manage-menu',@@ -17,23 +21,51 @@ import { VideoManageController } from './video-manage-controller.service'FormsModule,ReactiveFormsModule,NgbTooltipModule,- GlobalIconComponent+ GlobalIconComponent,+ HelpComponent,+ UnavailableMenuEntryComponent]})export class VideoManageMenuComponent implements OnInit {+ private serverService = inject(ServerService)private manageController = inject(VideoManageController)readonly canWatch = input.required<boolean, string | boolean>({ transform: booleanAttribute })private videoEdit: VideoEdit+ private replaceFileEnabled: boolean+ private studioEnabled: boolean+ private instanceName: stringngOnInit (): void {- const { videoEdit } = this.manageController.getStore()+ const config = this.serverService.getHTMLConfig()+ this.studioEnabled = config.videoStudio.enabled === true+ this.instanceName = config.instance.name+ this.replaceFileEnabled = config.videoFile.update.enabled === true+ const { videoEdit } = this.manageController.getStore()this.videoEdit = videoEdit}getVideo () {return this.videoEdit.getVideoAttributes()}++ studioUnavailable () {+ return getStudioUnavailability({+ ...this.videoEdit.getVideoAttributes(),++ instanceName: this.instanceName,+ studioEnabled: this.studioEnabled+ })+ }++ replaceFileUnavailable () {+ return getReplaceFileUnavailability({+ ...this.videoEdit.getVideoAttributes(),++ instanceName: this.instanceName,+ replaceFileEnabled: this.replaceFileEnabled+ })+ }}diff --git a/client/src/app/shared/shared-forms/peertube-checkbox.component.html b/client/src/app/shared/shared-forms/peertube-checkbox.component.htmlindex cd10e21262..5284d066e1 100644--- a/client/src/app/shared/shared-forms/peertube-checkbox.component.html+++ b/client/src/app/shared/shared-forms/peertube-checkbox.component.html@@ -26,9 +26,7 @@[tooltipPlacement]="helpPlacement()"helpType="custom">- <ng-template ptTemplate="customHtml">- <ng-template *ngTemplateOutlet="helpTemplate"></ng-template>- </ng-template>+ <ng-template *ngTemplateOutlet="helpTemplate"></ng-template></my-help><div *ngIf="recommended()" class="ms-2 pt-badge badge-secondary" i18n>Recommended</div>diff --git a/client/src/app/shared/shared-instance/instance-features-table.component.html b/client/src/app/shared/shared-instance/instance-features-table.component.htmlindex 7bc073824f..d5a4aefcb8 100644--- a/client/src/app/shared/shared-instance/instance-features-table.component.html+++ b/client/src/app/shared/shared-instance/instance-features-table.component.html@@ -57,9 +57,7 @@{{ initialUserVideoQuota | bytes: 0 }} <ng-container *ngIf="dailyUserVideoQuota !== -1">({{ dailyUserVideoQuota | bytes: 0 }} per day)</ng-container><my-help tooltipPlacement="auto" helpType="custom">- <ng-template ptTemplate="customHtml">- <div [innerHTML]="quotaHelpIndication"></div>- </ng-template>+ <div [innerHTML]="quotaHelpIndication"></div></my-help></ng-container>diff --git a/client/src/app/shared/shared-main/buttons/help.component.html b/client/src/app/shared/shared-main/buttons/help.component.htmlindex 8ce8f1af8c..882b10373f 100644--- a/client/src/app/shared/shared-main/buttons/help.component.html+++ b/client/src/app/shared/shared-main/buttons/help.component.html@@ -1,21 +1,9 @@<ng-template #tooltipTemplate>- <p *ngIf="preHtmlTemplate">- <ng-template *ngTemplateOutlet="preHtmlTemplate"></ng-template>- </p>+ <strong class="help-title" *ngIf="helpTitle()">{{ helpTitle() }}</strong>- <div *ngIf="preHtmlTemplate && (customHtmlTemplate || mainHtml || postHtmlTemplate)" class="mb-2"></div>+ <p *ngIf="markdownHTML" [innerHTML]="markdownHTML"></p>- <p *ngIf="customHtmlTemplate">- <ng-template *ngTemplateOutlet="customHtmlTemplate"></ng-template>- </p>-- <p *ngIf="mainHtml" [innerHTML]="mainHtml"></p>-- <div *ngIf="(customHtmlTemplate || mainHtml) && postHtmlTemplate" class="mb-2"></div>-- <p *ngIf="postHtmlTemplate">- <ng-template *ngTemplateOutlet="postHtmlTemplate"></ng-template>- </p>+ <ng-content></ng-content></ng-template><button@@ -28,6 +16,7 @@[autoClose]="autoClose()"(onHidden)="onPopoverHidden()"(onShown)="onPopoverShown()"+ [container]="container()"type="button"><my-global-icon [iconName]="iconName()"></my-global-icon>diff --git a/client/src/app/shared/shared-main/buttons/help.component.scss b/client/src/app/shared/shared-main/buttons/help.component.scssindex 6231531b43..dbdf77895a 100644--- a/client/src/app/shared/shared-main/buttons/help.component.scss+++ b/client/src/app/shared/shared-main/buttons/help.component.scss@@ -3,25 +3,32 @@.help-tooltip-button {my-global-icon {- width: 17px;- height: 17px;- line-height: 17px;- display: inline-block;- position: relative;- top: -1px;color: pvar(--fg-400);++ @include global-icon-size(18px);}}-:host ::ng-deep {+::ng-deep {.help-popover {+ --bs-popover-bg: #{pvar(--bg-secondary-450)};++ border: 0;min-width: 200px;max-width: 300px;.popover-body {- padding: 10px;- font-size: 13px;- border-radius: 3px;+ padding: 1rem;+ border-radius: 14px;+ color: pvar(--fg-200);++ .help-title {+ display: block;+ margin-bottom: 0.5rem;+ color: pvar(--fg-450);++ @include font-size(20px);+ }p {margin-bottom: 0;diff --git a/client/src/app/shared/shared-main/buttons/help.component.ts b/client/src/app/shared/shared-main/buttons/help.component.tsindex f9c5b655b3..9aedd686d8 100644--- a/client/src/app/shared/shared-main/buttons/help.component.ts+++ b/client/src/app/shared/shared-main/buttons/help.component.ts@@ -1,64 +1,35 @@-import { NgIf, NgTemplateOutlet } from '@angular/common'-import {- AfterContentInit,- booleanAttribute,- Component,- contentChildren,- input,- OnChanges,- OnInit,- TemplateRef-} from '@angular/core'+import { NgIf } from '@angular/common'+import { booleanAttribute, Component, input, OnChanges, OnInit } from '@angular/core'import { GlobalIconName } from '@app/shared/shared-icons/global-icon.component'import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'import { ENHANCED_RULES, TEXT_RULES } from '@peertube/peertube-core-utils'import { GlobalIconComponent } from '../../shared-icons/global-icon.component'-import { PeerTubeTemplateDirective } from '../common/peertube-template.directive'@Component({selector: 'my-help',styleUrls: [ './help.component.scss' ],templateUrl: './help.component.html',- imports: [ NgIf, NgTemplateOutlet, NgbPopover, GlobalIconComponent ]+ imports: [ NgIf, NgbPopover, GlobalIconComponent ]})-export class HelpComponent implements OnInit, OnChanges, AfterContentInit {+export class HelpComponent implements OnInit, OnChanges {+ readonly helpTitle = input('')readonly helpType = input<'custom' | 'markdownText' | 'markdownEnhanced'>('custom')- readonly tooltipPlacement = input('right auto')readonly iconName = input<GlobalIconName>('help')- readonly title = input($localize`Get help`)- readonly autoClose = input('outside')readonly supportRelMe = input(false, { transform: booleanAttribute })- readonly templates = contentChildren(PeerTubeTemplateDirective)+ readonly title = input($localize`Get help`)++ readonly tooltipPlacement = input('right auto')+ readonly autoClose = input('outside')+ readonly container = input<'body'>(undefined)isPopoverOpened = false- mainHtml = ''-- preHtmlTemplate: TemplateRef<any>- customHtmlTemplate: TemplateRef<any>- postHtmlTemplate: TemplateRef<any>+ markdownHTML = ''ngOnInit () {this.init()}- ngAfterContentInit () {- {- const t = this.templates().find(t => t.name() === 'preHtml')- if (t) this.preHtmlTemplate = t.template- }-- {- const t = this.templates().find(t => t.name() === 'customHtml')- if (t) this.customHtmlTemplate = t.template- }-- {- const t = this.templates().find(t => t.name() === 'postHtml')- if (t) this.postHtmlTemplate = t.template- }- }-ngOnChanges () {this.init()}@@ -74,12 +45,12 @@ export class HelpComponent implements OnInit, OnChanges, AfterContentInit {private init () {const helpType = this.helpType()if (helpType === 'markdownText') {- this.mainHtml = this.formatMarkdownSupport(TEXT_RULES)+ this.markdownHTML = this.formatMarkdownSupport(TEXT_RULES)return}if (helpType === 'markdownEnhanced') {- this.mainHtml = this.formatMarkdownSupport(ENHANCED_RULES)+ this.markdownHTML = this.formatMarkdownSupport(ENHANCED_RULES)return}}diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.html b/client/src/app/shared/shared-user-settings/user-video-settings.component.htmlindex 9721e2d3f5..c499015fc2 100644--- a/client/src/app/shared/shared-user-settings/user-video-settings.component.html+++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.html@@ -6,11 +6,9 @@<label i18n for="nsfwPolicy">Default policy on videos containing sensitive content</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>- With <strong>Hide</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video.- </ng-container>- </ng-template>+ <ng-container i18n>+ With <strong>Hide</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video.+ </ng-container></my-help></div>@@ -30,9 +28,7 @@<div class="pt-label-container"><label i18n for="videoLanguages">Only display videos in the following languages/subtitles</label><my-help>- <ng-template ptTemplate="customHtml">- <ng-container i18n>In Recently added, Trending, Local, Most liked and Search pages</ng-container>- </ng-template>+ <ng-container i18n>In Recently added, Trending, Local, Most liked and Search pages</ng-container></my-help></div>diff --git a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.html b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.htmlindex e8fcec5e70..19bd36438d 100644--- a/client/src/app/shared/shared-user-subscription/remote-subscribe.component.html+++ b/client/src/app/shared/shared-user-subscription/remote-subscribe.component.html@@ -15,18 +15,14 @@</button><my-help *ngIf="!interact() && showHelp()">- <ng-template ptTemplate="customHtml">- <ng-container i18n>- You can subscribe to the channel via any ActivityPub-capable fediverse instance (PeerTube, Mastodon or Pleroma for example).- </ng-container>- </ng-template>+ <ng-container i18n>+ You can subscribe to the channel via any ActivityPub-capable fediverse instance (PeerTube, Mastodon or Pleroma for example).+ </ng-container></my-help><my-help *ngIf="showHelp() && interact()">- <ng-template ptTemplate="customHtml">- <ng-container i18n>- You can interact with this via any ActivityPub-capable fediverse instance (PeerTube, Mastodon or Pleroma for example).- </ng-container>- </ng-template>+ <ng-container i18n>+ You can interact with this via any ActivityPub-capable fediverse instance (PeerTube, Mastodon or Pleroma for example).+ </ng-container></my-help></form>diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.ts b/client/src/app/shared/shared-video-miniature/videos-list.component.tsindex 143eb3979b..9d6b62dcfa 100644--- a/client/src/app/shared/shared-video-miniature/videos-list.component.ts+++ b/client/src/app/shared/shared-video-miniature/videos-list.component.ts@@ -70,10 +70,9 @@ export class VideosListComponent implements OnInit, OnChanges, OnDestroy {private screenService = inject(ScreenService)private peertubeRouter = inject(PeerTubeRouterService)+ // dprint-ignore// eslint-disable-next-line max-len- readonly getVideosObservableFunction = input<- (pagination: ComponentPaginationLight, filters: VideoFilters) => Observable<ResultList<Video>>- >(undefined)+ readonly getVideosObservableFunction = input<(pagination: ComponentPaginationLight, filters: VideoFilters) => Observable<ResultList<Video>>>(undefined)readonly getSyndicationItemsFunction = input<(filters: VideoFilters) => Promise<Syndication[]> | Syndication[]>(undefined)readonly defaultSort = input<VideoSortField>(undefined)diff --git a/client/src/app/shared/standalone-channels/video-channel-create.component.ts b/client/src/app/shared/standalone-channels/video-channel-create.component.tsindex d5f234f799..3bec544679 100644--- a/client/src/app/shared/standalone-channels/video-channel-create.component.ts+++ b/client/src/app/shared/standalone-channels/video-channel-create.component.ts@@ -21,6 +21,7 @@ import { ActorBannerEditComponent } from '../shared-actor-image-edit/actor-banneimport { MarkdownTextareaComponent } from '../shared-forms/markdown-textarea.component'import { PeertubeCheckboxComponent } from '../shared-forms/peertube-checkbox.component'import { HelpComponent } from '../shared-main/buttons/help.component'+import { MarkdownHintComponent } from '../shared-main/text/markdown-hint.component'import { VideoChannelEdit } from './video-channel-edit'@Component({@@ -36,7 +37,8 @@ import { VideoChannelEdit } from './video-channel-edit'HelpComponent,MarkdownTextareaComponent,PeertubeCheckboxComponent,- AlertComponent+ AlertComponent,+ MarkdownHintComponent]})export class VideoChannelCreateComponent extends VideoChannelEdit implements OnInit, AfterViewInit {diff --git a/client/src/app/shared/standalone-channels/video-channel-edit.component.html b/client/src/app/shared/standalone-channels/video-channel-edit.component.htmlindex b5e04e6554..1f3c72963f 100644--- a/client/src/app/shared/standalone-channels/video-channel-edit.component.html+++ b/client/src/app/shared/standalone-channels/video-channel-edit.component.html@@ -51,10 +51,9 @@</div></div>- <div class="form-group">+ <div class="form-group markdown-block"><label i18n for="description">Description</label>-<my-help helpType="markdownText" supportRelMe="true"></my-help><my-markdown-textarea@@ -67,12 +66,12 @@</div></div>- <div class="form-group">+ <div class="form-group markdown-block"><label i18n for="support">Support</label>- <my-help- helpType="markdownEnhanced" i18n-preHtml preHtml="Short text to tell people how they can support the channel (membership platform...).<br />- When a video is uploaded in this channel, the video support field will be automatically filled by this text."- ></my-help>++ <div class="form-group-description" i18n>+ This is text that helps people visiting your channel page <strong>understand how to support you</strong>. You can use <my-markdown-hint helpType="markdownText">Markdown Language</my-markdown-hint>, including <strong>links to your fundraising tools</strong>.+ </div><my-markdown-textareainputId="support" formControlName="support"diff --git a/client/src/app/shared/standalone-channels/video-channel-edit.component.scss b/client/src/app/shared/standalone-channels/video-channel-edit.component.scssindex a1adf65de8..732b985086 100644--- a/client/src/app/shared/standalone-channels/video-channel-edit.component.scss+++ b/client/src/app/shared/standalone-channels/video-channel-edit.component.scss@@ -14,13 +14,8 @@ input[type=submit] {@include margin-left(auto);}-textarea {- @include peertube-textarea(500px, 150px);-}--my-markdown-textarea {+.markdown-block {max-width: 500px;- display: block;}.peertube-select-container {diff --git a/client/src/app/shared/standalone-channels/video-channel-update.component.ts b/client/src/app/shared/standalone-channels/video-channel-update.component.tsindex a903d12fa7..d8cc8f0a36 100644--- a/client/src/app/shared/standalone-channels/video-channel-update.component.ts+++ b/client/src/app/shared/standalone-channels/video-channel-update.component.ts@@ -21,6 +21,7 @@ import { ActorBannerEditComponent } from '../shared-actor-image-edit/actor-banneimport { MarkdownTextareaComponent } from '../shared-forms/markdown-textarea.component'import { PeertubeCheckboxComponent } from '../shared-forms/peertube-checkbox.component'import { HelpComponent } from '../shared-main/buttons/help.component'+import { MarkdownHintComponent } from '../shared-main/text/markdown-hint.component'import { VideoChannelEdit } from './video-channel-edit'@Component({@@ -37,7 +38,8 @@ import { VideoChannelEdit } from './video-channel-edit'HelpComponent,MarkdownTextareaComponent,PeertubeCheckboxComponent,- AlertComponent+ AlertComponent,+ MarkdownHintComponent]})export class VideoChannelUpdateComponent extends VideoChannelEdit implements OnInit, AfterViewInit, OnDestroy {diff --git a/client/src/sass/include/_badges.scss b/client/src/sass/include/_badges.scssindex 675b9ecc88..f1a0a337e7 100644--- a/client/src/sass/include/_badges.scss+++ b/client/src/sass/include/_badges.scss@@ -26,6 +26,11 @@background-color: pvar(--bg-secondary-400);}+ &.badge-secondary-on-secondary {+ color: pvar(--fg-300);+ background-color: pvar(--bg-secondary-450);+ }+&.badge-banned,&.badge-danger,&.badge-red {