Skip to content

Commit 8728efe

Browse files
committed
优化仓库列表样式
1 parent 74d4899 commit 8728efe

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

SwiftPamphletApp/GItHubAPI/DetailView/RepoView.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ struct RepoView: View {
2525
HStack {
2626
Text(vm.repo.name).font(.system(.largeTitle))
2727
Text("(\(vm.repo.fullName))")
28-
Text("Star \(vm.repo.stargazersCount)")
28+
}
29+
HStack {
30+
Image(systemName: "star.fill").foregroundColor(.red)
31+
Text("\(vm.repo.stargazersCount)")
32+
Image(systemName: "tuningfork").foregroundColor(.cyan)
33+
Text("\(vm.repo.forks)")
2934
Text("议题 \(vm.repo.openIssues)")
3035
Text("语言 \(vm.repo.language ?? "")")
3136
ButtonGoGitHubWeb(url: vm.repo.htmlUrl ?? "https://github.com", text: "在 GitHub 上访问")

SwiftPamphletApp/GItHubAPI/GitHubAPIModel.swift

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ struct RepoModel: Jsonable {
128128
var fullName: String = ""
129129
var description: String?
130130
var stargazersCount: Int = 0
131+
var forks: Int = 0
131132
var openIssues: Int = 0
132133
var language: String?
133134
var htmlUrl: String?

SwiftPamphletApp/GItHubAPI/ListView/ExploreRepoListView.swift

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import SwiftUI
99

1010
struct ExploreRepoListView: View {
1111
@EnvironmentObject var appVM: AppVM
12+
@State private var isExpended = false
1213
var body: some View {
1314
List {
1415
Section {
@@ -22,7 +23,8 @@ struct ExploreRepoListView: View {
2223
}
2324
// end Section
2425
ForEach(appVM.exps) { er in
25-
Section {
26+
27+
DisclosureGroup {
2628
ForEach(er.repos) { r in
2729
if (appVM.expNotis[r.id]?.unRead ?? 0) > 0 {
2830

@@ -32,10 +34,10 @@ struct ExploreRepoListView: View {
3234
}
3335
} // end if
3436
} // end ForEach
35-
} header: {
36-
Text(er.name).font(.title)
37-
} // end Section
38-
37+
} label: {
38+
Text(er.name).font(.title3)
39+
}
40+
.padding(EdgeInsets(top: 2, leading: 0, bottom: 2, trailing: 0))
3941
} // end ForEach
4042
} // end List
4143
.navigationTitle("👾 探索库")
@@ -106,8 +108,8 @@ struct ExpListLinkView: View {
106108
.font(.footnote)
107109
.foregroundColor(.secondary)
108110
}
109-
Divider()
110-
.padding(EdgeInsets(top: 5, leading: 0, bottom: 10, trailing: 0))
111+
// Divider()
112+
// .padding(EdgeInsets(top: 5, leading: 0, bottom: 10, trailing: 0))
111113
} // end VStack
112114

113115
} // end body

SwiftPamphletApp/SwiftPamphletAppConfig.swift

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct SPC {
1414
static let githubHost = "https://github.com/"
1515
static let pamphletIssueRepoName = "KwaiAppTeam/SwiftPamphletApp"
1616

17-
static let timerForReposSec: Double = 120
1817
static let timerForDevsSec: Double = 160
1918
static let timerForExpSec: Double = 125
2019
static let timerForRssSec: Double = 60 * 60

0 commit comments

Comments
 (0)