Simplify images, tag overview
This commit is contained in:
@ -12,39 +12,16 @@ final class NavigationSettings: ObservableObject {
|
||||
@Published
|
||||
var english: LocalizedNavigationSettings
|
||||
|
||||
init(navigationItems: [Item], german: LocalizedNavigationSettings, english: LocalizedNavigationSettings) {
|
||||
init(navigationItems: [Item],
|
||||
german: LocalizedNavigationSettings,
|
||||
english: LocalizedNavigationSettings) {
|
||||
self.navigationItems = navigationItems
|
||||
self.german = german
|
||||
self.english = english
|
||||
}
|
||||
|
||||
init(file: NavigationSettingsFile,
|
||||
tags: [String : Tag],
|
||||
pages: [String : Page],
|
||||
files: [String : FileResource],
|
||||
posts: [String : Post],
|
||||
tagOverview: TagOverviewPage?) {
|
||||
|
||||
#warning("Notify about missing links")
|
||||
self.navigationItems = file.navigationItems.compactMap { raw in
|
||||
guard let type = ItemType(rawValue: raw, posts: posts, pages: pages, tags: tags) else {
|
||||
return nil
|
||||
}
|
||||
switch type {
|
||||
case .general:
|
||||
return nil
|
||||
case .post(let post):
|
||||
return post
|
||||
case .feed:
|
||||
return nil // TODO: Provide feed object
|
||||
case .page(let page):
|
||||
return page
|
||||
case .tagPage(let tag):
|
||||
return tag
|
||||
case .tagOverview:
|
||||
return tagOverview
|
||||
}
|
||||
}
|
||||
init(file: NavigationSettingsFile, map: (String) -> Item?) {
|
||||
self.navigationItems = file.navigationItems.compactMap(map)
|
||||
self.german = LocalizedNavigationSettings(file: file.german)
|
||||
self.english = LocalizedNavigationSettings(file: file.english)
|
||||
}
|
||||
|
@ -37,20 +37,8 @@ final class Settings: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
init(file: SettingsFile,
|
||||
tags: [String : Tag],
|
||||
pages: [String : Page],
|
||||
files: [String : FileResource],
|
||||
posts: [String : Post],
|
||||
tagOverview: TagOverviewPage?) {
|
||||
|
||||
self.navigation = NavigationSettings(
|
||||
file: file.navigation,
|
||||
tags: tags,
|
||||
pages: pages,
|
||||
files: files,
|
||||
posts: posts,
|
||||
tagOverview: tagOverview)
|
||||
init(file: SettingsFile, files: [String : FileResource], map: (String) -> Item?) {
|
||||
self.navigation = NavigationSettings(file: file.navigation, map: map)
|
||||
|
||||
self.posts = PostSettings(file: file.posts, files: files)
|
||||
self.pages = PageSettings(file: file.pages, files: files)
|
||||
|
Reference in New Issue
Block a user