Fixed mobile layout of admin page
This commit is contained in:
1 parent
c5461e95bb
commit
cce6b58331
3 files changed
+43
-7
No files matched your search
@@ -1,5 +1,16 @@
|
|||||||
|
@keyframes fadeIn {
|
||||||
|
0% {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#admin-bg {
|
#admin-bg {
|
||||||
transition: opacity 0.3s ease-in-out;
|
animation: fadeIn 1s ease-out;
|
||||||
background: #39354a;
|
background: #39354a;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -7,14 +18,16 @@
|
|||||||
width: 100vw;
|
width: 100vw;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
z-index: -100;
|
z-index: -100;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.height-container {
|
.height-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100vh;
|
min-height: 100vh;
|
||||||
width: 100vw;
|
width: 100vw;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-section,
|
.center-section,
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<div id="admin-bg">
|
<div id="admin-bg">
|
||||||
<div class="height-container">
|
<div class="height-container">
|
||||||
<!-- Left Section: Placeholder -->
|
<!-- Left Section: Placeholder -->
|
||||||
|
<ng-container *ngIf="!isMobile">
|
||||||
<div class="left-section">
|
<div class="left-section">
|
||||||
<!-- Placeholder for future content -->
|
<!-- Placeholder for future content -->
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
<!-- Center Section: Admin Dashboard and Create Article Tiles -->
|
<!-- Center Section: Admin Dashboard and Create Article Tiles -->
|
||||||
<div class="center-section">
|
<div class="center-section" [ngStyle]="{'width': isMobile ? '100%' : '33.33%'}">
|
||||||
<div class="admin-dashboard-tile">
|
<div class="admin-dashboard-tile">
|
||||||
<h2>Admin Dashboard</h2>
|
<h2>Admin Dashboard</h2>
|
||||||
<div class="admin-actions">
|
<div class="admin-actions">
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="create-article-tile">
|
<div class="create-article-tile">
|
||||||
<h2>Create New Article</h2>
|
<h2>Create New Article</h2>
|
||||||
<form (ngSubmit)="createArticle()">
|
<form (ngSubmit)="createArticle()">
|
||||||
@@ -30,9 +32,25 @@
|
|||||||
<button type="submit" [disabled]="!title || !content">Create Article</button>
|
<button type="submit" [disabled]="!title || !content">Create Article</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<ng-container *ngIf="isMobile">
|
||||||
|
<div class="articles-list-tile">
|
||||||
|
<h2>Articles</h2>
|
||||||
|
<div *ngIf="noArticles">
|
||||||
|
<p>No articles available.</p>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="!noArticles">
|
||||||
|
<ul>
|
||||||
|
<li *ngFor="let article of articles" (click)="navigateToArticle(article.slug)">
|
||||||
|
<strong>ID {{ article.id }}</strong> - {{ article.title }}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Right Section: Articles List Tile -->
|
<!-- Right Section: Articles List Tile -->
|
||||||
|
<ng-container *ngIf="!isMobile">
|
||||||
<div class="right-section">
|
<div class="right-section">
|
||||||
<div class="articles-list-tile">
|
<div class="articles-list-tile">
|
||||||
<h2>Articles</h2>
|
<h2>Articles</h2>
|
||||||
@@ -48,5 +66,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {ArticleService} from '../services/article.service';
|
import {ArticleService} from '../services/article.service';
|
||||||
import {NgFor, NgIf} from '@angular/common';
|
import {NgFor, NgIf, NgStyle} from '@angular/common';
|
||||||
import {Observer} from 'rxjs';
|
import {Observer} from 'rxjs';
|
||||||
import {FormsModule} from '@angular/forms';
|
import {FormsModule} from '@angular/forms';
|
||||||
|
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-admin',
|
selector: 'app-admin',
|
||||||
@@ -13,23 +14,26 @@ import {FormsModule} from '@angular/forms';
|
|||||||
NgIf,
|
NgIf,
|
||||||
NgFor,
|
NgFor,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
NgStyle
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AdminComponent implements OnInit {
|
export class AdminComponent implements OnInit {
|
||||||
articles: any[] = [];
|
articles: any[] = [];
|
||||||
noArticles: boolean = false;
|
noArticles: boolean = false;
|
||||||
|
isMobile: boolean = false;
|
||||||
title: string = '';
|
title: string = '';
|
||||||
content: string = '';
|
content: string = '';
|
||||||
token: string | null = localStorage.getItem('token');
|
token: string | null = localStorage.getItem('token');
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private articleService: ArticleService,
|
private articleService: ArticleService,
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
private deviceService: DeviceDetectorService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
// Fetch articles from backend
|
// Fetch articles from backend
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.isMobile = this.deviceService.isMobile;
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
this.navigateToLogin();
|
this.navigateToLogin();
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user