diff options
| author | Dustin Mierau <dustin@mierau.me> | 2023-12-06 22:52:09 -0800 |
|---|---|---|
| committer | Dustin Mierau <dustin@mierau.me> | 2023-12-06 22:52:09 -0800 |
| commit | e3392bb948ad53889ad334140952f2acf614668e (patch) | |
| tree | 74937a9202b3bb71f28ef9d8e0b3560bdd195b49 /Hotline/Views/NewsView.swift | |
| parent | 195af38221d1a4358455ba8501b87e4098da101b (diff) | |
Some work on news. More UI tweaks across the board.
Diffstat (limited to 'Hotline/Views/NewsView.swift')
| -rw-r--r-- | Hotline/Views/NewsView.swift | 89 |
1 files changed, 73 insertions, 16 deletions
diff --git a/Hotline/Views/NewsView.swift b/Hotline/Views/NewsView.swift index 5f2dbe9..9c4d34a 100644 --- a/Hotline/Views/NewsView.swift +++ b/Hotline/Views/NewsView.swift @@ -5,32 +5,89 @@ struct NewsView: View { @Environment(HotlineClient.self) private var hotline @State private var fetched = false + @State private var selectedCategory: HotlineNewsCategory? = nil + @State private var topListHeight: CGFloat = 200 + @State private var dividerHeight: CGFloat = 30 + + var topList: some View { + + // Your list content goes here + List { + ForEach(hotline.newsCategories, id: \.self) { cat in + DisclosureGroup { + ProgressView(value: 0.4) + .task { + print("EXPANDED?", cat.name) + hotline.sendGetNewsArticles(path: [cat.name]) { + print("OK") + } + } + } label: { + Text(cat.name) + .fontWeight(.medium) + .lineLimit(1) + .truncationMode(.tail) + } + } + } +// .listStyle(.plain) + } + + var bottomList: some View { + // Your list content goes here + ScrollView(.vertical) { + HStack(alignment: .top, spacing: 0) { + Text("HELLO") + .multilineTextAlignment(.leading) + Spacer() + } + .padding() + } + } var body: some View { -// @Bindable var config = appState NavigationStack { - ScrollView { - LazyVStack(alignment: .leading) { -// ForEach(hotline.messageBoardMessages, id: \.self) { -// Text($0) -// .lineLimit(100) -// .padding() -// .textSelection(.enabled) -// Divider() -// } + VStack(spacing: 0) { + topList + .frame(height: topListHeight) + VStack(alignment: .center) { + Divider() + Spacer() + HStack(alignment: .center) { + Image(systemName: "line.3.horizontal") + .opacity(0.2) + .font(.system(size: 14)) + } + Spacer() +// Divider() } - Spacer() + .background(Color(uiColor: UIColor.systemBackground)) + .frame(maxWidth: .infinity) + .frame(height: dividerHeight) + .gesture( + DragGesture() + .onChanged { gesture in + let delta = gesture.translation.height + topListHeight = max(min(topListHeight + delta, 500), 50) + // bottomListHeight = max(min(bottomListHeight - delta, 400), 0) + } + ) + bottomList } .task { if !fetched { hotline.sendGetNewsCategories() { fetched = true } + + // hotline.sendGetNewsArticles(path: ["News"]) { + // print("GOT ARTICLES?") + // } } } - .refreshable { - hotline.sendGetNewsCategories() - } + // .refreshable { + // hotline.sendGetNewsCategories() + // } .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .principal) { @@ -52,8 +109,8 @@ struct NewsView: View { } label: { Image(systemName: "square.and.pencil") -// .symbolRenderingMode(.hierarchical) -// .foregroundColor(.secondary) + // .symbolRenderingMode(.hierarchical) + // .foregroundColor(.secondary) } } |