removal of obsolete components

This commit is contained in:
Nicolas Constant 2019-03-05 23:08:14 -05:00
parent 7c3e3f42ff
commit 84988b1fcd
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
8 changed files with 3 additions and 253 deletions

View File

@ -36,7 +36,6 @@ import { AddNewStatusComponent } from "./components/floating-column/add-new-stat
import { ManageAccountComponent } from "./components/floating-column/manage-account/manage-account.component";
import { ActionBarComponent } from './components/stream/status/action-bar/action-bar.component';
import { WaitingAnimationComponent } from './components/waiting-animation/waiting-animation.component';
import { ReplyToStatusComponent } from './components/stream/status/reply-to-status/reply-to-status.component';
import { UserProfileComponent } from './components/stream/user-profile/user-profile.component';
import { ThreadComponent } from './components/stream/thread/thread.component';
import { HashtagComponent } from './components/stream/hashtag/hashtag.component';
@ -77,7 +76,6 @@ const routes: Routes = [
SearchComponent,
ActionBarComponent,
WaitingAnimationComponent,
ReplyToStatusComponent,
UserProfileComponent,
ThreadComponent,
HashtagComponent,

View File

@ -1,15 +1,5 @@
<div class="panel">
<h3 class="panel__title">new message</h3>
<!-- <form (ngSubmit)="onSubmit()">
<input [(ngModel)]="title" type="text" class="form-control form-control-sm" name="title" autocomplete="off" placeholder="Title (optional)" />
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm" style="min-width: 100%" rows="5" required placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"></textarea>
<select class="form-control form-control-sm form-control--privacy" id="privacy" name="privacy" [(ngModel)]="selectedPrivacy">
<option *ngFor="let p of privacyList" [ngValue]="p">{{p}}</option>
</select>
<button type="submit" class="btn btn-sm btn-custom-primary">POST!</button>
</form> -->
<app-create-status (onClose)="closeColumn()"></app-create-status>
</div>

View File

@ -1,11 +1,5 @@
import { Component, OnInit, Input, ElementRef, ViewChild } from '@angular/core';
import { Store } from '@ngxs/store';
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { AccountInfo } from '../../../states/accounts.state';
import { MastodonService, VisibilityEnum } from '../../../services/mastodon.service';
import { Status } from '../../../services/models/mastodon.interfaces';
import { NotificationService } from '../../../services/notification.service';
import { NavigationService } from '../../../services/navigation.service';
@Component({
@ -14,76 +8,13 @@ import { NavigationService } from '../../../services/navigation.service';
styleUrls: ['./add-new-status.component.scss']
})
export class AddNewStatusComponent implements OnInit {
// @Input() title: string;
// @Input() status: string;
// @ViewChild('reply') replyElement: ElementRef;
// selectedPrivacy = 'Public';
// privacyList: string[] = ['Public', 'Unlisted', 'Follows-only', 'DM'];
constructor(
private readonly store: Store,
private readonly notificationService: NotificationService,
private readonly navigationService: NavigationService,
private readonly mastodonService: MastodonService) { }
private readonly navigationService: NavigationService) { }
ngOnInit() {
// setTimeout(() => {
// this.replyElement.nativeElement.focus();
// }, 0);
ngOnInit() {
}
closeColumn() {
this.navigationService.closePanel();
}
// onSubmit(): boolean {
// const accounts = this.getRegisteredAccounts();
// const selectedAccounts = accounts.filter(x => x.isSelected);
// let visibility: VisibilityEnum = VisibilityEnum.Unknown;
// switch (this.selectedPrivacy) {
// case 'Public':
// visibility = VisibilityEnum.Public;
// break;
// case 'Unlisted':
// visibility = VisibilityEnum.Unlisted;
// break;
// case 'Follows-only':
// visibility = VisibilityEnum.Private;
// break;
// case 'DM':
// visibility = VisibilityEnum.Direct;
// break;
// }
// let spoiler = this.title;
// if(spoiler === '') {
// spoiler = null;
// }
// for (const acc of selectedAccounts) {
// this.mastodonService.postNewStatus(acc, this.status, visibility, spoiler)
// .then((res: Status) => {
// this.title = '';
// this.status = '';
// this.navigationService.closePanel();
// })
// .catch((err: HttpErrorResponse) => {
// this.notificationService.notifyHttpError(err);
// });
// }
// return false;
// }
// private getRegisteredAccounts(): AccountInfo[] {
// var regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
// return regAccounts;
// }
// onCtrlEnter(): boolean {
// this.onSubmit();
// return false;
// }
}

View File

@ -1,8 +0,0 @@
<form (ngSubmit)="onSubmit()">
<textarea #reply [(ngModel)]="status" name="status" class="form-control form-control-sm" rows="5" required placeholder="What's in your mind?" (keydown.control.enter)="onCtrlEnter()"></textarea>
<select class="form-control form-control-sm form-control--privacy" id="privacy" name="privacy" [(ngModel)]="selectedPrivacy">
<option *ngFor="let p of privacyList" [ngValue]="p">{{p}}</option>
</select>
<button type="submit" class="btn btn-sm btn-custom-primary">REPLY!</button>
</form>

View File

@ -1,36 +0,0 @@
@import "variables";
@import "panel";
@import "buttons";
$btn-send-status-width: 60px;
.form-control {
margin: 0 0 5px 5px;
width: calc(100% - 10px);
background-color: $column-color;
border-color: $status-secondary-color;
color: #fff;
font-size: $default-font-size;
&:focus {
box-shadow: none;
}
&--privacy {
display: inline-block;
width: calc(100% - 15px - #{$btn-send-status-width});
}
}
.btn-custom-primary {
display: inline-block;
width: $btn-send-status-width;
position: relative;
top: -1px;
left: 5px; // background-color: orange;
// border-color: orange;
// color: black;
font-weight: 500; // &:hover {
// }
// &:focus {
// border-color: darkblue;
// }
}

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ReplyToStatusComponent } from './reply-to-status.component';
xdescribe('ReplyToStatusComponent', () => {
let component: ReplyToStatusComponent;
let fixture: ComponentFixture<ReplyToStatusComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReplyToStatusComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ReplyToStatusComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,97 +0,0 @@
import { Component, OnInit, Input, Output, EventEmitter, ElementRef, ViewChild } from '@angular/core';
import { HttpErrorResponse } from '@angular/common/http';
import { MastodonService, VisibilityEnum } from '../../../../services/mastodon.service';
import { Status } from '../../../../services/models/mastodon.interfaces';
import { ToolsService } from '../../../../services/tools.service';
import { NotificationService } from '../../../../services/notification.service';
import { StatusWrapper } from '../../../../models/common.model';
@Component({
selector: 'app-reply-to-status',
templateUrl: './reply-to-status.component.html',
styleUrls: ['./reply-to-status.component.scss']
})
export class ReplyToStatusComponent implements OnInit {
@Input() status: string = '';
@Input() statusReplyingToWrapper: StatusWrapper;
@Output() onClose = new EventEmitter();
@ViewChild('reply') replyElement: ElementRef;
private statusReplyingTo: Status;
selectedPrivacy = 'Public';
privacyList: string[] = ['Public', 'Unlisted', 'Follows-only', 'DM'];
constructor(
// private readonly store: Store,
private readonly notificationService: NotificationService,
private readonly toolsService: ToolsService,
private readonly mastodonService: MastodonService) { }
ngOnInit() {
if (this.statusReplyingToWrapper.status.reblog) {
this.statusReplyingTo = this.statusReplyingToWrapper.status.reblog;
} else {
this.statusReplyingTo = this.statusReplyingToWrapper.status;
}
this.status += `@${this.statusReplyingTo.account.acct} `;
for (const mention of this.statusReplyingTo.mentions) {
this.status += `@${mention.acct} `;
}
setTimeout(() => {
this.replyElement.nativeElement.focus();
}, 0);
}
onSubmit(): boolean {
let visibility: VisibilityEnum = VisibilityEnum.Unknown;
switch (this.selectedPrivacy) {
case 'Public':
visibility = VisibilityEnum.Public;
break;
case 'Unlisted':
visibility = VisibilityEnum.Unlisted;
break;
case 'Follows-only':
visibility = VisibilityEnum.Private;
break;
case 'DM':
visibility = VisibilityEnum.Direct;
break;
}
let spoiler = this.statusReplyingTo.spoiler_text;
const selectedAccounts = this.toolsService.getSelectedAccounts();
for (const acc of selectedAccounts) {
const usableStatus = this.toolsService.getStatusUsableByAccount(acc, this.statusReplyingToWrapper);
usableStatus
.then((status: Status) => {
return this.mastodonService.postNewStatus(acc, this.status, visibility, spoiler, status.id);
})
.then((res: Status) => {
this.status = '';
this.onClose.emit();
})
.catch((err: HttpErrorResponse) => {
this.notificationService.notifyHttpError(err);
});
}
return false;
}
// private getRegisteredAccounts(): AccountInfo[] {
// var regAccounts = <AccountInfo[]>this.store.snapshot().registeredaccounts.accounts;
// return regAccounts;
// }
onCtrlEnter(): boolean {
this.onSubmit();
return false;
}
}

View File

@ -50,8 +50,5 @@
<app-action-bar #appActionBar [statusWrapper]="statusWrapper" (cwIsActiveEvent)="changeCw($event)"
(replyEvent)="openReply()"></app-action-bar>
<!-- <app-reply-to-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="statusWrapper" (onClose)="closeReply()">
</app-reply-to-status> -->
<app-create-status *ngIf="replyingToStatus" [statusReplyingToWrapper]="statusWrapper" (onClose)="closeReply()"></app-create-status>
</div>