-
Notifications
You must be signed in to change notification settings - Fork 237
Created Solana staking banners #708
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a97128a
Created Solana stacking banners
mihailpolev 93eb3e6
add Metrics
mihailpolev 10f5e84
Merge branch 'devop/release-2-9' into feature/solana-staking-banner
kvhnuke 26381e0
fix: solana banner
kvhnuke 4072980
fix: solana banner
kvhnuke caf9330
fix: solana banner
kvhnuke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import BrowserStorage from '../common/browser-storage'; | ||
| import { InternalStorageNamespace } from '@/types/provider'; | ||
| import { StorageKeys, IState } from './types'; | ||
|
|
||
| export default class BannersState { | ||
| private storage: BrowserStorage; | ||
|
|
||
| constructor() { | ||
| this.storage = new BrowserStorage(InternalStorageNamespace.bannersState); | ||
| } | ||
|
|
||
| private async getOrInitializeState(): Promise<IState> { | ||
| const state: IState | undefined = await this.storage.get( | ||
| StorageKeys.bannersInfo, | ||
| ); | ||
| if (state) { | ||
| return state; | ||
| } | ||
| const newState: IState = { | ||
| isHideSolanStakingBanner: false, | ||
| isHideNetworkAssetSolanStakingBanner: false, | ||
| }; | ||
| await this.storage.set(StorageKeys.bannersInfo, newState); | ||
| return newState; | ||
| } | ||
|
|
||
| async resetBanners(): Promise<void> { | ||
| const state = await this.getOrInitializeState(); | ||
| state.isHideNetworkAssetSolanStakingBanner = false; | ||
| state.isHideSolanStakingBanner = false; | ||
| await this.storage.set(StorageKeys.bannersInfo, state); | ||
| } | ||
|
|
||
| async showSolanaStakingBanner(): Promise<boolean> { | ||
| const state = await this.getOrInitializeState(); | ||
| return !state.isHideSolanStakingBanner; | ||
| } | ||
|
|
||
| async showNetworkAssetsSolanaStakingBanner(): Promise<boolean> { | ||
| const state = await this.getOrInitializeState(); | ||
| return !state.isHideNetworkAssetSolanStakingBanner; | ||
| } | ||
|
|
||
| async hideNetworkAssetsSolanaStakingBanner() { | ||
| const state = await this.getOrInitializeState(); | ||
| state.isHideNetworkAssetSolanStakingBanner = true; | ||
| await this.storage.set(StorageKeys.bannersInfo, state); | ||
| } | ||
|
|
||
| async hideSolanaStakingBanner() { | ||
| const state = await this.getOrInitializeState(); | ||
| state.isHideSolanStakingBanner = true; | ||
| this.storage.set(StorageKeys.bannersInfo, state); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export enum StorageKeys { | ||
| bannersInfo = 'banners-info', | ||
| } | ||
|
|
||
| export type IState = { | ||
| isHideSolanStakingBanner: boolean; | ||
| isHideNetworkAssetSolanStakingBanner: boolean; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+17.4 KB
packages/extension/src/ui/action/assets/banners/solana-stacking-banner-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+57.5 KB
...es/extension/src/ui/action/assets/banners/solana-stacking-banner-tokens-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+106 KB
packages/extension/src/ui/action/assets/banners/solana-stacking-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
119 changes: 119 additions & 0 deletions
119
packages/extension/src/ui/action/components/app-menu/components/solana-staking-banner.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| <template> | ||
| <div class="solana-stacking-banner"> | ||
| <img src="@action/assets/banners/solana-stacking-banner.png" alt="" /> | ||
|
|
||
| <div class="solana-stacking-banner__content"> | ||
| <enkrypt-staking-logo /> | ||
| <h5>Put your SOL to work — safely & easily.</h5> | ||
| <a href="javascript:void(0);" @click="openStakingLink" class="button" | ||
| ><span>Start Staking Now</span></a | ||
| > | ||
| </div> | ||
|
|
||
| <a class="solana-stacking-banner__close" @click="close"> | ||
| <close-icon /> | ||
| </a> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import CloseIcon from '@action/icons/common/close-icon.vue'; | ||
| import EnkryptStakingLogo from '@action/icons/common/enkrypt-staking-logo.vue'; | ||
| import { trackSolanaStakingBanner } from '@/libs/metrics'; | ||
| import { openLink } from '@action/utils/browser'; | ||
| import { SolanaStakingBannerEvents } from '@/libs/metrics/types'; | ||
|
|
||
| const emit = defineEmits<{ | ||
| (e: 'close'): void; | ||
| }>(); | ||
|
|
||
| const close = () => { | ||
| emit('close'); | ||
| }; | ||
| const openStakingLink = async () => { | ||
| trackSolanaStakingBanner(SolanaStakingBannerEvents.SolanaWalletClicked); | ||
| setTimeout(() => { | ||
| openLink('https://staking.enkrypt.com'); | ||
| }, 1000); | ||
| }; | ||
| </script> | ||
|
|
||
| <style lang="less"> | ||
| @import '@action/styles/theme.less'; | ||
|
|
||
| .solana-stacking-banner { | ||
| position: absolute; | ||
| width: 324px; | ||
| height: 128px; | ||
| left: 8px; | ||
| bottom: 8px; | ||
| background: #ffffff; | ||
| box-shadow: | ||
| 0px 8px 16px -6px rgba(0, 0, 0, 0.12), | ||
| 0px 6px 8px -6px rgba(0, 0, 0, 0.12); | ||
| border-radius: 12px; | ||
| padding: 0 129px 0 12px; | ||
| box-sizing: border-box; | ||
| overflow: hidden; | ||
|
|
||
| img { | ||
| height: 128px; | ||
| position: absolute; | ||
| right: 0; | ||
| top: 0; | ||
| } | ||
|
|
||
| &__content { | ||
| padding: 8px 0 0 0; | ||
|
|
||
| svg { | ||
| margin-bottom: 4px; | ||
| } | ||
|
|
||
| h5 { | ||
| font-size: 16px; | ||
| font-style: normal; | ||
| font-weight: 700; | ||
| line-height: 20px; | ||
| /* 125% */ | ||
| letter-spacing: 0.15px; | ||
| color: @primaryLabel; | ||
| margin: 0 0 8px 0; | ||
| background: linear-gradient(to left, #14f195, #64abf2, #9945ff); | ||
| -webkit-background-clip: text; | ||
| background-clip: text; | ||
| -webkit-text-fill-color: transparent; | ||
| } | ||
|
|
||
| .button { | ||
| text-decoration: none; | ||
| width: auto; | ||
| width: 163px; | ||
| height: 32px; | ||
| font-size: 12px; | ||
| line-height: 32px; | ||
| } | ||
| } | ||
|
|
||
| &__close { | ||
| position: absolute; | ||
| top: 0; | ||
| right: 0; | ||
| cursor: pointer; | ||
| transition: opacity 300ms ease-in-out; | ||
| opacity: 1; | ||
| font-size: 0; | ||
| width: 32px; | ||
| height: 32px; | ||
|
|
||
| svg { | ||
| width: 32px; | ||
| height: 32px; | ||
| } | ||
|
|
||
| &:hover { | ||
| opacity: 0.7; | ||
| } | ||
| } | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <template> | ||
| <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path fill-rule="evenodd" clip-rule="evenodd" d="M12.577 4.87832C12.6842 4.47822 13.0955 4.24079 13.4956 4.34799L18.2766 5.62908C18.4688 5.68056 18.6326 5.80626 18.732 5.97853C18.8315 6.15079 18.8585 6.35551 18.807 6.54764L17.5259 11.3287C17.4187 11.7288 17.0074 11.9663 16.6073 11.8591C16.2072 11.7519 15.9698 11.3406 16.077 10.9405L16.8865 7.91948C14.6303 9.30964 12.7541 11.0901 11.2935 13.1222C11.1651 13.3009 10.9646 13.4142 10.7452 13.432C10.5259 13.4498 10.3098 13.3704 10.1542 13.2148L7 10.0607L2.28033 14.7803C1.98744 15.0732 1.51256 15.0732 1.21967 14.7803C0.926777 14.4874 0.926777 14.0126 1.21967 13.7197L6.46967 8.46967C6.76256 8.17677 7.23744 8.17677 7.53033 8.46967L10.6039 11.5433C12.1049 9.63049 13.9633 7.95059 16.1492 6.61196L13.1073 5.79688C12.7072 5.68967 12.4698 5.27842 12.577 4.87832Z" fill="white" fill-opacity="0.7"/> | ||
| </svg> | ||
| </template> | ||
| <style scoped> | ||
| svg { | ||
| display: inline-block; | ||
| vertical-align: baseline; | ||
| } | ||
| </style> | ||
13 changes: 13 additions & 0 deletions
13
packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <template> | ||
| <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <path d="M10.7499 10.8176V13.4324C11.1816 13.3527 11.5745 13.2046 11.8876 12.9999C12.3698 12.6846 12.4999 12.352 12.4999 12.125C12.4999 11.898 12.3698 11.5654 11.8876 11.2501C11.5745 11.0454 11.1816 10.8973 10.7499 10.8176Z" fill="white" fill-opacity="0.7"/> | ||
| <path d="M8.32961 8.61947C8.38337 8.67543 8.44464 8.73053 8.51404 8.78416C8.72197 8.94484 8.97355 9.06777 9.25 9.1469V6.60315C9.17545 6.62449 9.10271 6.64901 9.03215 6.6766C8.98721 6.69417 8.94315 6.71299 8.90007 6.73302C8.75996 6.79816 8.63019 6.87614 8.51404 6.96589C8.13658 7.25757 8 7.59253 8 7.87503C8 8.05887 8.05784 8.26493 8.20228 8.46683C8.23898 8.51812 8.28126 8.56915 8.32961 8.61947Z" fill="white" fill-opacity="0.7"/> | ||
| <path fill-rule="evenodd" clip-rule="evenodd" d="M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM9.99994 4C10.4142 4 10.7499 4.33579 10.7499 4.75V5.06584C11.3423 5.17106 11.9182 5.40427 12.4031 5.77893C12.8293 6.10829 13.1467 6.51836 13.3282 6.97896C13.4801 7.36432 13.2908 7.79985 12.9055 7.95174C12.5201 8.10363 12.0846 7.91437 11.9327 7.52901C11.8599 7.34437 11.72 7.14675 11.4859 6.96586C11.278 6.80519 11.0264 6.68225 10.7499 6.60312V9.29944C11.448 9.39233 12.1327 9.61819 12.7085 9.99467C13.4955 10.5093 13.9999 11.2644 13.9999 12.125C13.9999 12.9856 13.4955 13.7407 12.7085 14.2553C12.1327 14.6318 11.448 14.8577 10.7499 14.9506V15.25C10.7499 15.6642 10.4142 16 9.99994 16C9.58573 16 9.24994 15.6642 9.24994 15.25V14.9506C8.55186 14.8577 7.8672 14.6318 7.29141 14.2553C6.80887 13.9398 6.4337 13.5376 6.21337 13.0672C6.0377 12.692 6.19937 12.2455 6.57449 12.0699C6.9496 11.8942 7.39611 12.0559 7.57178 12.431C7.65258 12.6035 7.81692 12.8067 8.11229 12.9999C8.42537 13.2046 8.8183 13.3526 9.24994 13.4324V10.6842C8.65762 10.5789 8.08167 10.3457 7.59681 9.97107C6.90033 9.43288 6.49994 8.68017 6.49994 7.875C6.49994 7.06983 6.90034 6.31712 7.59681 5.77893C8.08167 5.40427 8.65762 5.17106 9.24994 5.06584V4.75C9.24994 4.33579 9.58573 4 9.99994 4Z" fill="white" fill-opacity="0.7"/> | ||
| </svg> | ||
| </template> | ||
| <style scoped> | ||
| svg { | ||
| display: inline-block; | ||
| vertical-align: baseline; | ||
| } | ||
| </style> |
21 changes: 21 additions & 0 deletions
21
packages/extension/src/ui/action/icons/common/close-icon-white.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <template> | ||
| <svg | ||
| width="40" | ||
| height="40" | ||
| viewBox="0 0 40 40" | ||
| fill="none" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| > | ||
| <path | ||
| d="M26.3 13.71C25.91 13.32 25.28 13.32 24.89 13.71L20 18.59L15.11 13.7C14.72 13.31 14.09 13.31 13.7 13.7C13.31 14.09 13.31 14.72 13.7 15.11L18.59 20L13.7 24.89C13.31 25.28 13.31 25.91 13.7 26.3C14.09 26.69 14.72 26.69 15.11 26.3L20 21.41L24.89 26.3C25.28 26.69 25.91 26.69 26.3 26.3C26.69 25.91 26.69 25.28 26.3 24.89L21.41 20L26.3 15.11C26.68 14.73 26.68 14.09 26.3 13.71Z" | ||
| fill="white" | ||
| fill-opacity="0.70" | ||
| /> | ||
| </svg> | ||
| </template> | ||
kvhnuke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <style scoped> | ||
| svg { | ||
| display: inline-block; | ||
| vertical-align: baseline; | ||
| } | ||
| </style> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.