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 {
|
||||
transition: opacity 0.3s ease-in-out;
|
||||
animation: fadeIn 1s ease-out;
|
||||
background: #39354a;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
@@ -7,14 +18,16 @@
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
z-index: -100;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.height-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
min-height: 100vh;
|
||||
width: 100vw;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.center-section,
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<div id="admin-bg">
|
||||
<div class="height-container">
|
||||
<!-- Left Section: Placeholder -->
|
||||
<ng-container *ngIf="!isMobile">
|
||||
<div class="left-section">
|
||||
<!-- Placeholder for future content -->
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
<!-- 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">
|
||||
<h2>Admin Dashboard</h2>
|
||||
<div class="admin-actions">
|
||||
@@ -16,6 +17,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="create-article-tile">
|
||||
<h2>Create New Article</h2>
|
||||
<form (ngSubmit)="createArticle()">
|
||||
@@ -30,9 +32,25 @@
|
||||
<button type="submit" [disabled]="!title || !content">Create Article</button>
|
||||
</form>
|
||||
</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>
|
||||
|
||||
<!-- Right Section: Articles List Tile -->
|
||||
<ng-container *ngIf="!isMobile">
|
||||
<div class="right-section">
|
||||
<div class="articles-list-tile">
|
||||
<h2>Articles</h2>
|
||||
@@ -48,5 +66,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,9 +1,10 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {ArticleService} from '../services/article.service';
|
||||
import {NgFor, NgIf} from '@angular/common';
|
||||
import {NgFor, NgIf, NgStyle} from '@angular/common';
|
||||
import {Observer} from 'rxjs';
|
||||
import {FormsModule} from '@angular/forms';
|
||||
import {DeviceDetectorService} from '../services/device-detector.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-admin',
|
||||
@@ -13,23 +14,26 @@ import {FormsModule} from '@angular/forms';
|
||||
NgIf,
|
||||
NgFor,
|
||||
FormsModule,
|
||||
NgStyle
|
||||
]
|
||||
})
|
||||
export class AdminComponent implements OnInit {
|
||||
articles: any[] = [];
|
||||
noArticles: boolean = false;
|
||||
|
||||
isMobile: boolean = false;
|
||||
title: string = '';
|
||||
content: string = '';
|
||||
token: string | null = localStorage.getItem('token');
|
||||
|
||||
constructor(
|
||||
private articleService: ArticleService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private deviceService: DeviceDetectorService
|
||||
) {}
|
||||
|
||||
// Fetch articles from backend
|
||||
ngOnInit() {
|
||||
this.isMobile = this.deviceService.isMobile;
|
||||
if (!this.token) {
|
||||
this.navigateToLogin();
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user