Skip to content

Commit

Permalink
Reorganize stats window
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamuko committed Jun 14, 2024
1 parent 44c0416 commit ebe9898
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Dreadnought/Views/StatsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,38 @@ struct StatsView: View {

var body: some View {
Grid(alignment: .trailing, horizontalSpacing: 15) {
StatGridTitle(text: "Session")
StatGridTitle(text: "Lifetime")
GridRow {
Text("Upload")
Text(FilesizeFormatStyle().format(client.sessionUpload))
Text(FilesizeFormatStyle().format(client.allTimeUpload))
}
GridRow {
Text("Download")
Text(FilesizeFormatStyle().format(client.sessionDownload))
Text(FilesizeFormatStyle().format(client.allTimeDownload))
}
GridRow {
Text("Ratio")
Text(RatioFormatStyle().format(sessionRatio))
Text(RatioFormatStyle().format(allTimeRatio))
}

Divider().gridCellUnsizedAxes(.horizontal)

StatGridTitle(text: "Lifetime")
StatGridTitle(text: "Session")
GridRow {
Text("Upload")
Text(FilesizeFormatStyle().format(client.allTimeUpload))
Text(FilesizeFormatStyle().format(client.sessionUpload))
}
GridRow {
Text("Download")
Text(FilesizeFormatStyle().format(client.allTimeDownload))
Text(FilesizeFormatStyle().format(client.sessionDownload))
}
GridRow {
Text("Ratio")
Text(RatioFormatStyle().format(allTimeRatio))
Text(RatioFormatStyle().format(sessionRatio))
}

Divider().gridCellUnsizedAxes(.horizontal)

GridRow {
Text("Session waste")
Text("Waste")
Text(FilesizeFormatStyle().format(client.sessionWaste))
}
GridRow {
Expand Down Expand Up @@ -106,5 +104,11 @@ struct StatsView: View {

#Preview {
@State var client = TorrentClient()
client.allTimeDownload = 197912819680
client.allTimeUpload = 1834422655961
client.sessionUpload = 499025
client.sessionWaste = 1024
client.connectedPeers = 12
client.totalBufferSize = 131234
return StatsView().environmentObject(client)
}

0 comments on commit ebe9898

Please sign in to comment.