- Update NeonMoodTint to use synthwave colors matching Neon voting style (cyan, lime, yellow, orange, magenta) - Replace text label with 5 color circles in theme preview Colors row - Remove unused textColor customization code and picker views - Add .id(moodTint) to Month/Year views for color refresh - Clean up various unused color-related code 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
69 lines
2.8 KiB
Swift
69 lines
2.8 KiB
Swift
//
|
|
// CustomWigetView.swift
|
|
// Feels (iOS)
|
|
//
|
|
// Created by Trey Tartt on 4/2/22.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct CustomWigetView: View {
|
|
@AppStorage(UserDefaultsStore.Keys.theme.rawValue, store: GroupUserDefaults.groupDefaults) private var theme: Theme = .system
|
|
@StateObject private var selectedWidget = CustomWidgetStateViewModel()
|
|
|
|
private var textColor: Color { theme.currentTheme.labelColor }
|
|
|
|
var body: some View {
|
|
ZStack {
|
|
theme.currentTheme.secondaryBGColor
|
|
VStack {
|
|
ScrollView(.horizontal) {
|
|
HStack {
|
|
ForEach(UserDefaultsStore.getCustomWidgets(), id: \.uuid) { widget in
|
|
CustomWidgetView(customWidgetModel: widget)
|
|
.frame(width: 50, height: 50)
|
|
.cornerRadius(10)
|
|
.onTapGesture {
|
|
EventLogger.log(event: "show_widget")
|
|
selectedWidget.selectedItem = widget.copy() as? CustomWidgetModel
|
|
selectedWidget.showSheet = true
|
|
}
|
|
}
|
|
RoundedRectangle(cornerRadius: 10).fill().foregroundColor(theme.currentTheme.secondaryBGColor)
|
|
.frame(width: 50, height: 50)
|
|
.overlay(
|
|
Image(systemName: "plus")
|
|
)
|
|
.onTapGesture {
|
|
EventLogger.log(event: "tap_create_new_widget")
|
|
selectedWidget.selectedItem = CustomWidgetModel.randomWidget
|
|
selectedWidget.showSheet = true
|
|
}
|
|
}
|
|
.padding()
|
|
}
|
|
.background(RoundedRectangle(cornerRadius: 10).fill().foregroundColor(theme.currentTheme.bgColor))
|
|
.padding()
|
|
.cornerRadius(10)
|
|
|
|
Text("[\(String(localized: "how_to_add_widget"))](https://support.apple.com/guide/iphone/add-widgets-iphb8f1bf206/ios)")
|
|
.accentColor(textColor)
|
|
.padding(.bottom)
|
|
}
|
|
}
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
.cornerRadius(Constants.viewsCornerRaidus, corners: [.topLeft, .topRight, .bottomLeft, .bottomRight])
|
|
.sheet(isPresented: $selectedWidget.showSheet) {
|
|
if let selectedItem = selectedWidget.selectedItem {
|
|
CreateWidgetView(customWidget: selectedItem)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
struct CustomWigetView_Previews: PreviewProvider {
|
|
static var previews: some View {
|
|
CustomWigetView()
|
|
}
|
|
}
|