diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/angular.json b/DigitalData.UserManager.API/ClientApp/user_manager_ui/angular.json index 0a978d3..fb667a6 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/angular.json +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/angular.json @@ -102,9 +102,12 @@ ], "styles": [ "@angular/material/prebuilt-themes/indigo-pink.css", - "src/styles.scss" + "src/styles.scss", + "node_modules/bootstrap/dist/css/bootstrap.min.css" ], - "scripts": [] + "scripts": [ + "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js" + ] } } } diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/package-lock.json b/DigitalData.UserManager.API/ClientApp/user_manager_ui/package-lock.json index 50db939..071025e 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/package-lock.json +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/package-lock.json @@ -23,8 +23,11 @@ "@generic-ui/fabric": "^0.21.0", "@generic-ui/hermes": "^0.21.0", "@generic-ui/ngx-grid": "^0.21.0", + "bootstrap": "^5.3.3", + "bootstrap-icons": "^1.11.3", "express": "^4.18.2", "rxjs": "~7.8.0", + "sweetalert2": "^11.12.3", "tslib": "^2.3.0", "zone.js": "~0.14.3" }, @@ -4210,6 +4213,16 @@ "node": ">=14" } }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "peer": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.18.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", @@ -5474,6 +5487,39 @@ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" }, + "node_modules/bootstrap": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz", + "integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], + "peerDependencies": { + "@popperjs/core": "^2.11.8" + } + }, + "node_modules/bootstrap-icons": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/bootstrap-icons/-/bootstrap-icons-1.11.3.tgz", + "integrity": "sha512-+3lpHrCw/it2/7lBL15VR0HEumaBss0+f/Lb6ZvHISn1mlK83jjFpooTLsMWbIjJMDjDjOExMsTxnXSIT4k4ww==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ] + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -11876,6 +11922,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/sweetalert2": { + "version": "11.12.3", + "resolved": "https://registry.npmjs.org/sweetalert2/-/sweetalert2-11.12.3.tgz", + "integrity": "sha512-tgGJSgfSV/xK113JEvhjwqKAuBYLXsZf0z+tGlHKQNnsLMi4eSNuzn9tt5hUdvjOVTLSPDgo0Lc+tnjy9Uj7Og==", + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/limonte" + } + }, "node_modules/symbol-observable": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-4.0.0.tgz", diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/package.json b/DigitalData.UserManager.API/ClientApp/user_manager_ui/package.json index 20b90bb..c27cf3c 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/package.json +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/package.json @@ -26,8 +26,11 @@ "@generic-ui/fabric": "^0.21.0", "@generic-ui/hermes": "^0.21.0", "@generic-ui/ngx-grid": "^0.21.0", + "bootstrap": "^5.3.3", + "bootstrap-icons": "^1.11.3", "express": "^4.18.2", "rxjs": "~7.8.0", + "sweetalert2": "^11.12.3", "tslib": "^2.3.0", "zone.js": "~0.14.3" }, diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/app.component.html b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/app.component.html index ffdd3ca..345616e 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/app.component.html +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/app.component.html @@ -1,6 +1,4 @@ - - -
- -
- \ No newline at end of file + +
+ +
\ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/auth/auth.guard.ts b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/auth/auth.guard.ts index 966a66d..a150b9b 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/auth/auth.guard.ts +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/auth/auth.guard.ts @@ -15,25 +15,24 @@ export class AuthGuard implements CanActivate { private router: Router ) {} - canActivate( + async canActivate( next: ActivatedRouteSnapshot, state: RouterStateSnapshot - ): Observable | Promise | boolean { - return new Observable(observer => { - this.authService.isAuthenticated().subscribe({ - next: (res) => { - if(!res) - this.openLogin(); - - observer.next(res) - }, - error: (error) => { - observer.next(false) - }, - complete: () => observer.complete() - }); - }); + ): Promise { + try { + const isAuthenticated = await this.authService.isAuthenticated(); + + if (!isAuthenticated) { + this.openLogin(); + } + + return isAuthenticated; + } catch (error) { + // Hata durumunda false döndür + return false; + } } + openLogin(): MatDialogRef { const dialogRef = this.dialog.open(LoginComponent, { diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/nav-menu/nav-menu.component.ts b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/nav-menu/nav-menu.component.ts index 0b09466..6e4f5f5 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/nav-menu/nav-menu.component.ts +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/nav-menu/nav-menu.component.ts @@ -22,7 +22,7 @@ export class NavMenuComponent { isExpanded = false; constructor(public dialog: MatDialog, private authService: AuthenticationService) { - this.authService.isAuthenticated().subscribe(); + this.authService.isAuthenticated().then(console.log).catch(console.log) } get isDarkTheme(): boolean { @@ -48,24 +48,19 @@ export class NavMenuComponent { }); } - auth() { - this.authService.isAuthenticated().subscribe({ - next: (res) => { - if (res) - this.authService.logout().subscribe(); - else { - const dialogRef = this.dialog.open(LoginComponent, { - width: "35vw", - data: { - afterLogin: () => { - dialogRef.close(); - } - } - }); + async auth() { + const isLoggedIn = await this.authService.isAuthenticated(); + if (isLoggedIn) + this.authService.logout().subscribe(); + else { + const dialogRef = this.dialog.open(LoginComponent, { + width: "35vw", + data: { + afterLogin: () => { + dialogRef.close(); + } } - }, - error: (err) => { - } - }) + }); + } } } \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/services/authentication.service.ts b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/services/authentication.service.ts index 84370e3..531cd8b 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/services/authentication.service.ts +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/services/authentication.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { Observable } from 'rxjs'; +import { Observable, firstValueFrom } from 'rxjs'; import { Router } from '@angular/router'; import Swal from 'sweetalert2'; import { UrlService } from './url.service'; @@ -24,21 +24,15 @@ export class AuthenticationService { this.checkUrl = urlService.apiRoute.loginCheck; } - isAuthenticated(): Observable { - return new Observable(observer => { - this.http.get(this.checkUrl, { withCredentials: true }) - .subscribe({ - next: (response) => { - _isLogedIn = response; - observer.next(response) - }, - error: (error) => { - this.showErrorAlert() - observer.error(error) - }, - complete: () => observer.complete() - }); - }); + async isAuthenticated(): Promise { + try { + const response = await firstValueFrom(this.http.get(this.checkUrl, { withCredentials: true })); + _isLogedIn = response; + return response; + } catch (error) { + this.showErrorAlert(); + return false; + } } login(username: string, password: string): Observable { diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/DD_white.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/DD_white.svg new file mode 100644 index 0000000..19bca4a --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/DD_white.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/Huhn_andersrum.webp b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/Huhn_andersrum.webp new file mode 100644 index 0000000..4200507 Binary files /dev/null and b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/Huhn_andersrum.webp differ diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data.svg new file mode 100644 index 0000000..671d90d --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data.svg @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data_red_BG.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data_red_BG.svg new file mode 100644 index 0000000..4350de8 --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/digital_data_red_BG.svg @@ -0,0 +1,20 @@ + + + + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/group.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/group.svg new file mode 100644 index 0000000..6bd73ab --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/group.svg @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/login_logo.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/login_logo.svg new file mode 100644 index 0000000..f2d2f85 --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/login_logo.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/mode_logo.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/mode_logo.svg new file mode 100644 index 0000000..ae2ae3d --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/mode_logo.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/thema_bttn.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/thema_bttn.svg new file mode 100644 index 0000000..c764ed2 --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/thema_bttn.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user-plus-svgrepo-com.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user-plus-svgrepo-com.svg new file mode 100644 index 0000000..46e672d --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user-plus-svgrepo-com.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user.svg b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user.svg new file mode 100644 index 0000000..62a56e6 --- /dev/null +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/assets/img/user.svg @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/index.html b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/index.html index e270019..c3eb3a2 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/index.html +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/index.html @@ -6,7 +6,7 @@ - + diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/styles.scss b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/styles.scss index 7e7239a..5692efd 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/styles.scss +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/styles.scss @@ -1,4 +1,50 @@ -/* You can add global styles to this file, and also import other style files */ +@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css"; +@import '../node_modules/@angular/cdk/overlay-prebuilt.css'; +@import "../node_modules/bootstrap-icons/font/bootstrap-icons.css"; -html, body { height: 100%; } -body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; } +a { + color: #0366d6; +} + +.btn:focus, +.btn:active:focus, +.btn-link.nav-link:focus, +.form-control:focus, +.form-check-input:focus { + box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; +} + +code { + color: #e01a76; +} + +.btn-primary { + color: #fff; + background-color: #1b6ec2; + border-color: #1861ac; +} + +.assignment-row { + height: 40vh; +} + +.user-row { + height: 45vh; +} + +.flex-col { + display: flex; + flex-direction: column; +} + +.flex-col .card { + flex: 1; +} + +.mat-color-scheme-light .mat-mdc-tab:not(.mdc-tab--active) .mdc-tab__text-label { + color: rgb(100, 95, 95) !important; +} + +.mdc-tab__text-label{ + font-size: medium; +} \ No newline at end of file