some formatting stuff i guess

undo
saint 2024-05-16 16:08:52 -04:00
parent 4c484ccd90
commit 605c165523
1 changed files with 19 additions and 23 deletions

View File

@ -7,10 +7,11 @@
import GRDB
import GRDBQuery
import SwiftUIIntrospect
import os
import SwiftUI
import SwiftUIIntrospect
import WrappingHStack
let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "network")
var currentId: String?
@ -141,7 +142,6 @@ struct RibbonCrown: View {
alignment: .center
).foregroundColor(Color(UIColor(red: 0.30, green: 0.30, blue: 0.30, alpha: 0.4)))
.contentShape(.dragPreview, RoundedRectangle(cornerRadius: 32))
.if(draggedRibbon != nil && draggedRibbon!.id == ribbon.id && isDragging) { $0.overlay(Color(red: 0.1, green: 0.1, blue: 0.1)) }
// .offset(x: 10)
@ -208,35 +208,34 @@ private struct SegRow: View {
let decoder = JSONDecoder()
var retView = WrappingHStack(alignment: .leading, horizontalSpacing: 0) {
ForEach(0 ..< segSplit.count, id: \.self) { segIndex in
let verse = try! decoder.decode(Verse.self, from: segSplit[segIndex].data(using: .utf8)!)
let arrayOfText = verse.body.components(separatedBy: " ")
let lineHeight = CGFloat(30)
let fontSize = CGFloat(20)
let highlightColor = "470000"
ForEach(0 ..< arrayOfText.count, id: \.self) { index in
HStack(spacing: 0) {
if index == 0 {
Text("")
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
VStack(spacing: 0) {
ZStack {
Text(" ")
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
Text(String(verse.verse))
.font(Font.custom("AveriaSerifLibre-Regular", size: 10))
.padding(.horizontal, 0)
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
}
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
}
}
@ -244,12 +243,8 @@ private struct SegRow: View {
.foregroundColor(Color(UIColor(red: 0.76, green: 0.76, blue: 0.76, alpha: 1.00)))
.font(Font.custom("AveriaSerifLibre-Regular", size: fontSize))
.padding(.horizontal, 1.5) // intra word spacing
.if( self.highlights.contains(verse.verse) ) { $0.background(Color.init(hex: highlightColor)) }
.if(self.highlights.contains(verse.verse)) { $0.background(Color(hex: highlightColor)) }
.foregroundColor(Color.white)
.onTapGesture {
Print(arrayOfText[index])
Print(verse.verse)
@ -262,6 +257,7 @@ private struct SegRow: View {
}
.frame(height: 16) // intra line spacing
.padding(.vertical, 0)
// .if( index == 0 ) { $0.offset(x: -6) }
}
}
}