work on share view UI a bit
This commit is contained in:
@@ -52,7 +52,7 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
entries = entries.sorted(by: {
|
entries = entries.sorted(by: {
|
||||||
$0.mood.rawValue > $1.mood.rawValue
|
$0.percent > $1.percent
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
fatalError("no data")
|
fatalError("no data")
|
||||||
@@ -81,27 +81,45 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
|||||||
.foregroundColor(mood.color)
|
.foregroundColor(mood.color)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
|
||||||
.frame(height: 100)
|
|
||||||
|
|
||||||
HStack {
|
VStack {
|
||||||
ForEach(entries, id: \.mood) { model in
|
HStack {
|
||||||
ZStack {
|
ForEach(entries.prefix(2), id: \.mood) { model in
|
||||||
Circle().fill(model.mood.color)
|
ZStack {
|
||||||
|
Circle().fill(model.mood.color)
|
||||||
|
|
||||||
Text("\(model.percent, specifier: "%.0f")%")
|
Text("\(model.percent, specifier: "%.0f")%")
|
||||||
.font(.title)
|
.font(.title)
|
||||||
.fontWeight(.bold)
|
.fontWeight(.bold)
|
||||||
.scaledToFill()
|
.scaledToFill()
|
||||||
.minimumScaleFactor(0.5)
|
.minimumScaleFactor(0.5)
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.foregroundColor(Color(UIColor.white))
|
.foregroundColor(Color(UIColor.white))
|
||||||
.padding(2)
|
.padding(2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
|
||||||
.frame(height: 100)
|
|
||||||
}
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
ForEach(entries.suffix(3), id: \.mood) { model in
|
||||||
|
ZStack {
|
||||||
|
Circle().fill(model.mood.color)
|
||||||
|
|
||||||
|
Text("\(model.percent, specifier: "%.0f")%")
|
||||||
|
.font(.title)
|
||||||
|
.fontWeight(.bold)
|
||||||
|
.scaledToFill()
|
||||||
|
.minimumScaleFactor(0.5)
|
||||||
|
.lineLimit(1)
|
||||||
|
.foregroundColor(Color(UIColor.white))
|
||||||
|
.padding(2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
}
|
}
|
||||||
|
.padding(.top, 30)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
ForEach(entries, id: \.mood) { model in
|
ForEach(entries, id: \.mood) { model in
|
||||||
@@ -117,8 +135,6 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
|||||||
.foregroundColor(Color(UIColor.white))
|
.foregroundColor(Color(UIColor.white))
|
||||||
.padding(2)
|
.padding(2)
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
|
||||||
.frame(height: 100)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,19 +146,20 @@ struct AllMoodsTotalTemplate: View, SharingTemplate {
|
|||||||
.font(.title)
|
.font(.title)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
.padding(.top, 1)
|
.padding()
|
||||||
|
|
||||||
circularViews
|
circularViews
|
||||||
.padding([.trailing, .leading, .top])
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}.padding()
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainView: some View {
|
var mainView: some View {
|
||||||
VStack {
|
VStack {
|
||||||
shareView
|
shareView
|
||||||
Spacer()
|
.background(Color(UIColor.secondarySystemBackground))
|
||||||
|
.cornerRadius(10)
|
||||||
|
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
showSharingTemplate = true
|
showSharingTemplate = true
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ struct CurrentStreakTemplate: View, SharingTemplate {
|
|||||||
.font(.title)
|
.font(.title)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
.padding(.top, 1)
|
.padding(.top)
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
VStack {
|
VStack {
|
||||||
@@ -95,6 +95,8 @@ struct CurrentStreakTemplate: View, SharingTemplate {
|
|||||||
var mainView: some View {
|
var mainView: some View {
|
||||||
VStack {
|
VStack {
|
||||||
shareView
|
shareView
|
||||||
|
.background(Color(UIColor.secondarySystemBackground))
|
||||||
|
.cornerRadius(10)
|
||||||
Spacer()
|
Spacer()
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
|||||||
.font(.title)
|
.font(.title)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
.padding(.top, 1)
|
.padding()
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
Text(self.moodEntries.first?.forDate ?? Date(), formatter: itemFormatter)
|
Text(self.moodEntries.first?.forDate ?? Date(), formatter: itemFormatter)
|
||||||
@@ -135,6 +135,8 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
|||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
.padding(.top, 1)
|
.padding(.top, 1)
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
VStack {
|
VStack {
|
||||||
LazyVGrid(columns: columns, spacing: 0) {
|
LazyVGrid(columns: columns, spacing: 0) {
|
||||||
@@ -157,6 +159,8 @@ struct LongestStreakTemplate: View, SharingTemplate {
|
|||||||
var mainView: some View {
|
var mainView: some View {
|
||||||
VStack {
|
VStack {
|
||||||
shareView
|
shareView
|
||||||
|
.background(Color(UIColor.secondarySystemBackground))
|
||||||
|
.cornerRadius(10)
|
||||||
Spacer()
|
Spacer()
|
||||||
Menu(content: {
|
Menu(content: {
|
||||||
ForEach(Mood.allValues) { mood in
|
ForEach(Mood.allValues) { mood in
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ struct MonthTotalTemplate: View, SharingTemplate {
|
|||||||
.font(.title)
|
.font(.title)
|
||||||
.foregroundColor(Color(UIColor.label))
|
.foregroundColor(Color(UIColor.label))
|
||||||
.frame(maxWidth: .infinity, alignment: .center)
|
.frame(maxWidth: .infinity, alignment: .center)
|
||||||
.padding(.top, 1)
|
.padding()
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
LazyVGrid(columns: columns, spacing: 0) {
|
LazyVGrid(columns: columns, spacing: 10) {
|
||||||
ForEach(moodEntries) { entry in
|
ForEach(moodEntries) { entry in
|
||||||
entry.mood.icon
|
entry.mood.icon
|
||||||
.resizable()
|
.resizable()
|
||||||
@@ -123,17 +123,18 @@ struct MonthTotalTemplate: View, SharingTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.padding()
|
||||||
|
|
||||||
circularViews
|
circularViews
|
||||||
.padding([.trailing, .leading, .top])
|
.padding([.trailing, .leading, .top])
|
||||||
|
|
||||||
Spacer()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainView: some View {
|
var mainView: some View {
|
||||||
VStack {
|
VStack {
|
||||||
shareView
|
shareView
|
||||||
|
.background(Color(UIColor.secondarySystemBackground))
|
||||||
|
.cornerRadius(10)
|
||||||
Spacer()
|
Spacer()
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
Button(action: {
|
Button(action: {
|
||||||
|
|||||||
Reference in New Issue
Block a user