From 37031700d094d2e281529b937f196b65a0f83f2e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 27 Jul 2021 17:05:19 -0300 Subject: aplying design changes in provider details ui --- .../src/components/styled/index.tsx | 8 +++-- .../src/popup/ProviderDetailPage.tsx | 38 ++++++++++++++-------- 2 files changed, 30 insertions(+), 16 deletions(-) (limited to 'packages/taler-wallet-webextension') diff --git a/packages/taler-wallet-webextension/src/components/styled/index.tsx b/packages/taler-wallet-webextension/src/components/styled/index.tsx index 8afbb6c9a..7cc6d427a 100644 --- a/packages/taler-wallet-webextension/src/components/styled/index.tsx +++ b/packages/taler-wallet-webextension/src/components/styled/index.tsx @@ -4,7 +4,7 @@ import type * as Linaria from '@linaria/core'; import { styled } from '@linaria/react'; -export const PaymentStatus = styled.span<{ color: string }>` +export const PaymentStatus = styled.div<{ color: string }>` padding: 5px; border-radius: 5px; color: white; @@ -40,6 +40,10 @@ export const PopupBox = styled.div` & > div { align-self: center; } + + & > h3 { + margin: 0px; + } } & > footer { @@ -223,7 +227,7 @@ export const ErrorBox = styled.div` /* margin: 0.5em; */ padding-left: 1em; padding-right: 1em; - width: "100%"; + width: 100%; color: #721c24; background: #f8d7da; diff --git a/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx b/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx index 30512d227..c92137ee3 100644 --- a/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx +++ b/packages/taler-wallet-webextension/src/popup/ProviderDetailPage.tsx @@ -39,7 +39,7 @@ export function ProviderDetailPage({ pid, onBack }: Props): VNode { } return status.remove().then(onBack) } + onDelete={() => status.remove().then(onBack)} onBack={onBack} onExtend={() => { null }} />; @@ -54,18 +54,28 @@ export interface ViewProps { } export function ProviderView({ info, onDelete, onSync, onBack, onExtend }: ViewProps): VNode { + const lb = info?.lastSuccessfulBackupTimestamp + const isPaid = info.paymentStatus.type === ProviderPaymentType.Paid || info.paymentStatus.type === ProviderPaymentType.TermsChanged return (
- {info.paymentStatus.type} + - {info.terms &&
{info.terms.annualFee} / year
}
-
- +

{info.name} {info.syncProviderBaseUrl}

-

{daysSince(info?.lastSuccessfulBackupTimestamp)}

+ {isPaid ? 'Paid': 'Unpaid' } +
+
+

Last backup: {lb == null || lb.t_ms == "never" ? "never" : format(lb.t_ms, 'dd MMM yyyy')}

+ Back up + {info.terms && +

Provider fee: {info.terms && info.terms.annualFee} per year

+
+ }

{descriptionByStatus(info.paymentStatus)}

+ Extend + {info.paymentStatus.type === ProviderPaymentType.TermsChanged &&

terms has changed, extending the service will imply accepting the new terms of service

@@ -99,9 +109,7 @@ export function ProviderView({ info, onDelete, onSync, onBack, onExtend }: ViewP
- remove - extend - sync now + remove provider
@@ -171,17 +179,19 @@ function colorByStatus(status: ProviderPaymentType) { function descriptionByStatus(status: ProviderPaymentStatus) { switch (status.type) { - case ProviderPaymentType.InsufficientBalance: - return i18n.str`no enough balance to make the payment` - case ProviderPaymentType.Unpaid: - return i18n.str`not paid yet` + // return i18n.str`no enough balance to make the payment` + // return i18n.str`not paid yet` case ProviderPaymentType.Paid: case ProviderPaymentType.TermsChanged: if (status.paidUntil.t_ms === 'never') { return i18n.str`service paid` } else { - return i18n.str`service paid until ${format(status.paidUntil.t_ms, 'yyyy/MM/dd HH:mm:ss')}` + return + Backup valid until: {format(status.paidUntil.t_ms, 'dd MMM yyyy')} + } + case ProviderPaymentType.Unpaid: + case ProviderPaymentType.InsufficientBalance: case ProviderPaymentType.Pending: return '' } -- cgit v1.2.3