Commit 6a581a16 authored by Arko Dey Bhowmick's avatar Arko Dey Bhowmick

WIP: responsivness of portal

parent 9ef4ed16
import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core'; import { Component, Inject, OnInit, PLATFORM_ID } from '@angular/core';
import { Router, RouterModule, RouterOutlet } from '@angular/router'; import { Router, RouterModule, RouterOutlet,NavigationEnd } from '@angular/router';
import { RequestMapperService } from './mappers/request-mapper.service'; import { RequestMapperService } from './mappers/request-mapper.service';
import { InitThemeService } from './style-guide/service/initialize-theme.service'; import { InitThemeService } from './style-guide/service/initialize-theme.service';
import { isPlatformBrowser } from '@angular/common'; import { isPlatformBrowser } from '@angular/common';
import { filter } from 'rxjs';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -15,6 +16,7 @@ export class AppComponent implements OnInit{ ...@@ -15,6 +16,7 @@ export class AppComponent implements OnInit{
public isBrowser: boolean = false; public isBrowser: boolean = false;
constructor( constructor(
private router: Router,
private _themeService: InitThemeService, private _themeService: InitThemeService,
@Inject(PLATFORM_ID) private _platformId: Object @Inject(PLATFORM_ID) private _platformId: Object
) { ) {
...@@ -25,5 +27,19 @@ export class AppComponent implements OnInit{ ...@@ -25,5 +27,19 @@ export class AppComponent implements OnInit{
public ngOnInit(): void { public ngOnInit(): void {
this.router.events.pipe(
filter(event => event instanceof NavigationEnd)
).subscribe((event: any) => {
// console.log('Route changed:', event.url);
this.onRouteChange(event.url);
});
}
public onRouteChange(url: string): void {
// Custom function to execute on route change
// console.log('Triggered function on route change!', url);
this._themeService.updateSidebarState(false);
} }
} }
...@@ -62,5 +62,8 @@ ...@@ -62,5 +62,8 @@
</div>
<div class="theme_mode_changer">
<app-theme-mode-changer />
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
flex-direction: column; flex-direction: column;
height: 100%; height: 100%;
justify-content: space-between; justify-content: space-between;
position: relative;
} }
.sidebar_navigation_container a { .sidebar_navigation_container a {
...@@ -81,4 +82,26 @@ ...@@ -81,4 +82,26 @@
&.dd_active { &.dd_active {
transform: rotate(360deg); transform: rotate(360deg);
} }
}
.theme_mode_changer {
position: absolute;
bottom: 0;
}
@media only screen and (max-width: 999px) and (min-width: 300px) {
.theme_mode_changer {
position: fixed;
bottom: 52px;
transform: translateX(80px);
}
.sidebar_wrapper_inner {
display: flex;
flex-direction: column;
height: 100%;
justify-content: space-between;
position: relative;
z-index: 12;
}
} }
\ No newline at end of file
import { Component, OnInit } from '@angular/core'; import { Component, effect, inject, OnInit } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { Menu } from '../model/sidebar/menu'; import { Menu } from '../model/sidebar/menu';
import { Sidebar } from '../interface/sidebar'; import { Sidebar } from '../interface/sidebar';
// import { ThemeModeChangerComponent } from '../../../component-library/theme-mode-changer/theme-mode-changer.component'; import { ThemeModeChangerComponent } from '../../../component-library/theme-mode-changer/theme-mode-changer.component';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { InitThemeService } from '../../../style-guide/service/initialize-theme.service';
// import { InitThemeService } from '../../../style-guide/service/initialize-theme.service';
@Component({ @Component({
selector: 'app-sidebar', selector: 'app-sidebar',
imports: [ imports: [
CommonModule, CommonModule,
RouterModule, RouterModule,
// ThemeModeChangerComponent ThemeModeChangerComponent
], ],
templateUrl: './sidebar.component.html', templateUrl: './sidebar.component.html',
styleUrl: './sidebar.component.scss' styleUrl: './sidebar.component.scss'
...@@ -21,12 +23,10 @@ export class SidebarComponent implements OnInit { ...@@ -21,12 +23,10 @@ export class SidebarComponent implements OnInit {
public isNightModeActive: boolean = false; public isNightModeActive: boolean = false;
public ngOnInit(): void { public ngOnInit(): void {
// console.log(this.sideBarNavigationItems)
// TODO: implements Business logics for sidebar. Role base hide show
} }
trackById(index: number, item: any): any {
return item.id || index; // Ensure 'item.id' is unique, otherwise fall back to index // trackById(index: number, item: any): any {
} // return item.id || index; // Ensure 'item.id' is unique, otherwise fall back to index
// }
} }
<div class="topbar_navigation_wrapper"> <div class="topbar_navigation_wrapper">
<div class="topbar_logo"> <div class="topbar_logo">
<button class="topbar_menu_button" (click)="toggleSidebar()">
<span class="material-symbols-outlined">
menu
</span>
</button>
<img <img
[ngSrc]="'./assets/image/logo_lamarts.png'" [ngSrc]="'./assets/image/logo_lamarts.png'"
width="200" width="200"
...@@ -8,7 +15,7 @@ ...@@ -8,7 +15,7 @@
/> />
</div> </div>
<div class="topbar_navigation"> <div class="topbar_navigation">
<app-theme-mode-changer /> <!-- <app-theme-mode-changer /> -->
<div class="topbar_navigation_items topbar_profile_menu"> <div class="topbar_navigation_items topbar_profile_menu">
<img <img
......
...@@ -97,3 +97,45 @@ ...@@ -97,3 +97,45 @@
} }
} }
.topbar_menu_button {
display: none;
}
@media only screen and (max-width: 999px) and (min-width: 300px) {
.topbar_logo {
width: 39%;
display: flex;
gap: 10px;
}
.topbar_menu_button {
background-color: transparent;
border: none;
display: block;
}
::ng-deep body.dark .topbar_menu_button {
color: white;
}
.topbar_logo img {
max-width: 70px;
width: 79%;
}
.topbar_profile_menu .user_profile_info .user_name {
font-size: 12px;
}
.topbar_profile_menu .user_profile_info .user_role{
font-size: 10px;
}
.topbar_profile_menu .user_profile_info .user_image {
width: 31px;
height: 31px;
}
}
...@@ -3,13 +3,14 @@ import { Component } from '@angular/core'; ...@@ -3,13 +3,14 @@ import { Component } from '@angular/core';
import { LogoutService } from '../service/logout.service'; import { LogoutService } from '../service/logout.service';
import { GetProfileInformationService } from '../service/get-profile-information.service'; import { GetProfileInformationService } from '../service/get-profile-information.service';
import { UserProfile } from '../../../auth/interface/user-profile'; import { UserProfile } from '../../../auth/interface/user-profile';
import { ThemeModeChangerComponent } from "../../../component-library/theme-mode-changer/theme-mode-changer.component"; import { InitThemeService } from '../../../style-guide/service/initialize-theme.service';
// import { ThemeModeChangerComponent } from "../../../component-library/theme-mode-changer/theme-mode-changer.component";
@Component({ @Component({
selector: 'app-top-bar', selector: 'app-top-bar',
imports: [ imports: [
NgOptimizedImage, NgOptimizedImage,
ThemeModeChangerComponent // ThemeModeChangerComponent
], ],
templateUrl: './topbar.component.html', templateUrl: './topbar.component.html',
styleUrl: './topbar.component.scss' styleUrl: './topbar.component.scss'
...@@ -21,12 +22,17 @@ export class TopBarComponent { ...@@ -21,12 +22,17 @@ export class TopBarComponent {
public isBrowser: boolean = false; public isBrowser: boolean = false;
constructor( constructor(
private _logoutService: LogoutService, private _logoutService: LogoutService,
private _getProfileInformation: GetProfileInformationService private _getProfileInformation: GetProfileInformationService,
private _themeService: InitThemeService,
) { ) {
this._fetchProfileDetails(); this._fetchProfileDetails();
} }
public toggleSidebar(): void {
this._themeService.updateSidebarState(true);
}
public logout(): void { public logout(): void {
this._logoutService.logout(); this._logoutService.logout();
} }
......
...@@ -42,3 +42,11 @@ ...@@ -42,3 +42,11 @@
} }
} }
} }
@media only screen and (max-width: 999px) and (min-width: 300px) {
.portal_card_colored_card {
width: 100%;
margin-bottom: 10px;
}
}
...@@ -4,9 +4,10 @@ ...@@ -4,9 +4,10 @@
<app-top-bar /> <app-top-bar />
</div> </div>
<div class="sidebar"> <div class="sidebar {{isSidebarOpen?'active':''}}">
<app-sidebar /> <app-sidebar />
</div> </div>
<div *ngIf="isSidebarOpen" class="sidebar_wrapper_inner_overlay" (click)="closeSidebar()"></div>
<div class="portal_renderer"> <div class="portal_renderer">
<div class="portal_renderer_inner"> <div class="portal_renderer_inner">
......
...@@ -28,4 +28,45 @@ ...@@ -28,4 +28,45 @@
width: 100%; width: 100%;
background-color: var(--secondary-bg-color); background-color: var(--secondary-bg-color);
} }
}
@media only screen and (max-width: 999px) and (min-width: 300px) {
.sidebar {
width: 250px;
background-color: var(--secondary-bg-color);
padding-left: 20px;
height: 100%;
position: fixed;
left: -300px;
z-index: 2;
transition: all .5s;
&.active {
left: -21px;
}
}
.portal_renderer {
width: 100%;
}
.portal_renderer .portal_renderer_inner {
width: 94%;
border-radius: 10px;
padding: 20px 20px;
margin: 0 auto;
}
}
.sidebar_wrapper_inner_overlay {
position: fixed;
width: 100%;
height: 100%;
background-color: #0b0b0b94;
top: 0;
left: 0;
z-index: 1;
}
}
\ No newline at end of file
import { Component } from '@angular/core'; import { Component, effect, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router'; import { RouterOutlet } from '@angular/router';
import { SidebarComponent } from '../navigation/sidebar/sidebar.component'; import { SidebarComponent } from '../navigation/sidebar/sidebar.component';
import { TopBarComponent } from '../navigation/topbar/topbar.component'; import { TopBarComponent } from '../navigation/topbar/topbar.component';
import {MatSidenavModule} from '@angular/material/sidenav'; import {MatSidenavModule} from '@angular/material/sidenav';
import { InitThemeService } from '../../style-guide/service/initialize-theme.service';
import { CommonModule } from '@angular/common';
@Component({ @Component({
selector: 'app-portal', selector: 'app-portal',
...@@ -10,11 +12,23 @@ import {MatSidenavModule} from '@angular/material/sidenav'; ...@@ -10,11 +12,23 @@ import {MatSidenavModule} from '@angular/material/sidenav';
RouterOutlet, RouterOutlet,
SidebarComponent, SidebarComponent,
TopBarComponent, TopBarComponent,
MatSidenavModule MatSidenavModule,
CommonModule
], ],
templateUrl: './portal.component.html', templateUrl: './portal.component.html',
styleUrl: './portal.component.scss' styleUrl: './portal.component.scss'
}) })
export class PortalComponent { export class PortalComponent {
private _themeService = inject(InitThemeService);
public isSidebarOpen = false;
constructor() {
effect(() => this.isSidebarOpen = this._themeService.isSidebarOpen())
}
public closeSidebar():void {
this._themeService.updateSidebarState(false);
}
} }
import { isPlatformBrowser } from "@angular/common"; import { isPlatformBrowser } from "@angular/common";
import { Inject, Injectable, PLATFORM_ID } from "@angular/core"; import { effect, Inject, Injectable, PLATFORM_ID, signal } from "@angular/core";
import { BehaviorSubject } from "rxjs"; import { BehaviorSubject } from "rxjs";
@Injectable({ @Injectable({
...@@ -9,9 +9,17 @@ export class InitThemeService { ...@@ -9,9 +9,17 @@ export class InitThemeService {
private _isBrowser: boolean = false; private _isBrowser: boolean = false;
public isLightModeActive$ = new BehaviorSubject<boolean>(false); public isLightModeActive$ = new BehaviorSubject<boolean>(false);
public isSidebarOpen = signal<boolean>(false);
constructor(@Inject(PLATFORM_ID) private _platformId: Object) { constructor(@Inject(PLATFORM_ID) private _platformId: Object) {
this._isBrowser = isPlatformBrowser(this._platformId); this._isBrowser = isPlatformBrowser(this._platformId);
} }
public updateSidebarState(isOpen: boolean): void {
this.isSidebarOpen.set(isOpen);
}
public init(): void { public init(): void {
if (!this._isBrowser) return if (!this._isBrowser) return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment