This commit is contained in:
parent
4f38fb65c8
commit
d702e01f16
@ -1,28 +0,0 @@
|
|||||||
<div class="wrappe">
|
|
||||||
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
|
||||||
<app-send-post></app-send-post>,
|
|
||||||
<h2>Вы находитесь на доске {{boardName}} </h2>
|
|
||||||
<h3> в треде номер {{displayed_thread_number}}</h3>
|
|
||||||
<a (click)="showGuide = !showGuide" style=" font-size: small; color: chocolate; width: 500px;"> Что это и как это работает?</a>
|
|
||||||
<br>
|
|
||||||
<div *ngIf="showGuide">
|
|
||||||
Добро пожаловать на эту небольшую борду. Сейчас тут только три треда и одна доска, но скоро будет больше.
|
|
||||||
Чтобы выбрать тред воспользуйтесь полем ниже, после выбора нажмите кнопку "Обновить" дабы перейти в этот тред.
|
|
||||||
Вы можете отправлять сообщения в открытый тред и прикреплять к сообщению картинки.
|
|
||||||
Ведите себя хорошо.
|
|
||||||
</div>
|
|
||||||
<input type="number" [(ngModel)]=displayed_thread_number>
|
|
||||||
<br>
|
|
||||||
<button (click)="refreshPosts(boardName , displayed_thread_number)">Обновить</button>
|
|
||||||
<post-single
|
|
||||||
*ngFor="let post of postsToShow" [post]="post"
|
|
||||||
></post-single>
|
|
||||||
<button (click)="refreshPosts(boardName , displayed_thread_number)">Обновить</button>
|
|
||||||
<br>
|
|
||||||
<div class="hexagon">
|
|
||||||
<div class="hexagon-inside">
|
|
||||||
<div class="hexagon-image">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,48 +0,0 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
|
||||||
import { SinglePost } from '../models/post'
|
|
||||||
import * as vars from '../var/api'
|
|
||||||
import {ActivatedRoute} from "@angular/router";
|
|
||||||
import {setDisplayedThread} from "../var/api";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-SingleThread',
|
|
||||||
templateUrl: `./boards.component.html`,
|
|
||||||
styleUrls: [`./boards.component.css`]
|
|
||||||
})
|
|
||||||
export class BoardsComponent implements OnInit {
|
|
||||||
command: string = "";
|
|
||||||
response: any;
|
|
||||||
postsToShow: SinglePost[] = []
|
|
||||||
boardName:string = 'b';
|
|
||||||
displayed_thread_number = vars.displayed_thread;
|
|
||||||
showGuide: boolean = false;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public apiChatService: ApiChatService,
|
|
||||||
private activatedRoute:ActivatedRoute
|
|
||||||
){
|
|
||||||
|
|
||||||
}
|
|
||||||
refreshPosts(boardName: string , threadId:number) {
|
|
||||||
this.apiChatService.getPosts(boardName, threadId).subscribe(response => {
|
|
||||||
this.postsToShow = response
|
|
||||||
vars.setDisplayedThread(this.displayed_thread_number);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
var threadId = this.activatedRoute.snapshot.queryParamMap.get('thread');
|
|
||||||
if(threadId != null)
|
|
||||||
{
|
|
||||||
this.displayed_thread_number = parseInt(threadId);
|
|
||||||
vars.setDisplayedThread(this.displayed_thread_number);
|
|
||||||
}
|
|
||||||
this.apiChatService.getPosts('postgres', this.displayed_thread_number).subscribe(response => {
|
|
||||||
this.postsToShow = response
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -5,16 +5,16 @@ import { HttpClientModule } from '@angular/common/http';
|
|||||||
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { HomeComponent } from './home/home.component';
|
import { HomeComponent } from './pages/home/home.component';
|
||||||
import { AboutComponent } from './about/about.component';
|
import { AboutComponent } from './pages/about/about.component';
|
||||||
import { BoardsComponent } from './SingleThread/boards.component';
|
import { BoardsComponent } from './pages/SingleThread/boards.component';
|
||||||
import { NotFoundComponent } from './not-found/not-found.component';
|
import { NotFoundComponent } from './pages/not-found/not-found.component';
|
||||||
import { ApiChatService } from './services/api-chat.service';
|
import { ApiChatService } from './services/api-chat.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { SendPostComponent } from './send-post/send-post.component';
|
import { SendPostComponent } from './pages/send-post/send-post.component';
|
||||||
import { PostComponent } from './SingleThread/post/post.component'
|
import { PostComponent } from './pages/SingleThread/post/post.component'
|
||||||
import { ThreadsComponent } from './BoardThreads/threads.component';
|
import { ThreadsComponent } from './pages/BoardThreads/threads.component';
|
||||||
import { OPComponent } from './BoardThreads/op/op.component';
|
import { OPComponent } from './pages/BoardThreads/op/op.component';
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: '', component: HomeComponent },
|
{ path: '', component: HomeComponent },
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
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/';
|
||||||
export var displayed_thread: number;
|
|
||||||
export function setDisplayedThread(toset:number){
|
|
||||||
displayed_thread = toset;
|
|
||||||
};
|
|
||||||
|
|
||||||
const ALERT_SHOW_TIME = 5000;
|
const ALERT_SHOW_TIME = 5000;
|
||||||
const showAlert = (message:string, color:string) => {
|
const showAlert = (message:string, color:string) => {
|
@ -1,5 +1,5 @@
|
|||||||
import {Component, Input, OnInit} from '@angular/core';
|
import {Component, Input, OnInit} from '@angular/core';
|
||||||
import { SinglePost } from '../../models/post';
|
import { SinglePost } from '../../../models/post';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'op-single',
|
selector: 'op-single',
|
@ -1,7 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import * as vars from "../var/api";
|
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',
|
||||||
@ -14,7 +13,6 @@ export class ThreadsComponent implements OnInit {
|
|||||||
command: string = "";
|
command: string = "";
|
||||||
response: any;
|
response: any;
|
||||||
opsToShow: SinglePost[] = []
|
opsToShow: SinglePost[] = []
|
||||||
displayed_thread_number = vars.displayed_thread;
|
|
||||||
showGuide: boolean = false;
|
showGuide: boolean = false;
|
||||||
|
|
||||||
constructor(public apiChatService: ApiChatService) {
|
constructor(public apiChatService: ApiChatService) {
|
||||||
@ -23,7 +21,6 @@ export class ThreadsComponent implements OnInit {
|
|||||||
refreshOPs(boardName: string) {
|
refreshOPs(boardName: string) {
|
||||||
this.apiChatService.getThreads(boardName).subscribe(response => {
|
this.apiChatService.getThreads(boardName).subscribe(response => {
|
||||||
this.opsToShow = response
|
this.opsToShow = response
|
||||||
vars.setDisplayedThread(this.displayed_thread_number);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
21
src/app/pages/SingleThread/boards.component.html
Normal file
21
src/app/pages/SingleThread/boards.component.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<div class="wrappe">
|
||||||
|
<img src="http://static.vdk2ch.ru:15555/test-public/16657431265390.png" alt="свiня" width="150">
|
||||||
|
<app-send-post></app-send-post>,
|
||||||
|
<h2>Вы находитесь на доске {{boardName}} </h2>
|
||||||
|
<h3> в треде номер {{threadId}}</h3>
|
||||||
|
<a (click)="showGuide = !showGuide" style=" font-size: small; color: chocolate; width: 500px;"> Что это и как это работает?</a>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<button (click)="refreshPosts(boardName , threadId)">Обновить</button>
|
||||||
|
<post-single
|
||||||
|
*ngFor="let post of postsToShow" [post]="post"
|
||||||
|
></post-single>
|
||||||
|
<button (click)="refreshPosts(boardName , threadId)">Обновить</button>
|
||||||
|
<br>
|
||||||
|
<div class="hexagon">
|
||||||
|
<div class="hexagon-inside">
|
||||||
|
<div class="hexagon-image">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
37
src/app/pages/SingleThread/boards.component.ts
Normal file
37
src/app/pages/SingleThread/boards.component.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { ApiChatService } from '../../services/api-chat.service';
|
||||||
|
import { SinglePost } from '../../models/post'
|
||||||
|
import {ActivatedRoute} from "@angular/router";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-SingleThread',
|
||||||
|
templateUrl: `./boards.component.html`,
|
||||||
|
styleUrls: [`./boards.component.css`]
|
||||||
|
})
|
||||||
|
export class BoardsComponent implements OnInit {
|
||||||
|
command: string = "";
|
||||||
|
response: any;
|
||||||
|
postsToShow: SinglePost[] = []
|
||||||
|
boardName:string = 'b';
|
||||||
|
showGuide: boolean = false;
|
||||||
|
threadId: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
public apiChatService: ApiChatService,
|
||||||
|
private activatedRoute:ActivatedRoute
|
||||||
|
){
|
||||||
|
|
||||||
|
}
|
||||||
|
refreshPosts(boardName: string , threadId:number) {
|
||||||
|
this.apiChatService.getPosts(boardName, this.threadId).subscribe(response => {
|
||||||
|
this.postsToShow = response
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.threadId = parseInt(<string>this.activatedRoute.snapshot.queryParamMap.get('thread'));
|
||||||
|
this.apiChatService.getPosts('postgres', this.threadId).subscribe(response => {
|
||||||
|
this.postsToShow = response
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { SinglePost } from '../../models/post';
|
import { SinglePost } from '../../../models/post';
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
// двач лучший двач
|
// двач лучший двач
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
import { ApiChatService } from '../../services/api-chat.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-about',
|
selector: 'app-about',
|
@ -1,7 +1,8 @@
|
|||||||
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
import { Component, OnInit, } from '@angular/core';
|
||||||
import { ApiChatService } from '../services/api-chat.service';
|
import { ApiChatService } from '../../services/api-chat.service';
|
||||||
import {BoardsComponent} from "../SingleThread/boards.component";
|
import { BoardsComponent } from "../SingleThread/boards.component";
|
||||||
import * as vars from "../var/api";
|
import * as vars from "../../const/api";
|
||||||
|
import {ActivatedRoute} from "@angular/router";
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -14,10 +15,12 @@ export class SendPostComponent implements OnInit {
|
|||||||
progress: number;
|
progress: number;
|
||||||
message: string = '';
|
message: string = '';
|
||||||
filename: string[] = [];
|
filename: string[] = [];
|
||||||
|
threadId: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public apiChatService: ApiChatService,
|
public apiChatService: ApiChatService,
|
||||||
private boards: BoardsComponent
|
private boards: BoardsComponent,
|
||||||
|
private activatedRoute:ActivatedRoute
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,8 +28,8 @@ export class SendPostComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
sendPost(text: string) {
|
sendPost(text: string) {
|
||||||
var threadId = vars.displayed_thread;
|
this.threadId = parseInt(<string>this.activatedRoute.snapshot.queryParamMap.get('thread'));
|
||||||
this.apiChatService.sendPostToApi(text, this.filename, threadId).subscribe( response => {
|
this.apiChatService.sendPostToApi(text, this.filename, this.threadId).subscribe( response => {
|
||||||
response = response.toString();
|
response = response.toString();
|
||||||
vars.showAlert(response.toString(), "#ff0a36");
|
vars.showAlert(response.toString(), "#ff0a36");
|
||||||
this.refreshDisplayedThread();
|
this.refreshDisplayedThread();
|
||||||
@ -46,7 +49,7 @@ export class SendPostComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshDisplayedThread(){
|
refreshDisplayedThread(){
|
||||||
this.boards.refreshPosts("b", vars.displayed_thread)
|
this.boards.refreshPosts("b", this.threadId)
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { SinglePost } from '../models/post';
|
import { SinglePost } from '../models/post';
|
||||||
import * as globals from '../var/api';
|
import * as globals from '../const/api';
|
||||||
|
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
Reference in New Issue
Block a user