mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
* wip * update marketplace categories styling * update logo icons * add sort pipe * update search component styling * clean up categories component * cleanup and remove unnecessary sort pipe * query packages in selected category * fix search styling * add reg icon and font, adjust category styles * fix build from rebasing integration/refactors * adjust marketplace types for icon with store data, plus formatting * formatting * update categories and search * hover styling for categories * category styling * refactor for category as a behavior subject * more category styling * base functionality with new marketplace components * styling cleanup * misc style fixes and fix category selection from package page * fixes from review feedback * add and style additional details * implement release notes modal * fix menu when on service show page mobile to display change marketplace * style and responsiveness fixes * rename header to sidebar * input icon config to sidebar * add mime type pipe and type fn * review feedback fixes * skeleton text, more abstraction * reorder categories, clean up a little * audit sidebar, categories, store-icon, marketplace-sidebar, search * finish code cleanup and fix few bugs * misc fixes and cleanup * fix broken styles and markdown * bump shared marketplace version * more cleanup * sync package lock * rename sidebar component to menu * wip preview sidebar * sync package lock * breakout package show elements into components * link to brochure in preview; custom taiga button styles * move marketplace preview component into ui; open preview when viewing service in marketplace * sync changes post file struture rename * further cleanup * create service for sidebar toggle and cleanup marketplace components * bump shared marketplace version * bump shared for new images needed for brochure marketplace * cleanup --------- Co-authored-by: Matt Hill <mattnine@protonmail.com>
93 lines
3.1 KiB
TypeScript
93 lines
3.1 KiB
TypeScript
import { Component, inject, OnDestroy } from '@angular/core'
|
|
import { Router } from '@angular/router'
|
|
import { combineLatest, map, merge, startWith } from 'rxjs'
|
|
import { AuthService } from './services/auth.service'
|
|
import { SplitPaneTracker } from './services/split-pane.service'
|
|
import { PatchDataService } from './services/patch-data.service'
|
|
import { PatchMonitorService } from './services/patch-monitor.service'
|
|
import { ConnectionService } from './services/connection.service'
|
|
import { Title } from '@angular/platform-browser'
|
|
import {
|
|
ClientStorageService,
|
|
WidgetDrawer,
|
|
} from './services/client-storage.service'
|
|
import { ThemeSwitcherService } from './services/theme-switcher.service'
|
|
import { THEME } from '@start9labs/shared'
|
|
import { PatchDB } from 'patch-db-client'
|
|
import { DataModel } from './services/patch-db/data-model'
|
|
import { slideInAnimation } from './route-animation'
|
|
|
|
function hasNavigation(url: string): boolean {
|
|
return (
|
|
!url.startsWith('/loading') &&
|
|
!url.startsWith('/diagnostic') &&
|
|
!url.startsWith('/portal')
|
|
)
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-root',
|
|
templateUrl: 'app.component.html',
|
|
styleUrls: ['app.component.scss'],
|
|
animations: [slideInAnimation],
|
|
})
|
|
export class AppComponent implements OnDestroy {
|
|
readonly subscription = merge(this.patchData, this.patchMonitor).subscribe()
|
|
readonly sidebarOpen$ = this.splitPane.sidebarOpen$
|
|
readonly widgetDrawer$ = this.clientStorageService.widgetDrawer$
|
|
readonly theme$ = inject(THEME)
|
|
// @TODO theres a bug here disabling the side menu from appearing on first login; refresh fixes
|
|
readonly navigation$ = combineLatest([
|
|
this.authService.isVerified$,
|
|
this.router.events.pipe(map(() => hasNavigation(this.router.url))),
|
|
]).pipe(map(([isVerified, hasNavigation]) => isVerified && hasNavigation))
|
|
|
|
readonly offline$ = combineLatest([
|
|
this.authService.isVerified$,
|
|
this.connection.connected$,
|
|
this.patch
|
|
.watch$('server-info', 'status-info')
|
|
.pipe(startWith({ restarting: false, 'shutting-down': false })),
|
|
]).pipe(
|
|
map(
|
|
([verified, connected, status]) =>
|
|
verified &&
|
|
(!connected || status.restarting || status['shutting-down']),
|
|
),
|
|
)
|
|
|
|
constructor(
|
|
private readonly router: Router,
|
|
private readonly titleService: Title,
|
|
private readonly patchData: PatchDataService,
|
|
private readonly patchMonitor: PatchMonitorService,
|
|
private readonly splitPane: SplitPaneTracker,
|
|
private readonly patch: PatchDB<DataModel>,
|
|
readonly authService: AuthService,
|
|
readonly connection: ConnectionService,
|
|
readonly clientStorageService: ClientStorageService,
|
|
readonly themeSwitcher: ThemeSwitcherService,
|
|
) {}
|
|
|
|
async ngOnInit() {
|
|
this.patch
|
|
.watch$('ui', 'name')
|
|
.subscribe(name => this.titleService.setTitle(name || 'StartOS'))
|
|
}
|
|
|
|
splitPaneVisible({ detail }: any) {
|
|
this.splitPane.sidebarOpen$.next(detail.visible)
|
|
}
|
|
|
|
onResize(drawer: WidgetDrawer) {
|
|
this.clientStorageService.updateWidgetDrawer({
|
|
...drawer,
|
|
width: drawer.width === 400 ? 600 : 400,
|
|
})
|
|
}
|
|
|
|
ngOnDestroy() {
|
|
this.subscription.unsubscribe()
|
|
}
|
|
}
|