-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added lists view and two ways to navigate to it
- Loading branch information
1 parent
deb11e0
commit a0a5686
Showing
10 changed files
with
240 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import CoreData | ||
import SwiftUI | ||
|
||
struct ListsDestination: Hashable { | ||
let author: Author | ||
} | ||
|
||
struct ListsView: View { | ||
@Environment(\.managedObjectContext) private var viewContext | ||
|
||
let author: Author | ||
|
||
@FetchRequest var lists: FetchedResults<AuthorList> | ||
|
||
init(author: Author) { | ||
self.author = author | ||
_lists = FetchRequest(fetchRequest: AuthorList.authorLists(ownedBy: author)) | ||
} | ||
|
||
var body: some View { | ||
ZStack { | ||
Color.appBg | ||
|
||
Group { | ||
if lists.isEmpty { | ||
VStack { | ||
Image(systemName: "person.2") | ||
|
||
Text("Add your favorite accounts to public lists and pin them to your home feed") | ||
} | ||
} else { | ||
ScrollView { | ||
VStack(spacing: 0) { | ||
ForEach(lists) { list in | ||
HStack { | ||
VStack(alignment: .leading) { | ||
Text(list.title ?? "") | ||
.font(.body) | ||
|
||
if let description = list.listDescription { | ||
Text(description) | ||
.foregroundStyle(Color.secondaryTxt) | ||
.font(.footnote) | ||
} | ||
} | ||
|
||
Spacer() | ||
|
||
Menu { | ||
Button("editListInfo") { | ||
// TODO: Edit List Info | ||
} | ||
Button("manageUsers") { | ||
// TODO: Manage Users | ||
} | ||
Button("deleteList", role: .destructive) { | ||
// TODO: Delete List | ||
} | ||
} label: { | ||
Image(systemName: "ellipsis") | ||
.foregroundStyle(Color.secondaryTxt) | ||
.fontWeight(.bold) | ||
} | ||
} | ||
.padding(.horizontal, 16) | ||
.padding(.vertical, 12) | ||
.frame(minHeight: 50) | ||
|
||
BeveledSeparator() | ||
} | ||
} | ||
.background(LinearGradient.cardBackground) | ||
.clipShape(RoundedRectangle(cornerRadius: 15)) | ||
.mimicCardButtonStyle() | ||
} | ||
.padding(EdgeInsets(top: 16, leading: 16, bottom: 16, trailing: 16)) | ||
} | ||
} | ||
} | ||
.scrollContentBackground(.hidden) | ||
.toolbar { | ||
ToolbarItem(placement: .navigationBarTrailing) { | ||
ActionButton("new", action: newButtonPressed) | ||
.frame(height: 22) | ||
.padding(.bottom, 3) | ||
} | ||
} | ||
.nosNavigationBar("yourLists") | ||
} | ||
|
||
private func newButtonPressed() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.