feat: userrname

This commit is contained in:
jinyaqiu 2025-08-21 16:43:26 +08:00
parent 44de40cf83
commit 599ea6eae7
5 changed files with 54 additions and 31 deletions

View File

@ -7,7 +7,7 @@
<key>wake.xcscheme_^#shared#^_</key> <key>wake.xcscheme_^#shared#^_</key>
<dict> <dict>
<key>orderHint</key> <key>orderHint</key>
<integer>3</integer> <integer>0</integer>
</dict> </dict>
</dict> </dict>
</dict> </dict>

View File

@ -23,7 +23,7 @@
<key>UIAppFonts</key> <key>UIAppFonts</key>
<array> <array>
<string>Inter.ttf</string> <string>Inter.ttf</string>
<string>Quicksand X.ttf</string> <string>Quicksand x.ttf</string>
<string>Quicksand-Regular.ttf</string> <string>Quicksand-Regular.ttf</string>
<string>Quicksand-Bold.ttf</string> <string>Quicksand-Bold.ttf</string>
<string>Quicksand-SemiBold.ttf</string> <string>Quicksand-SemiBold.ttf</string>

View File

@ -5,9 +5,11 @@ public struct AvatarPicker: View {
@State private var showMediaPicker = false @State private var showMediaPicker = false
@State private var isUploading = false @State private var isUploading = false
@Binding var selectedImage: UIImage? @Binding var selectedImage: UIImage?
@Binding var showUsername: Bool
public init(selectedImage: Binding<UIImage?>) { public init(selectedImage: Binding<UIImage?>, showUsername: Binding<Bool>) {
self._selectedImage = selectedImage self._selectedImage = selectedImage
self._showUsername = showUsername
} }
public var body: some View { public var body: some View {
@ -37,23 +39,25 @@ public struct AvatarPicker: View {
} }
} }
} }
if !showUsername {
// Upload button // Upload button
Button(action: { Button(action: {
showMediaPicker = true showMediaPicker = true
}) { }) {
Text("Upload from Gallery") Text("Upload from Gallery")
.font(Typography.font(for: .subtitle, family: .inter)) .font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular) .fontWeight(.regular)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding() .padding()
.foregroundColor(.black) .foregroundColor(.black)
.background( .background(
RoundedRectangle(cornerRadius: 16) RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight) .fill(Color.themePrimaryLight)
) )
}
.frame(maxWidth: .infinity)
} }
.frame(width: .infinity)
} }
.sheet(isPresented: $showMediaPicker) { .sheet(isPresented: $showMediaPicker) {
MediaPicker( MediaPicker(

View File

@ -4,12 +4,13 @@ struct UserInfo: View {
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
// Sample user data - replace with your actual data model // Sample user data - replace with your actual data model
@State private var userName = "MeMo" @State private var userName = ""
@State private var userEmail = "memo@example.com" @State private var userEmail = "memo@example.com"
@State private var notificationsEnabled = true @State private var notificationsEnabled = true
@State private var darkModeEnabled = false @State private var darkModeEnabled = false
@State private var showLogoutAlert = false @State private var showLogoutAlert = false
@State private var avatarImage: UIImage? // Add this line @State private var avatarImage: UIImage?
@State private var showUsername: Bool = false
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
@ -46,29 +47,47 @@ struct UserInfo: View {
Spacer() Spacer()
VStack(spacing: 20) { VStack(spacing: 20) {
// Title // Title
Text("Add Your Avatar") Text(showUsername ? "Add Your Avatar" : "Whats Your Name")
.font(Typography.font(for: .body, family: .quicksandBold)) .font(Typography.font(for: .body, family: .quicksandBold))
.frame(maxWidth: .infinity, alignment: .center) .frame(maxWidth: .infinity, alignment: .center)
// Avatar // Avatar
ZStack { ZStack {
AvatarPicker(selectedImage: $avatarImage) AvatarPicker(
selectedImage: $avatarImage,
showUsername: $showUsername
)
} }
.padding(.top, 20) .padding(.top, 20)
Button(action: { if !showUsername {
// Action for second button Button(action: {
}) { // Action for second button
Text("Take a Photo") }) {
Text("Take a Photo")
.font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular)
.frame(maxWidth: .infinity)
.padding()
.foregroundColor(.black)
.background(
RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight)
)
}
}
if showUsername {
TextField("Username", text: $userName)
.font(Typography.font(for: .subtitle, family: .inter)) .font(Typography.font(for: .subtitle, family: .inter))
.fontWeight(.regular) .multilineTextAlignment(.center)
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
.padding() .padding()
.foregroundColor(.black) .foregroundColor(.black)
.background( .background(
RoundedRectangle(cornerRadius: 16) RoundedRectangle(cornerRadius: 16)
.fill(Color.themePrimaryLight) .fill(Color.themePrimaryLight)
) )
} }
} }
.padding() .padding()
@ -76,7 +95,7 @@ struct UserInfo: View {
.cornerRadius(20) .cornerRadius(20)
Spacer() Spacer()
Button(action: { Button(action: {
// Action for next button showUsername = true
}) { }) {
Text("Continue") Text("Continue")
.font(Typography.font(for: .body)) .font(Typography.font(for: .body))