diff options
Diffstat (limited to 'src/DevHive.Angular')
12 files changed, 63 insertions, 5 deletions
diff --git a/src/DevHive.Angular/src/app/components/feed/feed.component.ts b/src/DevHive.Angular/src/app/components/feed/feed.component.ts index 8e9ffbc..b412b3c 100644 --- a/src/DevHive.Angular/src/app/components/feed/feed.component.ts +++ b/src/DevHive.Angular/src/app/components/feed/feed.component.ts @@ -101,10 +101,14 @@ export class FeedComponent implements OnInit { createPost(): void { const postMessage = this.createPostFormGroup.get('newPostMessage')?.value; + this.dataArrived = false; this._postService.createPostWithSessionStorageRequest(postMessage, this.files).subscribe( (result: object) => { this.goToProfile(); + }, + (err: HttpErrorResponse) => { + this.dataArrived = true; } ); } diff --git a/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.css b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.css diff --git a/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.html b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.html new file mode 100644 index 0000000..7392a21 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.html @@ -0,0 +1,8 @@ +<div class="kaleidoscope"> + <ng-container *ngComponentOutlet="component"></ng-container> + <app-login *ngIf="logged!"></app-login> + <app-register *ngIf="!logged!"></app-register> + <!-- <app-feed></app-feed> --> + <script>var logged = false;</script> + <!-- to be fixed tomorow --> +</div>
\ No newline at end of file diff --git a/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.ts b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.ts new file mode 100644 index 0000000..1c5cda1 --- /dev/null +++ b/src/DevHive.Angular/src/app/components/kaleidoscope/kaleidoscope.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { LoginComponent } from '../login/login.component'; + +@Component({ + selector: 'app-kaleidoscope', + templateUrl: './kaleidoscope.component.html', + styleUrls: ['./kaleidoscope.component.css'] +}) +export class KaleidoscopeComponent implements OnInit { + + public _component: Component; + + constructor(loginComponent: LoginComponent) { + this._component = loginComponent as Component; + } + + ngOnInit(): void { + + } + + assignComponent(component: Component) { + this._component = component; + } +} diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html index a8ebce7..4d381d1 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.html @@ -10,8 +10,8 @@ </div> <div class="show-full-attachment" *ngIf="showFull" (click)="toggleShowFull()"> - <img class="attachment-img" *ngIf="paramURL.includes('image')" src="{{paramURL}}"> - <a class="attachment-download submit-btn" *ngIf="!paramURL.includes('image')" href="{{paramURL}}">Download attachment</a> + <img class="attachment-img" *ngIf="isImage" src="{{paramURL}}"> + <a class="attachment-download submit-btn" *ngIf="!isImage" href="{{paramURL}}">Download attachment</a> <div class="close"> ☒ </div> diff --git a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts index 6c468b0..1d00def 100644 --- a/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts +++ b/src/DevHive.Angular/src/app/components/post-attachment/post-attachment.component.ts @@ -7,6 +7,7 @@ import { Component, Input, OnInit } from '@angular/core'; }) export class PostAttachmentComponent implements OnInit { @Input() paramURL: string; + public isImage = false; public showFull = false; public fileName: string; public fileType: string; @@ -15,7 +16,8 @@ export class PostAttachmentComponent implements OnInit { { } ngOnInit(): void { - this.fileType = this.paramURL.includes('image') ? 'img' : 'raw'; + this.isImage = this.paramURL.includes('image') && !this.paramURL.endsWith('pdf'); + this.fileType = this.isImage ? 'img' : 'raw'; this.fileName = this.paramURL.match('(?<=\/)(?:.(?!\/))+$')?.pop() ?? 'Attachment'; } diff --git a/src/DevHive.Angular/src/app/components/post/post.component.css b/src/DevHive.Angular/src/app/components/post/post.component.css index 07d931f..1b88c7d 100644 --- a/src/DevHive.Angular/src/app/components/post/post.component.css +++ b/src/DevHive.Angular/src/app/components/post/post.component.css @@ -76,6 +76,11 @@ hr { /* Rating */ +/* Temporary, until ratings are implemented fully */ +.rating { + display: none !important; +} + .rating { display: flex; flex-direction: column; diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.css b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.css index 27d1584..1c07d9f 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.css +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.css @@ -42,6 +42,7 @@ hr { align-items: center; justify-content: center; padding: 0 .5em; + flex-wrap: wrap; } #profile-picture { diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html index d87c35c..502697d 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.html @@ -3,6 +3,7 @@ <div id="content" *ngIf="dataArrived"> <nav id="navigation"> <button class="submit-btn" (click)="goToProfile()">ᐊ Back</button> + <button class="submit-btn" (click)="navigateToAdminPanel()" *ngIf="isAdminUser">Panel</button> <button class="submit-btn" (click)="logout()">Logout</button> </nav> <hr> @@ -11,7 +12,7 @@ <img id="profile-picture" class="round-image" [src]="user.profilePictureURL"> <div id="submit-file"> <div id="upload-file" class="submit-btn"> - <input type="file" formControlName="fileUpload" (change)="onFileUpload($event)"> + <input type="file" accept="image/*" formControlName="fileUpload" (change)="onFileUpload($event)"> </div> <button class="submit-btn" type="submit">Update profile picture</button> </div> diff --git a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts index 463b980..a484665 100644 --- a/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts +++ b/src/DevHive.Angular/src/app/components/profile-settings/profile-settings.component.ts @@ -13,6 +13,7 @@ import { Language } from 'src/models/language'; import { Technology } from 'src/models/technology'; import { TokenService } from 'src/app/services/token.service'; import { Title } from '@angular/platform-browser'; +import { AppConstants } from 'src/app/app-constants.module'; @Component({ selector: 'app-profile-settings', @@ -24,6 +25,7 @@ export class ProfileSettingsComponent implements OnInit { @ViewChild(ErrorBarComponent) private _errorBar: ErrorBarComponent; @ViewChild(SuccessBarComponent) private _successBar: SuccessBarComponent; private _urlUsername: string; + public isAdminUser = false; public dataArrived = false; public deleteAccountConfirm = false; public showLanguages = false; @@ -51,6 +53,7 @@ export class ProfileSettingsComponent implements OnInit { this._userService.getUserByUsernameRequest(this._urlUsername).subscribe( (res: object) => { Object.assign(this.user, res); + this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); this.finishUserLoading(); }, (err: HttpErrorResponse) => { @@ -262,6 +265,10 @@ export class ProfileSettingsComponent implements OnInit { this._router.navigate([this._router.url.substring(0, this._router.url.length - 9)]); } + navigateToAdminPanel(): void { + this._router.navigate(['/admin-panel']); + } + logout(): void { this._tokenService.logoutUserFromSessionStorage(); this.goToProfile(); diff --git a/src/DevHive.Angular/src/app/components/profile/profile.component.ts b/src/DevHive.Angular/src/app/components/profile/profile.component.ts index f364c0d..a60250c 100644 --- a/src/DevHive.Angular/src/app/components/profile/profile.component.ts +++ b/src/DevHive.Angular/src/app/components/profile/profile.component.ts @@ -53,6 +53,7 @@ export class ProfileComponent implements OnInit { this._userService.getUserByUsernameRequest(this._urlUsername).subscribe( (res: object) => { Object.assign(this.user, res); + this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); this.loadLanguages(); }, (err: HttpErrorResponse) => { @@ -117,7 +118,6 @@ export class ProfileComponent implements OnInit { this.isTheLoggedInUser = true; } this.dataArrived = true; - this.isAdminUser = this.user.roles.map(x => x.name).includes(AppConstants.ADMIN_ROLE_NAME); }, (err: HttpErrorResponse) => { this.logout(); diff --git a/src/DevHive.Angular/src/app/components/register/register.component.css b/src/DevHive.Angular/src/app/components/register/register.component.css index 653b590..93d8006 100644 --- a/src/DevHive.Angular/src/app/components/register/register.component.css +++ b/src/DevHive.Angular/src/app/components/register/register.component.css @@ -8,6 +8,12 @@ form { width: 100%; } +@media screen and (max-height: 630px) { + #content { + height: fit-content !important; + } +} + #content hr { width: 100%; border: 1px solid black; |
