Skip to content

Commit

Permalink
TRCL-3281 : Add transfer entry point to profile page pt 2 - UI Tweaks (
Browse files Browse the repository at this point in the history
…#32)

* apply design feedback

* update more colors to match design

* enable profile buttons always

* clean up

undo podfile lock changes

* fix compile issue
  • Loading branch information
mike-dydx committed Aug 20, 2024
1 parent 517283b commit 66b8a41
Show file tree
Hide file tree
Showing 23 changed files with 44 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ public class PlatformButtonViewModel<Content: PlatformViewModeling>: PlatformVie
PlatformView(viewModel: self, parentStyle: parentStyle, styleKey: styleKey) { [weak self] style in
guard let self = self else { return AnyView(PlatformView.nilView) }

let disabled: Bool
if case .disabled = self.state {
disabled = true
} else {
disabled = false
}
let disabled = .disabled == self.state
return AnyView(
Group {
switch self.type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,19 @@ private struct SheetViewModifier: ViewModifier {
@EnvironmentObject var themeSettings: ThemeSettings

func body(content: Content) -> some View {
let dragIndicator = Rectangle()
.themeColor(background: .layer1)
.frame(width: 36, height: 4)
.clipShape(Capsule())
.padding(.top, topPadding)

if sheetStyle == .fullScreen {
return AnyView(
ZStack(alignment: .top) {
content
.cornerRadius(36, corners: [.topLeft, .topRight])
VStack {
Rectangle()
.themeColor(background: .layer1)
.frame(width: 36, height: 4)
.padding(.top, topPadding)
dragIndicator
Spacer()
}
}
Expand All @@ -208,10 +211,7 @@ private struct SheetViewModifier: ViewModifier {
content
.cornerRadius(36, corners: [.topLeft, .topRight])
VStack {
Rectangle()
.themeColor(background: .layer1)
.frame(width: 36, height: 4)
.padding(.top, topPadding)
dragIndicator
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Download.pdf",
"filename" : "icon_transfer_deposit.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Frame.svg",
"filename" : "icon_transfer_dydx.pdf",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Frame 1410.pdf",
"filename" : "icon_transfer_withdrawal.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "Vector.pdf",
"filename" : "settings_signout.pdf",
"idiom" : "universal"
}
],
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion dydx/dydxViews/dydxViews/Themes/ThemeLight.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"layer_1": "#EDF0F2",
"layer_2": "#F9FAFB",
"layer_3": "#EDF0F2",
"layer_4": "#E0E6EB",
"layer_4": "#FFFFFF",
"layer_5": "#E0E6EB",
"layer_6": "#D1D9E0",
"layer_7": "#C2CCD6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,19 @@ public class dydxProfileButtonsViewModel: PlatformViewModel {
self.createButton(parentStyle: style,
imageName: "icon_transfer_deposit",
title: DataLocalizer.localize(path: "APP.GENERAL.DEPOSIT"),
templateColor: self.onboarded ? .textSecondary : .textTertiary,
action: self.depositAction)

self.createButton(parentStyle: style,
imageName: "icon_transfer_withdrawal",
title: DataLocalizer.localize(path: "APP.GENERAL.WITHDRAW"),
templateColor: self.onboarded ? .textSecondary : .textTertiary,
action: self.withdrawAction)

self.createButton(parentStyle: style,
imageName: "icon_transfer_dydx",
title: DataLocalizer.localize(path: "APP.GENERAL.TRANSFER"),
templateColor: self.onboarded ? .textSecondary : .textTertiary,
action: self.transferAction)

if self.onboarded {
Expand All @@ -65,28 +68,29 @@ public class dydxProfileButtonsViewModel: PlatformViewModel {
}
}

private func createButton(parentStyle: ThemeStyle, imageName: String, title: String, styleKey: String? = nil, backgroundColor: ThemeColor.SemanticColor = .layer3, templateColor: ThemeColor.SemanticColor? = .textSecondary, action: (() -> Void)?) -> some View {
private func createButton(parentStyle: ThemeStyle, imageName: String, title: String, styleKey: String? = nil, backgroundColor: ThemeColor.SemanticColor = .layer3, templateColor: ThemeColor.SemanticColor?, action: (() -> Void)?) -> some View {
let icon = PlatformIconViewModel(type: .asset(name: imageName, bundle: Bundle.dydxView),
clip: .circle(background: backgroundColor, spacing: 24, borderColor: .layer6),
size: CGSize(width: 48, height: 48),
templateColor: templateColor)
return createButton(parentStyle: parentStyle, icon: icon, title: title, action: action)
}

private func createButton(parentStyle: ThemeStyle, icon: PlatformViewModel, title: String, action: (() -> Void)?) -> some View {
VStack {
PlatformButtonViewModel(content: icon,
type: .iconType,
state: .primary,
action: action ?? {})
.createView(parentStyle: parentStyle)

Text(title)
.themeFont(fontSize: .small)
.themeColor(foreground: .textTertiary)
.lineLimit(1)
let title = Text(title)
.themeFont(fontSize: .small)
.themeColor(foreground: templateColor ?? .textSecondary)
.lineLimit(1)

let buttonContent = VStack {
icon
title
}
.frame(maxWidth: .infinity)
.wrappedViewModel

return PlatformButtonViewModel(content: buttonContent,
type: .iconType,
action: action ?? {})
.createView(parentStyle: parentStyle)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class dydxProfileFeesViewModel: PlatformViewModel, Equatable {
}
.padding(16)
}
.themeColor(background: .layer4)
.themeColor(background: .layer3)
.cornerRadius(12, corners: .allCorners)
.onTapGesture { [weak self] in
self?.tapAction?()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class dydxProfileHeaderViewModel: PlatformViewModel {
}
}
.padding(.all, 20)
.themeColor(background: .layer4)
.themeColor(background: .layer3)
.cornerRadius(12, corners: .allCorners)
if let sourceAddress = self.sourceAddress {
HStack(spacing: 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class dydxProfileHistoryViewModel: PlatformViewModel {
VStack(spacing: 0) {
HStack {
Text(DataLocalizer.localize(path: "APP.GENERAL.HISTORY"))
.themeColor(foreground: .textSecondary)
.themeFont(fontSize: .small)
Spacer()
PlatformIconViewModel(type: .system(name: "chevron.right"),
Expand Down Expand Up @@ -145,7 +146,7 @@ public class dydxProfileHistoryViewModel: PlatformViewModel {
}
.frame(maxWidth: .infinity)
.frame(minHeight: 210)
.themeColor(background: .layer4)
.themeColor(background: .layer3)
.cornerRadius(12, corners: .allCorners)
.onTapGesture { [weak self] in
self?.tapAction?()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class dydxProfileRewardsViewModel: PlatformViewModel {
}
.padding(.horizontal, 16)
.padding(.vertical, 16)
.themeColor(background: .layer4)
.themeColor(background: .layer3)
.cornerRadius(14, corners: .allCorners)
)
}
Expand All @@ -66,7 +66,7 @@ public class dydxProfileRewardsViewModel: PlatformViewModel {
}

Text(nativeTokenName ?? "")
.themeColor(foreground: .textPrimary)
.themeColor(foreground: .textSecondary)
.themeFont(fontSize: .medium)

Spacer()
Expand Down Expand Up @@ -94,17 +94,18 @@ public class dydxProfileRewardsViewModel: PlatformViewModel {
private func createAmountPanel(style: ThemeStyle, title: String, amount: String) -> some View {
VStack(spacing: 16) {
Text(title)
.themeColor(foreground: .textSecondary)
.themeFont(fontSize: .small)
.leftAligned()

Text(amount)
.themeColor(foreground: .textPrimary)
.themeColor(foreground: .textTertiary)
.themeFont(fontType: .number, fontSize: .largest)
.leftAligned()

}
.padding(16)
.themeColor(background: .layer6)
.themeColor(background: .layer4)
.cornerRadius(10, corners: .allCorners)
.frame(maxWidth: .infinity)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class dydxSettingsHelpRowViewModel: PlatformViewModel {
}
.padding(.horizontal, 16)
.padding(.vertical, 22)
.themeColor(background: .layer4)
.themeColor(background: .layer3)
.cornerRadius(12, corners: .allCorners)
.frame(maxWidth: .infinity)
.onTapGesture {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public class WalletConnectionViewModel: PlatformViewModel {
.padding(.vertical, buttonContentVerticalPadding)
.themeColor(background: .layer3)
})
.borderAndClip(style: .capsule, borderColor: .layer6, lineWidth: buttonBorderWidth)
.borderAndClip(style: .cornerRadius(8), borderColor: .layer6, lineWidth: buttonBorderWidth)

let exportPhraseButton = Button(action: {
self?.exportSecretPhraseTapped?()
Expand Down
1 change: 1 addition & 0 deletions dydx/dydxViews/dydxViews/_v4/Wallet/Wallets2View.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class Wallets2ViewModel: PlatformViewModel {
Text(DataLocalizer.localize(path: "APP.GENERAL.MANAGE_WALLET", params: nil))
.themeFont(fontType: .bold, fontSize: .largest)
.padding(.top, 40)
.padding(.leading, 16)

VStack {
ForEach(self.walletConnections, id: \.id) { walletConnection in
Expand Down

0 comments on commit 66b8a41

Please sign in to comment.