mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Add setting to show/hide recents and limit number of recents shown
This commit is contained in:
@@ -5,12 +5,14 @@ struct AppSidebarRecents: View {
|
||||
var recents = RecentsModel.shared
|
||||
|
||||
@Default(.recentlyOpened) private var recentItems
|
||||
@Default(.limitRecents) private var limitRecents
|
||||
@Default(.limitRecentsAmount) private var limitRecentsAmount
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if !recentItems.isEmpty {
|
||||
Section(header: Text("Recents")) {
|
||||
ForEach(recentItems.reversed()) { recent in
|
||||
ForEach(recentItems.reversed().prefix(limitRecents ? limitRecentsAmount : recentItems.count)) { recent in
|
||||
Group {
|
||||
switch recent.type {
|
||||
case .channel:
|
||||
|
@@ -13,6 +13,7 @@ struct Sidebar: View {
|
||||
@Default(.showDocuments) private var showDocuments
|
||||
#endif
|
||||
@Default(.showUnwatchedFeedBadges) private var showUnwatchedFeedBadges
|
||||
@Default(.showRecents) private var showRecents
|
||||
|
||||
var body: some View {
|
||||
ScrollViewReader { scrollView in
|
||||
@@ -20,8 +21,10 @@ struct Sidebar: View {
|
||||
mainNavigationLinks
|
||||
|
||||
if !accounts.isEmpty {
|
||||
AppSidebarRecents()
|
||||
.id("recentlyOpened")
|
||||
if showRecents {
|
||||
AppSidebarRecents()
|
||||
.id("recentlyOpened")
|
||||
}
|
||||
|
||||
if accounts.api.signedIn {
|
||||
if visibleSections.contains(.subscriptions), accounts.app.supportsSubscriptions {
|
||||
|
Reference in New Issue
Block a user