-
Notifications
You must be signed in to change notification settings - Fork 7
feat: earn button on home #2337
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 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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,63 @@ | ||
| // | ||
| // EarnBanner.swift | ||
| // FRW | ||
| // | ||
| // Created by cat on 28/1/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct EarnBanner: View { | ||
| var body: some View { | ||
| Button{ | ||
| if let url = URL(string: AppUrl.earnUrl) { | ||
| Router.route(to: RouteMap.Explore.browser(url)) | ||
| } else { | ||
| HUD.error(title: "don't have earn url") | ||
| } | ||
| } label: { | ||
| HStack(alignment: .center, spacing: 0) { | ||
| VStack(alignment: .leading, spacing: 4) { | ||
| Text("Don’t miss out on $1,203 this year") | ||
| .font(.inter(size: 14)) | ||
| .lineLimit(1) | ||
| .foregroundStyle(Color.white) | ||
|
|
||
| Text("Earn 15% APY on Flow Vaults") | ||
| .font(.inter(size: 16, weight: .semibold)) | ||
| .lineLimit(1) | ||
| .foregroundStyle(Color.Brain.Primary.main) | ||
| } | ||
| Spacer() | ||
| Image("earn_icon_36") | ||
| .resizable() | ||
| .frame(width: 20, height: 20) | ||
| .padding(8) | ||
| .background(Color.Brain.Primary.main) | ||
| .clipShape(Circle()) | ||
| } | ||
| .padding(18) | ||
| .frame(width: .infinity, alignment: .leading) | ||
|
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. Using |
||
| .background( | ||
| LinearGradient( | ||
| stops: [ | ||
| Gradient.Stop(color: Color(red: 0.1, green: 0.1, blue: 0.1), location: 0.00), | ||
| Gradient.Stop(color: Color(red: 0, green: 0.94, blue: 0.55), location: 1.00), | ||
| ], | ||
| startPoint: UnitPoint(x: 0.75, y: 1), | ||
| endPoint: UnitPoint(x: 0.75, y: -5) | ||
| ) | ||
| ) | ||
| .cornerRadius(16) | ||
| .overlay( | ||
| RoundedRectangle(cornerRadius: 16) | ||
| .inset(by: 0.25) | ||
| .stroke(Color(red: 0.09, green: 1, blue: 0.6), lineWidth: 0.5) | ||
| ) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| EarnBanner() | ||
| } | ||
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,37 @@ | ||
| // | ||
| // EarnButton.swift | ||
| // FRW | ||
| // | ||
| // Created by cat on 28/1/26. | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| struct EarnButton: View { | ||
| var body: some View { | ||
| Button { | ||
| if let url = URL(string: AppUrl.earnUrl) { | ||
| Router.route(to: RouteMap.Explore.browser(url)) | ||
| } else { | ||
| HUD.error(title: "don't have earn url") | ||
| } | ||
| } label: { | ||
| HStack(spacing: 10) { | ||
| Text("earn".localized) | ||
| .font(.inter(size: 16, weight: .medium)) | ||
| .foregroundStyle(Color.Brain.Core.icons) | ||
| Image("earn_icon") | ||
| .resizable() | ||
| .frame(width: 20, height: 20) | ||
| } | ||
| .frame(height: 40) | ||
| .padding(.horizontal, 12) | ||
| .background(Color.Brain.Light.lines10) | ||
| .cornerRadius(20) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #Preview { | ||
| EarnButton() | ||
| } |
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
12 changes: 12 additions & 0 deletions
12
FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/Contents.json
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,12 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "earn_icon.svg", | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/earn_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/Contents.json
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,12 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "filename" : "earn_icon_36.pdf", | ||
| "idiom" : "universal" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "author" : "xcode", | ||
| "version" : 1 | ||
| } | ||
| } |
Binary file added
BIN
+5.77 KB
FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/earn_icon_36.pdf
Binary file not shown.
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.
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.
The
earnUrlis set to an empty string with a TODO comment. This will cause the button to always show an error message ("don't have earn url") when clicked sinceURL(string: "")returnsnil. Consider either:showEarnButtontofalseuntil the URL is available