diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/addresses.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/addresses.component.ts index c7e411194..af4919ed6 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/addresses.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/addresses.component.ts @@ -4,31 +4,19 @@ import { TuiButton } from '@taiga-ui/core' import { TuiAccordion } from '@taiga-ui/experimental' import { PlaceholderComponent } from 'src/app/routes/portal/components/placeholder.component' import { TableComponent } from 'src/app/routes/portal/components/table.component' -import { MappedServiceInterface } from '../interface.utils' -import { AddressActionsComponent } from './actions.component' +import { MappedServiceInterface } from '../interface.service' +import { InterfaceAddressItemComponent } from './item.component' @Component({ selector: 'section[addresses]', template: `
{{ 'Addresses' | i18n }}
- @for (address of addresses().common; track $index) { - - - - - - - + @for ( + address of addresses().common.concat(addresses().uncommon); + track $index + ) { + } @empty { } -
- - {{ address.type }}{{ address.gateway }}{{ address.url }}
@@ -38,35 +26,17 @@ import { AddressActionsComponent } from './actions.component'
- - @if (addresses().uncommon.length) { - - - - + +
`, styles: ` [tuiAccordion], @@ -79,25 +49,13 @@ import { AddressActionsComponent } from './actions.component' margin-inline-end: 0.25rem; } } - - :host-context(tui-root._mobile) { - td:first-child { - display: none; - } - - td:nth-child(2) { - font: var(--tui-font-text-m); - font-weight: bold; - color: var(--tui-text-primary); - } - } `, host: { class: 'g-card' }, imports: [ TableComponent, PlaceholderComponent, i18nPipe, - AddressActionsComponent, + InterfaceAddressItemComponent, TuiButton, TuiAccordion, ], @@ -106,6 +64,4 @@ import { AddressActionsComponent } from './actions.component' export class InterfaceAddressesComponent { readonly addresses = input.required() readonly isRunning = input.required() - - instructions() {} } 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 new file mode 100644 index 000000000..701ef3f98 --- /dev/null +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/addresses/item.component.ts @@ -0,0 +1,63 @@ +import { + ChangeDetectionStrategy, + Component, + input, + inject, +} from '@angular/core' +import { DialogService, i18nKey, i18nPipe } from '@start9labs/shared' +import { TuiButton } from '@taiga-ui/core' +import { DisplayAddress } from '../interface.service' +import { AddressActionsComponent } from './actions.component' + +@Component({ + selector: 'tr[address]', + template: ` + @if (address(); as address) { + + + + {{ address.type }} + {{ address.gatewayName || '-' }} + {{ address.url }} + + } + `, + styles: ` + :host-context(tui-root._mobile) { + td:first-child { + display: none; + } + + td:nth-child(2) { + font: var(--tui-font-text-m); + font-weight: bold; + color: var(--tui-text-primary); + } + } + `, + imports: [i18nPipe, AddressActionsComponent, TuiButton], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class InterfaceAddressItemComponent { + readonly address = input.required() + readonly isRunning = input.required() + readonly dialog = inject(DialogService) + + instructions(bullets: string[]) { + this.dialog + .openAlert( + `
    ${bullets.map(b => `
  • ${b}
  • `).join('')}
` as i18nKey, + { + label: 'About this address' as i18nKey, + }, + ) + .subscribe() + } +} diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/clearnet-domains.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/clearnet-domains.component.ts index 9780929f9..fe450b7c4 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/clearnet-domains.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/clearnet-domains.component.ts @@ -5,7 +5,7 @@ import { PlaceholderComponent } from 'src/app/routes/portal/components/placehold import { TableComponent } from 'src/app/routes/portal/components/table.component' import { DomainComponent } from './domain.component' -import { ClearnetDomain } from './interface.utils' +import { ClearnetDomain } from './interface.service' @Component({ selector: 'section[clearnetDomains]', diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/domain.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/domain.component.ts index 96b48155f..244ab678b 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/domain.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/domain.component.ts @@ -20,7 +20,7 @@ import { TuiBadge } from '@taiga-ui/kit' import { filter } from 'rxjs' import { ApiService } from 'src/app/services/api/embassy-api.service' import { InterfaceComponent } from './interface.component' -import { ClearnetDomain } from './interface.utils' +import { ClearnetDomain } from './interface.service' @Component({ selector: 'tr[domain]', diff --git a/web/projects/ui/src/app/routes/portal/components/interfaces/gateways.component.ts b/web/projects/ui/src/app/routes/portal/components/interfaces/gateways.component.ts index 77baa6a00..e38ed9385 100644 --- a/web/projects/ui/src/app/routes/portal/components/interfaces/gateways.component.ts +++ b/web/projects/ui/src/app/routes/portal/components/interfaces/gateways.component.ts @@ -1,16 +1,11 @@ import { CommonModule } from '@angular/common' -import { - ChangeDetectionStrategy, - Component, - computed, - input, -} from '@angular/core' +import { ChangeDetectionStrategy, Component, input } from '@angular/core' import { TuiTitle } from '@taiga-ui/core' import { TuiSwitch } from '@taiga-ui/kit' import { FormsModule } from '@angular/forms' import { i18nPipe } from '@start9labs/shared' import { TuiCell } from '@taiga-ui/layout' -import { InterfaceGateway } from './interface.utils' +import { InterfaceGateway } from './interface.service' @Component({ selector: 'section[gateways]', @@ -18,7 +13,7 @@ import { InterfaceGateway } from './interface.utils'
{{ 'Gateways' | i18n }}
@for (gateway of gateways(); track $index) {