Show linking posts on page content
This commit is contained in:
parent
e69486895f
commit
4131b483e6
@ -183,6 +183,8 @@
|
||||
E2FD1D232D2EB27000B48627 /* LoadingResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FD1D222D2EB26C00B48627 /* LoadingResult.swift */; };
|
||||
E2FD1D252D2EBA8000B48627 /* TagOverview.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FD1D242D2EBA7C00B48627 /* TagOverview.swift */; };
|
||||
E2FD1D282D2F2DAD00B48627 /* ErrorPrinter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FD1D272D2F2D9100B48627 /* ErrorPrinter.swift */; };
|
||||
E2FD1D2A2D35B74C00B48627 /* TextWithPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FD1D292D35B74C00B48627 /* TextWithPopup.swift */; };
|
||||
E2FD1D2C2D35B76D00B48627 /* ListPopup.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FD1D2B2D35B76D00B48627 /* ListPopup.swift */; };
|
||||
E2FE0EE62D15A0B5002963B7 /* GenerationResults.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0EE52D15A0B1002963B7 /* GenerationResults.swift */; };
|
||||
E2FE0EE82D16D4A3002963B7 /* ConvertThrowing.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0EE72D16D4A3002963B7 /* ConvertThrowing.swift */; };
|
||||
E2FE0EEC2D1C1253002963B7 /* MultiFileSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2FE0EEB2D1C124E002963B7 /* MultiFileSelectionView.swift */; };
|
||||
@ -412,6 +414,8 @@
|
||||
E2FD1D222D2EB26C00B48627 /* LoadingResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingResult.swift; sourceTree = "<group>"; };
|
||||
E2FD1D242D2EBA7C00B48627 /* TagOverview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagOverview.swift; sourceTree = "<group>"; };
|
||||
E2FD1D272D2F2D9100B48627 /* ErrorPrinter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorPrinter.swift; sourceTree = "<group>"; };
|
||||
E2FD1D292D35B74C00B48627 /* TextWithPopup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextWithPopup.swift; sourceTree = "<group>"; };
|
||||
E2FD1D2B2D35B76D00B48627 /* ListPopup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListPopup.swift; sourceTree = "<group>"; };
|
||||
E2FE0EE52D15A0B1002963B7 /* GenerationResults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerationResults.swift; sourceTree = "<group>"; };
|
||||
E2FE0EE72D16D4A3002963B7 /* ConvertThrowing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConvertThrowing.swift; sourceTree = "<group>"; };
|
||||
E2FE0EEB2D1C124E002963B7 /* MultiFileSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiFileSelectionView.swift; sourceTree = "<group>"; };
|
||||
@ -651,6 +655,8 @@
|
||||
E2A21C372CB9A4F10060935B /* Generic */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E2FD1D2B2D35B76D00B48627 /* ListPopup.swift */,
|
||||
E2FD1D292D35B74C00B48627 /* TextWithPopup.swift */,
|
||||
E2FE0F6F2D2D5231002963B7 /* TextIndicator.swift */,
|
||||
E2FE0F232D2A8C1A002963B7 /* TagDisplayView.swift */,
|
||||
E229902F2D0F75CF009F8D77 /* BoolPropertyView.swift */,
|
||||
@ -1185,6 +1191,7 @@
|
||||
E2FD1D232D2EB27000B48627 /* LoadingResult.swift in Sources */,
|
||||
E29D31B82D0DAC250051B7F4 /* ButtonCommand.swift in Sources */,
|
||||
E29D31962D0C186E0051B7F4 /* PathSettings.swift in Sources */,
|
||||
E2FD1D2C2D35B76D00B48627 /* ListPopup.swift in Sources */,
|
||||
E2B85F412C4294790047CD0C /* PageHead.swift in Sources */,
|
||||
E2FE0F2A2D2AFBE6002963B7 /* ImageCompareIcons.swift in Sources */,
|
||||
E29D316B2D07488B0051B7F4 /* PostListPageGenerator.swift in Sources */,
|
||||
@ -1284,6 +1291,7 @@
|
||||
E25DA5912D023A8400AEF16D /* IntegerField.swift in Sources */,
|
||||
E2FD1D192D2DC4F500B48627 /* LoadingContext.swift in Sources */,
|
||||
E29D318B2D0B07EE0051B7F4 /* ContentBox.swift in Sources */,
|
||||
E2FD1D2A2D35B74C00B48627 /* TextWithPopup.swift in Sources */,
|
||||
E2FE0F4D2D2BCD30002963B7 /* PageLinkCommand.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -8,7 +8,6 @@ import SFSafeSymbols
|
||||
|
||||
**UI**
|
||||
- Image search: Add view to see all images and filter
|
||||
- Pages: Show linking posts
|
||||
- Page Content: Show all results of `PageGenerationResults`
|
||||
- Files: Show usages of file
|
||||
- Buttons to insert special commands (images, page links, ...)
|
||||
|
@ -12,8 +12,6 @@ extension FileManager {
|
||||
|
||||
extension Content {
|
||||
|
||||
private static let dbPath = FileManager.default.documentDirectory.appendingPathComponent("db").path()
|
||||
|
||||
static let mock: Content = Content(
|
||||
settings: .default,
|
||||
posts: [.empty, .mock, .fullMock],
|
||||
|
25
CHDataManagement/Views/Generic/ListPopup.swift
Normal file
25
CHDataManagement/Views/Generic/ListPopup.swift
Normal file
@ -0,0 +1,25 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ListPopup: View {
|
||||
|
||||
@Environment(\.dismiss)
|
||||
var dismiss
|
||||
|
||||
let items: [String]
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
ForEach(items, id: \.self) { page in
|
||||
Text(page)
|
||||
}
|
||||
}
|
||||
.frame(minHeight: min(CGFloat(items.count) * 31, 500))
|
||||
Button("Dismiss") { dismiss() }
|
||||
}
|
||||
.padding(.vertical)
|
||||
.onTapGesture {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
36
CHDataManagement/Views/Generic/TextWithPopup.swift
Normal file
36
CHDataManagement/Views/Generic/TextWithPopup.swift
Normal file
@ -0,0 +1,36 @@
|
||||
import SwiftUI
|
||||
import SFSafeSymbols
|
||||
|
||||
struct TextWithPopup: View {
|
||||
|
||||
let symbol: SFSymbol
|
||||
|
||||
let text: LocalizedStringKey
|
||||
|
||||
let items: [String]
|
||||
|
||||
@State
|
||||
private var isHovering = false
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Image(systemSymbol: symbol)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 16, height: 16)
|
||||
Text(text)
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
if items.count > 0 {
|
||||
isHovering.toggle()
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $isHovering) {
|
||||
ListPopup(items: items)
|
||||
.onTapGesture {
|
||||
isHovering.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -42,9 +42,17 @@ struct LocalizedPageContentView: View {
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
if let generationResults {
|
||||
PageContentResultsView(results: generationResults)
|
||||
}
|
||||
|
||||
HStack {
|
||||
if let generationResults {
|
||||
PageContentResultsView(results: generationResults)
|
||||
}
|
||||
let linkingPosts = content.posts.filter { $0.linkedPage == page }
|
||||
TextWithPopup(
|
||||
symbol: .ipadAndArrowForward,
|
||||
text: "\(linkingPosts.count) linking posts",
|
||||
items: linkingPosts.map { $0.title(in: language) })
|
||||
}.foregroundStyle(.secondary)
|
||||
HighlightedTextEditor(
|
||||
text: $pageContent,
|
||||
highlightRules: .markdown)
|
||||
|
@ -1,64 +1,6 @@
|
||||
import SwiftUI
|
||||
import SFSafeSymbols
|
||||
|
||||
private struct ListPopup: View {
|
||||
|
||||
@Environment(\.dismiss)
|
||||
var dismiss
|
||||
|
||||
let items: [String]
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
List {
|
||||
ForEach(items, id: \.self) { page in
|
||||
Text(page)
|
||||
}
|
||||
}
|
||||
.frame(minHeight: min(CGFloat(items.count) * 31, 500))
|
||||
Button("Dismiss") { dismiss() }
|
||||
}
|
||||
.padding(.vertical)
|
||||
.onTapGesture {
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct TextWithPopup: View {
|
||||
|
||||
let symbol: SFSymbol
|
||||
|
||||
let text: LocalizedStringKey
|
||||
|
||||
let items: [String]
|
||||
|
||||
@State
|
||||
private var isHovering = false
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Image(systemSymbol: symbol)
|
||||
.resizable()
|
||||
.aspectRatio(contentMode: .fit)
|
||||
.frame(width: 16, height: 16)
|
||||
Text(text)
|
||||
}
|
||||
.contentShape(Rectangle())
|
||||
.onTapGesture {
|
||||
if items.count > 0 {
|
||||
isHovering.toggle()
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $isHovering) {
|
||||
ListPopup(items: items)
|
||||
.onTapGesture {
|
||||
isHovering.toggle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct PageContentResultsView: View {
|
||||
|
||||
@Environment(\.language)
|
||||
|
Loading…
x
Reference in New Issue
Block a user