From 97b34cd70245cc897711919cdced1b9c64956092 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 16 Sep 2021 23:36:51 +0200 Subject: [PATCH] wip --- frontend/{src => }/assets/favicon.png | Bin frontend/{src => }/assets/logo.svg | 0 frontend/{src => }/assets/meta-preview.png | Bin .../{src => }/assets/screenshots/colors.png | Bin .../{src => }/assets/screenshots/fonts.png | Bin .../{src => }/assets/screenshots/history.png | Bin .../{src => }/assets/screenshots/hotkeys.png | Bin .../{src => }/assets/screenshots/paste.png | Bin .../{src => }/assets/screenshots/ports.png | Bin .../{src => }/assets/screenshots/profiles.png | Bin .../{src => }/assets/screenshots/progress.png | Bin .../{src => }/assets/screenshots/quake.png | Bin .../{src => }/assets/screenshots/serial.png | Bin .../{src => }/assets/screenshots/split.png | Bin frontend/{src => }/assets/screenshots/ssh.png | Bin .../{src => }/assets/screenshots/ssh2.png | Bin .../{src => }/assets/screenshots/tabs.png | Bin frontend/{src => }/assets/screenshots/win.png | Bin .../{src => }/assets/screenshots/window.png | Bin .../{src => }/assets/screenshots/zmodem.png | Bin frontend/src/app.component.ts | 7 +++ frontend/src/app.module.ts | 37 +++----------- frontend/src/app.server.module.ts | 6 +-- .../components/configModal.component.pug | 0 .../components/configModal.component.ts | 4 +- .../components/connectionList.component.pug | 0 .../components/connectionList.component.ts | 0 .../{ => app}/components/main.component.pug | 0 .../{ => app}/components/main.component.scss | 2 +- .../{ => app}/components/main.component.ts | 7 ++- .../components/settingsModal.component.pug | 0 .../components/settingsModal.component.ts | 7 +-- .../components/upgradeModal.component.pug | 0 .../components/upgradeModal.component.ts | 5 +- frontend/src/app/index.ts | 46 ++++++++++++++++++ .../services/appConnector.service.ts | 5 +- frontend/src/common/index.ts | 24 +++++++++ frontend/src/{ => common}/interceptor.ts | 4 +- .../{ => common}/services/common.service.ts | 0 .../{ => common}/services/config.service.ts | 2 +- .../{ => common}/services/login.service.ts | 2 +- frontend/src/components/app.component.pug | 1 - frontend/src/components/app.component.ts | 9 ---- .../components/demoTerminal.component.scss | 2 +- .../components/demoTerminal.component.ts | 4 +- .../homepage/components/home.component.scss | 2 +- .../src/homepage/components/home.component.ts | 4 +- .../components/homeFeatures.component.pug | 8 +-- .../components/homeFeatures.component.scss | 4 ++ .../components/homeFeatures.component.ts | 24 ++++----- .../components/homeIndex.component.scss | 2 +- .../components/homeIndex.component.ts | 10 ++-- frontend/src/homepage/index.ts | 8 ++- frontend/src/index.html | 2 +- .../components/login.component.pug | 0 .../components/login.component.scss | 0 .../{ => login}/components/login.component.ts | 3 +- frontend/src/login/index.ts | 37 ++++++++++++++ frontend/src/styles.scss | 2 +- frontend/{src => }/theme/index.scss | 0 frontend/{src => }/theme/vars.scss | 0 frontend/tsconfig.json | 2 +- frontend/webpack.config.base.js | 2 + 63 files changed, 179 insertions(+), 105 deletions(-) rename frontend/{src => }/assets/favicon.png (100%) rename frontend/{src => }/assets/logo.svg (100%) rename frontend/{src => }/assets/meta-preview.png (100%) rename frontend/{src => }/assets/screenshots/colors.png (100%) rename frontend/{src => }/assets/screenshots/fonts.png (100%) rename frontend/{src => }/assets/screenshots/history.png (100%) rename frontend/{src => }/assets/screenshots/hotkeys.png (100%) rename frontend/{src => }/assets/screenshots/paste.png (100%) rename frontend/{src => }/assets/screenshots/ports.png (100%) rename frontend/{src => }/assets/screenshots/profiles.png (100%) rename frontend/{src => }/assets/screenshots/progress.png (100%) rename frontend/{src => }/assets/screenshots/quake.png (100%) rename frontend/{src => }/assets/screenshots/serial.png (100%) rename frontend/{src => }/assets/screenshots/split.png (100%) rename frontend/{src => }/assets/screenshots/ssh.png (100%) rename frontend/{src => }/assets/screenshots/ssh2.png (100%) rename frontend/{src => }/assets/screenshots/tabs.png (100%) rename frontend/{src => }/assets/screenshots/win.png (100%) rename frontend/{src => }/assets/screenshots/window.png (100%) rename frontend/{src => }/assets/screenshots/zmodem.png (100%) create mode 100644 frontend/src/app.component.ts rename frontend/src/{ => app}/components/configModal.component.pug (100%) rename frontend/src/{ => app}/components/configModal.component.ts (94%) rename frontend/src/{ => app}/components/connectionList.component.pug (100%) rename frontend/src/{ => app}/components/connectionList.component.ts (100%) rename frontend/src/{ => app}/components/main.component.pug (100%) rename frontend/src/{ => app}/components/main.component.scss (97%) rename frontend/src/{ => app}/components/main.component.ts (94%) rename frontend/src/{ => app}/components/settingsModal.component.pug (100%) rename frontend/src/{ => app}/components/settingsModal.component.ts (85%) rename frontend/src/{ => app}/components/upgradeModal.component.pug (100%) rename frontend/src/{ => app}/components/upgradeModal.component.ts (87%) create mode 100644 frontend/src/app/index.ts rename frontend/src/{ => app}/services/appConnector.service.ts (97%) create mode 100644 frontend/src/common/index.ts rename frontend/src/{ => common}/interceptor.ts (95%) rename frontend/src/{ => common}/services/common.service.ts (100%) rename frontend/src/{ => common}/services/config.service.ts (98%) rename frontend/src/{ => common}/services/login.service.ts (95%) delete mode 100644 frontend/src/components/app.component.pug delete mode 100644 frontend/src/components/app.component.ts rename frontend/src/{ => login}/components/login.component.pug (100%) rename frontend/src/{ => login}/components/login.component.scss (100%) rename frontend/src/{ => login}/components/login.component.ts (89%) create mode 100644 frontend/src/login/index.ts rename frontend/{src => }/theme/index.scss (100%) rename frontend/{src => }/theme/vars.scss (100%) diff --git a/frontend/src/assets/favicon.png b/frontend/assets/favicon.png similarity index 100% rename from frontend/src/assets/favicon.png rename to frontend/assets/favicon.png diff --git a/frontend/src/assets/logo.svg b/frontend/assets/logo.svg similarity index 100% rename from frontend/src/assets/logo.svg rename to frontend/assets/logo.svg diff --git a/frontend/src/assets/meta-preview.png b/frontend/assets/meta-preview.png similarity index 100% rename from frontend/src/assets/meta-preview.png rename to frontend/assets/meta-preview.png diff --git a/frontend/src/assets/screenshots/colors.png b/frontend/assets/screenshots/colors.png similarity index 100% rename from frontend/src/assets/screenshots/colors.png rename to frontend/assets/screenshots/colors.png diff --git a/frontend/src/assets/screenshots/fonts.png b/frontend/assets/screenshots/fonts.png similarity index 100% rename from frontend/src/assets/screenshots/fonts.png rename to frontend/assets/screenshots/fonts.png diff --git a/frontend/src/assets/screenshots/history.png b/frontend/assets/screenshots/history.png similarity index 100% rename from frontend/src/assets/screenshots/history.png rename to frontend/assets/screenshots/history.png diff --git a/frontend/src/assets/screenshots/hotkeys.png b/frontend/assets/screenshots/hotkeys.png similarity index 100% rename from frontend/src/assets/screenshots/hotkeys.png rename to frontend/assets/screenshots/hotkeys.png diff --git a/frontend/src/assets/screenshots/paste.png b/frontend/assets/screenshots/paste.png similarity index 100% rename from frontend/src/assets/screenshots/paste.png rename to frontend/assets/screenshots/paste.png diff --git a/frontend/src/assets/screenshots/ports.png b/frontend/assets/screenshots/ports.png similarity index 100% rename from frontend/src/assets/screenshots/ports.png rename to frontend/assets/screenshots/ports.png diff --git a/frontend/src/assets/screenshots/profiles.png b/frontend/assets/screenshots/profiles.png similarity index 100% rename from frontend/src/assets/screenshots/profiles.png rename to frontend/assets/screenshots/profiles.png diff --git a/frontend/src/assets/screenshots/progress.png b/frontend/assets/screenshots/progress.png similarity index 100% rename from frontend/src/assets/screenshots/progress.png rename to frontend/assets/screenshots/progress.png diff --git a/frontend/src/assets/screenshots/quake.png b/frontend/assets/screenshots/quake.png similarity index 100% rename from frontend/src/assets/screenshots/quake.png rename to frontend/assets/screenshots/quake.png diff --git a/frontend/src/assets/screenshots/serial.png b/frontend/assets/screenshots/serial.png similarity index 100% rename from frontend/src/assets/screenshots/serial.png rename to frontend/assets/screenshots/serial.png diff --git a/frontend/src/assets/screenshots/split.png b/frontend/assets/screenshots/split.png similarity index 100% rename from frontend/src/assets/screenshots/split.png rename to frontend/assets/screenshots/split.png diff --git a/frontend/src/assets/screenshots/ssh.png b/frontend/assets/screenshots/ssh.png similarity index 100% rename from frontend/src/assets/screenshots/ssh.png rename to frontend/assets/screenshots/ssh.png diff --git a/frontend/src/assets/screenshots/ssh2.png b/frontend/assets/screenshots/ssh2.png similarity index 100% rename from frontend/src/assets/screenshots/ssh2.png rename to frontend/assets/screenshots/ssh2.png diff --git a/frontend/src/assets/screenshots/tabs.png b/frontend/assets/screenshots/tabs.png similarity index 100% rename from frontend/src/assets/screenshots/tabs.png rename to frontend/assets/screenshots/tabs.png diff --git a/frontend/src/assets/screenshots/win.png b/frontend/assets/screenshots/win.png similarity index 100% rename from frontend/src/assets/screenshots/win.png rename to frontend/assets/screenshots/win.png diff --git a/frontend/src/assets/screenshots/window.png b/frontend/assets/screenshots/window.png similarity index 100% rename from frontend/src/assets/screenshots/window.png rename to frontend/assets/screenshots/window.png diff --git a/frontend/src/assets/screenshots/zmodem.png b/frontend/assets/screenshots/zmodem.png similarity index 100% rename from frontend/src/assets/screenshots/zmodem.png rename to frontend/assets/screenshots/zmodem.png diff --git a/frontend/src/app.component.ts b/frontend/src/app.component.ts new file mode 100644 index 0000000..5b44570 --- /dev/null +++ b/frontend/src/app.component.ts @@ -0,0 +1,7 @@ +import { Component } from '@angular/core' + +@Component({ + selector: 'app', + template: '', +}) +export class AppComponent { } diff --git a/frontend/src/app.module.ts b/frontend/src/app.module.ts index 22d4e3a..305671d 100644 --- a/frontend/src/app.module.ts +++ b/frontend/src/app.module.ts @@ -5,20 +5,13 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations' import { CommonModule } from '@angular/common' import { FormsModule } from '@angular/forms' import { RouterModule } from '@angular/router' -import { HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http' import { ClipboardModule } from '@angular/cdk/clipboard' import { TransferHttpCacheModule } from '@nguniversal/common' import { FontAwesomeModule } from '@fortawesome/angular-fontawesome' +import { HttpClientModule } from '@angular/common/http' -import { BackendXsrfInterceptor, UniversalInterceptor } from './interceptor' -import { AppComponent } from './components/app.component' -import { MainComponent } from './components/main.component' -import { ConfigModalComponent } from './components/configModal.component' -import { SettingsModalComponent } from './components/settingsModal.component' -import { LoginComponent } from './components/login.component' -import { ConnectionListComponent } from './components/connectionList.component' -import { UpgradeModalComponent } from './components/upgradeModal.component' -import { InstanceInfoResolver } from './api' +import { AppComponent } from './app.component' +import { CommonAppModule } from 'src/common' import '@fortawesome/fontawesome-svg-core/styles.css' @@ -29,17 +22,11 @@ const ROUTES = [ }, { path: 'app', - component: MainComponent, - resolve: { - instanceInfo: InstanceInfoResolver, - }, + loadChildren: () => import(/* webpackChunkName: "app" */'./app').then(m => m.ApplicationModule), }, { path: 'login', - component: LoginComponent, - resolve: { - instanceInfo: InstanceInfoResolver, - }, + loadChildren: () => import(/* webpackChunkName: "login" */'./login').then(m => m.LoginModule), }, ] @@ -48,30 +35,20 @@ const ROUTES = [ BrowserModule.withServerTransition({ appId: 'tabby', }), + CommonAppModule.forRoot(), TransferHttpCacheModule, BrowserAnimationsModule, CommonModule, FormsModule, - HttpClientModule, - HttpClientXsrfModule, NgbDropdownModule, NgbModalModule, FontAwesomeModule, ClipboardModule, + HttpClientModule, RouterModule.forRoot(ROUTES), ], - providers: [ - { provide: HTTP_INTERCEPTORS, useClass: UniversalInterceptor, multi: true }, - { provide: HTTP_INTERCEPTORS, useClass: BackendXsrfInterceptor, multi: true }, - ], declarations: [ AppComponent, - MainComponent, - LoginComponent, - ConfigModalComponent, - SettingsModalComponent, - ConnectionListComponent, - UpgradeModalComponent, ], bootstrap: [AppComponent], }) diff --git a/frontend/src/app.server.module.ts b/frontend/src/app.server.module.ts index e597349..e72ace9 100644 --- a/frontend/src/app.server.module.ts +++ b/frontend/src/app.server.module.ts @@ -1,18 +1,14 @@ import { NgModule } from '@angular/core' import { ServerModule, ServerTransferStateModule } from '@angular/platform-server' import { AppModule } from './app.module' -import { AppComponent } from './components/app.component' +import { AppComponent } from './app.component' @NgModule({ imports: [ - // The AppServerModule should import your AppModule followed - // by the ServerModule from @angular/platform-server. AppModule, ServerModule, ServerTransferStateModule, ], - // Since the bootstrapped component is not inherited from your - // imported AppModule, it needs to be repeated here. bootstrap: [AppComponent], }) export class AppServerModule {} diff --git a/frontend/src/components/configModal.component.pug b/frontend/src/app/components/configModal.component.pug similarity index 100% rename from frontend/src/components/configModal.component.pug rename to frontend/src/app/components/configModal.component.pug diff --git a/frontend/src/components/configModal.component.ts b/frontend/src/app/components/configModal.component.ts similarity index 94% rename from frontend/src/components/configModal.component.ts rename to frontend/src/app/components/configModal.component.ts index 8573421..d430c23 100644 --- a/frontend/src/components/configModal.component.ts +++ b/frontend/src/app/components/configModal.component.ts @@ -1,9 +1,9 @@ import { Component } from '@angular/core' import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { AppConnectorService } from '../services/appConnector.service' -import { ConfigService } from '../services/config.service' +import { ConfigService } from 'src/common' import { faCopy, faFile, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons' -import { Config, Version } from '../api' +import { Config, Version } from 'src/api' @Component({ selector: 'config-modal', diff --git a/frontend/src/components/connectionList.component.pug b/frontend/src/app/components/connectionList.component.pug similarity index 100% rename from frontend/src/components/connectionList.component.pug rename to frontend/src/app/components/connectionList.component.pug diff --git a/frontend/src/components/connectionList.component.ts b/frontend/src/app/components/connectionList.component.ts similarity index 100% rename from frontend/src/components/connectionList.component.ts rename to frontend/src/app/components/connectionList.component.ts diff --git a/frontend/src/components/main.component.pug b/frontend/src/app/components/main.component.pug similarity index 100% rename from frontend/src/components/main.component.pug rename to frontend/src/app/components/main.component.pug diff --git a/frontend/src/components/main.component.scss b/frontend/src/app/components/main.component.scss similarity index 97% rename from frontend/src/components/main.component.scss rename to frontend/src/app/components/main.component.scss index 7a9b6f0..d991707 100644 --- a/frontend/src/components/main.component.scss +++ b/frontend/src/app/components/main.component.scss @@ -1,4 +1,4 @@ -@import "../theme/vars"; +@import "theme/vars"; :host { position: absolute; diff --git a/frontend/src/components/main.component.ts b/frontend/src/app/components/main.component.ts similarity index 94% rename from frontend/src/components/main.component.ts rename to frontend/src/app/components/main.component.ts index 98d1340..5dbea25 100644 --- a/frontend/src/components/main.component.ts +++ b/frontend/src/app/components/main.component.ts @@ -4,13 +4,12 @@ import { Title } from '@angular/platform-browser' import { AppConnectorService } from '../services/appConnector.service' import { faCog, faFile, faPlus, faSignOutAlt } from '@fortawesome/free-solid-svg-icons' -import { LoginService } from '../services/login.service' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { SettingsModalComponent } from './settingsModal.component' import { ConfigModalComponent } from './configModal.component' -import { ConfigService } from '../services/config.service' +import { ConfigService, LoginService } from 'src/common' import { combineLatest } from 'rxjs' -import { Config, Version } from '../api' +import { Config, Version } from 'src/api' import { Router } from '@angular/router' @Component({ @@ -19,7 +18,7 @@ import { Router } from '@angular/router' styleUrls: ['./main.component.scss'], }) export class MainComponent { - _logo = require('../assets/logo.svg') + _logo = require('assets/logo.svg') _settingsIcon = faCog _logoutIcon = faSignOutAlt _addIcon = faPlus diff --git a/frontend/src/components/settingsModal.component.pug b/frontend/src/app/components/settingsModal.component.pug similarity index 100% rename from frontend/src/components/settingsModal.component.pug rename to frontend/src/app/components/settingsModal.component.pug diff --git a/frontend/src/components/settingsModal.component.ts b/frontend/src/app/components/settingsModal.component.ts similarity index 85% rename from frontend/src/components/settingsModal.component.ts rename to frontend/src/app/components/settingsModal.component.ts index c8bd136..6522c96 100644 --- a/frontend/src/components/settingsModal.component.ts +++ b/frontend/src/app/components/settingsModal.component.ts @@ -1,17 +1,14 @@ import { Component } from '@angular/core' -import { LoginService } from '../services/login.service' - import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' -import { User } from '../api' +import { User } from 'src/api' +import { CommonService, LoginService } from 'src/common' import { AppConnectorService } from '../services/appConnector.service' -import { CommonService } from '../services/common.service' import { faGithub } from '@fortawesome/free-brands-svg-icons' import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons' @Component({ selector: 'settings-modal', templateUrl: './settingsModal.component.pug', - // styleUrls: ['./settingsModal.component.scss'], }) export class SettingsModalComponent { user: User diff --git a/frontend/src/components/upgradeModal.component.pug b/frontend/src/app/components/upgradeModal.component.pug similarity index 100% rename from frontend/src/components/upgradeModal.component.pug rename to frontend/src/app/components/upgradeModal.component.pug diff --git a/frontend/src/components/upgradeModal.component.ts b/frontend/src/app/components/upgradeModal.component.ts similarity index 87% rename from frontend/src/components/upgradeModal.component.ts rename to frontend/src/app/components/upgradeModal.component.ts index 9f7d612..d0289cd 100644 --- a/frontend/src/components/upgradeModal.component.ts +++ b/frontend/src/app/components/upgradeModal.component.ts @@ -3,10 +3,9 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { faGithub } from '@fortawesome/free-brands-svg-icons' import { faGift, faHeart } from '@fortawesome/free-solid-svg-icons' -import { LoginService } from '../services/login.service' import { AppConnectorService } from '../services/appConnector.service' -import { CommonService } from '../services/common.service' -import { User } from '../api' +import { CommonService, LoginService } from 'src/common' +import { User } from 'src/api' @Component({ selector: 'upgrade-modal', diff --git a/frontend/src/app/index.ts b/frontend/src/app/index.ts new file mode 100644 index 0000000..2f58d07 --- /dev/null +++ b/frontend/src/app/index.ts @@ -0,0 +1,46 @@ +import { NgModule } from '@angular/core' +import { NgbDropdownModule, NgbModalModule } from '@ng-bootstrap/ng-bootstrap' +import { CommonModule } from '@angular/common' +import { FormsModule } from '@angular/forms' +import { RouterModule } from '@angular/router' +import { ClipboardModule } from '@angular/cdk/clipboard' +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome' + +import { MainComponent } from './components/main.component' +import { ConfigModalComponent } from './components/configModal.component' +import { SettingsModalComponent } from './components/settingsModal.component' +import { ConnectionListComponent } from './components/connectionList.component' +import { UpgradeModalComponent } from './components/upgradeModal.component' +import { InstanceInfoResolver } from 'src/api' +import { CommonAppModule } from 'src/common' + +const ROUTES = [ + { + path: '', + component: MainComponent, + resolve: { + instanceInfo: InstanceInfoResolver, + }, + }, +] + +@NgModule({ + imports: [ + CommonAppModule, + CommonModule, + FormsModule, + NgbDropdownModule, + NgbModalModule, + ClipboardModule, + FontAwesomeModule, + RouterModule.forChild(ROUTES), + ], + declarations: [ + MainComponent, + ConfigModalComponent, + SettingsModalComponent, + ConnectionListComponent, + UpgradeModalComponent, + ], +}) +export class ApplicationModule { } diff --git a/frontend/src/services/appConnector.service.ts b/frontend/src/app/services/appConnector.service.ts similarity index 97% rename from frontend/src/services/appConnector.service.ts rename to frontend/src/app/services/appConnector.service.ts index fb5d608..5380a71 100644 --- a/frontend/src/services/appConnector.service.ts +++ b/frontend/src/app/services/appConnector.service.ts @@ -5,9 +5,8 @@ import { HttpClient } from '@angular/common/http' import { Injectable, Injector, NgZone } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { UpgradeModalComponent } from '../components/upgradeModal.component' -import { Config, Gateway, Version } from '../api' -import { LoginService } from './login.service' -import { CommonService } from './common.service' +import { Config, Gateway, Version } from 'src/api' +import { LoginService, CommonService } from 'src/common' export class SocketProxy { connect$ = new Subject() diff --git a/frontend/src/common/index.ts b/frontend/src/common/index.ts new file mode 100644 index 0000000..ecc54da --- /dev/null +++ b/frontend/src/common/index.ts @@ -0,0 +1,24 @@ +import { ModuleWithProviders, NgModule } from '@angular/core' +import { HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http' +import { BackendXsrfInterceptor, UniversalInterceptor } from './interceptor' + +@NgModule({ + imports: [ + HttpClientXsrfModule, + ], +}) +export class CommonAppModule { + static forRoot (): ModuleWithProviders { + return { + ngModule: CommonAppModule, + providers: [ + { provide: HTTP_INTERCEPTORS, useClass: UniversalInterceptor, multi: true }, + { provide: HTTP_INTERCEPTORS, useClass: BackendXsrfInterceptor, multi: true }, + ] + } + } +} + +export { LoginService } from './services/login.service' +export { ConfigService } from './services/config.service' +export { CommonService } from './services/common.service' diff --git a/frontend/src/interceptor.ts b/frontend/src/common/interceptor.ts similarity index 95% rename from frontend/src/interceptor.ts rename to frontend/src/common/interceptor.ts index 2d3e4cb..5e6bf65 100644 --- a/frontend/src/interceptor.ts +++ b/frontend/src/common/interceptor.ts @@ -3,7 +3,7 @@ import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpXsrfTokenExtr import { Observable } from 'rxjs' import { CommonService } from './services/common.service' -@Injectable() +@Injectable({ providedIn: 'root' }) export class UniversalInterceptor implements HttpInterceptor { constructor (private commonService: CommonService) { } @@ -19,7 +19,7 @@ export class UniversalInterceptor implements HttpInterceptor { } } -@Injectable() +@Injectable({ providedIn: 'root' }) export class BackendXsrfInterceptor implements HttpInterceptor { constructor ( private commonService: CommonService, diff --git a/frontend/src/services/common.service.ts b/frontend/src/common/services/common.service.ts similarity index 100% rename from frontend/src/services/common.service.ts rename to frontend/src/common/services/common.service.ts diff --git a/frontend/src/services/config.service.ts b/frontend/src/common/services/config.service.ts similarity index 98% rename from frontend/src/services/config.service.ts rename to frontend/src/common/services/config.service.ts index 1bc4bc3..06c639c 100644 --- a/frontend/src/services/config.service.ts +++ b/frontend/src/common/services/config.service.ts @@ -2,7 +2,7 @@ import * as semverCompare from 'semver/functions/compare-loose' import { AsyncSubject, Subject } from 'rxjs' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { Config, User, Version } from '../api' +import { Config, User, Version } from '../../api' import { LoginService } from './login.service' diff --git a/frontend/src/services/login.service.ts b/frontend/src/common/services/login.service.ts similarity index 95% rename from frontend/src/services/login.service.ts rename to frontend/src/common/services/login.service.ts index 717d8f7..187d2e3 100644 --- a/frontend/src/services/login.service.ts +++ b/frontend/src/common/services/login.service.ts @@ -1,7 +1,7 @@ import { AsyncSubject } from 'rxjs' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' -import { User } from '../api' +import { User } from '../../api' @Injectable({ providedIn: 'root' }) diff --git a/frontend/src/components/app.component.pug b/frontend/src/components/app.component.pug deleted file mode 100644 index 6053953..0000000 --- a/frontend/src/components/app.component.pug +++ /dev/null @@ -1 +0,0 @@ -router-outlet diff --git a/frontend/src/components/app.component.ts b/frontend/src/components/app.component.ts deleted file mode 100644 index c3b9ee9..0000000 --- a/frontend/src/components/app.component.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Component } from '@angular/core' - -@Component({ - selector: 'app', - templateUrl: './app.component.pug', - // styleUrls: ['./app.component.scss'], -}) -export class AppComponent { -} diff --git a/frontend/src/homepage/components/demoTerminal.component.scss b/frontend/src/homepage/components/demoTerminal.component.scss index 9e20365..be45980 100644 --- a/frontend/src/homepage/components/demoTerminal.component.scss +++ b/frontend/src/homepage/components/demoTerminal.component.scss @@ -1,4 +1,4 @@ -@import "../../theme/vars.scss"; +@import "theme/vars"; :host { display: flex; diff --git a/frontend/src/homepage/components/demoTerminal.component.ts b/frontend/src/homepage/components/demoTerminal.component.ts index 8bef375..b70d9c3 100644 --- a/frontend/src/homepage/components/demoTerminal.component.ts +++ b/frontend/src/homepage/components/demoTerminal.component.ts @@ -2,8 +2,8 @@ import { Subject } from 'rxjs' import * as semverCompare from 'semver/functions/compare-loose' import { HttpClient } from '@angular/common/http' import { Component, ElementRef, ViewChild } from '@angular/core' -import { Version } from '../../api' -import { CommonService } from '../../services/common.service' +import { Version } from 'src/api' +import { CommonService } from 'src/common' class DemoConnector { constructor ( diff --git a/frontend/src/homepage/components/home.component.scss b/frontend/src/homepage/components/home.component.scss index 5fa3ba7..fe4b045 100644 --- a/frontend/src/homepage/components/home.component.scss +++ b/frontend/src/homepage/components/home.component.scss @@ -1,4 +1,4 @@ -@import "../../theme/vars.scss"; +@import "theme/vars"; @import "~@fontsource/fira-code/latin.css"; :host { diff --git a/frontend/src/homepage/components/home.component.ts b/frontend/src/homepage/components/home.component.ts index c9bc41a..dc8da92 100644 --- a/frontend/src/homepage/components/home.component.ts +++ b/frontend/src/homepage/components/home.component.ts @@ -2,7 +2,7 @@ import { Component } from '@angular/core' import { ActivatedRoute, Router } from '@angular/router' import { faCoffee, faDownload, faSignInAlt } from '@fortawesome/free-solid-svg-icons' import { Waves } from '../vanta/vanta.waves.js' -import { InstanceInfo } from '../../api' +import { InstanceInfo } from 'src/api' @Component({ @@ -15,7 +15,7 @@ export class HomeComponent { releaseURL = `${this.githubURL}/releases/latest` donationURL = 'https://ko-fi.com/eugeny' - _logo = require('../../assets/logo.svg') + _logo = require('assets/logo.svg') _downloadIcon = faDownload _loginIcon = faSignInAlt _donateIcon = faCoffee diff --git a/frontend/src/homepage/components/homeFeatures.component.pug b/frontend/src/homepage/components/homeFeatures.component.pug index ed74f36..ddfb715 100644 --- a/frontend/src/homepage/components/homeFeatures.component.pug +++ b/frontend/src/homepage/components/homeFeatures.component.pug @@ -1,7 +1,7 @@ .container.mt-5.mb-5 h1 Features - .row.mb-5 + .row .col-12.col-md-4 .card.bg-dark img.card-img-top([src]='screenshots.progress') @@ -23,7 +23,7 @@ h5.card-title Customizable hotkeys .card-text Freely customizable single and multi-chord shortcuts. - .row.mb-5 + .row .col-12.col-md-4 .card.bg-dark img.card-img-top([src]='screenshots.ssh2') @@ -45,7 +45,7 @@ h5.card-title Zmodem transfers .card-text Send and receive files directly form the prompt in SSH, telnet and serial session. - .row.mb-5 + .row .col-12.col-md-4 .card.bg-dark img.card-img-top([src]='screenshots.quake') @@ -67,7 +67,7 @@ h5.card-title Profile manager .card-text Every option configurable combined in a profile startable a hotkey. - .row.mb-5 + .row .col-12.col-md-4 .card.bg-dark img.card-img-top([src]='screenshots.fonts') diff --git a/frontend/src/homepage/components/homeFeatures.component.scss b/frontend/src/homepage/components/homeFeatures.component.scss index b346804..c8b749b 100644 --- a/frontend/src/homepage/components/homeFeatures.component.scss +++ b/frontend/src/homepage/components/homeFeatures.component.scss @@ -6,3 +6,7 @@ aspect-ratio: 2; object-fit: cover; } + +.card { + margin-bottom: 20px; +} diff --git a/frontend/src/homepage/components/homeFeatures.component.ts b/frontend/src/homepage/components/homeFeatures.component.ts index 0e2c08c..cab2ce0 100644 --- a/frontend/src/homepage/components/homeFeatures.component.ts +++ b/frontend/src/homepage/components/homeFeatures.component.ts @@ -7,17 +7,17 @@ import { Component } from '@angular/core' }) export class HomeFeaturesComponent { screenshots = { - progress: require('../../assets/screenshots/progress.png'), - zmodem: require('../../assets/screenshots/zmodem.png'), - colors: require('../../assets/screenshots/colors.png'), - hotkeys: require('../../assets/screenshots/hotkeys.png'), - ports: require('../../assets/screenshots/ports.png'), - ssh2: require('../../assets/screenshots/ssh2.png'), - fonts: require('../../assets/screenshots/fonts.png'), - history: require('../../assets/screenshots/history.png'), - paste: require('../../assets/screenshots/paste.png'), - quake: require('../../assets/screenshots/quake.png'), - split: require('../../assets/screenshots/split.png'), - profiles: require('../../assets/screenshots/profiles.png'), + progress: require('assets/screenshots/progress.png'), + zmodem: require('assets/screenshots/zmodem.png'), + colors: require('assets/screenshots/colors.png'), + hotkeys: require('assets/screenshots/hotkeys.png'), + ports: require('assets/screenshots/ports.png'), + ssh2: require('assets/screenshots/ssh2.png'), + fonts: require('assets/screenshots/fonts.png'), + history: require('assets/screenshots/history.png'), + paste: require('assets/screenshots/paste.png'), + quake: require('assets/screenshots/quake.png'), + split: require('assets/screenshots/split.png'), + profiles: require('assets/screenshots/profiles.png'), } } diff --git a/frontend/src/homepage/components/homeIndex.component.scss b/frontend/src/homepage/components/homeIndex.component.scss index 973d68f..8d4c1d5 100644 --- a/frontend/src/homepage/components/homeIndex.component.scss +++ b/frontend/src/homepage/components/homeIndex.component.scss @@ -1,4 +1,4 @@ -@import "../../theme/vars.scss"; +@import "theme/vars"; h1 { font-family: $font-family-monospace; diff --git a/frontend/src/homepage/components/homeIndex.component.ts b/frontend/src/homepage/components/homeIndex.component.ts index 4678be0..a384996 100644 --- a/frontend/src/homepage/components/homeIndex.component.ts +++ b/frontend/src/homepage/components/homeIndex.component.ts @@ -15,10 +15,10 @@ export class HomeIndexComponent { _githubIcon = faGithub screenshots = { - window: require('../../assets/screenshots/window.png'), - tabs: require('../../assets/screenshots/tabs.png'), - ssh: require('../../assets/screenshots/ssh.png'), - serial: require('../../assets/screenshots/serial.png'), - win: require('../../assets/screenshots/win.png'), + window: require('assets/screenshots/window.png'), + tabs: require('assets/screenshots/tabs.png'), + ssh: require('assets/screenshots/ssh.png'), + serial: require('assets/screenshots/serial.png'), + win: require('assets/screenshots/win.png'), } } diff --git a/frontend/src/homepage/index.ts b/frontend/src/homepage/index.ts index 75f2a56..ddc07a7 100644 --- a/frontend/src/homepage/index.ts +++ b/frontend/src/homepage/index.ts @@ -3,7 +3,6 @@ import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap' import { CommonModule } from '@angular/common' import { FormsModule } from '@angular/forms' import { RouterModule } from '@angular/router' -import { HttpClientModule } from '@angular/common/http' import { FontAwesomeModule } from '@fortawesome/angular-fontawesome' import { NgxImageZoomModule } from 'ngx-image-zoom' @@ -11,9 +10,8 @@ import { HomeComponent } from './components/home.component' import { HomeIndexComponent } from './components/homeIndex.component' import { DemoTerminalComponent } from './components/demoTerminal.component' import { HomeFeaturesComponent } from './components/homeFeatures.component' -import { InstanceInfoResolver } from '../api' - -import '@fortawesome/fontawesome-svg-core/styles.css' +import { InstanceInfoResolver } from 'src/api' +import { CommonAppModule } from 'src/common' const ROUTES = [ { @@ -37,9 +35,9 @@ const ROUTES = [ @NgModule({ imports: [ + CommonAppModule, CommonModule, FormsModule, - HttpClientModule, NgbNavModule, FontAwesomeModule, NgxImageZoomModule, diff --git a/frontend/src/index.html b/frontend/src/index.html index 16be000..9879066 100644 --- a/frontend/src/index.html +++ b/frontend/src/index.html @@ -5,7 +5,7 @@ - + Tabby - a terminal for a more modern age diff --git a/frontend/src/components/login.component.pug b/frontend/src/login/components/login.component.pug similarity index 100% rename from frontend/src/components/login.component.pug rename to frontend/src/login/components/login.component.pug diff --git a/frontend/src/components/login.component.scss b/frontend/src/login/components/login.component.scss similarity index 100% rename from frontend/src/components/login.component.scss rename to frontend/src/login/components/login.component.scss diff --git a/frontend/src/components/login.component.ts b/frontend/src/login/components/login.component.ts similarity index 89% rename from frontend/src/components/login.component.ts rename to frontend/src/login/components/login.component.ts index 885945b..53106b1 100644 --- a/frontend/src/components/login.component.ts +++ b/frontend/src/login/components/login.component.ts @@ -1,6 +1,5 @@ import { Component } from '@angular/core' -import { LoginService } from '../services/login.service' -import { CommonService } from '../services/common.service' +import { LoginService, CommonService } from 'src/common' import { faGithub, faGitlab, faGoogle, faMicrosoft } from '@fortawesome/free-brands-svg-icons' diff --git a/frontend/src/login/index.ts b/frontend/src/login/index.ts new file mode 100644 index 0000000..d925250 --- /dev/null +++ b/frontend/src/login/index.ts @@ -0,0 +1,37 @@ +import { NgModule } from '@angular/core' +import { NgbNavModule } from '@ng-bootstrap/ng-bootstrap' +import { CommonModule } from '@angular/common' +import { FormsModule } from '@angular/forms' +import { RouterModule } from '@angular/router' +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome' +import { NgxImageZoomModule } from 'ngx-image-zoom' + +import { LoginComponent } from './components/login.component' +import { InstanceInfoResolver } from 'src/api' +import { CommonAppModule } from 'src/common' + +const ROUTES = [ + { + path: '', + component: LoginComponent, + resolve: { + instanceInfo: InstanceInfoResolver, + }, + }, +] + +@NgModule({ + imports: [ + CommonAppModule, + CommonModule, + FormsModule, + NgbNavModule, + FontAwesomeModule, + NgxImageZoomModule, + RouterModule.forChild(ROUTES), + ], + declarations: [ + LoginComponent, + ], +}) +export class LoginModule { } diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss index 387efc4..2ce37e8 100644 --- a/frontend/src/styles.scss +++ b/frontend/src/styles.scss @@ -9,4 +9,4 @@ body { @import "~source-code-pro/source-code-pro.css"; @import "~source-sans-pro/source-sans-pro.css"; -@import "./theme/index.scss" +@import "theme/index" diff --git a/frontend/src/theme/index.scss b/frontend/theme/index.scss similarity index 100% rename from frontend/src/theme/index.scss rename to frontend/theme/index.scss diff --git a/frontend/src/theme/vars.scss b/frontend/theme/vars.scss similarity index 100% rename from frontend/src/theme/vars.scss rename to frontend/theme/vars.scss diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 8231bb8..cc168b5 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -24,7 +24,7 @@ "es7" ], "paths": { - "src/*": ["./src/*"] + "src/*": ["./*"] } }, "include": ["src"] diff --git a/frontend/webpack.config.base.js b/frontend/webpack.config.base.js index c449b24..7982756 100644 --- a/frontend/webpack.config.base.js +++ b/frontend/webpack.config.base.js @@ -18,7 +18,9 @@ module.exports = { ], extensions: ['.ts', '.js'], alias: { + assets: path.resolve(__dirname, 'assets'), src: path.resolve(__dirname, 'src'), + theme: path.resolve(__dirname, 'theme'), }, }, module: {