Skip to content

Commit

Permalink
fix: fix dates
Browse files Browse the repository at this point in the history
  • Loading branch information
kemuru committed May 21, 2024
1 parent b28dd0e commit b5564cc
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 35 deletions.
8 changes: 4 additions & 4 deletions web/src/components/PreviewCard/Terms/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IDescription {
sendingQuantity: string;
sendingToken: string;
sellerAddress: string;
deadlineDate: Date;
deadline: number;
assetSymbol: string;
buyer: string;
}
Expand All @@ -35,23 +35,23 @@ const Description: React.FC<IDescription> = ({
sendingQuantity,
sendingToken,
sellerAddress,
deadlineDate,
deadline,
assetSymbol,
}) => {
const generalEscrowSummary = (
<>
By Paying {sendingQuantity}{" "}
<InlineBlockSpan>{assetSymbol ? assetSymbol : <StyledSkeleton width={30} />}</InlineBlockSpan>, address{" "}
{buyerAddress} should receive "{deliverableText}" from address {sellerAddress} before the delivery deadline{" "}
{new Date(deadlineDate).toString()}.
{new Date(deadline).toString()}.
</>
);

const cryptoSwapSummary = (
<>
By Paying {sendingQuantity} {sendingToken}, [Blockchain] address {buyerAddress} should receive {receivingQuantity}{" "}
{receivingToken} at the [Blockchain] address {sellerAddress} from [Blockchain] address TODO before the delivery
deadline {new Date(deadlineDate).toString()}.
deadline {new Date(deadline).toString()}.
</>
);

Expand Down
24 changes: 13 additions & 11 deletions web/src/components/PreviewCard/Terms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ITerms {
sendingQuantity: string;
sendingToken: string;
sellerAddress: string;
deadlineDate: Date;
deadline: number;
assetSymbol: string;
extraDescriptionUri: string;
buyer: string;
Expand All @@ -32,24 +32,26 @@ const Terms: React.FC<ITerms> = ({
buyerAddress,
sendingQuantity,
sellerAddress,
deadlineDate,
deadline,
assetSymbol,
extraDescriptionUri,
}) => {
return (
<Container>
<Header />
<Description
escrowType={escrowType}
deliverableText={deliverableText}
receivingQuantity={receivingQuantity}
buyerAddress={buyerAddress}
sendingQuantity={sendingQuantity}
sellerAddress={sellerAddress}
deadlineDate={deadlineDate}
assetSymbol={assetSymbol}
{...{
escrowType,
deliverableText,
receivingQuantity,
buyerAddress,
sendingQuantity,
sellerAddress,
deadline,
assetSymbol,
}}
/>
<AttachedFile extraDescriptionUri={extraDescriptionUri} />
<AttachedFile {...{ extraDescriptionUri }} />
</Container>
);
};
Expand Down
11 changes: 4 additions & 7 deletions web/src/components/PreviewCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ interface IPreviewCard {
receivingQuantity: string;
transactionCreationTimestamp: string;
status: string;
token: string;
buyerAddress: string;
sendingQuantity: string;
sellerAddress: string;
deadlineDate: string;
deadline: number;
assetSymbol: string;
overrideIsList: boolean;
extraDescriptionUri: string;
Expand All @@ -80,11 +79,10 @@ const PreviewCard: React.FC<IPreviewCard> = ({
receivingQuantity,
transactionCreationTimestamp,
status,
token,
buyerAddress,
sendingQuantity,
sellerAddress,
deadlineDate,
deadline,
assetSymbol,
overrideIsList,
extraDescriptionUri,
Expand All @@ -104,9 +102,8 @@ const PreviewCard: React.FC<IPreviewCard> = ({
<Divider />
<TransactionInfo
amount={sendingQuantity}
assetSymbol={assetSymbol}
isPreview={true}
{...{ overrideIsList, deadlineDate, sellerAddress, buyerAddress }}
{...{ overrideIsList, deadline, sellerAddress, buyerAddress, assetSymbol }}
/>
<Divider />
</TransactionInfoContainer>
Expand All @@ -118,7 +115,7 @@ const PreviewCard: React.FC<IPreviewCard> = ({
buyerAddress,
sendingQuantity,
sellerAddress,
deadlineDate,
deadline,
assetSymbol,
extraDescriptionUri,
}}
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/TransactionInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const RestOfFieldsContainer = styled.div<{ isList?: boolean; isPreview?: boolean

export interface ITransactionInfo {
amount?: string;
deadlineDate: string;
deadline: number;
assetSymbol?: string;
status?: Statuses;
overrideIsList?: boolean;
Expand All @@ -83,7 +83,7 @@ export interface ITransactionInfo {
const TransactionInfo: React.FC<ITransactionInfo> = ({
amount,
assetSymbol,
deadlineDate,
deadline,
sellerAddress,
buyerAddress,
overrideIsList,
Expand All @@ -108,11 +108,11 @@ const TransactionInfo: React.FC<ITransactionInfo> = ({
isPreview={isPreview}
/>
) : null}
{deadlineDate ? (
{deadline ? (
<Field
icon={CalendarIcon}
name="Delivery Deadline"
value={deadlineDate}
value={new Date(deadline).toLocaleString()}
displayAsList={displayAsList}
isPreview={isPreview}
/>
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/MyTransactions/TransactionDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const TransactionDetails: React.FC = () => {
sellerAddress={seller}
transactionCreationTimestamp={timestamp}
sendingQuantity={!isUndefined(amount) ? formatEther(amount) : ""}
deadlineDate={new Date(deadline * 1000).toLocaleString()}
deadline={deadline * 1000}
assetSymbol={!token ? nativeTokenSymbol : erc20TokenSymbol}
overrideIsList={false}
amount={!isUndefined(amount) ? formatEther(amount) : ""}
Expand Down
18 changes: 10 additions & 8 deletions web/src/pages/NewTransaction/Preview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,20 @@ const Preview: React.FC = () => {
<Container>
<Header />
<PreviewCard
receivingQuantity={receivingQuantity}
sellerAddress={sellerAddress}
sendingQuantity={sendingQuantity}
buyerAddress={address}
escrowType={escrowType}
deliverableText={deliverableText}
assetSymbol={sendingToken === "native" ? nativeTokenSymbol : erc20TokenSymbol}
deadlineDate={new Date(deadline).toLocaleString()}
overrideIsList={false}
escrowTitle={escrowTitle}
extraDescriptionUri={extraDescriptionUri}
isPreview={true}
deadline={new Date(deadline).getTime()}
{...{
receivingQuantity,
sellerAddress,
sendingQuantity,
escrowType,
deliverableText,
escrowTitle,
extraDescriptionUri,
}}
/>
<NavigationButtons prevRoute="/new-transaction/notifications" nextRoute="/new-transaction/deliverable" />
</Container>
Expand Down

0 comments on commit b5564cc

Please sign in to comment.