mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-24 13:29:55 +00:00
added welcome tab (fixes #845)
This commit is contained in:
parent
96f1342c84
commit
8e390eef05
19
terminus-core/src/components/welcomeTab.component.pug
Normal file
19
terminus-core/src/components/welcomeTab.component.pug
Normal file
@ -0,0 +1,19 @@
|
||||
.mb-4
|
||||
.terminus-logo
|
||||
h1.terminus-title Terminus
|
||||
sup α
|
||||
|
||||
.container
|
||||
.text-center.mb-5 Thank you for downloading Terminus!
|
||||
|
||||
.form-line
|
||||
.header
|
||||
.title Enable analytics
|
||||
.description Help us track the number of Terminus installs across the world!
|
||||
toggle(
|
||||
[(ngModel)]='config.store.enableAnalytics',
|
||||
(ngModelChange)='config.save(); config.requestRestart()',
|
||||
)
|
||||
|
||||
.text-center.mt-5
|
||||
button.btn.btn-primary((click)='closeAndDisable()') Close and never show again
|
6
terminus-core/src/components/welcomeTab.component.scss
Normal file
6
terminus-core/src/components/welcomeTab.component.scss
Normal file
@ -0,0 +1,6 @@
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
flex: 0 1 500px;
|
||||
}
|
26
terminus-core/src/components/welcomeTab.component.ts
Normal file
26
terminus-core/src/components/welcomeTab.component.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { BaseTabComponent } from './baseTab.component'
|
||||
import { ConfigService } from '../services/config.service'
|
||||
import { AppService } from '../services/app.service'
|
||||
|
||||
/** @hidden */
|
||||
@Component({
|
||||
selector: 'welcome-page',
|
||||
template: require('./welcomeTab.component.pug'),
|
||||
styles: [require('./welcomeTab.component.scss')],
|
||||
})
|
||||
export class WelcomeTabComponent extends BaseTabComponent {
|
||||
constructor (
|
||||
private app: AppService,
|
||||
public config: ConfigService,
|
||||
) {
|
||||
super()
|
||||
this.setTitle('Welcome')
|
||||
}
|
||||
|
||||
closeAndDisable () {
|
||||
this.config.store.enableWelcomeTab = false
|
||||
this.config.save()
|
||||
this.app.closeTab(this)
|
||||
}
|
||||
}
|
@ -11,3 +11,4 @@ appearance:
|
||||
vibrancy: false
|
||||
vibrancyType: 'blur'
|
||||
enableAnalytics: true
|
||||
enableWelcomeTab: true
|
||||
|
@ -18,6 +18,7 @@ import { WindowControlsComponent } from './components/windowControls.component'
|
||||
import { RenameTabModalComponent } from './components/renameTabModal.component'
|
||||
import { SplitTabComponent, SplitTabRecoveryProvider } from './components/splitTab.component'
|
||||
import { SplitTabSpannerComponent } from './components/splitTabSpanner.component'
|
||||
import { WelcomeTabComponent } from './components/welcomeTab.component'
|
||||
|
||||
import { AutofocusDirective } from './directives/autofocus.directive'
|
||||
|
||||
@ -27,6 +28,9 @@ import { Theme } from './api/theme'
|
||||
import { TabContextMenuItemProvider } from './api/tabContextMenuProvider'
|
||||
import { TabRecoveryProvider } from './api/tabRecovery'
|
||||
|
||||
import { AppService } from './services/app.service'
|
||||
import { ConfigService } from './services/config.service'
|
||||
|
||||
import { StandardTheme, StandardCompactTheme, PaperTheme } from './theme'
|
||||
import { CoreConfigProvider } from './config'
|
||||
import { AppHotkeyProvider } from './hotkeys'
|
||||
@ -72,11 +76,13 @@ const PROVIDERS = [
|
||||
AutofocusDirective,
|
||||
SplitTabComponent,
|
||||
SplitTabSpannerComponent,
|
||||
WelcomeTabComponent,
|
||||
],
|
||||
entryComponents: [
|
||||
RenameTabModalComponent,
|
||||
SafeModeModalComponent,
|
||||
SplitTabComponent,
|
||||
WelcomeTabComponent,
|
||||
],
|
||||
exports: [
|
||||
CheckboxComponent,
|
||||
@ -85,6 +91,14 @@ const PROVIDERS = [
|
||||
]
|
||||
})
|
||||
export default class AppModule {
|
||||
constructor (app: AppService, config: ConfigService) {
|
||||
app.ready$.subscribe(() => {
|
||||
if (config.store.enableWelcomeTab) {
|
||||
app.openNewTabRaw(WelcomeTabComponent)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static forRoot (): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: AppModule,
|
||||
|
@ -16,7 +16,7 @@ export class HomeBaseService {
|
||||
) {
|
||||
this.appVersion = electron.app.getVersion()
|
||||
|
||||
if (this.config.store.enableAnalytics) {
|
||||
if (this.config.store.enableAnalytics && !this.config.store.enableWelcomeTab) {
|
||||
this.enableAnalytics()
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
}
|
||||
|
||||
open (): void {
|
||||
let settingsTab = this.app.tabs.find((tab) => tab instanceof SettingsTabComponent)
|
||||
let settingsTab = this.app.tabs.find(tab => tab instanceof SettingsTabComponent)
|
||||
if (settingsTab) {
|
||||
this.app.selectTab(settingsTab)
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user