Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/web/src/app/core/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ export interface ApiKeyLoginResponse {
account_id: string;
}

export function IsPlatformAccount(account: Account | null): boolean {
return !!account && account.platform_account === account.id;
}

export function ResolveDashboardType(account: Account | null): DashboardType {
const explicit = account?.controller?.zoneless_dashboard?.type;
if (explicit) {
return explicit;
}
if (account && account.platform_account === account.id) {
if (IsPlatformAccount(account)) {
return 'full';
}
return 'express';
Expand Down Expand Up @@ -71,7 +75,7 @@ export class AuthService {

SyncFromAccount(account: Account | null): void {
const type = ResolveDashboardType(account);
const isPlatform = !!(account && account.platform_account === account.id);
const isPlatform = IsPlatformAccount(account);

this.dashboardType.set(type);
this.isPlatform.set(isPlatform);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,15 @@ <h2 class="section-title">Account balances</h2>
>
<span>Pull funds</span>
</button>
@if (!isPlatformAccount()) {
<button
type="button"
class="action-button action-button-dainty outline"
(click)="OnPayout()"
>
<span>Pay out account balance</span>
</button>
}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
IdentityService,
PersonService,
} from '../../../../../data';
import { MetaService } from '../../../../../core';
import { IsPlatformAccount, MetaService } from '../../../../../core';
import {
CopyTextComponent,
PaginatedListColumn,
Expand Down Expand Up @@ -128,6 +128,10 @@ export class ConnectedAccountDetailViewComponent implements OnInit, OnDestroy {
return account?.email ?? account?.individual?.email ?? null;
});

readonly isPlatformAccount = computed(() =>
IsPlatformAccount(this.account())
);

readonly showIdentityAction = computed(() =>
NeedsIdentityDocumentAction(this.account())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ <h1>Settings</h1>
<!-- External Wallet Card -->
@if (externalWalletService.wallet()) {
<div class="view-section">
<div class="settings-section-title">Payout wallet</div>
<div class="settings-section-title">
{{ authService.isPlatform() ? 'Platform wallet' : 'Payout wallet' }}
</div>
<app-settings-card
[title]="externalWalletService.GetWalletTitle()"
[rows]="externalWalletService.GetSettingsCardRows()"
Expand Down Expand Up @@ -279,7 +281,9 @@ <h1>Settings</h1>
<!-- Edit Wallet Slide Panel -->
<app-slide-panel
[isOpen]="editWalletPanelOpen()"
title="Edit payout wallet"
[title]="
authService.isPlatform() ? 'Edit platform wallet' : 'Edit payout wallet'
"
[loading]="editWalletLoading()"
submitLabel="Save"
[submitDisabled]="false"
Expand Down
Loading