Skip to content

Commit 64372a0

Browse files
committed
style(properties-panel): improve readability and display project size in general info
1 parent f2b6880 commit 64372a0

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

Reframed/Editor/PropertiesPanel.swift

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ struct PropertiesPanel: View {
164164
infoRow("Capture Mode", value: captureModeLabel(mode))
165165
}
166166

167-
infoRow("File Size", value: formattedFileSize(url: editorState.result.screenVideoURL))
167+
infoRow("Project Size", value: formattedProjectSize())
168168

169169
if let ws = editorState.result.webcamSize {
170170
infoRow("Webcam", value: "\(Int(ws.width))x\(Int(ws.height))")
@@ -199,13 +199,19 @@ struct PropertiesPanel: View {
199199
}
200200
}
201201

202-
private func formattedFileSize(url: URL) -> String {
203-
guard let attrs = try? FileManager.default.attributesOfItem(atPath: url.path),
204-
let size = attrs[.size] as? Int64
205-
else {
202+
private func formattedProjectSize() -> String {
203+
guard let bundleURL = editorState.project?.bundleURL else { return "" }
204+
let fm = FileManager.default
205+
guard let enumerator = fm.enumerator(at: bundleURL, includingPropertiesForKeys: [.fileSizeKey], options: [.skipsHiddenFiles]) else {
206206
return ""
207207
}
208-
return ByteCountFormatter.string(fromByteCount: size, countStyle: .file)
208+
var total: Int64 = 0
209+
for case let fileURL as URL in enumerator {
210+
if let size = (try? fileURL.resourceValues(forKeys: [.fileSizeKey]))?.fileSize {
211+
total += Int64(size)
212+
}
213+
}
214+
return ByteCountFormatter.string(fromByteCount: total, countStyle: .file)
209215
}
210216

211217
private func formattedDate(_ date: Date) -> String {
@@ -222,7 +228,7 @@ struct PropertiesPanel: View {
222228
.foregroundStyle(ReframedColors.dimLabel)
223229
Spacer()
224230
Text(value)
225-
.font(.system(size: 12, design: .monospaced))
231+
.font(.system(size: 12))
226232
.foregroundStyle(ReframedColors.secondaryText)
227233
}
228234
}

0 commit comments

Comments
 (0)