chore: import clean-up

This commit is contained in:
2023-01-05 18:37:33 +01:00
parent 6f8de844d1
commit 05f4b0d706
22 changed files with 51 additions and 109 deletions

View File

@@ -1,4 +1,3 @@
export * from './account';
export * from './list';
export * from './registered_app';
export * from './user_account';

View File

@@ -1,3 +0,0 @@
export interface UserAccount {
id: string;
}

View File

@@ -3,7 +3,6 @@ import {MastodonApiService} from "./mastodon-api.service";
import {map, Observable} from "rxjs";
import {GetAccountResponse} from "../interfaces/responses/get_account_response";
import {Account} from "../interfaces/public/account";
import {HttpResponse} from "@angular/common/http";
@Injectable({
providedIn: 'root'

View File

@@ -1,5 +1,5 @@
import {Injectable} from '@angular/core';
import {catchError, map, Observable, of, throwError} from "rxjs";
import {catchError, map, Observable, throwError} from "rxjs";
import {RegisterAppResponse} from "../interfaces/responses/register_app_response";
import {GetAccessTokenResponse} from "../interfaces/responses/get_access_token_response";
import {VerifyCredentialsResponse} from "../interfaces/responses/verify_credentials_response";

View File

@@ -1,6 +1,5 @@
import {Injectable} from '@angular/core';
import {concatMap, from, map, mergeAll, mergeMap, Observable, reduce, switchMap, tap, toArray} from "rxjs";
import {VerifyCredentialsResponse} from "../interfaces/responses/verify_credentials_response";
import {map, Observable} from "rxjs";
import {MastodonApiService} from "./mastodon-api.service";
import {GetListsResponse} from "../interfaces/responses/get_lists_response";
import {GetAccountResponse} from "../interfaces/responses/get_account_response";

View File

@@ -4,3 +4,4 @@
export * from './lib/services/services';
export * from './lib/interfaces/interfaces';
export * from './lib/mastodon-api.module';

View File

@@ -1,35 +1,35 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
import {TestBed} from '@angular/core/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {AppComponent} from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'mastolists'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('mastolists');
});
it(`should have as title 'mastolists'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.appName).toEqual('mastolists');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('mastolists app is running!');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('mastolists app is running!');
});
});

View File

@@ -4,7 +4,6 @@ import {fromApplication, fromAuthorize, selectIsLoggedIn} from "./shared/state/s
import {environment} from "../environments/environment";
// @ts-ignore
import packageJson from '../../../../package.json';
import {tap} from "rxjs";
@Component({
selector: 'app-root',

View File

@@ -3,17 +3,8 @@ import {BrowserModule} from '@angular/platform-browser';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {MastodonApiModule} from "../../../mastodon-api/src/lib/mastodon-api.module";
import {
NbActionsModule,
NbContextMenuModule,
NbDialogModule,
NbGlobalPhysicalPosition,
NbLayoutModule,
NbMenuModule,
NbThemeModule,
NbToastrModule
} from "@nebular/theme";
import {MastodonApiModule} from "projects/mastodon-api/src/public-api";
import {NbActionsModule, NbContextMenuModule, NbDialogModule, NbGlobalPhysicalPosition, NbLayoutModule, NbMenuModule, NbThemeModule, NbToastrModule} from "@nebular/theme";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {SharedModule} from './shared/shared.module';
import {NbEvaIconsModule} from "@nebular/eva-icons";

View File

@@ -1,15 +1,16 @@
import {Component, OnDestroy, OnInit} from '@angular/core';
import {FormControl, FormGroup, Validators} from "@angular/forms";
import {ActivatedRoute, Params} from "@angular/router";
import {concat, filter, map, merge, Observable, take, tap, withLatestFrom, zip, zipWith} from "rxjs";
import {ActivatedRoute} from "@angular/router";
import {filter, map, Observable, take, tap, zip} from "rxjs";
import {select, Store} from "@ngrx/store";
import {
selectAuthorizingUserFlag,
selectCurrentInstance,
fromAuthorize,
selectApplicationRegisteredFlag,
selectAuthorizingUserFlag,
selectCurrentInstanceWithApplicationRegisteredState,
selectDataForAuthorizationFlow,
selectIsLoggedIn,
selectRegisteringApplicationFlag,
selectDataForAuthorizationFlow, selectApplicationRegisteredFlag, selectCurrentInstanceWithApplicationRegisteredState
selectRegisteringApplicationFlag
} from "../../shared/state/store";
@Component({
@@ -52,7 +53,7 @@ export class AuthorizeComponent implements OnInit, OnDestroy {
.pipe(
filter(([params, instanceName, isLoggedIn]) => params['code'] && instanceName !== undefined && !isLoggedIn),
take(1),
).subscribe(([params, instanceName, isLoggedIn]) => {
).subscribe(([params]) => {
this.store.pipe(
select(selectDataForAuthorizationFlow),
take(1),

View File

@@ -3,14 +3,11 @@ import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from "
import {Observable, tap} from "rxjs";
import {select, Store} from "@ngrx/store";
import {selectIsLoggedIn} from "../../shared/state/store";
import {MastodonApiAuthenticationService} from 'projects/mastodon-api/src/public-api';
@Injectable({providedIn: 'root'})
export class AuthGuard implements CanActivate {
constructor(private store: Store,
private router: Router,
private mastodonApiAuthService: MastodonApiAuthenticationService) {
constructor(private store: Store, private router: Router) {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {

View File

@@ -2,7 +2,7 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {SharedModule} from "../shared/shared.module";
import {FollowingsRoutingModule} from "./followings-list-routing.module";
import {NbBadgeModule, NbCheckboxModule, NbIconModule, NbListModule, NbPopoverModule, NbToggleModule, NbUserModule} from "@nebular/theme";
import {NbBadgeModule, NbCheckboxModule, NbListModule, NbPopoverModule, NbToggleModule, NbUserModule} from "@nebular/theme";
import {ListComponent} from "./list/list.component";
import {TableComponent} from "./table/table.component";
import {MatrixComponent} from "./matrix/matrix.component";

View File

@@ -42,8 +42,3 @@ table {
line-height: 5px;
}
}
nb-card.more-info-panel {
min-width: 450px;
max-width: 800px;
}

View File

@@ -1,10 +1,8 @@
import {Component} from '@angular/core';
import {map, Observable} from "rxjs";
import {Account} from "../../../../../mastodon-api/src/lib/interfaces/public/account";
import {List} from "../../../../../mastodon-api/src/lib/interfaces/public/list";
import {select, Store} from "@ngrx/store";
import {selectFilteredFollowingsWithLists, selectLists} from "../../shared/state/store/selectors";
import {fromTableViewPage} from "../../shared/state/store";
import {fromTableViewPage, selectFilteredFollowingsWithLists, selectLists} from "../../shared/state/store";
import {Account, List} from 'projects/mastodon-api/src/public-api';
interface DataGridRow {
id: string;

View File

@@ -2,9 +2,8 @@ import {Component} from '@angular/core';
import {List} from 'projects/mastodon-api/src/public-api';
import {Observable} from "rxjs";
import {select, Store} from "@ngrx/store";
import {selectCurrentInstance, selectLists} from "../../shared/state/store/selectors";
import {fromListsPage, selectCurrentInstance, selectLists} from "../../shared/state/store";
import {FormControl, FormGroup} from "@angular/forms";
import {fromListsPage} from '../../shared/state/store';
@Component({
selector: 'app-lists',

View File

@@ -2,10 +2,6 @@
width: 100%;
}
td.field-label {
min-width: 180px;
}
.table {
display: flex;
flex-direction: column;

View File

@@ -23,14 +23,6 @@
}
.buttons {
padding-top: 20px;
button {
margin-right: 10px;
}
}
@media (max-width: 573px) {
.form {
flex-direction: column;

View File

@@ -1,5 +1,5 @@
import {Injectable, OnDestroy} from '@angular/core';
import {EMPTY, expand, map, Observable, reduce, Subscription, switchMap, tap} from "rxjs";
import {EMPTY, expand, map, Observable, reduce, Subscription} from "rxjs";
import {select, Store} from "@ngrx/store";
import {Account, MastodonApiAccountsService} from 'projects/mastodon-api/src/public-api';
import {selectDataForAuthorizedRequest} from "../state/store";

View File

@@ -1,5 +1,5 @@
import {Injectable, OnDestroy} from '@angular/core';
import {EMPTY, expand, filter, map, Observable, of, reduce, Subscription, switchMap, tap} from "rxjs";
import {EMPTY, expand, map, Observable, reduce, Subscription} from "rxjs";
import {select, Store} from "@ngrx/store";
import {List, MastodonApiListsService} from 'projects/mastodon-api/src/public-api';
import {selectDataForAuthorizedRequest} from "../state/store";

View File

@@ -1,5 +1,4 @@
import {List} from "../../../../../../mastodon-api/src/lib/interfaces/public/list";
import {Account} from "../../../../../../mastodon-api/src/lib/interfaces/public/account";
import {Account, List} from "projects/mastodon-api/src/public-api";
export interface Filters {
username: string;

View File

@@ -1,7 +1,7 @@
import {Injectable} from "@angular/core";
import {Actions, createEffect, ofType} from "@ngrx/effects";
import {fromAuthorize} from "../actions";
import {catchError, exhaustMap, map, of, switchMap, tap, throwError} from "rxjs";
import {catchError, exhaustMap, map, of, switchMap} from "rxjs";
import {NbToastrService} from "@nebular/theme";
import {MastodonApiAuthenticationService, RegisteredApp} from "projects/mastodon-api/src/public-api";
import {Store} from "@ngrx/store";

View File

@@ -91,23 +91,3 @@ export const selectLoading = createSelector(
applicationStateFeature,
(state: ApplicationState) => state.listsLoading || state.listAccountsLoading || state.followingsLoading
);
export const selectLoadingPercentage = createSelector(
applicationStateFeature,
(state: ApplicationState) => {
if (!state.listsLoading && !state.listAccountsLoading && !state.followingsLoading) {
return 100;
}
if (state.listsLoading && !state.listAccountsLoading && !state.followingsLoading) {
return 50;
}
if (!state.listsLoading && state.listAccountsLoading && !state.followingsLoading) {
return 80;
}
if (!state.listsLoading && !state.listAccountsLoading && state.followingsLoading) {
return 50;
}
return 0;
},
);