Skip to content

Commit 251cb9a

Browse files
committed
登录页增加 Personal Access Token 获取引导提示
1 parent 948c84e commit 251cb9a

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

V2exOS/Views/ProfileView.swift

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,28 @@ struct ProfileView: View {
1616
@State var isAccessTokenChecked: Bool? = nil
1717
@State var isSaveTokenLoading = false
1818

19+
@State private var showingPopover = false
20+
1921
var body: some View {
2022

21-
Group {
23+
VStack {
24+
25+
Spacer()
26+
2227
if let _ = currentUser.accessToken {
2328
profile
2429
}else{
2530
loginView
2631
}
32+
33+
Spacer()
34+
35+
Link(destination: URL(string: "https://github.com/isaced/V2exOS")!) {
36+
Text("github.com/isaced/V2exOS")
37+
.underline()
38+
.padding(20)
39+
}
40+
2741
}
2842
.navigationTitle("用户")
2943
.toolbar {
@@ -57,6 +71,26 @@ struct ProfileView: View {
5771
TextField("Personal Access Token", text: $accessToken, prompt: Text("00000000-0000-0000-0000-000000000000"))
5872
.frame(width: 450)
5973

74+
Button {
75+
showingPopover.toggle()
76+
} label: {
77+
Image(systemName: "questionmark.circle")
78+
}
79+
.buttonStyle(PlainButtonStyle())
80+
.popover(isPresented: $showingPopover) {
81+
Link(destination: URL(string: "https://v2ex.com/settings/tokens")!) {
82+
Text("请前往 v2ex.com/settings/tokens 生成")
83+
}
84+
.padding()
85+
.onHover { inside in
86+
if inside {
87+
NSCursor.pointingHand.push()
88+
} else {
89+
NSCursor.pop()
90+
}
91+
}
92+
}
93+
6094
if isSaveTokenLoading {
6195

6296
ProgressView()
@@ -108,7 +142,7 @@ struct ProfileView: View {
108142
struct ProfileView_Previews: PreviewProvider {
109143
static var previews: some View {
110144
ProfileView()
111-
.frame(width: 400.0, height: 400.0)
145+
112146
.environmentObject(CurrentUserStore())
113147
}
114148
}

0 commit comments

Comments
 (0)