Skip to content

Commit dcd791d

Browse files
committed
tweaks to list and previews
1 parent 09d8eb1 commit dcd791d

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

Django Files/Views/FileList.swift

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct FileRowView: View {
5858
}
5959
.frame(width: 64, height: 64)
6060
.clipped()
61+
.cornerRadius(8)
6162
} else {
6263
Image(systemName: getIcon())
6364
.font(.system(size: 50))
@@ -79,6 +80,11 @@ struct FileRowView: View {
7980

8081

8182
HStack(spacing: 6) {
83+
Label(file.mime, systemImage: "")
84+
.font(.caption)
85+
.labelStyle(CustomLabel(spacing: 3))
86+
.lineLimit(1)
87+
8288
Label("", systemImage: "lock")
8389
.font(.caption)
8490
.labelStyle(CustomLabel(spacing: 3))
@@ -96,10 +102,7 @@ struct FileRowView: View {
96102
}
97103

98104
HStack(spacing: 5) {
99-
Label(file.mime, systemImage: getIcon())
100-
.font(.caption)
101-
.labelStyle(CustomLabel(spacing: 3))
102-
.lineLimit(1)
105+
103106

104107
Label(file.userUsername, systemImage: "person")
105108
.font(.caption)
@@ -127,15 +130,13 @@ struct FileListView: View {
127130

128131
@State private var files: [DFFile] = []
129132
@State private var currentPage = 1
130-
@State private var hasNextPage = false
131-
@State private var isLoading = true
133+
@State private var hasNextPage: Bool = false
134+
@State private var isLoading: Bool = true
132135
@State private var errorMessage: String? = nil
133-
@State private var showingUploadSheet = false
134-
@State private var showingShortCreator = false
135-
@State private var showingAlbumCreator = false
136-
137-
@State private var previewFile: Bool = true
138-
@State private var selectedFile: DFFile? = nil
136+
@State private var showingUploadSheet: Bool = false
137+
@State private var showingShortCreator: Bool = false
138+
@State private var showingAlbumCreator: Bool = false
139+
@State private var showingPreview: Bool = false
139140

140141
@State private var showingDeleteConfirmation = false
141142
@State private var fileIDsToDelete: [Int] = []
@@ -183,6 +184,8 @@ struct FileListView: View {
183184
}
184185
}
185186
}
187+
.toolbar(showingPreview ? .hidden : .visible, for: .tabBar)
188+
.animation(.easeInOut(duration: 0.3), value: showingPreview)
186189
.navigationDestination(for: DFFile.self) { file in
187190
ZStack {
188191
if redirectURLs[file.raw] == nil {
@@ -197,28 +200,33 @@ struct FileListView: View {
197200
.navigationTitle(file.name)
198201
.navigationBarTitleDisplayMode(.inline)
199202
.toolbar {
200-
ToolbarItem(placement: .navigationBarTrailing) {
201-
Button(action: {
202-
showFileInfo = true
203-
}) {
204-
Label("File Info", systemImage: "info.circle")
205-
}
206-
}
207203
ToolbarItem(placement: .navigationBarTrailing) {
208204
Menu {
209-
fileShareMenu(for: file)
205+
fileContextMenu(for: file, isPreviewing: true, isPrivate: file.private, expirationText: $expirationText, passwordText: $passwordText, fileNameText: $fileNameText)
210206
} label: {
211-
Image(systemName: "square.and.arrow.up")
207+
Image(systemName: "ellipsis.circle")
212208
}
213209
}
214-
ToolbarItem(placement: .navigationBarTrailing) {
210+
ToolbarItemGroup(placement: .bottomBar) {
215211
Menu {
216-
fileContextMenu(for: file, isPreviewing: true, isPrivate: file.private, expirationText: $expirationText, passwordText: $passwordText, fileNameText: $fileNameText)
212+
fileShareMenu(for: file)
217213
} label: {
218-
Image(systemName: "ellipsis.circle")
214+
Image(systemName: "square.and.arrow.up")
215+
}
216+
Spacer()
217+
Button(action: {
218+
showFileInfo = true
219+
}) {
220+
Label("File Info", systemImage: "info.circle")
219221
}
220222
}
221223
}
224+
.onAppear {
225+
showingPreview = true
226+
}
227+
.onDisappear {
228+
showingPreview = false
229+
}
222230
}
223231
}
224232
}
@@ -422,7 +430,7 @@ struct FileListView: View {
422430
isPreviewing: isPreviewing,
423431
isPrivate: isPrivate,
424432
onPreview: {
425-
selectedFile = file
433+
navigationPath.wrappedValue.append(file)
426434
},
427435
onCopyShareLink: {
428436
UIPasteboard.general.string = file.url

Django Files/Views/Preview.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ struct ContentPreview: View {
1414
@State private var error: Error?
1515
@State private var imageScale: CGFloat = 1.0
1616
@State private var lastImageScale: CGFloat = 1.0
17-
17+
@State private var isPreviewing: Bool = false
18+
1819
var body: some View {
1920
Group {
2021
if isLoading {
@@ -33,6 +34,10 @@ struct ContentPreview: View {
3334
}
3435
.onAppear {
3536
loadContent()
37+
isPreviewing = true
38+
}
39+
.onDisappear {
40+
isPreviewing = false
3641
}
3742
}
3843

0 commit comments

Comments
 (0)