From 9e401fde36bdcb4b5e8dc54262c01f1e660d81a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 6 Mar 2023 11:39:23 +0100 Subject: Refactor my actor avatar edit --- .../actor-avatar-edit.component.html | 46 ++++++++++------------ .../actor-avatar-edit.component.scss | 23 +++++------ .../actor-avatar-edit.component.ts | 3 -- .../actor-banner-edit.component.html | 33 ++++++++-------- .../actor-banner-edit.component.scss | 18 ++++++++- .../shared-actor-image-edit/actor-image-edit.scss | 16 +------- .../shared-actor-image/actor-avatar.component.ts | 7 ++-- 7 files changed, 70 insertions(+), 76 deletions(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.html b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.html index 6459c5ffe..a0f65a3d9 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.html +++ b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.html @@ -1,23 +1,32 @@
-
+
-
- -
- - - -
+
+ + + +
-
+
+
+
+ + + +
+
@@ -27,16 +36,3 @@
{{ actor.followersCount }} subscribers
- - - - - - diff --git a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.scss b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.scss index fd8cd7ffc..01e2131ba 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.scss +++ b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.scss @@ -5,10 +5,6 @@ display: flex; } -my-actor-avatar { - @include margin-right(15px); -} - .actor-info { display: inline-flex; flex-direction: column; @@ -16,12 +12,12 @@ my-actor-avatar { .actor-info-display-name { @include peertube-word-wrap; + @include font-size(1.25rem); - font-size: 20px; font-weight: $font-bold; @media screen and (max-width: $small-view) { - font-size: 16px; + @include font-size(18px); } } @@ -35,17 +31,18 @@ my-actor-avatar { padding-bottom: .5rem; } -.actor-img-edit-container { - position: relative; - width: 0; -} - .actor-img-edit-button { - top: 55px; - right: 45px; border-radius: 50%; + + position: absolute; + bottom: 5px; + right: 5px; } .dropdown-item { @include dropdown-with-icon-item; } + +.dropdown-toggle::after { + display: none; +} diff --git a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts index b71a3c485..fc925083e 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts +++ b/client/src/app/shared/shared-actor-image-edit/actor-avatar-edit.component.ts @@ -1,7 +1,6 @@ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' import { Notifier, ServerService } from '@app/core' import { Account, VideoChannel } from '@app/shared/shared-main' -import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' import { getBytes } from '@root-helpers/bytes' import { imageToDataURL } from '@root-helpers/images' @@ -15,7 +14,6 @@ import { imageToDataURL } from '@root-helpers/images' }) export class ActorAvatarEditComponent implements OnInit { @ViewChild('avatarfileInput') avatarfileInput: ElementRef - @ViewChild('avatarPopover') avatarPopover: NgbPopover @Input() actor: VideoChannel | Account @Input() editable = true @@ -58,7 +56,6 @@ export class ActorAvatarEditComponent implements OnInit { const formData = new FormData() formData.append('avatarfile', avatarfile) - this.avatarPopover?.close() this.avatarChange.emit(formData) if (this.previewImage) { diff --git a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.html b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.html index f675371d9..d6fe37094 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.html +++ b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.html @@ -8,26 +8,25 @@
-
- - -
-
- +
+
+ + +
- - +
+ - +
- + diff --git a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.scss b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.scss index ec2de2528..b2c64fff7 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.scss +++ b/client/src/app/shared/shared-actor-image-edit/actor-banner-edit.component.scss @@ -16,12 +16,28 @@ align-items: center; } -.actor-img-edit-button { +.dropdown { position: absolute; + + > .actor-img-edit-button { + position: relative; + } +} + +.actor-img-edit-button { width: auto; + position: absolute; label { font-weight: $font-semibold; margin-bottom: 0; } } + +.dropdown-item { + @include dropdown-with-icon-item; +} + +.dropdown-toggle::after { + display: none; +} diff --git a/client/src/app/shared/shared-actor-image-edit/actor-image-edit.scss b/client/src/app/shared/shared-actor-image-edit/actor-image-edit.scss index b054086e4..9e4ff2654 100644 --- a/client/src/app/shared/shared-actor-image-edit/actor-image-edit.scss +++ b/client/src/app/shared/shared-actor-image-edit/actor-image-edit.scss @@ -1,18 +1,8 @@ @use '_variables' as *; @use '_mixins' as *; -.actor ::ng-deep .popover-image-info .popover-body { - padding: 0; - - .dropdown-item { - padding: 6px 10px; - border-radius: 4px; - - &:first-child { - @include peertube-file; - display: block; - } - } +.dropdown-file { + @include peertube-file; } .actor-img-edit-button { @@ -22,8 +12,6 @@ display: flex; justify-content: center; - margin-top: 10px; - margin-bottom: 5px; cursor: pointer; input { diff --git a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts index 6036123f9..a52e68a17 100644 --- a/client/src/app/shared/shared-actor-image/actor-avatar.component.ts +++ b/client/src/app/shared/shared-actor-image/actor-avatar.component.ts @@ -50,15 +50,15 @@ export class ActorAvatarComponent implements OnInit, OnChanges { ngOnInit () { this.buildDefaultAvatarUrl() - this.buildClasses() this.buildAlt() this.buildAvatarUrl() + this.buildClasses() } ngOnChanges () { - this.buildClasses() this.buildAlt() this.buildAvatarUrl() + this.buildClasses() } private buildClasses () { @@ -114,12 +114,13 @@ export class ActorAvatarComponent implements OnInit, OnChanges { displayImage () { if (this.actorType === 'unlogged') return true + if (this.previewImage) return true return !!(this.actor && this.avatarUrl) } displayActorInitial () { - return this.actor && !this.avatarUrl + return !this.displayImage() && this.actor && !this.avatarUrl } displayPlaceholder () { -- cgit v1.2.3