Skip to content

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

Display subscribe button when it's loaded

Chocobozzzf4c2124f1e65
diff --git a/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
index 158777a02d..5ff1961a8a 100644
--- a/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
+++ b/client/src/app/+video-watch/shared/comment/video-comment-add.component.ts
@@ -6,7 +6,6 @@ import {
inject,
input,
LOCALE_ID,
- numberAttribute,
OnChanges,
OnInit,
output,
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.html b/client/src/app/shared/shared-user-subscription/subscribe-button.component.html
index 0db4faf253..ba874ddd47 100644
--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.html
+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.html
@@ -1,7 +1,7 @@
<div
class="btn-group"
role="group"
- [ngClass]="{ 'big': isBigButton }"
+ [ngClass]="{ 'big': isBigButton, loaded: isLoaded() }"
ngbDropdown="dropdown"
autoClose="outside"
placement="bottom-right bottom-left bottom auto"
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.scss b/client/src/app/shared/shared-user-subscription/subscribe-button.component.scss
index 74b7ce5f53..98a74b4006 100644
--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.scss
+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.scss
@@ -1,9 +1,14 @@
-@use '_variables' as *;
-@use '_mixins' as *;
-@use '_form-mixins' as *;
+@use "_variables" as *;
+@use "_mixins" as *;
+@use "_form-mixins" as *;
.btn-group {
padding: 0;
+ opacity: 0;
+
+ &.loaded {
+ opacity: 1;
+ }
.peertube-button {
// Prevent weird border radius blur on chrome
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
index 59f3c9d5c3..bc4d5b8073 100644
--- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
+++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts
@@ -49,6 +49,8 @@ export class SubscribeButtonComponent implements OnChanges {
buttonClasses: Record<string, boolean> = {}
+ private loadedSubscribedStatus = false
+
get handle () {
const account = this.account()
return account
@@ -218,6 +220,13 @@ export class SubscribeButtonComponent implements OnChanges {
return this.isSingleSubscribe && !this.isUserLoggedIn()
}
+ isLoaded () {
+ if (!this.isUserLoggedIn()) return true
+ if (!this.videoChannels() || this.videoChannels().length === 0) return true
+
+ return this.loadedSubscribedStatus
+ }
+
private getChannelHandler (videoChannel: VideoChannel) {
return videoChannel.name + '@' + videoChannel.host
}
@@ -236,6 +245,7 @@ export class SubscribeButtonComponent implements OnChanges {
.subscribe({
next: res => {
this.subscribed.set(handle, res)
+ this.loadedSubscribedStatus = true
this.buildClasses()
},