Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add animation on the Smart Transaction status page #24389

Merged
merged 1 commit into from
May 7, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ exports[`SmartTransactionStatusPage renders the "Sorry for the wait" pending sta
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -58,6 +61,9 @@ exports[`SmartTransactionStatusPage renders the "Sorry for the wait" pending sta
</p>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -83,8 +89,11 @@ exports[`SmartTransactionStatusPage renders the "cancelled" STX status 1`] = `
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -119,6 +128,9 @@ exports[`SmartTransactionStatusPage renders the "cancelled" STX status 1`] = `
</button>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -144,8 +156,11 @@ exports[`SmartTransactionStatusPage renders the "deadline_missed" STX status 1`]
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -180,6 +195,9 @@ exports[`SmartTransactionStatusPage renders the "deadline_missed" STX status 1`]
</button>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -205,8 +223,11 @@ exports[`SmartTransactionStatusPage renders the "reverted" STX status 1`] = `
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -241,6 +262,9 @@ exports[`SmartTransactionStatusPage renders the "reverted" STX status 1`] = `
</button>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -266,8 +290,11 @@ exports[`SmartTransactionStatusPage renders the "success" STX status 1`] = `
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand All @@ -293,6 +320,9 @@ exports[`SmartTransactionStatusPage renders the "success" STX status 1`] = `
</button>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -318,8 +348,11 @@ exports[`SmartTransactionStatusPage renders the "unknown" STX status 1`] = `
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -354,6 +387,9 @@ exports[`SmartTransactionStatusPage renders the "unknown" STX status 1`] = `
</button>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand All @@ -379,8 +415,11 @@ exports[`SmartTransactionStatusPage renders the component with initial props 1`]
style="flex-grow: 1;"
>
<div
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center"
class="mm-box mm-box--padding-right-6 mm-box--padding-left-6 mm-box--display-flex mm-box--flex-direction-column mm-box--align-items-center mm-box--width-full"
>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top mm-box--margin-top-3"
/>
<div
class="mm-box mm-box--display-flex"
style="font-size: 48px;"
Expand Down Expand Up @@ -427,6 +466,9 @@ exports[`SmartTransactionStatusPage renders the component with initial props 1`]
</p>
</div>
</div>
<div
class="mm-box smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom mm-box--margin-top-3"
/>
</div>
<div
class="mm-box smart-transaction-status-page__footer mm-box--padding-4 mm-box--padding-bottom-0 mm-box--display-flex mm-box--flex-direction-column mm-box--width-full"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

@keyframes shift {
to {
background-position: 100% 0;
}
}

.smart-transaction-status-page {
text-align: center;

Expand Down Expand Up @@ -31,4 +37,27 @@
width: 100%;
text-align: left;
}

&__background-animation {
position: relative;
left: -88px;
background-repeat: repeat;
background-position: 0 0;

&--top {
width: 1634px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a future PR:
Where do these constants come from? Should we use computed values or constants?
cc @georgewrmarshall from DS team.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tag @dbrans! I tend to think arbitrary values in styles are code smells, but sometimes they are necessary. It would be great to see a screencast of these changes in the PR description so I can review without having to checkout the branch and locate where these changes are implemented @dan437 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This width is twice the size of the transaction-background-top.svg image (817px) and I believe it was used in the past to make the animation work properly. We just reused the same code for animation from Smart Swaps as a short term solution. We will be replacing it with a long term solution once it's designed.

height: 54px;
background-size: 817px 54px;
background-image: url('/images/transaction-background-top.svg');
animation: shift 19s linear infinite;
}

&--bottom {
width: 1600px;
height: 62px;
background-size: 800px 62px;
background-image: url('/images/transaction-background-bottom.svg');
animation: shift 22s linear infinite;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,12 @@ export const SmartTransactionStatusPage = ({
alignItems={AlignItems.center}
paddingLeft={6}
paddingRight={6}
width={BlockSize.Full}
>
<Box
marginTop={3}
className="smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--top"
/>
<SmartTransactionsStatusIcon
iconName={iconName}
iconColor={iconColor}
Expand All @@ -517,6 +522,10 @@ export const SmartTransactionStatusPage = ({
transactionId={fullTxData.id}
/>
)}
<Box
marginTop={3}
className="smart-transaction-status-page__background-animation smart-transaction-status-page__background-animation--bottom"
/>
</Box>
<SmartTransactionsStatusPageFooter
isDapp={isDapp}
Expand Down
Loading