Skip to content

Commit

Permalink
update!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
pdtxie committed Mar 8, 2024
1 parent 1c1cef6 commit 3bb3cca
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 31 deletions.
22 changes: 13 additions & 9 deletions CubeTime/Helper/HelperButtons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct CTButtonBase<V: View>: View {
var staticHeight: CGFloat = 0

@Environment(\.dynamicTypeSize) private var dynamicTypeSize
@Environment(\.colorScheme) private var colourScheme

let horizontalPadding: CGFloat
let fontType: Font
Expand Down Expand Up @@ -206,7 +207,7 @@ struct CTButtonBase<V: View>: View {
self.colourShadow = Color.black.opacity(0.07)

case .coloured(let colour):
self.colourBg = colour?.opacity(0.25) ?? Color("accent").opacity(0.20)
self.colourBg = colour?.opacity(0.25) ?? Color("accent").opacity(0.22)
self.colourFg = colour ?? Color("accent")
self.colourShadow = colour?.opacity(0.16) ?? Color("accent").opacity(0.08)

Expand Down Expand Up @@ -277,21 +278,24 @@ struct CTButtonBase<V: View>: View {
ZStack {
let frameHeight: CGFloat = (self.supportsDynamicResizing ? self.dynamicHeight : self.staticHeight)

if (self.hasBackground) {
if (self.hasBackground && colourScheme == .light) {
RoundedRectangle(cornerRadius: 6, style: .continuous)
.fill(Material.thinMaterial)
.fill(Material.ultraThinMaterial)
.frame(width: square ? frameHeight : nil, height: frameHeight)
}

RoundedRectangle(cornerRadius: 6, style: .continuous)
.fill(self.hasBackground ? self.colourBg.opacity(0.92) : Color.white.opacity(0.001))
.frame(width: square ? frameHeight : nil, height: frameHeight)
.shadow(color: self.hasShadow
? self.colourShadow
: Color.clear,
radius: self.hasShadow ? 4 : 0,
x: 0,
y: self.hasShadow ? 1 : 0)
.if(colourScheme == .light) { view in
view
.shadow(color: self.hasShadow
? self.colourShadow
: Color.clear,
radius: self.hasShadow ? 4 : 0,
x: 0,
y: self.hasShadow ? 1 : 0)
}

Group {
if (dynamicTypeSize > .xLarge) {
Expand Down
14 changes: 7 additions & 7 deletions CubeTime/Stats/StatsDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ struct StatsDetailView: View {
ThemedDivider()

HStack {
Text(solves.name == "Comp Sim Solve" ? "COMPSIM" : solves.name.uppercased())

Text("|")
.offset(y: -1) // slight offset of bar

HStack(alignment: .center, spacing: 4) {
if (SessionType(rawValue: session.sessionType)! == .playground) {
Text("Playground")
Expand All @@ -123,9 +118,14 @@ struct StatsDetailView: View {
.frame(width: 16, height: 16)

}

}

Text("|")
.offset(y: -1) // slight offset of bar

Text(solves.name == "Comp Sim Solve" ? "compsim" : solves.name.lowercased())


Spacer()
}
.font(.subheadline.weight(.medium))
Expand Down Expand Up @@ -180,7 +180,7 @@ struct StatsDetailView: View {
}
}
.navigationBarTitleDisplayMode(.inline)
.navigationTitle(solves.name == "Comp Sim Solve" ? "Comp Sim" : solves.name)
.navigationTitle("Stats Detail")

.sheet(item: $solveDetail) { item in
TimeDetailView(for: item, currentSolve: $solveDetail)
Expand Down
20 changes: 10 additions & 10 deletions CubeTime/StopwatchManager/StopwatchManager+Stats.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ extension StopwatchManager {
return nil
}

return Self.getCalculatedAverage(forSolves: solvesByDate.suffix(period), name: "Current ao", isCompsim: false)
return Self.getCalculatedAverage(forSolves: solvesByDate.suffix(period), name: "current ao", isCompsim: false)
}
}

Expand Down Expand Up @@ -382,7 +382,7 @@ extension StopwatchManager {
)
|| (currentAo5.totalPen, bestAo5!.totalPen) == (Penalty.none, Penalty.dnf) { // current is none and best is dnf
self.bestAo5 = currentAo5
self.bestAo5?.name = "Best ao5"
self.bestAo5?.name = "best ao5"
#warning("TODO: unhardcode")
}
}
Expand All @@ -394,7 +394,7 @@ extension StopwatchManager {
)
|| (currentAo12.totalPen, bestAo12!.totalPen) == (Penalty.none, Penalty.dnf) { // current is none and best is dnf
self.bestAo12 = currentAo12
self.bestAo12?.name = "Best ao12"
self.bestAo12?.name = "best ao12"
#warning("TODO: unhardcode")
}
}
Expand All @@ -406,7 +406,7 @@ extension StopwatchManager {
)
|| (currentAo100.totalPen, bestAo100!.totalPen) == (Penalty.none, Penalty.dnf) { // current is none and best is dnf
self.bestAo100 = currentAo100
self.bestAo100?.name = "Best ao100"
self.bestAo100?.name = "best ao100"
#warning("TODO: unhardcode")
}
}
Expand Down Expand Up @@ -489,7 +489,7 @@ extension StopwatchManager {
if groupLastSolve.count != 5 {
return nil
} else {
return Self.getCalculatedAverage(forSolves: groupLastSolve, name: "Current Comp Sim", isCompsim: true)
return Self.getCalculatedAverage(forSolves: groupLastSolve, name: "current compsim", isCompsim: true)
}

} else {
Expand All @@ -499,10 +499,10 @@ extension StopwatchManager {

if lastInGroup.count == 5 {

return Self.getCalculatedAverage(forSolves: lastInGroup, name: "Current Comp Sim", isCompsim: true)
return Self.getCalculatedAverage(forSolves: lastInGroup, name: "current compsim", isCompsim: true)
} else {

return Self.getCalculatedAverage(forSolves: (groupLastTwoSolves.last!.solves!.allObjects as! [Solve]), name: "Current Comp Sim", isCompsim: true)
return Self.getCalculatedAverage(forSolves: (groupLastTwoSolves.last!.solves!.allObjects as! [Solve]), name: "current compsim", isCompsim: true)
}
}
} else {
Expand All @@ -528,7 +528,7 @@ extension StopwatchManager {
if solvegroup.solves!.allObjects.count == 5 {


let currentAvg = Self.getCalculatedAverage(forSolves: solvegroup.solves!.allObjects as! [Solve], name: "Best Comp Sim", isCompsim: true)
let currentAvg = Self.getCalculatedAverage(forSolves: solvegroup.solves!.allObjects as! [Solve], name: "best compsim", isCompsim: true)

if currentAvg?.totalPen == .dnf {
continue
Expand Down Expand Up @@ -689,13 +689,13 @@ extension StopwatchManager {
let allSolves = trimmedSolves + countedSolvesIndices.map({ solvesByDate[Int($0)] })

if (bestAverage == .infinity) {
return CalculatedAverage(name: "Best ao \(width)",
return CalculatedAverage(name: "best ao \(width)",
average: bestAverage,
accountedSolves: allSolves,
totalPen: .dnf,
trimmedSolves: trimmedSolves)
} else {
return CalculatedAverage(name: "Best ao\(width)",
return CalculatedAverage(name: "best ao\(width)",
average: bestAverage,
accountedSolves: allSolves,
totalPen: .none,
Expand Down
11 changes: 6 additions & 5 deletions CubeTime/TimeList/TimeDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ struct TimeDetailView: View {


HStack {
Text(date, formatter: getSolveDateFormatter(date))

Text("|")
.offset(y: -1) // slight offset of bar

HStack(alignment: .center, spacing: 4) {
Text(puzzle_type.name)

Expand All @@ -125,6 +120,12 @@ struct TimeDetailView: View {
.frame(width: 16, height: 16)
}

Text("|")
.offset(y: -1) // slight offset of bar

Text(date, formatter: getSolveDateFormatter(date))


Spacer()
}
.font(.subheadline.weight(.medium))
Expand Down

0 comments on commit 3bb3cca

Please sign in to comment.