From 1e4a624da963653d4ac09397a7b96a3297ed906d Mon Sep 17 00:00:00 2001 From: Alex Inkin Date: Sun, 11 Jan 2026 01:39:43 +0400 Subject: [PATCH] chore: comments (#3093) * chore: comments * revert some sizing --------- Co-authored-by: Matt Hill --- .../shared/src/components/markdown.component.ts | 12 +++++++----- .../shared/src/directives/docs-link.directive.ts | 11 ++++++++++- web/projects/ui/src/app/app.providers.ts | 9 +++++++++ .../routes/marketplace/marketplace.component.ts | 4 ++-- .../portal/routes/services/routes/about.component.ts | 10 ++++------ 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/web/projects/shared/src/components/markdown.component.ts b/web/projects/shared/src/components/markdown.component.ts index 82c82f5ba..ca260e562 100644 --- a/web/projects/shared/src/components/markdown.component.ts +++ b/web/projects/shared/src/components/markdown.component.ts @@ -1,10 +1,9 @@ -import { ChangeDetectionStrategy, Component, inject } from '@angular/core' +import { ChangeDetectionStrategy, Component } from '@angular/core' import { toSignal } from '@angular/core/rxjs-interop' -import { ActivatedRoute } from '@angular/router' -import { TuiDialogContext, TuiLoader, TuiNotification } from '@taiga-ui/core' +import { TuiLoader, TuiNotification } from '@taiga-ui/core' import { NgDompurifyPipe } from '@taiga-ui/dompurify' import { injectContext, PolymorpheusComponent } from '@taiga-ui/polymorpheus' -import { catchError, ignoreElements, Observable, of } from 'rxjs' +import { catchError, ignoreElements, Observable, of, share } from 'rxjs' import { SafeLinksDirective } from '../directives/safe-links.directive' import { MarkdownPipe } from '../pipes/markdown.pipe' import { getErrorMessage } from '../services/error.service' @@ -34,7 +33,10 @@ import { getErrorMessage } from '../services/error.service' ], }) export class MarkdownComponent { - protected readonly data = injectContext<{ data: Observable }>().data + private readonly data = injectContext<{ + data: Observable + }>().data.pipe(share()) + protected readonly content = toSignal(this.data) protected readonly error = toSignal( this.data.pipe( diff --git a/web/projects/shared/src/directives/docs-link.directive.ts b/web/projects/shared/src/directives/docs-link.directive.ts index e98b76b8c..e0ff60e69 100644 --- a/web/projects/shared/src/directives/docs-link.directive.ts +++ b/web/projects/shared/src/directives/docs-link.directive.ts @@ -5,11 +5,14 @@ import { InjectionToken, input, } from '@angular/core' +import { TuiHintDirective } from '@taiga-ui/core' +import { i18nPipe } from '../i18n/i18n.pipe' export const VERSION = new InjectionToken('VERSION') @Directive({ selector: '[docsLink]', + hostDirectives: [TuiHintDirective], host: { target: '_blank', rel: 'noreferrer', @@ -20,12 +23,18 @@ export class DocsLinkDirective { private readonly version = inject(VERSION) readonly path = input.required() - readonly fragment = input('') protected readonly url = computed(() => { const path = this.path() const relative = path.startsWith('/') ? path : `/${path}` + return `https://docs.start9.com${relative}?os=${this.version}${this.fragment()}` }) + + constructor() { + inject(TuiHintDirective).content.set( + inject(i18nPipe).transform('Documentation'), + ) + } } diff --git a/web/projects/ui/src/app/app.providers.ts b/web/projects/ui/src/app/app.providers.ts index 731973051..e2db99464 100644 --- a/web/projects/ui/src/app/app.providers.ts +++ b/web/projects/ui/src/app/app.providers.ts @@ -20,6 +20,7 @@ import { tuiObfuscateOptionsProvider } from '@taiga-ui/cdk' import { TUI_DATE_FORMAT, TUI_DIALOGS_CLOSE, + TUI_MEDIA, tuiAlertOptionsProvider, tuiButtonOptionsProvider, tuiDropdownOptionsProvider, @@ -140,4 +141,12 @@ export const APP_PROVIDERS = [ none: identity, }, }), + { + provide: TUI_MEDIA, + useValue: { + mobile: 1000, + desktopSmall: 1280, + desktopLarge: Infinity, + }, + }, ] diff --git a/web/projects/ui/src/app/routes/portal/routes/marketplace/marketplace.component.ts b/web/projects/ui/src/app/routes/portal/routes/marketplace/marketplace.component.ts index 82c6e2d08..8c96721cd 100644 --- a/web/projects/ui/src/app/routes/portal/routes/marketplace/marketplace.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/marketplace/marketplace.component.ts @@ -111,11 +111,11 @@ import { ConfigService } from 'src/app/services/config.service' &-list { display: grid; grid-template-columns: repeat(1, minmax(0, 1fr)); - gap: 4rem 3rem; + gap: 3.5rem 2.5rem; padding: 1.5rem; @media (min-width: 768px) { - padding: 2rem; + grid-template-columns: repeat(2, minmax(0, 1fr)); } @media (min-width: 1024px) { grid-template-columns: repeat(2, minmax(0, 1fr)); diff --git a/web/projects/ui/src/app/routes/portal/routes/services/routes/about.component.ts b/web/projects/ui/src/app/routes/portal/routes/services/routes/about.component.ts index 27cf78394..3d70470c1 100644 --- a/web/projects/ui/src/app/routes/portal/routes/services/routes/about.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/services/routes/about.component.ts @@ -10,7 +10,7 @@ import { } from '@start9labs/shared' import { TuiCell } from '@taiga-ui/layout' import { PatchDB } from 'patch-db-client' -import { from, map } from 'rxjs' +import { defer, map } from 'rxjs' import { ApiService } from 'src/app/services/api/embassy-api.service' import { DataModel } from 'src/app/services/patch-db/data-model' import { getManifest } from 'src/app/utils/get-package-data' @@ -54,15 +54,13 @@ import { }) export default class ServiceAboutRoute { private readonly pkgId = getPkgId() + private readonly api = inject(ApiService) private readonly copyService = inject(CopyService) private readonly markdown = inject(DialogService).openComponent(MARKDOWN, { label: 'License', size: 'l', - data: from( - inject(ApiService).getStatic( - [`/s9pk/installed/${this.pkgId}.s9pk/LICENSE.md`], - {}, - ), + data: defer(() => + this.api.getStatic([`/s9pk/installed/${this.pkgId}.s9pk/LICENSE.md`], {}), ), })