External files, improve page generation

This commit is contained in:
Christoph Hagen
2024-12-10 15:21:28 +01:00
parent 8183bc4903
commit efc9234917
50 changed files with 1069 additions and 424 deletions

View File

@ -13,44 +13,56 @@ struct FileContentView: View {
var body: some View {
VStack {
switch file.type {
case .image:
file.imageToDisplay
.resizable()
.aspectRatio(contentMode: .fit)
case .model:
if file.isExternallyStored {
VStack {
Image(systemSymbol: .cubeTransparent)
Image(systemSymbol: .squareDashed)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
Text("External file")
.font(.title)
}
.foregroundStyle(.secondary)
case .text, .code:
TextFileContentView(file: file)
.id(file.id)
case .video:
VStack {
Image(systemSymbol: .film)
} else {
switch file.type {
case .image:
file.imageToDisplay
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
.font(.title)
case .model:
VStack {
Image(systemSymbol: .cubeTransparent)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
.font(.title)
}
.foregroundStyle(.secondary)
case .text, .code:
TextFileContentView(file: file)
.id(file.id)
case .video:
VStack {
Image(systemSymbol: .film)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
.font(.title)
}
.foregroundStyle(.secondary)
case .other:
VStack {
Image(systemSymbol: .docQuestionmark)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
.font(.title)
}
.foregroundStyle(.secondary)
}
.foregroundStyle(.secondary)
case .other:
VStack {
Image(systemSymbol: .docQuestionmark)
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: iconSize)
Text("No preview available")
.font(.title)
}
.foregroundStyle(.secondary)
}
}.padding()
}