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

CLI-627: vault landing screen graph #221

Merged
merged 4 commits into from
Aug 8, 2024
Merged

CLI-627: vault landing screen graph #221

merged 4 commits into from
Aug 8, 2024

Conversation

mike-dydx
Copy link
Contributor

Links (dYdX Internal Use Only)

Linear Ticket: CLI-627: vault landing screen graph

Figma Design: design


Description / Intuition

  • new RadioButtonGroup which is a lightweight version of TabGroup with a bit more SwiftUI API readiness (binding)
  • adds graph to vault screen

Before/After Screenshots or Videos

Before After
Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-08-07.at.11.43.50.mp4

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring or Technical Debt
  • Documentation update
  • Other (please describe: )

Copy link

linear bot commented Aug 7, 2024

@@ -120,6 +120,7 @@ import Foundation
open func stringForValue(_ value: Double, axis _: AxisBase?) -> String {
var result: String = ""
if let anchor = GraphingAnchor.shared?.date {
// what is 2500 here?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ruixhuang any idea on this number?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure... Try changing it and see how it looks

Comment on lines +206 to +211
fileprivate class TimeAxisValueFormatter: DateFormatter, IAxisValueFormatter {
func stringForValue(_ value: Double, axis: AxisBase?) -> String {
let date = Date(timeIntervalSince1970: value)
return self.string(from: date)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The alternative DateTimeAxisFormatter seems to be doing a lot of work and it did not really match the vault designs for xAxis value formatting so I opted for a custom formatter which uses an out-of-the-box DateFormatter more or less. Unsure why DateTimeAxisFormatter is so complicated.

Comment on lines +106 to +115
// TODO: delete and replace with real data
private var cancellables = Set<AnyCancellable>()
init() {
super.init()
Timer.publish(every: 1, triggerNow: true)
.sink { [weak self] _ in
self?.setEntries()
}
.store(in: &cancellables)
}
Copy link
Contributor Author

@mike-dydx mike-dydx Aug 7, 2024

Choose a reason for hiding this comment

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

just for testing before abacus is hooked up

Comment on lines +66 to +73
//TODO: remove
// this is just for testing
let now = Date().timeIntervalSince1970
let finalTimeSecondsAway = selectedValueTime == .oneDay ? 3600.0*24.0 : selectedValueTime == .sevenDays ? 3600.0*24.0*7.0 : 3600.0*24.0*30.0
let numEntries = Int.random(in: 0..<100)
let entries = (0..<numEntries).map { i in
ChartDataEntry(x: now + Double(i)/Double(numEntries) * finalTimeSecondsAway, y: Double.random(in: 0..<100))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just for testing before abacus is hooked up

@ruixhuang ruixhuang merged commit bb5ea49 into develop Aug 8, 2024
2 checks passed
@ruixhuang ruixhuang deleted the mike/add-chart-2 branch August 8, 2024 00:26
mike-dydx added a commit that referenced this pull request Aug 20, 2024
* add chart radio buttons

* fine tune graph

* comment

* comment

---------

Co-authored-by: Mike <[email protected]>
mike-dydx added a commit that referenced this pull request Aug 21, 2024
* add chart radio buttons

* fine tune graph

* comment

* comment

---------

Co-authored-by: Mike <[email protected]>
mike-dydx added a commit that referenced this pull request Aug 21, 2024
* add chart radio buttons

* fine tune graph

* comment

* comment

---------

Co-authored-by: Mike <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants