From 29ddfad9d724e721cc8adfdd3a28dc23c7d9b9cb Mon Sep 17 00:00:00 2001 From: waterplea Date: Sat, 9 Aug 2025 17:45:31 +0700 Subject: [PATCH] fix: address comments --- .../interfaces/addresses/actions.component.ts | 29 +++--- .../addresses/addresses.component.ts | 95 ++++++++++++++----- .../interfaces/addresses/item.component.ts | 19 +++- .../interfaces/clearnet-domains.component.ts | 30 ++++-- .../components/interfaces/domain.component.ts | 2 +- .../interfaces/gateways.component.ts | 20 +++- .../interfaces/interface.component.ts | 19 +++- .../portal/components/interfaces/mask.pipe.ts | 2 +- .../interfaces/tor-domains.component.ts | 22 +++-- .../routes/startos-ui/startos-ui.component.ts | 4 +- .../portal/routes/system/system.component.ts | 4 - web/projects/ui/src/styles.scss | 2 +- 12 files changed, 169 insertions(+), 79 deletions(-) diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/actions.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/actions.component.ts index 9baacfaab..bf1e86e16 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/actions.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/actions.component.ts @@ -3,7 +3,6 @@ import { Component, inject, input, - DOCUMENT, } from '@angular/core' import { CopyService, DialogService, i18nPipe } from '@start9labs/shared' import { TUI_IS_MOBILE } from '@taiga-ui/cdk' @@ -23,16 +22,17 @@ import { InterfaceComponent } from '../interface.component' selector: 'td[actions]', template: `
- @if (interface.value().type === 'ui') { - + } - @if (interface.value().type === 'ui') { - + } + + } `, styles: ` + tui-accordion { + border-radius: 0; + } + [tuiAccordion], tui-expand { box-shadow: none; padding: 0; - background: none !important; + } - &::after { - margin-inline-end: 0.25rem; + [tuiAccordion] { + justify-content: center; + height: 3rem; + border-radius: 0 0 var(--tui-radius-m) var(--tui-radius-m) !important; + } + + hr { + margin: 0; + height: 0.25rem; + border-radius: 1rem; + } + + :host-context(tui-root._mobile) { + [tuiAccordion] { + margin: 0.5rem 0; + border-radius: var(--tui-radius-m) !important; } } `, @@ -56,12 +95,16 @@ import { InterfaceAddressItemComponent } from './item.component' PlaceholderComponent, i18nPipe, InterfaceAddressItemComponent, - TuiButton, TuiAccordion, + TuiSkeleton, ], changeDetection: ChangeDetectionStrategy.OnPush, }) export class InterfaceAddressesComponent { - readonly addresses = input.required() + readonly addresses = input.required< + MappedServiceInterface['addresses'] | undefined + >() readonly isRunning = input.required() + + uncommon = false } diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/item.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/item.component.ts index 701ef3f98..7be6841cd 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/item.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/item.component.ts @@ -13,7 +13,7 @@ import { AddressActionsComponent } from './actions.component' selector: 'tr[address]', template: ` @if (address(); as address) { - +
} @empty { - - {{ 'No Tor domains' | i18n }} - + @if (torDomains()) { + + {{ 'No Tor domains' | i18n }} + + } @else { + @for (_ of [0, 1]; track $index) { + + } + } } `, styles: ` @@ -84,6 +93,7 @@ type OnionForm = { PlaceholderComponent, i18nPipe, DocsLinkDirective, + TuiSkeleton, ], changeDetection: ChangeDetectionStrategy.OnPush, }) @@ -96,7 +106,7 @@ export class InterfaceTorDomainsComponent { private readonly interface = inject(InterfaceComponent) private readonly i18n = inject(i18nPipe) - readonly torDomains = input.required() + readonly torDomains = input.required() async remove(onion: string) { this.dialog @@ -111,7 +121,7 @@ export class InterfaceTorDomainsComponent { await this.api.pkgRemoveOnion({ ...params, package: this.interface.packageId(), - host: this.interface.value().addressInfo.hostId, + host: this.interface.value()?.addressInfo.hostId || '', }) } else { await this.api.serverRemoveOnion(params) @@ -166,7 +176,7 @@ export class InterfaceTorDomainsComponent { await this.api.pkgAddOnion({ onion, package: this.interface.packageId(), - host: this.interface.value().addressInfo.hostId, + host: this.interface.value()?.addressInfo.hostId || '', }) } else { await this.api.serverAddOnion({ onion }) diff --git a/web/projects/ui/src/app/routes/portal/routes/system/routes/startos-ui/startos-ui.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/routes/startos-ui/startos-ui.component.ts index 6beadb379..d987fafa8 100644 --- a/web/projects/ui/src/app/routes/portal/routes/system/routes/startos-ui/startos-ui.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/system/routes/startos-ui/startos-ui.component.ts @@ -37,9 +37,7 @@ import { TitleDirective } from 'src/app/services/title.service'

{{ iface.description }}

- @if (ui(); as ui) { - - } + `, host: { class: 'g-subpage' }, changeDetection: ChangeDetectionStrategy.OnPush, diff --git a/web/projects/ui/src/app/routes/portal/routes/system/system.component.ts b/web/projects/ui/src/app/routes/portal/routes/system/system.component.ts index 64af9e65a..ca2384a11 100644 --- a/web/projects/ui/src/app/routes/portal/routes/system/system.component.ts +++ b/web/projects/ui/src/app/routes/portal/routes/system/system.component.ts @@ -101,10 +101,6 @@ import { map } from 'rxjs' } } - hr { - background: var(--tui-border-normal); - } - ::ng-deep hgroup h3 { display: none; } diff --git a/web/projects/ui/src/styles.scss b/web/projects/ui/src/styles.scss index 56c8cf38c..8ebfbb6f7 100644 --- a/web/projects/ui/src/styles.scss +++ b/web/projects/ui/src/styles.scss @@ -19,7 +19,7 @@ ul { hr { height: 1px; - background: var(--tui-background-neutral-1); + background: var(--tui-border-normal); border: none; }