many, MANY improvements to admin UI
This commit is contained in:
1 parent
eac0938ccf
commit
3b6ac1dcab
14 files changed
+2421
-99
No files matched your search
@@ -19,12 +19,15 @@
|
||||
|
||||
.content-container {
|
||||
display: inline-grid;
|
||||
max-width: 960px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
color: #fff;
|
||||
background: linear-gradient(to top, #a0eddb 0%, #ffffff 100%);
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
margin-top: 120px;
|
||||
margin-bottom: 40px;
|
||||
font-weight: 600;
|
||||
@@ -32,22 +35,33 @@ h1 {
|
||||
|
||||
.article-content {
|
||||
font-size: 1.2rem;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
line-height: 1.8;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.article-content h1, .article-content h2, .article-content h3, .article-content h4, .article-content h5, .article-content h6 {
|
||||
color:white;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
font-size: 1rem;
|
||||
color: #e6e6e6;
|
||||
color: #D6DAEFBD;
|
||||
text-align: left;
|
||||
margin: 25px 0;
|
||||
}
|
||||
|
||||
.article-meta p {
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.content-container button {
|
||||
.article-buttons {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.article-buttons button {
|
||||
background-color: #444893FF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
@@ -57,13 +71,34 @@ h1 {
|
||||
border-radius: 25px;
|
||||
transition: background-color 0.3s;
|
||||
font-weight: 400;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.content-container button:hover {
|
||||
.article-buttons button:hover {
|
||||
background-color: #707ec5;
|
||||
}
|
||||
|
||||
#shareBtn {
|
||||
background-color: transparent;
|
||||
font-size: 1.5rem;
|
||||
margin: 0;
|
||||
transition: all ease-in-out 0.2s;
|
||||
}
|
||||
|
||||
#shareBtn:hover {
|
||||
color: #cfd7f8;
|
||||
}
|
||||
|
||||
#shareBtn.copied {
|
||||
color: #8798dc;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
margin-right: 64px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.error-message h1 {
|
||||
font-size: 10rem;
|
||||
margin: 0;
|
||||
@@ -138,6 +173,10 @@ h1 {
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.article-content .centered-text {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
|
||||
@@ -16,17 +16,21 @@
|
||||
<div class="article-container">
|
||||
<div>
|
||||
<h1>{{ article.title }}</h1>
|
||||
<div class="content-container">
|
||||
<div
|
||||
#articleContent
|
||||
<div class="content-container" [ngStyle]="{'width': isNarrow ? '100%' : '70%'}">
|
||||
<markdown
|
||||
class="article-content"
|
||||
[innerHTML]="article.content"
|
||||
[data]="renderedContent"
|
||||
(click)="onArticleContentClick($event)"
|
||||
></div>
|
||||
<a href="/blog"><button>{{ 'ARTICLE_BACK' | translate }}</button></a>
|
||||
></markdown>
|
||||
<div class="article-buttons">
|
||||
<button id="shareBtn" (click)="copyLink()" [class.copied]="copied" class="fa-solid fa-share"></button>
|
||||
<div class="back-btn">
|
||||
<a href="/blog"><button id="backBtn">{{ 'ARTICLE_BACK' | translate }}</button></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-meta">
|
||||
<p><strong>Author:</strong> {{ article.authorName}}</p>
|
||||
<p><strong>Views:</strong> {{ article.views }}</p><br><button (click)="copyLink()" [ngStyle]="{'background-color':copied ? '#22b34b' : ''}">{{ copied ? 'Copied' : 'Share' }}</button>
|
||||
<p><strong>Views:</strong> {{ article.views }}</p>
|
||||
<p><strong>{{ 'CREATED_AT' | translate }}</strong> {{ article.createdAt | date:'MMM dd, yyyy, HH:mm' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,6 +5,8 @@ import {ActivatedRoute} from '@angular/router';
|
||||
import {Title} from '@angular/platform-browser';
|
||||
import {TranslatePipe} from '@ngx-translate/core';
|
||||
import {ParallaxComponent} from '../../shared/parallax/parallax.component';
|
||||
import {MarkdownModule} from 'ngx-markdown';
|
||||
import {ViewportService} from '../../shared/services/viewport.service';
|
||||
|
||||
interface Article {
|
||||
id: number;
|
||||
@@ -25,7 +27,8 @@ interface Article {
|
||||
DatePipe,
|
||||
NgStyle,
|
||||
TranslatePipe,
|
||||
ParallaxComponent
|
||||
ParallaxComponent,
|
||||
MarkdownModule
|
||||
],
|
||||
templateUrl: './article-page.component.html',
|
||||
styleUrl: './article-page.component.css'
|
||||
@@ -38,10 +41,15 @@ export class ArticlePageComponent implements OnInit {
|
||||
copied: boolean = false;
|
||||
loading: boolean = true;
|
||||
|
||||
renderedContent: string = '';
|
||||
|
||||
isNarrow: boolean = false;
|
||||
|
||||
constructor(
|
||||
private articleService: ArticleService,
|
||||
private titleService: Title,
|
||||
private route: ActivatedRoute
|
||||
private route: ActivatedRoute,
|
||||
private viewportService: ViewportService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -53,6 +61,8 @@ export class ArticlePageComponent implements OnInit {
|
||||
this.error = false;
|
||||
this.article = null;
|
||||
|
||||
this.isNarrow = this.viewportService.isNarrow;
|
||||
|
||||
if (!slug) {
|
||||
this.titleService.setTitle('Error | itzMiney');
|
||||
return;
|
||||
@@ -68,6 +78,7 @@ export class ArticlePageComponent implements OnInit {
|
||||
}
|
||||
|
||||
this.article = article;
|
||||
this.renderedContent = this.transformCustomBlocks(article.content);
|
||||
this.titleService.setTitle(`${article.title} | itzMiney`);
|
||||
this.loading = false;
|
||||
},
|
||||
@@ -93,6 +104,35 @@ export class ArticlePageComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
transformCustomBlocks(content: string): string {
|
||||
let result = content;
|
||||
|
||||
result = result.replace(
|
||||
/\[gallery\]\s*([\s\S]*?)\s*\[\/gallery\]/g,
|
||||
(_, inner) => {
|
||||
const urls = inner
|
||||
.split('\n')
|
||||
.map((line: string) => line.trim())
|
||||
.filter((line: string) => line.length > 0);
|
||||
|
||||
const images = urls
|
||||
.map((url: string) => `<img src="${url}" alt="Gallery image">`)
|
||||
.join('');
|
||||
|
||||
return `<div class="gallery">${images}</div>`;
|
||||
}
|
||||
);
|
||||
|
||||
result = result.replace(
|
||||
/\[center\]\s*([\s\S]*?)\s*\[\/center\]/g,
|
||||
(_, inner) => {
|
||||
return `<div class="centered-text">${inner}</div>`;
|
||||
}
|
||||
);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
openPreview(src: string) {
|
||||
this.selectedImage = src;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user