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

This commit is contained in:
RakVhalate 2022-12-17 20:57:29 +05:00
parent 984c47c045
commit 44049bf900
5 changed files with 36 additions and 29 deletions

20
src/app/const/alert.ts Normal file
View File

@ -0,0 +1,20 @@
const ALERT_SHOW_TIME = 5000;
const showAlert = (message:string, color:string) => {
const alertContainer = document.createElement('div');
alertContainer.style.zIndex = '100';
alertContainer.style.position = 'fixed';
alertContainer.style.left = '50';
alertContainer.style.top = '0';
alertContainer.style.right = '0';
alertContainer.style.padding = '30px 3px';
alertContainer.style.fontSize = '20px';
alertContainer.style.textAlign = 'right';
alertContainer.style.backgroundColor = color;
alertContainer.style.border = "2px dashed #6CFFDD"
alertContainer.textContent = message;
document.body.append(alertContainer);
setTimeout(() => {
alertContainer.remove();
}, ALERT_SHOW_TIME);
}
export {showAlert}

View File

@ -1,24 +1,2 @@
export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/'; export const api_endpoint: string = 'http://api.vdk2ch.ru:5000/';
//export const api_endpoint: string = 'http://localhost:7141/'; //export const api_endpoint: string = 'http://localhost:7141/';
const ALERT_SHOW_TIME = 5000;
const showAlert = (message:string, color:string) => {
const alertContainer = document.createElement('div');
alertContainer.style.zIndex = '100';
alertContainer.style.position = 'fixed';
alertContainer.style.left = '50';
alertContainer.style.top = '0';
alertContainer.style.right = '0';
alertContainer.style.padding = '30px 3px';
alertContainer.style.fontSize = '20px';
alertContainer.style.textAlign = 'right';
alertContainer.style.backgroundColor = color;
alertContainer.style.border = "2px dashed #6CFFDD"
alertContainer.textContent = message;
document.body.append(alertContainer);
setTimeout(() => {
alertContainer.remove();
}, ALERT_SHOW_TIME);
}
export {showAlert}

View File

@ -1,7 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { showAlert } from 'src/app/const/alert';
import {SinglePost} from "../../models/post"; import {SinglePost} from "../../models/post";
import {ApiChatService} from "../../services/api-chat.service"; import {ApiChatService} from "../../services/api-chat.service";
@Component({ @Component({
selector: 'app-BoardThreads', selector: 'app-BoardThreads',
templateUrl: './threads.component.html', templateUrl: './threads.component.html',
@ -27,6 +29,7 @@ export class ThreadsComponent implements OnInit {
alert(tosend: any){ alert(tosend: any){
console.log("Получен эмит создания треда " + tosend.text); console.log("Получен эмит создания треда " + tosend.text);
console.log("С картинками: " + tosend.images) console.log("С картинками: " + tosend.images)
showAlert("Cкоро можно будет создавать треды" , "#ff0a36");
} }
ngOnInit(): void { ngOnInit(): void {
@ -35,3 +38,5 @@ export class ThreadsComponent implements OnInit {
}) })
} }
} }

View File

@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
import { ApiChatService } from '../../services/api-chat.service'; import { ApiChatService } from '../../services/api-chat.service';
import { SinglePost } from '../../models/post' import { SinglePost } from '../../models/post'
import * as vars from "../../const/api" import * as vars from "../../const/api"
import { showAlert } from 'src/app/const/alert';
import {ActivatedRoute} from "@angular/router"; import {ActivatedRoute} from "@angular/router";
@Component({ @Component({
@ -29,14 +30,16 @@ export class BoardsComponent implements OnInit {
}) })
} }
sendPost(tosend: any){ sendPost(toSend: any){
console.log(`Получен эмит создания поста с текстом ${tosend.text}`); console.log(`Получен эмит создания поста с текстом ${toSend.text}`);
console.log("С картинками: " + tosend.images) console.log("С картинками: " + toSend.images)
console.log("В тред " + this.threadId) console.log("В тред " + this.threadId)
this.apiChatService.sendPostToApi(tosend.text, tosend.images, this.threadId).subscribe( response => {
this.apiChatService.sendPostToApi(toSend.text, toSend.images, this.threadId).subscribe( response => {
response = response.toString(); response = response.toString();
vars.showAlert(response.toString(), "#ff0a36"); showAlert(response.toString(), "#ff0a36");
this.getThreadPosts(); this.getThreadPosts();
}); });
} }

View File

@ -1,4 +1,5 @@
import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core'; import { Component, Output, EventEmitter, Input, OnInit } from '@angular/core';
import { showAlert } from 'src/app/const/alert';
import { ApiChatService } from 'src/app/services/api-chat.service'; import { ApiChatService } from 'src/app/services/api-chat.service';
import * as vars from "../../const/api" import * as vars from "../../const/api"
@ -11,7 +12,7 @@ export class SendFormComponent implements OnInit {
@Input() board: string; @Input() board: string;
showForm:boolean = false; showForm:boolean = false;
inputText: string; // inputText: string;
inputImages: string[] = []; inputImages: string[] = [];
@Output() sendInfoToCreate = new EventEmitter(); @Output() sendInfoToCreate = new EventEmitter();
@ -36,7 +37,7 @@ export class SendFormComponent implements OnInit {
response => { response => {
response = response.value.toString(); response = response.value.toString();
this.inputImages.push(response); this.inputImages.push(response);
vars.showAlert(`Картинка ${response} добавлена`, "#ff0a36") showAlert(`Картинка ${response} добавлена`, "#ff0a36")
}); });
} }