From 4a58c08c5b1301c0297fe65f0c1f0e22e7b6bfc8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 26 Nov 2024 10:23:08 +0100 Subject: [PATCH] Fix responsive --- .../following-list.component.html | 2 +- .../video-redundancies-list.component.scss | 14 +-- .../+admin/system/jobs/jobs.component.html | 2 +- .../+admin/system/jobs/jobs.component.scss | 19 +--- .../src/app/core/wrappers/screen.service.ts | 58 ---------- client/src/app/header/header.component.scss | 1 + .../select/select-options.component.html | 2 +- .../select/select-options.component.scss | 4 + .../menu/horizontal-menu.component.html | 8 +- .../menu/horizontal-menu.component.scss | 104 ++++++++++++------ .../menu/horizontal-menu.component.ts | 13 ++- .../menu/list-overflow.component.html | 40 +++---- .../menu/list-overflow.component.scss | 40 +------ .../menu/list-overflow.component.ts | 9 +- .../video-actions-dropdown.component.scss | 4 + .../video-actions-dropdown.component.ts | 2 + .../videos-list.component.html | 2 +- client/src/sass/class-helpers/_images.scss | 4 + client/src/sass/class-helpers/_menu.scss | 8 +- client/src/sass/primeng-custom.scss | 14 +-- 20 files changed, 144 insertions(+), 206 deletions(-) diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html index fbe173de9..b41baa5d4 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.html +++ b/client/src/app/+admin/follows/following-list/following-list.component.html @@ -20,7 +20,7 @@ -
+
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.scss b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.scss index b62e79e4f..bb88bb726 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.scss +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.scss @@ -13,18 +13,8 @@ a { .admin-sub-header { justify-content: flex-end; - .select-filter-block { - &:not(:last-child) { - @include margin-right(10px); - } - - label { - margin-bottom: 2px; - } - - .peertube-select-container { - @include peertube-select-container(auto); - } + .peertube-select-container { + @include peertube-select-container(auto); } } diff --git a/client/src/app/+admin/system/jobs/jobs.component.html b/client/src/app/+admin/system/jobs/jobs.component.html index 1ceb355f3..e969f8ac9 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.html +++ b/client/src/app/+admin/system/jobs/jobs.component.html @@ -17,7 +17,7 @@ >
-
+
diff --git a/client/src/app/+admin/system/jobs/jobs.component.scss b/client/src/app/+admin/system/jobs/jobs.component.scss index 0ce18bd30..f2e5e5571 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.scss +++ b/client/src/app/+admin/system/jobs/jobs.component.scss @@ -33,25 +33,10 @@ } .admin-sub-header { - flex-direction: row !important; justify-content: flex-end; - .select-filter-block { - &:not(:last-child) { - @include margin-right(10px); - } - - label { - margin-bottom: 2px; - } - - .peertube-select-container { - @include peertube-select-container(auto); - } - } - - .button-filter-block { - align-self: flex-end; + .peertube-select-container { + @include peertube-select-container(auto); } } diff --git a/client/src/app/core/wrappers/screen.service.ts b/client/src/app/core/wrappers/screen.service.ts index 92c54d588..3026825de 100644 --- a/client/src/app/core/wrappers/screen.service.ts +++ b/client/src/app/core/wrappers/screen.service.ts @@ -35,64 +35,6 @@ export class ScreenService { return this.windowInnerWidth } - // https://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android - onFingerSwipe (direction: 'left' | 'right' | 'up' | 'down', action: () => void, removeEventOnEnd = true) { - let touchDownClientX: number - let touchDownClientY: number - - const onTouchStart = (event: TouchEvent) => { - const firstTouch = event.touches[0] - touchDownClientX = firstTouch.clientX - touchDownClientY = firstTouch.clientY - } - - const onTouchMove = (event: TouchEvent) => { - if (!touchDownClientX || !touchDownClientY) { - return - } - - const touchUpClientX = event.touches[0].clientX - const touchUpClientY = event.touches[0].clientY - - const touchClientX = Math.abs(touchDownClientX - touchUpClientX) - const touchClientY = Math.abs(touchDownClientY - touchUpClientY) - - if (touchClientX > touchClientY) { - if (touchClientX > 0) { - if (direction === 'left') { - if (removeEventOnEnd) this.removeFingerSwipeEventListener(onTouchStart, onTouchMove) - action() - } - } else { - if (direction === 'right') { - if (removeEventOnEnd) this.removeFingerSwipeEventListener(onTouchStart, onTouchMove) - action() - } - } - } else { - if (touchClientY > 0) { - if (direction === 'up') { - if (removeEventOnEnd) this.removeFingerSwipeEventListener(onTouchStart, onTouchMove) - action() - } - } else { - if (direction === 'down') { - if (removeEventOnEnd) this.removeFingerSwipeEventListener(onTouchStart, onTouchMove) - action() - } - } - } - } - - document.addEventListener('touchstart', onTouchStart, false) - document.addEventListener('touchmove', onTouchMove, false) - } - - private removeFingerSwipeEventListener (onTouchStart: (event: TouchEvent) => void, onTouchMove: (event: TouchEvent) => void) { - document.removeEventListener('touchstart', onTouchStart) - document.removeEventListener('touchmove', onTouchMove) - } - private refreshWindowInnerWidth () { this.lastFunctionCallTime = new Date().getTime() diff --git a/client/src/app/header/header.component.scss b/client/src/app/header/header.component.scss index 0d934c650..0f2508cfa 100644 --- a/client/src/app/header/header.component.scss +++ b/client/src/app/header/header.component.scss @@ -189,6 +189,7 @@ my-actor-avatar { .buttons-container { margin: 0 auto; + max-width: 100%; } .menu-button { diff --git a/client/src/app/shared/shared-forms/select/select-options.component.html b/client/src/app/shared/shared-forms/select/select-options.component.html index a29d0b910..dd33cc061 100644 --- a/client/src/app/shared/shared-forms/select/select-options.component.html +++ b/client/src/app/shared/shared-forms/select/select-options.component.html @@ -24,7 +24,7 @@ @if (customItemTemplate) { } @else { -
+
{{ item.label }} diff --git a/client/src/app/shared/shared-forms/select/select-options.component.scss b/client/src/app/shared/shared-forms/select/select-options.component.scss index 9b5cb25d4..008c42ad4 100644 --- a/client/src/app/shared/shared-forms/select/select-options.component.scss +++ b/client/src/app/shared/shared-forms/select/select-options.component.scss @@ -11,3 +11,7 @@ img { .muted { font-size: 90%; } + +.item-label { + min-height: 22px; +} diff --git a/client/src/app/shared/shared-main/menu/horizontal-menu.component.html b/client/src/app/shared/shared-main/menu/horizontal-menu.component.html index 6df31a064..5af28314f 100644 --- a/client/src/app/shared/shared-main/menu/horizontal-menu.component.html +++ b/client/src/app/shared/shared-main/menu/horizontal-menu.component.html @@ -5,11 +5,15 @@ {{ h1 }} - + {{ item.label }} + [ngClass]="{ 'child-active': activeParent === item, 'dropdown-item': dropdown, 'in-modal': modal }" + (click)="onLinkClick(modal)" + > + {{ item.label }} +
diff --git a/client/src/app/shared/shared-main/menu/horizontal-menu.component.scss b/client/src/app/shared/shared-main/menu/horizontal-menu.component.scss index 5b760675d..16a684890 100644 --- a/client/src/app/shared/shared-main/menu/horizontal-menu.component.scss +++ b/client/src/app/shared/shared-main/menu/horizontal-menu.component.scss @@ -19,39 +19,79 @@ h1 { } } -.parent-container { - .entry { - color: pvar(--fg-100); - display: inline-block; - font-weight: $font-bold; - white-space: nowrap; +@mixin parent-active { + color: pvar(--fg); - @include font-size(22px); - @include disable-default-a-behaviour; - @include margin-right(2rem); + &::after { + content: ''; + display: block; + height: 4px; + background-color: pvar(--border-primary); + border-radius: 2px; + position: absolute; + bottom: -3px; + width: 100%; + } +} - &.active, - &.child-active { - color: pvar(--fg); - position: relative; +@mixin child-active { + color: pvar(--fg-350); + font-weight: $font-bold; + background-color: pvar(--bg-secondary-400); + text-decoration: none; +} - &::after { - content: ''; - display: block; - height: 4px; - background-color: pvar(--border-primary); - border-radius: 2px; - position: absolute; - bottom: -3px; - width: 100%; - } - } +.parent-container my-list-overflow ::ng-deep .overflow-button { + &:has(+ * .active), + &:has(+ * .child-active) { + @include parent-active; + } +} - &:hover, - &:active, - &:focus { - color: pvar(--fg); - } +.children-container my-list-overflow ::ng-deep .overflow-button { + &:has(+ * .active), + &:has(+ * .child-active) { + @include child-active; + } +} + +.parent-container .entry, +.entry.in-modal { + color: pvar(--fg-100); + display: inline-block; + font-weight: $font-bold; + white-space: nowrap; + + @include font-size(22px); + @include disable-default-a-behaviour; + + &:hover, + &:active, + &:focus { + color: pvar(--fg); + } +} + +.parent-container .entry { + @include margin-right(2rem); + + &.active, + &.child-active { + position: relative; + + @include parent-active; + } +} + +.entry.in-modal { + padding: 9px 12px; + width: 100%; + + &.active, + &.child-active { + color: pvar(--on-primary) !important; + background-color: pvar(--primary-450); + opacity: .9; } } @@ -87,11 +127,9 @@ h1 { @include font-size(18px); &.active { - color: pvar(--fg-350); - font-weight: $font-bold; - background-color: pvar(--bg-secondary-400); position: relative; - text-decoration: none; + + @include child-active; } &:hover, diff --git a/client/src/app/shared/shared-main/menu/horizontal-menu.component.ts b/client/src/app/shared/shared-main/menu/horizontal-menu.component.ts index 379b2c21c..3d853b8c2 100644 --- a/client/src/app/shared/shared-main/menu/horizontal-menu.component.ts +++ b/client/src/app/shared/shared-main/menu/horizontal-menu.component.ts @@ -6,6 +6,7 @@ import { logger } from '@root-helpers/logger' import { filter, Subscription } from 'rxjs' import { PluginSelectorDirective } from '../plugins/plugin-selector.directive' import { ListOverflowComponent } from './list-overflow.component' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' export type HorizontalMenuEntry = { label: string @@ -51,7 +52,11 @@ export class HorizontalMenuComponent implements OnInit, OnChanges, OnDestroy { private routerSub: Subscription - constructor (private router: Router, private route: ActivatedRoute) { + constructor ( + private router: Router, + private route: ActivatedRoute, + private modal: NgbModal + ) { } @@ -69,6 +74,12 @@ export class HorizontalMenuComponent implements OnInit, OnChanges, OnDestroy { if (this.routerSub) this.routerSub.unsubscribe() } + onLinkClick (modal: boolean) { + if (modal) { + this.modal.dismissAll() + } + } + private buildChildren () { this.children = [] this.activeParent = undefined diff --git a/client/src/app/shared/shared-main/menu/list-overflow.component.html b/client/src/app/shared/shared-main/menu/list-overflow.component.html index 550ef3f03..ed86bf621 100644 --- a/client/src/app/shared/shared-main/menu/list-overflow.component.html +++ b/client/src/app/shared/shared-main/menu/list-overflow.component.html @@ -13,28 +13,26 @@ @if (isMenuDisplayed()) { @if (isInMobileView) { - - } @else { -
- - -
    - @for (item of items | slice:showItemsUntilIndexExcluded:items.length; track item.label) { - @if (!item.isDisplayed || item.isDisplayed()) { -
  • - - {{ item.label }} - -
  • - } - } -
-
} + +
+ + +
    + @for (item of items | slice:showItemsUntilIndexExcluded:items.length; track item.label) { + @if (!item.isDisplayed || item.isDisplayed()) { +
  • + +
  • + } + } +
+
}
@@ -44,9 +42,7 @@ @for (item of items | slice:showItemsUntilIndexExcluded:items.length; track item.label) { @if (!item.isDisplayed || item.isDisplayed()) {
  • - - {{ item.label }} - +
  • } } diff --git a/client/src/app/shared/shared-main/menu/list-overflow.component.scss b/client/src/app/shared/shared-main/menu/list-overflow.component.scss index d60f904c4..dd871bf9e 100644 --- a/client/src/app/shared/shared-main/menu/list-overflow.component.scss +++ b/client/src/app/shared/shared-main/menu/list-overflow.component.scss @@ -33,39 +33,9 @@ li { right: 0; } -button { - &::after { - display: none; - } - - &.route-active { - &::after { - display: inherit; - border: 2px solid pvar(--primary); - position: relative; - right: 95%; - top: 50%; - } - } -} - -.modal-body { - a { - color: currentColor; - box-sizing: border-box; - display: block; - font-size: 1.2rem; - padding: 9px 12px; - text-align: initial; - text-transform: unset; - width: 100%; - - @include disable-default-a-behaviour; - - &.active { - color: pvar(--on-primary) !important; - background-color: pvar(--primary-450); - opacity: .9; - } - } +.overflow-button::after { + display: none; + margin-left: inherit; + vertical-align: inherit; + border: inherit; } diff --git a/client/src/app/shared/shared-main/menu/list-overflow.component.ts b/client/src/app/shared/shared-main/menu/list-overflow.component.ts index cedb97674..519fb490b 100644 --- a/client/src/app/shared/shared-main/menu/list-overflow.component.ts +++ b/client/src/app/shared/shared-main/menu/list-overflow.component.ts @@ -14,7 +14,6 @@ import { ViewChild, ViewChildren } from '@angular/core' -import { RouterLink, RouterLinkActive } from '@angular/router' import { ScreenService } from '@app/core' import { NgbDropdown, NgbDropdownMenu, NgbDropdownToggle, NgbModal } from '@ng-bootstrap/ng-bootstrap' import { randomInt } from '@peertube/peertube-core-utils' @@ -41,14 +40,12 @@ export interface ListOverflowItem { NgbDropdownToggle, NgClass, NgbDropdownMenu, - RouterLinkActive, - RouterLink, SlicePipe ] }) export class ListOverflowComponent implements OnInit, AfterViewInit { @Input() items: T[] - @Input() itemTemplate: TemplateRef<{ item: T }> + @Input() itemTemplate: TemplateRef<{ item: T, dropdown?: boolean, modal?: boolean }> @Input({ transform: booleanAttribute }) hasBorder = false @ViewChild('modal', { static: true }) modal: ElementRef @@ -110,10 +107,6 @@ export class ListOverflowComponent implements OnInit this.modalService.open(this.modal, { centered: true }) } - dismissOtherModals () { - this.modalService.dismissAll() - } - getId (id: number | string = uniqueId()): string { return lowerFirst(this.constructor.name) + '_' + this.randomInt + '_' + id } diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss index cb1d25599..616b2cc78 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.scss @@ -1,3 +1,7 @@ +:host { + position: relative; +} + .playlist-dropdown { position: absolute; diff --git a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts index bdae2183a..38c7c387a 100644 --- a/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-actions-dropdown.component.ts @@ -135,6 +135,8 @@ export class VideoActionsDropdownComponent implements OnChanges { } ngOnChanges () { + console.log('on changes') + if (this.loaded) { this.loaded = false if (this.playlistAdd) this.playlistAdd.reload() diff --git a/client/src/app/shared/shared-video-miniature/videos-list.component.html b/client/src/app/shared/shared-video-miniature/videos-list.component.html index 237a62446..13ef3220f 100644 --- a/client/src/app/shared/shared-video-miniature/videos-list.component.html +++ b/client/src/app/shared/shared-video-miniature/videos-list.component.html @@ -24,7 +24,7 @@ >

    - Current lives + Current lives

    diff --git a/client/src/sass/class-helpers/_images.scss b/client/src/sass/class-helpers/_images.scss index 6da4bbecd..b70ca3f74 100644 --- a/client/src/sass/class-helpers/_images.scss +++ b/client/src/sass/class-helpers/_images.scss @@ -12,3 +12,7 @@ .revert-margin-content.banner { width: calc(100% + 2 * #{pvar(--x-margin-content)}); } + +.pt-icon { + @include icon(24px); +} diff --git a/client/src/sass/class-helpers/_menu.scss b/client/src/sass/class-helpers/_menu.scss index 440370121..cfd36aa33 100644 --- a/client/src/sass/class-helpers/_menu.scss +++ b/client/src/sass/class-helpers/_menu.scss @@ -53,11 +53,9 @@ .admin-sub-header { display: flex; align-items: center; - margin-bottom: 30px; - - @media screen and (max-width: $small-view) { - flex-direction: column; - } + margin-bottom: 2rem; + flex-wrap: wrap; + gap: 0.5rem; } .pt-breadcrumb { diff --git a/client/src/sass/primeng-custom.scss b/client/src/sass/primeng-custom.scss index e2be68818..79520fa1f 100644 --- a/client/src/sass/primeng-custom.scss +++ b/client/src/sass/primeng-custom.scss @@ -763,9 +763,10 @@ p-table { display: inline-flex; align-items: center; flex-wrap: wrap; + gap: 0.5rem; .left-buttons { - @include padding-left(15px); + @include padding-left(1rem); } } } @@ -1172,14 +1173,9 @@ p-toast { @media screen and (max-width: $mobile-view) { p-table { .p-datatable-header { - .caption { - flex-wrap: wrap; - - > div { - width: 100%; - padding: 0 !important; - margin-bottom: 5px; - } + .caption > div { + width: 100%; + padding: 0 !important; } } }