External files, improve page generation
This commit is contained in:
@ -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()
|
||||
}
|
||||
|
Reference in New Issue
Block a user