From ea6961eb8a2243328aed76b4f94d1af92e6b431b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Polat?= Date: Sun, 28 Sep 2025 05:41:26 +0300 Subject: [PATCH] feat: add sidebar toggle and normalize component padding --- .../main/components/home/home.component.html | 24 ++-- .../sysperf-cards.component.html | 6 +- .../src/app/main/main.component.html | 72 +++++----- .../src/app/main/main.component.scss | 129 ++++++++++-------- .../src/app/main/main.component.ts | 11 +- 5 files changed, 127 insertions(+), 115 deletions(-) diff --git a/openbullet2-web-client/src/app/main/components/home/home.component.html b/openbullet2-web-client/src/app/main/components/home/home.component.html index 726942b92..31a30d4ab 100644 --- a/openbullet2-web-client/src/app/main/components/home/home.component.html +++ b/openbullet2-web-client/src/app/main/components/home/home.component.html @@ -1,5 +1,5 @@ -
+

OpenBullet 2

@@ -19,10 +19,10 @@
-
+

Announcement

-

@@ -31,8 +31,8 @@
-
Your collection
-
+
Your collection
+
@@ -102,8 +102,8 @@
Your collection
-
Recent hits
-
+
Recent hits
+
@@ -116,13 +116,13 @@
Recent hits
- -
+
Webserver Uptime
- {{serverUptime | timespan}} Unknown
@@ -143,7 +143,7 @@
Recent hits
Current Working Directory
{{serverInfo.currentWorkingDirectory | truncate : 30}} -
Build Date
- {{buildDate | date : 'medium'}}
diff --git a/openbullet2-web-client/src/app/main/components/home/sysperf-cards/sysperf-cards.component.html b/openbullet2-web-client/src/app/main/components/home/sysperf-cards/sysperf-cards.component.html index cf989a20f..9fd37bea0 100644 --- a/openbullet2-web-client/src/app/main/components/home/sysperf-cards/sysperf-cards.component.html +++ b/openbullet2-web-client/src/app/main/components/home/sysperf-cards/sysperf-cards.component.html @@ -1,5 +1,5 @@ -
System performance
-
+
System performance
+
@@ -92,7 +92,7 @@
System performance
Memory Last minute - -
+ - - + + diff --git a/openbullet2-web-client/src/app/main/main.component.scss b/openbullet2-web-client/src/app/main/main.component.scss index 68988204d..4bfc9cd33 100644 --- a/openbullet2-web-client/src/app/main/main.component.scss +++ b/openbullet2-web-client/src/app/main/main.component.scss @@ -3,71 +3,84 @@ $sidebarWidth: 230px; .wrapper { - display: flex; - min-height: 100vh; + display: flex; + min-height: 100vh; - .sidebar { - background-color: var(--bg-secondary); - width: $sidebarWidth; - min-width: $sidebarWidth; - overflow-y: auto; - overflow-x: hidden; - flex: 0 1 $sidebarWidth; - - .sidebar-logo { - padding: 40px 50px 0px 50px; - margin-bottom: 10px; - - img { - width: 100%; - } - } - - .sidebar-version { - padding: 10px 0px; - margin-bottom: 10px; - display: flex; - justify-content: center; - align-items: center; - font-size: 10px; + .sidebar { + background-color: var(--bg-secondary); + width: $sidebarWidth; + min-width: $sidebarWidth; + overflow-y: auto; + overflow-x: hidden; + flex: 0 1 $sidebarWidth; + margin-left: -$sidebarWidth; + transition: margin 0.3s ease-in-out; - a { - color: var(--fg-inactive); - text-decoration: none; - font-weight: bold; - } - } + &.show { + margin-left: 0px; + } - .sidebar-logout { - display: flex; - justify-content: center; - align-items: center; - padding: 10px 0px; - margin-top: 10px; + .sidebar-logo { + padding: 40px 50px 0px 50px; + margin-bottom: 10px; - button { - color: var(--fg-primary); - border: none; - padding: 10px 50px; - border-radius: 5px; - cursor: pointer; - font-weight: bold; - transition: background-color 0.2s; + img { + width: 100%; + } + } - &:hover { - background-color: var(--bg-primary); - } - - } - } + .sidebar-version { + padding: 10px 0px; + margin-bottom: 10px; + display: flex; + justify-content: center; + align-items: center; + font-size: 10px; + + a { + color: var(--fg-inactive); + text-decoration: none; + font-weight: bold; + } } - .content { - background-color: var(--bg-primary); + .sidebar-logout { + display: flex; + justify-content: center; + align-items: center; + padding: 10px 0px; + margin-top: 10px; + + button { color: var(--fg-primary); - flex: 1 1 auto; - padding: 30px 50px; - width: calc(100vw - $sidebarWidth); - overflow-x: hidden; + border: none; + padding: 10px 50px; + border-radius: 5px; + cursor: pointer; + font-weight: bold; + transition: background-color 0.2s; + + &:hover { + background-color: var(--bg-primary); + } + } + } + } + + .content { + background-color: var(--bg-primary); + color: var(--fg-primary); + flex: 1 1 auto; + padding: 30px 50px; + width: calc(100vw - $sidebarWidth); + overflow-x: hidden; + + .topbar { + .sidebar-toggle-button { + &:hover { + color: var(--fg-accent); + } + } } + } } diff --git a/openbullet2-web-client/src/app/main/main.component.ts b/openbullet2-web-client/src/app/main/main.component.ts index dec08435f..940edd3ae 100644 --- a/openbullet2-web-client/src/app/main/main.component.ts +++ b/openbullet2-web-client/src/app/main/main.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { faExclamationTriangle, faRightFromBracket } from '@fortawesome/free-solid-svg-icons'; import { UpdateInfoDto, VersionType } from './dtos/info/update-info.dto'; @@ -11,11 +11,14 @@ import { UserService } from './services/user.service'; styleUrls: ['./main.component.scss'], }) export class MainComponent implements OnInit { + @ViewChild('sidebar') sidebar!: ElementRef; + updateInfo: UpdateInfoDto | null = null; faExclamationTriangle = faExclamationTriangle; faRightFromBracket = faRightFromBracket; changelogModalVisible = false; + constructor( private router: Router, private infoService: InfoService, @@ -64,4 +67,10 @@ export class MainComponent implements OnInit { this.userService.resetJwt(); window.location.reload(); } + + toggleSidebar() { + if (this.sidebar) { + this.sidebar.nativeElement.classList.toggle('show'); + } + } }