-
Notifications
You must be signed in to change notification settings - Fork 237
Feat/blocked landing #770
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/blocked landing #770
Changes from all commits
9130c31
a104588
859e386
10423f3
28c34e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <!doctype html> | ||
| <html lang=""> | ||
|
|
||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
| <meta name="viewport" content="width=device-width,initial-scale=1.0" /> | ||
| <link rel="icon" href="/favicon.ico" /> | ||
| <title>Enkrypt Extension - Everything in the blockchain made easy</title> | ||
| </head> | ||
|
|
||
| <body> | ||
| <noscript> | ||
| <strong>We're sorry but Enkrypt doesn't work properly without JavaScript | ||
| enabled. Please enable it to continue.</strong> | ||
| </noscript> | ||
| <div id="app"></div> | ||
| <script type="module" src="/src/ui/blocked/main.ts"></script> | ||
| </body> | ||
|
|
||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { ProviderName, ProviderNameProper } from "@enkryptcom/swap/src/types" | ||
|
|
||
| import changellyLogo from '@/ui/action/assets/swap/changelly-logo.png' | ||
| import oneInch from '@/ui/action/assets/swap/1inch-logo.png' | ||
| import paraswap from '@/ui/action/assets/swap/paraswap-logo.png' | ||
| import zerox from '@/ui/action/assets/swap/0x-logo.png' | ||
| import rango from '@/ui/action/assets/swap/rango-logo.png' | ||
| import jupiter from '@/ui/action/assets/swap/jupiter-logo.png' | ||
| import okx from '@/ui/action/assets/swap/okx-logo.png' | ||
|
|
||
| export default { | ||
| [ProviderName.changelly]: { name: ProviderNameProper.changelly, logo: changellyLogo }, | ||
| [ProviderName.oneInch]: { name: ProviderNameProper.oneInch, logo: oneInch }, | ||
| [ProviderName.oneInchFusion]: { name: ProviderNameProper.oneInchFusion, logo: oneInch }, | ||
| [ProviderName.paraswap]: { name: ProviderNameProper.paraswap, logo: paraswap }, | ||
| [ProviderName.zerox]: { name: ProviderNameProper.zerox, logo: zerox }, | ||
| [ProviderName.rango]: { name: ProviderNameProper.rango, logo: rango }, | ||
| [ProviderName.jupiter]: { name: ProviderNameProper.jupiter, logo: jupiter }, | ||
| [ProviderName.okx]: { name: ProviderNameProper.okx, logo: okx } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <template> | ||
| <svg | ||
| width="24" | ||
| height="24" | ||
| viewBox="0 0 24 24" | ||
| fill="none" | ||
| stroke="#444" | ||
| stroke-width="1.6" | ||
| stroke-linecap="round" | ||
| stroke-linejoin="round" | ||
| > | ||
| <rect x="6" y="3" width="12" height="18" rx="2" ry="2" /> | ||
| <path d="M9 3.5V2.8C9 2.36 9.36 2 9.8 2h4.4c.44 0 .8.36.8.8v.7" /> | ||
| <rect x="9" y="3" width="6" height="2.8" rx="0.6" ry="0.6" fill="#fff" /> | ||
| <path d="M9 9h6M9 13h4M9 17h3" stroke="#888" /> | ||
| </svg> | ||
| </template> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,19 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <a class="best-offer-list-item" @click="select"> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <div> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <img | ||||||||||||||||||||||||||||||||||||||||||||||||||
| v-if="providersDetails[props.provider]" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| :src="providersDetails[props.provider].logo" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Image element should be accessible with alt text. The provider logo image lacks an Add an alt attribute: <img
v-if="providersDetails[props.provider]"
:src="providersDetails[props.provider].logo"
+ :alt="`${providersDetails[props.provider].name} logo`"
/>🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <div class="best-offer-list-item__info"> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Offer {{ swapNumber }}</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| <p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| props.provider | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ? providersDetails[props.provider].name | ||||||||||||||||||||||||||||||||||||||||||||||||||
| : 'Unknown Provider' | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </p> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+10
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential runtime error when accessing provider details. The code checks Apply defensive coding to handle missing provider details: <p>
{{
props.provider
- ? providersDetails[props.provider].name
+ ? providersDetails[props.provider]?.name || 'Unknown Provider'
: 'Unknown Provider'
}}
</p>Alternatively, consolidate the logic: - <p>
- {{
- props.provider
- ? providersDetails[props.provider].name
- : 'Unknown Provider'
- }}
- </p>
+ <p>
+ {{ providersDetails[props.provider]?.name || 'Unknown Provider' }}
+ </p>📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
| <h5>{{ amount }}</h5> | ||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -19,14 +31,23 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
| import DoneIcon from '@action/icons/common/done_icon.vue'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import LottieStatusJson from '@action/assets/animation/status.json'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Vue3Lottie } from 'vue3-lottie'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { ProviderName } from '@enkryptcom/swap/src/types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import providersDetails from '@/libs/utils/providersDetails'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { PropType } from 'vue'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| defineProps({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const props = defineProps({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| select: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| type: Function as () => void, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| type: Function as PropType<() => void>, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| default: () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| provider: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| type: String as PropType<ProviderName>, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| default: () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| swapNumber: { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| type: Number, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| default: () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -60,7 +81,7 @@ defineProps({ | |||||||||||||||||||||||||||||||||||||||||||||||||
| .best-offer-list-item { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 56px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 8px 12px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 8px 4px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| justify-content: flex-start; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -77,8 +98,7 @@ defineProps({ | |||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| img { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 32px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 32px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 20px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| margin-right: 8px; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
| <template> | ||
| <div class="swap-best-offer-block"> | ||
| <h3>Best offer including network fee</h3> | ||
| <h3> | ||
| Best offer including network fee powered by | ||
| <img :src="providersDetails[props.pickedTrade.provider].logo" /> | ||
| {{ providersDetails[props.pickedTrade.provider].name }} | ||
| </h3> | ||
|
Comment on lines
+3
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add defensive checks for provider details access. The code directly accesses Add defensive checks or fallbacks: <h3>
Best offer including network fee powered by
- <img :src="providersDetails[props.pickedTrade.provider].logo" />
- {{ providersDetails[props.pickedTrade.provider].name }}
+ <img :src="providersDetails[props.pickedTrade.provider]?.logo" />
+ {{ providersDetails[props.pickedTrade.provider]?.name || props.pickedTrade.provider }}
</h3>And similarly for lines 50-54: <p>
Provider:
<img
height="15px"
- :src="providersDetails[props.pickedTrade.provider].logo"
+ :src="providersDetails[props.pickedTrade.provider]?.logo"
/>
- {{ providersDetails[props.pickedTrade.provider].name }}
+ {{ providersDetails[props.pickedTrade.provider]?.name || props.pickedTrade.provider }}
</p>Also applies to: 48-55 🤖 Prompt for AI Agents |
||
| <div class="swap-best-offer-block__for"> | ||
| for<img :src="fromToken.logoURI" /> | ||
| <p> | ||
|
|
@@ -41,6 +45,14 @@ | |
| /> | ||
| </div> | ||
| <div class="swap-best-offer-block__info"> | ||
| <p> | ||
| Provider: | ||
| <img | ||
| height="15px" | ||
| :src="providersDetails[props.pickedTrade.provider].logo" | ||
| /> | ||
| {{ providersDetails[props.pickedTrade.provider].name }} | ||
| </p> | ||
| <p> | ||
| Rate: 1 {{ fromToken.symbol.toUpperCase() }} ≈ | ||
| {{ $filters.formatFloatingPointValue(ratio).value }} | ||
|
|
@@ -89,6 +101,7 @@ import { | |
| SwapToken, | ||
| } from '@enkryptcom/swap'; | ||
| import { imageLoadError } from '@/ui/action/utils/misc'; | ||
| import providersDetails from '@/libs/utils/providersDetails'; | ||
|
|
||
| interface SwapBestOfferProps { | ||
| trades: ProviderSwapResponse[]; | ||
|
|
@@ -178,6 +191,11 @@ const toggleOffers = () => { | |
| letter-spacing: 0.15px; | ||
| color: @primaryLabel; | ||
| margin: 0 0 8px 0; | ||
|
|
||
| img { | ||
| margin-left: 2px; | ||
| width: 20px; | ||
| } | ||
| } | ||
|
|
||
| &__for { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,122 @@ | ||||||||||||||||||||||||||||||||
| <template> | ||||||||||||||||||||||||||||||||
| <div class="blocked__container"> | ||||||||||||||||||||||||||||||||
| <logo class="blocked__logo" /> | ||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: Missing import for logo component. The template uses Add the logo import to the script section: -<script setup lang="ts"></script>
+<script setup lang="ts">
+import Logo from '@action/icons/common/logo.vue';
+</script>Note: Verify the correct path for the logo component in your codebase. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| <div class="blocked__wrap"> | ||||||||||||||||||||||||||||||||
| <router-view /> | ||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||
| </template> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <script setup lang="ts"></script> | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| <style lang="less"> | ||||||||||||||||||||||||||||||||
| @import '@action/styles/theme.less'; | ||||||||||||||||||||||||||||||||
| @import (css) | ||||||||||||||||||||||||||||||||
| url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap'); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| body { | ||||||||||||||||||||||||||||||||
| width: 100vw; | ||||||||||||||||||||||||||||||||
| height: 100vh; | ||||||||||||||||||||||||||||||||
| margin: 0; | ||||||||||||||||||||||||||||||||
| overflow: hidden; | ||||||||||||||||||||||||||||||||
| font-size: 0; | ||||||||||||||||||||||||||||||||
| font-family: 'Roboto', sans-serif; | ||||||||||||||||||||||||||||||||
| overflow-y: auto; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| .blocked { | ||||||||||||||||||||||||||||||||
| &__logo { | ||||||||||||||||||||||||||||||||
| position: absolute; | ||||||||||||||||||||||||||||||||
| left: 32px; | ||||||||||||||||||||||||||||||||
| top: 24px; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &__back { | ||||||||||||||||||||||||||||||||
| position: absolute; | ||||||||||||||||||||||||||||||||
| top: 8px; | ||||||||||||||||||||||||||||||||
| left: 8px; | ||||||||||||||||||||||||||||||||
| border-radius: 8px; | ||||||||||||||||||||||||||||||||
| cursor: pointer; | ||||||||||||||||||||||||||||||||
| padding: 8px; | ||||||||||||||||||||||||||||||||
| transition: background 300ms ease-in-out; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &:hover { | ||||||||||||||||||||||||||||||||
| background: @black007; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &__container { | ||||||||||||||||||||||||||||||||
| background-color: @lightBg; | ||||||||||||||||||||||||||||||||
| width: 100vw; | ||||||||||||||||||||||||||||||||
| height: 100vh; | ||||||||||||||||||||||||||||||||
| position: relative; | ||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||
| flex-direction: row; | ||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||
| justify-content: center; | ||||||||||||||||||||||||||||||||
| min-height: 700px; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &__wrap { | ||||||||||||||||||||||||||||||||
| width: 460px; | ||||||||||||||||||||||||||||||||
| height: 650px; | ||||||||||||||||||||||||||||||||
| background: @white; | ||||||||||||||||||||||||||||||||
| box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.16); | ||||||||||||||||||||||||||||||||
| border-radius: 12px; | ||||||||||||||||||||||||||||||||
| padding: 40px; | ||||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||||
| position: relative; | ||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||
| flex-direction: row; | ||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||
| justify-content: flex-start; | ||||||||||||||||||||||||||||||||
| overflow: hidden; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &--ready { | ||||||||||||||||||||||||||||||||
| background: transparent; | ||||||||||||||||||||||||||||||||
| box-shadow: none; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &--auto-height { | ||||||||||||||||||||||||||||||||
| height: auto; | ||||||||||||||||||||||||||||||||
| max-height: 600px; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &__info { | ||||||||||||||||||||||||||||||||
| position: absolute; | ||||||||||||||||||||||||||||||||
| right: 8px; | ||||||||||||||||||||||||||||||||
| top: 8px; | ||||||||||||||||||||||||||||||||
| background: @tip; | ||||||||||||||||||||||||||||||||
| border: 1px solid rgba(0, 0, 0, 0.1); | ||||||||||||||||||||||||||||||||
| width: 301px; | ||||||||||||||||||||||||||||||||
| height: 96px; | ||||||||||||||||||||||||||||||||
| border-radius: 10px; | ||||||||||||||||||||||||||||||||
| padding: 12px 20px; | ||||||||||||||||||||||||||||||||
| box-sizing: border-box; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| h4 { | ||||||||||||||||||||||||||||||||
| font-style: normal; | ||||||||||||||||||||||||||||||||
| font-weight: 500; | ||||||||||||||||||||||||||||||||
| font-size: 16px; | ||||||||||||||||||||||||||||||||
| line-height: 24px; | ||||||||||||||||||||||||||||||||
| color: @primaryLabel; | ||||||||||||||||||||||||||||||||
| margin: 0; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| p { | ||||||||||||||||||||||||||||||||
| font-style: normal; | ||||||||||||||||||||||||||||||||
| font-weight: 400; | ||||||||||||||||||||||||||||||||
| font-size: 16px; | ||||||||||||||||||||||||||||||||
| line-height: 24px; | ||||||||||||||||||||||||||||||||
| color: @black07; | ||||||||||||||||||||||||||||||||
| margin: 0; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| &__online { | ||||||||||||||||||||||||||||||||
| width: 16px; | ||||||||||||||||||||||||||||||||
| height: 16px; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| </style> | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Add type annotation for better type safety.
The exported object lacks a type annotation, which reduces type safety when accessing provider details elsewhere in the codebase. This makes it easier for runtime errors to occur when accessing non-existent properties.
Add a typed interface and annotation:
This provides compile-time checking that all
ProviderNameenum values are present in the mapping.🤖 Prompt for AI Agents