Add visibility property to Tag, improve UI
This commit is contained in:
parent
0e3fea9b0d
commit
1261ea534b
@ -25,6 +25,8 @@
|
|||||||
E218502D2CF791440090B18B /* PostImagesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E218502C2CF791440090B18B /* PostImagesView.swift */; };
|
E218502D2CF791440090B18B /* PostImagesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E218502C2CF791440090B18B /* PostImagesView.swift */; };
|
||||||
E218502F2CFAF69C0090B18B /* Content+Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E218502E2CFAF6990090B18B /* Content+Generate.swift */; };
|
E218502F2CFAF69C0090B18B /* Content+Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E218502E2CFAF6990090B18B /* Content+Generate.swift */; };
|
||||||
E21850312CFAF8880090B18B /* Content+Import.swift in Sources */ = {isa = PBXBuildFile; fileRef = E21850302CFAF8840090B18B /* Content+Import.swift */; };
|
E21850312CFAF8880090B18B /* Content+Import.swift in Sources */ = {isa = PBXBuildFile; fileRef = E21850302CFAF8840090B18B /* Content+Import.swift */; };
|
||||||
|
E21850332CFAFA2F0090B18B /* WebsiteData.swift in Sources */ = {isa = PBXBuildFile; fileRef = E21850322CFAFA200090B18B /* WebsiteData.swift */; };
|
||||||
|
E21850352CFAFA5A0090B18B /* WebsiteDataFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = E21850342CFAFA570090B18B /* WebsiteDataFile.swift */; };
|
||||||
E24252012C50E0A40029FF16 /* HighlightedTextEditor in Frameworks */ = {isa = PBXBuildFile; productRef = E24252002C50E0A40029FF16 /* HighlightedTextEditor */; };
|
E24252012C50E0A40029FF16 /* HighlightedTextEditor in Frameworks */ = {isa = PBXBuildFile; productRef = E24252002C50E0A40029FF16 /* HighlightedTextEditor */; };
|
||||||
E24252032C5163CF0029FF16 /* Importer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24252022C5163CF0029FF16 /* Importer.swift */; };
|
E24252032C5163CF0029FF16 /* Importer.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24252022C5163CF0029FF16 /* Importer.swift */; };
|
||||||
E24252062C51684E0029FF16 /* GenericMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24252052C51684E0029FF16 /* GenericMetadata.swift */; };
|
E24252062C51684E0029FF16 /* GenericMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = E24252052C51684E0029FF16 /* GenericMetadata.swift */; };
|
||||||
@ -103,6 +105,8 @@
|
|||||||
E218502C2CF791440090B18B /* PostImagesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostImagesView.swift; sourceTree = "<group>"; };
|
E218502C2CF791440090B18B /* PostImagesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PostImagesView.swift; sourceTree = "<group>"; };
|
||||||
E218502E2CFAF6990090B18B /* Content+Generate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Content+Generate.swift"; sourceTree = "<group>"; };
|
E218502E2CFAF6990090B18B /* Content+Generate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Content+Generate.swift"; sourceTree = "<group>"; };
|
||||||
E21850302CFAF8840090B18B /* Content+Import.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Content+Import.swift"; sourceTree = "<group>"; };
|
E21850302CFAF8840090B18B /* Content+Import.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Content+Import.swift"; sourceTree = "<group>"; };
|
||||||
|
E21850322CFAFA200090B18B /* WebsiteData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebsiteData.swift; sourceTree = "<group>"; };
|
||||||
|
E21850342CFAFA570090B18B /* WebsiteDataFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebsiteDataFile.swift; sourceTree = "<group>"; };
|
||||||
E24252022C5163CF0029FF16 /* Importer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Importer.swift; sourceTree = "<group>"; };
|
E24252022C5163CF0029FF16 /* Importer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Importer.swift; sourceTree = "<group>"; };
|
||||||
E24252052C51684E0029FF16 /* GenericMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericMetadata.swift; sourceTree = "<group>"; };
|
E24252052C51684E0029FF16 /* GenericMetadata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericMetadata.swift; sourceTree = "<group>"; };
|
||||||
E24252072C5168750029FF16 /* GenericMetadata+Localized.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GenericMetadata+Localized.swift"; sourceTree = "<group>"; };
|
E24252072C5168750029FF16 /* GenericMetadata+Localized.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GenericMetadata+Localized.swift"; sourceTree = "<group>"; };
|
||||||
@ -235,6 +239,7 @@
|
|||||||
E2A37D0F2CE5375E0000979F /* Storage */ = {
|
E2A37D0F2CE5375E0000979F /* Storage */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E21850342CFAFA570090B18B /* WebsiteDataFile.swift */,
|
||||||
E21850142CEE55D40090B18B /* FileOnDisk.swift */,
|
E21850142CEE55D40090B18B /* FileOnDisk.swift */,
|
||||||
E21850162CEE55FB0090B18B /* FileType.swift */,
|
E21850162CEE55FB0090B18B /* FileType.swift */,
|
||||||
E2A37D102CE537670000979F /* PageFile.swift */,
|
E2A37D102CE537670000979F /* PageFile.swift */,
|
||||||
@ -258,6 +263,7 @@
|
|||||||
E2B85F392C428F020047CD0C /* Model */ = {
|
E2B85F392C428F020047CD0C /* Model */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
E21850322CFAFA200090B18B /* WebsiteData.swift */,
|
||||||
E2E06DFA2CA4A6570019C2AF /* Content.swift */,
|
E2E06DFA2CA4A6570019C2AF /* Content.swift */,
|
||||||
E218502E2CFAF6990090B18B /* Content+Generate.swift */,
|
E218502E2CFAF6990090B18B /* Content+Generate.swift */,
|
||||||
E21850302CFAF8840090B18B /* Content+Import.swift */,
|
E21850302CFAF8840090B18B /* Content+Import.swift */,
|
||||||
@ -511,12 +517,14 @@
|
|||||||
E21850152CEE55D40090B18B /* FileOnDisk.swift in Sources */,
|
E21850152CEE55D40090B18B /* FileOnDisk.swift in Sources */,
|
||||||
E2A21C332CB5BCAC0060935B /* PageDetailView.swift in Sources */,
|
E2A21C332CB5BCAC0060935B /* PageDetailView.swift in Sources */,
|
||||||
E2A21C122CB18D560060935B /* DatePickerView.swift in Sources */,
|
E2A21C122CB18D560060935B /* DatePickerView.swift in Sources */,
|
||||||
|
E21850332CFAFA2F0090B18B /* WebsiteData.swift in Sources */,
|
||||||
E21850192CEE561C0090B18B /* PageOnDisk.swift in Sources */,
|
E21850192CEE561C0090B18B /* PageOnDisk.swift in Sources */,
|
||||||
E2A21C4D2CBB16B50060935B /* ImagesView.swift in Sources */,
|
E2A21C4D2CBB16B50060935B /* ImagesView.swift in Sources */,
|
||||||
E2A21C202CB28ED20060935B /* MockImage.swift in Sources */,
|
E2A21C202CB28ED20060935B /* MockImage.swift in Sources */,
|
||||||
E2A21C2C2CB2BB250060935B /* PostList.swift in Sources */,
|
E2A21C2C2CB2BB250060935B /* PostList.swift in Sources */,
|
||||||
E21850112CEE17070090B18B /* Page+Storage.swift in Sources */,
|
E21850112CEE17070090B18B /* Page+Storage.swift in Sources */,
|
||||||
E218500D2CEE07180090B18B /* ColorPalette.swift in Sources */,
|
E218500D2CEE07180090B18B /* ColorPalette.swift in Sources */,
|
||||||
|
E21850352CFAFA5A0090B18B /* WebsiteDataFile.swift in Sources */,
|
||||||
E21850132CEE541D0090B18B /* Post+Storage.swift in Sources */,
|
E21850132CEE541D0090B18B /* Post+Storage.swift in Sources */,
|
||||||
E2B85F412C4294790047CD0C /* PageHead.swift in Sources */,
|
E2B85F412C4294790047CD0C /* PageHead.swift in Sources */,
|
||||||
E218501D2CEE6CB60090B18B /* VerticalCenter.swift in Sources */,
|
E218501D2CEE6CB60090B18B /* VerticalCenter.swift in Sources */,
|
||||||
|
@ -76,6 +76,7 @@ final class Importer {
|
|||||||
|
|
||||||
let tag = TagFile(
|
let tag = TagFile(
|
||||||
id: enTag.urlComponent,
|
id: enTag.urlComponent,
|
||||||
|
isVisible: true,
|
||||||
german: deTag,
|
german: deTag,
|
||||||
english: enTag)
|
english: enTag)
|
||||||
tags[tagId] = tag
|
tags[tagId] = tag
|
||||||
|
@ -79,13 +79,13 @@ final class Content: ObservableObject {
|
|||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func convert(_ tag: LocalizedTagFile) -> LocalizedTag {
|
private func convert(_ tag: LocalizedTagFile, images: [String : ImageResource]) -> LocalizedTag {
|
||||||
LocalizedTag(
|
LocalizedTag(
|
||||||
urlComponent: tag.urlComponent,
|
urlComponent: tag.urlComponent,
|
||||||
name: tag.name,
|
name: tag.name,
|
||||||
subtitle: tag.subtitle,
|
subtitle: tag.subtitle,
|
||||||
description: tag.description,
|
description: tag.description,
|
||||||
thumbnail: tag.thumbnail,
|
thumbnail: tag.thumbnail.map { images[$0] },
|
||||||
originalUrl: tag.originalURL)
|
originalUrl: tag.originalURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,13 +122,6 @@ final class Content: ObservableObject {
|
|||||||
let postsData = try storage.loadAllPosts()
|
let postsData = try storage.loadAllPosts()
|
||||||
let filesData = try storage.loadAllFiles()
|
let filesData = try storage.loadAllFiles()
|
||||||
|
|
||||||
let tags = tagData.reduce(into: [:]) { (tags, data) in
|
|
||||||
tags[data.key] = Tag(german: convert(data.value.german),
|
|
||||||
english: convert(data.value.english))
|
|
||||||
}
|
|
||||||
|
|
||||||
let pages: [String : Page] = loadPages(pagesData, tags: tags)
|
|
||||||
|
|
||||||
let images: [String : ImageResource] = filesData.reduce(into: [:]) { dict, item in
|
let images: [String : ImageResource] = filesData.reduce(into: [:]) { dict, item in
|
||||||
let (file, url) = item
|
let (file, url) = item
|
||||||
let ext = file.components(separatedBy: ".").last!.lowercased()
|
let ext = file.components(separatedBy: ".").last!.lowercased()
|
||||||
@ -146,6 +139,15 @@ final class Content: ObservableObject {
|
|||||||
return FileResource(uniqueId: file, description: "")
|
return FileResource(uniqueId: file, description: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tags = tagData.reduce(into: [:]) { (tags, data) in
|
||||||
|
tags[data.key] = Tag(
|
||||||
|
isVisible: data.value.isVisible,
|
||||||
|
german: convert(data.value.german, images: images),
|
||||||
|
english: convert(data.value.english, images: images))
|
||||||
|
}
|
||||||
|
|
||||||
|
let pages: [String : Page] = loadPages(pagesData, tags: tags)
|
||||||
|
|
||||||
let posts = postsData.map { postId, post in
|
let posts = postsData.map { postId, post in
|
||||||
let linkedPage = post.linkedPageId.map { pages[$0] }
|
let linkedPage = post.linkedPageId.map { pages[$0] }
|
||||||
let german = convert(post.german, images: images)
|
let german = convert(post.german, images: images)
|
||||||
|
@ -17,7 +17,7 @@ final class LocalizedTag: ObservableObject {
|
|||||||
|
|
||||||
/// The image id of the thumbnail
|
/// The image id of the thumbnail
|
||||||
@Published
|
@Published
|
||||||
var thumbnail: String?
|
var thumbnail: ImageResource?
|
||||||
|
|
||||||
/// The original url in the previous site layout
|
/// The original url in the previous site layout
|
||||||
let originalUrl: String?
|
let originalUrl: String?
|
||||||
@ -26,7 +26,7 @@ final class LocalizedTag: ObservableObject {
|
|||||||
name: String,
|
name: String,
|
||||||
subtitle: String? = nil,
|
subtitle: String? = nil,
|
||||||
description: String? = nil,
|
description: String? = nil,
|
||||||
thumbnail: String? = nil,
|
thumbnail: ImageResource? = nil,
|
||||||
originalUrl: String? = nil) {
|
originalUrl: String? = nil) {
|
||||||
self.urlComponent = urlComponent
|
self.urlComponent = urlComponent
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@ -4,6 +4,7 @@ extension Tag {
|
|||||||
|
|
||||||
var tagFile: TagFile {
|
var tagFile: TagFile {
|
||||||
.init(id: id,
|
.init(id: id,
|
||||||
|
isVisible: isVisible,
|
||||||
german: german.tagFile,
|
german: german.tagFile,
|
||||||
english: english.tagFile)
|
english: english.tagFile)
|
||||||
}
|
}
|
||||||
@ -16,7 +17,7 @@ extension LocalizedTag {
|
|||||||
name: name,
|
name: name,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
description: description,
|
description: description,
|
||||||
thumbnail: thumbnail,
|
thumbnail: thumbnail?.id,
|
||||||
originalURL: originalUrl)
|
originalURL: originalUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,17 @@ final class Tag: ObservableObject {
|
|||||||
english.urlComponent
|
english.urlComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Published
|
||||||
|
var isVisible: Bool
|
||||||
|
|
||||||
@Published
|
@Published
|
||||||
var german: LocalizedTag
|
var german: LocalizedTag
|
||||||
|
|
||||||
@Published
|
@Published
|
||||||
var english: LocalizedTag
|
var english: LocalizedTag
|
||||||
|
|
||||||
init(german: LocalizedTag, english: LocalizedTag) {
|
init(isVisible: Bool = true, german: LocalizedTag, english: LocalizedTag) {
|
||||||
|
self.isVisible = isVisible
|
||||||
self.german = german
|
self.german = german
|
||||||
self.english = english
|
self.english = english
|
||||||
}
|
}
|
||||||
|
5
CHDataManagement/Model/WebsiteData.swift
Normal file
5
CHDataManagement/Model/WebsiteData.swift
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
final class WebsiteData: ObservableObject {
|
||||||
|
|
||||||
|
}
|
@ -34,7 +34,7 @@ extension LocalizedTag {
|
|||||||
name: "Electronics",
|
name: "Electronics",
|
||||||
subtitle: "Projects with electronics",
|
subtitle: "Projects with electronics",
|
||||||
description: "Some description of the tag",
|
description: "Some description of the tag",
|
||||||
thumbnail: "electronic-thumbnail.jpg",
|
thumbnail: ImageResource(resourceName: "image1"),
|
||||||
originalUrl: "projects/electronics")
|
originalUrl: "projects/electronics")
|
||||||
|
|
||||||
static let german = LocalizedTag(
|
static let german = LocalizedTag(
|
||||||
@ -42,6 +42,6 @@ extension LocalizedTag {
|
|||||||
name: "Elektronik",
|
name: "Elektronik",
|
||||||
subtitle: "Projekte mit Elektronik",
|
subtitle: "Projekte mit Elektronik",
|
||||||
description: "Eine Beschreibung des Tags",
|
description: "Eine Beschreibung des Tags",
|
||||||
thumbnail: "electronic-thumbnail.jpg",
|
thumbnail: ImageResource(resourceName: "image2"),
|
||||||
originalUrl: "projects/electronics")
|
originalUrl: "projects/electronics")
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ struct TagFile {
|
|||||||
|
|
||||||
let id: String
|
let id: String
|
||||||
|
|
||||||
|
let isVisible: Bool
|
||||||
|
|
||||||
let german: LocalizedTagFile
|
let german: LocalizedTagFile
|
||||||
|
|
||||||
let english: LocalizedTagFile
|
let english: LocalizedTagFile
|
||||||
|
49
CHDataManagement/Storage/WebsiteDataFile.swift
Normal file
49
CHDataManagement/Storage/WebsiteDataFile.swift
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct WebsiteDataFile {
|
||||||
|
|
||||||
|
let german: LocalizedWebsiteDataFile
|
||||||
|
|
||||||
|
let english: LocalizedWebsiteDataFile
|
||||||
|
}
|
||||||
|
|
||||||
|
extension WebsiteDataFile: Codable {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
struct LocalizedWebsiteDataFile {
|
||||||
|
|
||||||
|
let title: String
|
||||||
|
|
||||||
|
let description: String
|
||||||
|
|
||||||
|
let iconDescription: String
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
extension LocalizedWebsiteDataFile: Codable {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
let navigationItems: [FeedNavigationLink] = [
|
||||||
|
.init(text: .init(en: "Projects", de: "Projekte"),
|
||||||
|
url: .init(en: "/projects", de: "/projekte")),
|
||||||
|
.init(text: .init(en: "Adventures", de: "Abenteuer"),
|
||||||
|
url: .init(en: "/adventures", de: "/abenteuer")),
|
||||||
|
.init(text: .init(en: "Services", de: "Dienste"),
|
||||||
|
url: .init(en: "/services", de: "/dienste")),
|
||||||
|
.init(text: .init(en: "Tags", de: "Kategorien"),
|
||||||
|
url: .init(en: "/tags", de: "/kategorien")),
|
||||||
|
]
|
||||||
|
|
||||||
|
let feed = Feed(
|
||||||
|
language: language,
|
||||||
|
title: .init(en: "Blog | CH", de: "Blog | CH"),
|
||||||
|
description: .init(en: "The latests posts, projects and adventures",
|
||||||
|
de: "Die neusten Beiträge, Projekte und Abenteuer"),
|
||||||
|
iconDescription: .init(en: "An icon consisting of the letters C and H in blue and orange",
|
||||||
|
de: "Ein Logo aus den Buchstaben C und H in Blau und Orange"),
|
||||||
|
navigationItems: navigationItems,
|
||||||
|
posts: posts)
|
||||||
|
*/
|
@ -2,14 +2,25 @@ import SwiftUI
|
|||||||
|
|
||||||
struct TagDetailView: View {
|
struct TagDetailView: View {
|
||||||
|
|
||||||
|
@Binding
|
||||||
|
var tagIsVisible: Bool
|
||||||
|
|
||||||
@ObservedObject
|
@ObservedObject
|
||||||
var tag: LocalizedTag
|
var tag: LocalizedTag
|
||||||
|
|
||||||
@EnvironmentObject
|
@EnvironmentObject
|
||||||
private var content: Content
|
private var content: Content
|
||||||
|
|
||||||
|
@State
|
||||||
|
private var showImagePicker = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
|
Toggle("Appears in overviews", isOn: $tagIsVisible)
|
||||||
|
.toggleStyle(.switch)
|
||||||
|
.font(.callout)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
|
||||||
Text("Name")
|
Text("Name")
|
||||||
.font(.callout)
|
.font(.callout)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
@ -40,14 +51,23 @@ struct TagDetailView: View {
|
|||||||
Text("Thumbnail")
|
Text("Thumbnail")
|
||||||
.font(.callout)
|
.font(.callout)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
Text(tag.thumbnail ?? "-")
|
Button(action: { showImagePicker = true }) {
|
||||||
.padding(.top, 1)
|
Text(tag.thumbnail?.id ?? "Select")
|
||||||
.padding(.bottom)
|
}
|
||||||
|
.buttonStyle(.plain)
|
||||||
|
.foregroundStyle(.blue)
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
|
.sheet(isPresented: $showImagePicker) {
|
||||||
|
ImagePickerView(showImagePicker: $showImagePicker) { image in
|
||||||
|
tag.thumbnail = image
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
TagDetailView(tag: Tag.mock.english)
|
TagDetailView(
|
||||||
|
tagIsVisible: .constant(true),
|
||||||
|
tag: Tag.mock.english)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,20 @@
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
|
private struct SelectedTagView: View {
|
||||||
|
|
||||||
|
@Environment(\.language)
|
||||||
|
private var language
|
||||||
|
|
||||||
|
@ObservedObject
|
||||||
|
var tag: Tag
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
TagDetailView(
|
||||||
|
tagIsVisible: $tag.isVisible,
|
||||||
|
tag: tag.localized(in: language))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct TagsListView: View {
|
struct TagsListView: View {
|
||||||
|
|
||||||
@Environment(\.language)
|
@Environment(\.language)
|
||||||
@ -20,13 +35,18 @@ struct TagsListView: View {
|
|||||||
}
|
}
|
||||||
} detail: {
|
} detail: {
|
||||||
if let selectedTag {
|
if let selectedTag {
|
||||||
TagDetailView(tag: selectedTag.localized(in: language))
|
SelectedTagView(tag: selectedTag)
|
||||||
} else {
|
} else {
|
||||||
Text("Select a tag to show the details")
|
Text("Select a tag to show the details")
|
||||||
.font(.largeTitle)
|
.font(.largeTitle)
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.onAppear {
|
||||||
|
if selectedTag == nil {
|
||||||
|
selectedTag = content.tags.first
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user