Skip to content

Commit

Permalink
Improve Chart Layout and UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Black-Fox-2022 committed May 24, 2024
1 parent a599f69 commit c43d989
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 18 deletions.
15 changes: 11 additions & 4 deletions Cluster/ClusterInstrument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ struct ClusterInstrument: View {
let type: InsightDisplayMode

var body: some View {
VStack(alignment: .leading) {
VStack(alignment: .leading, spacing: 8) {
Text(title)
.font(.title)
.padding(.bottom)
.font(.headline)
.fontWeight(.medium)
.foregroundStyle(Color.Zinc600)
.padding(.top)
.padding(.horizontal)
QueryRunner(query: query, type: type)
}
.padding()
.compositingGroup()
.background(.background)
.shadow(color: .gray.opacity(0.15), radius: 5, x: 0, y: 2)
.border(Color.Zinc200, width: 1.0)
.padding(.vertical, 5)
}
}
19 changes: 16 additions & 3 deletions Cluster/QueryRunner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,27 @@ struct QueryRunner: View {
@State var isLoading: Bool = false

var body: some View {
VStack {
VStack(spacing: 10){
if let queryResult = queryResultWrapper?.result {
ClusterChart(query: query, result: queryResult, type: type)
.padding(.horizontal)
}

if isLoading {
Text("Loading...")
HStack(spacing: 3){
Spacer()
if let queryResultWrapper = queryResultWrapper {
Text("Updated")
Text(queryResultWrapper.calculationFinishedAt, style: .relative)
Text("ago")

} else {
Text("Calculating...")
}
}
.font(.footnote)
.foregroundStyle(Color.Zinc400)
.padding(8)
.background(Color.Zinc50)
}
.onAppear {
Task {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xF3",
"red" : "0xF0"
"red" : "0xF3"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x30",
"green" : "0x29",
"red" : "0x25"
"blue" : "0x1B",
"green" : "0x18",
"red" : "0x18"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x30",
"green" : "0x29",
"red" : "0x25"
"blue" : "0xE7",
"green" : "0xE3",
"red" : "0xE3"
}
},
"idiom" : "universal"
Expand All @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x78",
"green" : "0x67",
"red" : "0x5D"
"blue" : "0x2A",
"green" : "0x27",
"red" : "0x27"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xAA",
"green" : "0xA1",
"red" : "0xA1"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x5B",
"green" : "0x51",
"red" : "0x51"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xF5",
"green" : "0xF3",
"red" : "0xF3"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x0B",
"green" : "0x09",
"red" : "0x09"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x5B",
"green" : "0x51",
"red" : "0x51"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xAA",
"green" : "0xA1",
"red" : "0xA1"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
7 changes: 7 additions & 0 deletions UIComponents/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@ extension Color {
static let telemetryOrange = Color("Torange")
static let cardBackground = Color("CardBackgroundColor")
static let customTextColor = Color("CustomTextColor")

static let Zinc50 = Color("Zinc50")
static let Zinc100 = Color("Zinc100")
static let Zinc200 = Color("Zinc200")
static let Zinc400 = Color("Zinc400")
static let Zinc600 = Color("Zinc600")

}
2 changes: 1 addition & 1 deletion iOS/InsightGroupsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct InsightGroupsView: View {

selectedInsightGroupID.map {
GroupView(groupID: $0, selectedInsightID: $selectedInsightID, sidebarVisible: $sidebarVisible)
.background(Color.separatorColor)
.background(Color.Zinc100)
}
}
}
Expand Down

0 comments on commit c43d989

Please sign in to comment.