Small refactor.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
RakVhalate 2022-11-25 12:36:08 +10:00
parent 23181e4997
commit fb2ea59afb
5 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,5 @@
<div class="op"> <div class="op">
<h4>Тред номер {{op.Thread_Id}}</h4> <a [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Зайти в тред{{op.Thread_Id}} </a>
<a [routerLink] ="['/board']" [queryParams]="{thread: op.Thread_Id}" >Тред номер {{op.Thread_Id}} </a>
<p> # {{op.Id}} {{op.Timestamp}}</p> <p> # {{op.Id}} {{op.Timestamp}}</p>
<div> <div>
<a *ngFor="let i of op.ImgURL" [href]="i" target="_blank"> <a *ngFor="let i of op.ImgURL" [href]="i" target="_blank">

View File

@ -3,6 +3,7 @@ import { ApiChatService } from '../services/api-chat.service';
import { SinglePost } from '../models/post' import { SinglePost } from '../models/post'
import * as vars from '../var/api' import * as vars from '../var/api'
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
import {setDisplayedThread} from "../var/api";
@Component({ @Component({
selector: 'app-SingleThread', selector: 'app-SingleThread',
@ -34,6 +35,7 @@ export class BoardsComponent implements OnInit {
if(threadId != null) if(threadId != null)
{ {
this.displayed_thread_number = parseInt(threadId); this.displayed_thread_number = parseInt(threadId);
vars.setDisplayedThread(this.displayed_thread_number);
} }
this.apiChatService.getPosts('postgres', this.displayed_thread_number).subscribe(response => { this.apiChatService.getPosts('postgres', this.displayed_thread_number).subscribe(response => {
this.postsToShow = response this.postsToShow = response

View File

@ -11,7 +11,7 @@ import * as vars from "../var/api";
export class SendPostComponent implements OnInit { export class SendPostComponent implements OnInit {
progress: number; progress: number;
message: string; message: string = '';
filename: string[] = []; filename: string[] = [];
constructor( constructor(
@ -24,10 +24,13 @@ export class SendPostComponent implements OnInit {
sendPost(text: string) { sendPost(text: string) {
var threadId = vars.displayed_thread; var threadId = vars.displayed_thread;
this.apiChatService.sendPostToApi(text, this.filename, threadId).subscribe(); this.apiChatService.sendPostToApi(text, this.filename, threadId).subscribe( response => {
response = response.toString();
vars.showAlert(response.toString(), "#ff0a36");
});
this.message = '0'; this.message = '0';
this.filename = []; this.filename = [];
alert("Сообщение отправлено.");
} }
@ -37,7 +40,7 @@ export class SendPostComponent implements OnInit {
response => { response => {
response = response.value.toString(); response = response.value.toString();
this.filename.push(response); this.filename.push(response);
vars.showAlert("Картинка " + response + " добавлена к посту!", "#696116") vars.showAlert("Картинка " + response + " добавлена к посту!", "#ff0a36")
}); });
} }

View File

@ -13,9 +13,9 @@ const showAlert = (message:string, color:string) => {
alertContainer.style.left = '50'; alertContainer.style.left = '50';
alertContainer.style.top = '0'; alertContainer.style.top = '0';
alertContainer.style.right = '0'; alertContainer.style.right = '0';
alertContainer.style.padding = '10px 3px'; alertContainer.style.padding = '30px 3px';
alertContainer.style.fontSize = '30px'; alertContainer.style.fontSize = '20px';
alertContainer.style.textAlign = 'center'; alertContainer.style.textAlign = 'right';
alertContainer.style.backgroundColor = color; alertContainer.style.backgroundColor = color;
alertContainer.style.border = "2px dashed #6CFFDD" alertContainer.style.border = "2px dashed #6CFFDD"
alertContainer.textContent = message; alertContainer.textContent = message;