diff --git a/mobile/Heygo.xcodeproj/project.xcworkspace/xcuserdata/junv.xcuserdatad/UserInterfaceState.xcuserstate b/mobile/Heygo.xcodeproj/project.xcworkspace/xcuserdata/junv.xcuserdatad/UserInterfaceState.xcuserstate index df43a57..48412de 100644 Binary files a/mobile/Heygo.xcodeproj/project.xcworkspace/xcuserdata/junv.xcuserdatad/UserInterfaceState.xcuserstate and b/mobile/Heygo.xcodeproj/project.xcworkspace/xcuserdata/junv.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/mobile/Heygo/Views/LinkListView.swift b/mobile/Heygo/Views/LinkListView.swift index 78b3ee7..22adcce 100644 --- a/mobile/Heygo/Views/LinkListView.swift +++ b/mobile/Heygo/Views/LinkListView.swift @@ -384,51 +384,64 @@ struct FilterView: View { struct MarkdownContentView: View { let link: Link @Environment(\.presentationMode) var presentationMode + @EnvironmentObject var linkViewModel: LinkViewModel + @State private var showingEditLink = false var body: some View { NavigationView { - ScrollView { - VStack(alignment: .leading, spacing: 16) { - // Title + VStack(alignment: .leading, spacing: 12) { + // Alias label + HStack { Text(link.alias) - .font(.largeTitle) - .fontWeight(.bold) - .padding(.horizontal) - - // Description if available - if let description = link.linkDescription, !description.isEmpty { - Text(description) - .font(.subheadline) - .foregroundColor(.secondary) - .padding(.horizontal) - } - - // Markdown content - if let content = link.text, !content.isEmpty { - // Use the existing markdown renderer - Text(MarkdownRenderer.renderToAttributedString(content)) - .padding(.horizontal) - .textSelection(.enabled) - } else { - Text("No content available") - .font(.body) - .foregroundColor(.secondary) - .padding(.horizontal) - } + .font(.caption) + .padding(.horizontal, 8) + .padding(.vertical, 4) + .background(Color.blue.opacity(0.2)) + .foregroundColor(.blue) + .cornerRadius(6) Spacer() } - .padding(.vertical) + .padding(.horizontal) + + // Markdown content + ScrollView { + if let content = link.text, !content.isEmpty { + Text(MarkdownRenderer.renderToAttributedString(content)) + .frame(maxWidth: .infinity, alignment: .leading) + .padding(.horizontal) + .textSelection(.enabled) + } else { + VStack { + Image(systemName: "doc.text") + .font(.system(size: 50)) + .foregroundColor(.secondary) + Text("No content available") + .font(.title3) + .foregroundColor(.secondary) + } + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } } .navigationTitle("Custom Content") .navigationBarTitleDisplayMode(.inline) .toolbar { + ToolbarItem(placement: .navigationBarLeading) { + Button("Edit") { + showingEditLink = true + } + } ToolbarItem(placement: .navigationBarTrailing) { Button("Done") { presentationMode.wrappedValue.dismiss() } } } + .sheet(isPresented: $showingEditLink) { + LinkFormView(link: link) + .environmentObject(linkViewModel) + } } } } diff --git a/mobile/Heygo/Views/MarkdownContentView.swift b/mobile/Heygo/Views/MarkdownContentView.swift deleted file mode 100644 index 89d67a7..0000000 --- a/mobile/Heygo/Views/MarkdownContentView.swift +++ /dev/null @@ -1,65 +0,0 @@ -import SwiftUI - -struct MarkdownContentView: View { - let link: Link - @Environment(\.presentationMode) var presentationMode - - var body: some View { - NavigationView { - ScrollView { - VStack(alignment: .leading, spacing: 16) { - // Title - Text(link.alias) - .font(.largeTitle) - .fontWeight(.bold) - .padding(.horizontal) - - // Description if available - if let description = link.linkDescription, !description.isEmpty { - Text(description) - .font(.subheadline) - .foregroundColor(.secondary) - .padding(.horizontal) - } - - // Markdown content - if let content = link.text, !content.isEmpty { - // Use the existing markdown renderer - Text(MarkdownRenderer.renderToAttributedString(content)) - .padding(.horizontal) - .textSelection(.enabled) - } else { - Text("No content available") - .font(.body) - .foregroundColor(.secondary) - .padding(.horizontal) - } - - Spacer() - } - .padding(.vertical) - } - .navigationTitle("Custom Content") - .navigationBarTitleDisplayMode(.inline) - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button("Done") { - presentationMode.wrappedValue.dismiss() - } - } - } - } - } -} - -#Preview { - // Create a sample link for preview - let context = PersistenceController.preview.container.viewContext - let sampleLink = Link(context: context) - sampleLink.alias = "Sample Custom Content" - sampleLink.text = "# This is a heading\n\nThis is some **bold** text and some *italic* text.\n\n- Item 1\n- Item 2\n- Item 3\n\nThis is a paragraph with some content." - sampleLink.linkDescription = "A sample custom content link" - sampleLink.linkType = LinkType.custom.rawValue - - return MarkdownContentView(link: sampleLink) -}