Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Add unavailable features on publish page

Chocobozzz96380859ef9d
diff --git a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.html b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.html
index ec5a6916c4..34ebe50314 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.html
+++ b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.html
@@ -69,10 +69,22 @@
</ng-template>
</ng-container>
- <ng-container ngbNavItem="import-url" *ngIf="isVideoImportHttpEnabled()">
- <a ngbNavLink>
- <span i18n>Import with URL</span>
- </a>
+ <ng-container ngbNavItem="import-url">
+ @if (isVideoImportHttpEnabled()) {
+ <a ngbNavLink>
+ <span i18n>Import with URL</span>
+ </a>
+ } @else {
+ <div class="unavailable-nav-link">
+ <span i18n>Import with URL</span>
+
+ <div class="pt-badge badge-secondary ms-2 me-1" i18n>UNAVAILABLE</div>
+
+ <my-help i18n-helpTitle helpTitle="Feature unavailable" container="body">
+ Import with URL is not available on {{ instanceName }}.
+ </my-help>
+ </div>
+ }
<ng-template ngbNavContent>
<my-video-import-url
@@ -82,10 +94,22 @@
</ng-template>
</ng-container>
- <ng-container ngbNavItem="import-torrent" *ngIf="isVideoImportTorrentEnabled()">
- <a ngbNavLink>
- <span i18n>Import with torrent</span>
- </a>
+ <ng-container ngbNavItem="import-torrent">
+ @if (isVideoImportTorrentEnabled()) {
+ <a ngbNavLink>
+ <span i18n>Import with torrent</span>
+ </a>
+ } @else {
+ <div class="unavailable-nav-link">
+ <span i18n>Import with torrent</span>
+
+ <div class="pt-badge badge-secondary ms-2 me-1" i18n>UNAVAILABLE</div>
+
+ <my-help i18n-helpTitle helpTitle="Feature unavailable" container="body">
+ Import with torrent is not available on {{ instanceName }}.
+ </my-help>
+ </div>
+ }
<ng-template ngbNavContent>
<my-video-import-torrent
@@ -95,10 +119,22 @@
</ng-template>
</ng-container>
- <ng-container ngbNavItem="go-live" *ngIf="isVideoLiveEnabled()">
- <a ngbNavLink>
- <span i18n>Go live</span>
- </a>
+ <ng-container ngbNavItem="go-live">
+ @if (isVideoLiveEnabled()) {
+ <a ngbNavLink>
+ <span i18n>Go live</span>
+ </a>
+ } @else {
+ <div class="unavailable-nav-link">
+ <span i18n>Go live</span>
+
+ <div class="pt-badge badge-secondary ms-2 me-1" i18n>UNAVAILABLE</div>
+
+ <my-help i18n-helpTitle helpTitle="Feature unavailable" container="body">
+ Live streaming is not available on {{ instanceName }}.
+ </my-help>
+ </div>
+ }
<ng-template ngbNavContent>
<my-video-go-live
diff --git a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.scss b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.scss
index b32af6a1bb..ee35e518d4 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.scss
+++ b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.scss
@@ -33,6 +33,12 @@ $nav-link-height: 40px;
:host ::ng-deep .video-add-nav {
@include peertube-nav-tabs($border-width, $border-type, $border-color, $nav-link-height);
+ & {
+ overflow-x: auto;
+ flex-wrap: unset;
+ white-space: nowrap;
+ }
+
a.nav-link {
&.active {
background-color: pvar(--bg-secondary-400) !important;
@@ -58,23 +64,3 @@ $nav-link-height: 40px;
border: 3px dashed pvar(--primary);
}
}
-
-@mixin nav-scroll {
- ::ng-deep .video-add-nav {
- height: #{$nav-link-height + $border-width * 2};
- overflow-x: auto;
- white-space: nowrap;
- flex-wrap: unset;
-
- /* Hide active tab style to not have a moving tab effect */
- a.nav-link.active {
- border-color: transparent;
- background-color: pvar(--bg) !important;
- }
- }
-}
-
-/* Make .video-add-nav tabs scrollable on small devices */
-@media screen and (max-width: $small-view) {
- @include nav-scroll();
-}
diff --git a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.ts b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.ts
index 30b214610b..dd547e14f2 100644
--- a/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.ts
+++ b/client/src/app/+videos-publish-manage/+video-publish/video-publish.component.ts
@@ -1,20 +1,13 @@
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common'
import { Component, HostListener, OnInit, inject, viewChild } from '@angular/core'
import { ActivatedRoute, Router, RouterLink } from '@angular/router'
-import {
- AuthService,
- AuthUser,
- CanComponentDeactivate,
- CanDeactivateGuard,
- HooksService,
- PeerTubeRouterService,
- ServerService
-} from '@app/core'
+import { AuthService, AuthUser, CanComponentDeactivate, CanDeactivateGuard, HooksService, ServerService } from '@app/core'
import { AlertComponent } from '@app/shared/shared-main/common/alert.component'
import { VideoService } from '@app/shared/shared-main/video/video.service'
import { NgbNav, NgbNavContent, NgbNavItem, NgbNavLink, NgbNavLinkBase, NgbNavOutlet } from '@ng-bootstrap/ng-bootstrap'
import { HTMLServerConfig, UserVideoQuota, VideoConstant, VideoPrivacyType } from '@peertube/peertube-models'
import { SelectChannelItem } from 'src/types'
+import { HelpComponent } from '../../shared/shared-main/buttons/help.component'
import { ChannelsSetupMessageComponent } from '../../shared/shared-main/channel/channels-setup-message.component'
import { UserQuotaComponent } from '../../shared/shared-main/users/user-quota.component'
import { VideoManageType } from '../shared-manage/common/video-manage.type'
@@ -46,7 +39,8 @@ import { VideoPublishResolverData } from './video-publish.resolver'
VideoGoLiveComponent,
VideoImportTorrentComponent,
VideoImportUrlComponent,
- VideoUploadComponent
+ VideoUploadComponent,
+ HelpComponent
],
providers: [ VideoManageController ]
})
@@ -59,7 +53,6 @@ export class VideoPublishComponent implements OnInit, CanComponentDeactivate {
private manageController = inject(VideoManageController)
private videoService = inject(VideoService)
private canDeactivateGuard = inject(CanDeactivateGuard)
- private peertubeRouter = inject(PeerTubeRouterService)
readonly videoUpload = viewChild<VideoUploadComponent>('videoUpload')
readonly videoImportUrl = viewChild<VideoImportUrlComponent>('videoImportUrl')
@@ -97,6 +90,10 @@ export class VideoPublishComponent implements OnInit, CanComponentDeactivate {
return this.serverConfig.email.enabled && this.serverConfig.contactForm.enabled
}
+ get instanceName () {
+ return this.serverConfig.instance.name
+ }
+
ngOnInit () {
const data = this.route.snapshot.data.resolverData as VideoPublishResolverData
const { videoChannels, userQuota, privacies } = data
diff --git a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
index d50215bc80..73b3d93045 100644
--- a/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
+++ b/client/src/app/+videos-publish-manage/shared-manage/stats/video-stats.component.ts
@@ -24,7 +24,6 @@ import { SelectOptionsItem } from 'src/types'
import { SelectOptionsComponent } from '../../../shared/shared-forms/select/select-options.component'
import { ButtonComponent } from '../../../shared/shared-main/buttons/button.component'
import { HelpComponent } from '../../../shared/shared-main/buttons/help.component'
-import { PeerTubeTemplateDirective } from '../../../shared/shared-main/common/peertube-template.directive'
import { EmbedComponent } from '../../../shared/shared-main/video/embed.component'
import { VideoEdit } from '../common/video-edit.model'
import { VideoManageController } from '../video-manage-controller.service'
@@ -62,7 +61,6 @@ ChartJSDefaults.color = getComputedStyle(document.body).getPropertyValue('--fg')
NgFor,
NgIf,
HelpComponent,
- PeerTubeTemplateDirective,
EmbedComponent,
SelectOptionsComponent,
FormsModule,
diff --git a/client/src/sass/bootstrap.scss b/client/src/sass/bootstrap.scss
index 6765aab342..d9a2f33db6 100644
--- a/client/src/sass/bootstrap.scss
+++ b/client/src/sass/bootstrap.scss
@@ -214,63 +214,42 @@ body {
// Nav
// ---------------------------------------------------------------------------
-.nav:not(.nav-pills) {
- --bs-nav-link-padding-x: 0;
-
- .nav-link {
- @include margin-right(2rem);
+.nav {
+ .nav-link,
+ .unavailable-nav-link {
+ display: flex;
+ align-items: center;
+ min-height: 30px;
+ padding-top: 0;
+ padding-bottom: 0;
}
}
-.nav .nav-link {
- display: flex !important;
- align-items: center;
- height: 30px !important;
-}
-
-.nav.nav-pills {
- font-size: 16px !important;
- font-weight: $font-semibold !important;
+.nav-tabs {
+ .nav-link,
+ .unavailable-nav-link {
+ color: pvar(--fg-100);
+ font-weight: $font-semibold;
+ border: 0;
+ border-bottom: 2px solid transparent;
+ }
.nav-link {
- opacity: 0.7 !important;
+ @include disable-default-a-behaviour;
+
+ &.active {
+ background-color: pvar(--bg) !important;
+ border-bottom-color: pvar(--border-primary);
+ }
&.active,
&:hover,
&:active,
&:focus {
- opacity: 1 !important;
+ opacity: 1;
+ color: pvar(--fg);
}
}
-
- a {
- color: pvar(--fg);
-
- @include disable-default-a-behaviour;
- }
-}
-
-.nav-tabs .nav-link {
- color: pvar(--fg);
- font-weight: $font-semibold;
- border: 0;
- border-bottom: 2px solid transparent;
- opacity: 0.7;
-
- @include disable-default-a-behaviour;
-
- &.active {
- color: pvar(--fg);
- background-color: pvar(--bg) !important;
- border-bottom-color: pvar(--border-primary);
- }
-
- &.active,
- &:hover,
- &:active,
- &:focus {
- opacity: 1;
- }
}
// ---------------------------------------------------------------------------
diff --git a/client/src/sass/include/_bootstrap-variables.scss b/client/src/sass/include/_bootstrap-variables.scss
index 8bdacf128a..f1e8f0e335 100644
--- a/client/src/sass/include/_bootstrap-variables.scss
+++ b/client/src/sass/include/_bootstrap-variables.scss
@@ -48,8 +48,6 @@ $input-group-addon-color: pvar(--fg);
$input-group-addon-bg: pvar(--bg-secondary-500);
$input-group-addon-border-color: pvar(--input-border-color);
-$nav-pills-link-active-bg: pvar(--bg-secondary-500);
-$nav-pills-link-active-color: pvar(--fg);
$nav-link-transition: none;
$dropdown-box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
diff --git a/client/src/sass/include/_nav.scss b/client/src/sass/include/_nav.scss
index 0a462076b6..96493b657d 100644
--- a/client/src/sass/include/_nav.scss
+++ b/client/src/sass/include/_nav.scss
@@ -14,9 +14,10 @@
display: none !important;
}
- a.nav-link {
+ a.nav-link,
+ .unavailable-nav-link {
margin-bottom: -$border-width;
- height: $nav-link-height !important;
+ min-height: $nav-link-height !important;
padding: 0 30px !important;
border: $border-width $border-type transparent;