openuispec 0.1.27 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -19
- package/cli/init.ts +7 -7
- package/docs/implementation-notes.md +5 -1
- package/docs/release-notes-v0.1.28.md +25 -0
- package/docs/stress-test-maturity-report.md +1 -1
- package/drift/index.ts +21 -4
- package/examples/taskflow/AGENTS.md +112 -0
- package/examples/taskflow/CLAUDE.md +112 -0
- package/examples/taskflow/generated/android/TaskFlow/README.md +43 -0
- package/examples/taskflow/generated/android/TaskFlow/app/build.gradle.kts +76 -0
- package/examples/taskflow/generated/android/TaskFlow/app/proguard-rules.pro +1 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/AndroidManifest.xml +21 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/MainActivity.kt +19 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/TaskFlowApp.kt +283 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/DomainModels.kt +106 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/model/SampleData.kt +57 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/components/Common.kt +109 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/HomeScreen.kt +112 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/ProjectsScreen.kt +61 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/SettingsScreen.kt +82 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/screens/TaskDetailScreen.kt +111 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/sheets/Sheets.kt +77 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Color.kt +30 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Theme.kt +86 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/java/uz/rsteam/taskflow/ui/theme/Type.kt +57 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/strings.xml +155 -0
- package/examples/taskflow/generated/android/TaskFlow/app/src/main/res/values/themes.xml +4 -0
- package/examples/taskflow/generated/android/TaskFlow/build.gradle.kts +5 -0
- package/examples/taskflow/generated/android/TaskFlow/gradle/gradle-daemon-jvm.properties +12 -0
- package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/examples/taskflow/generated/android/TaskFlow/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/examples/taskflow/generated/android/TaskFlow/gradle.properties +4 -0
- package/examples/taskflow/generated/android/TaskFlow/gradlew +18 -0
- package/examples/taskflow/generated/android/TaskFlow/gradlew.bat +12 -0
- package/examples/taskflow/generated/android/TaskFlow/settings.gradle.kts +18 -0
- package/examples/taskflow/generated/ios/TaskFlow/README.md +21 -0
- package/examples/taskflow/generated/ios/TaskFlow/Resources/en.lproj/Localizable.strings +115 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/App/TaskFlowApp.swift +24 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Components/AppChrome.swift +150 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Flows/TaskEditorSheet.swift +220 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Models/DomainModels.swift +122 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/CalendarView.swift +21 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/HomeView.swift +201 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProfileEditView.swift +48 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectDetailView.swift +59 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectsView.swift +63 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/SettingsView.swift +85 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/TaskDetailView.swift +219 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppModel.swift +320 -0
- package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Support/AppSupport.swift +41 -0
- package/examples/taskflow/generated/ios/TaskFlow/project.yml +26 -0
- package/examples/taskflow/generated/web/TaskFlow/README.md +19 -0
- package/examples/taskflow/generated/web/TaskFlow/index.html +12 -0
- package/examples/taskflow/generated/web/TaskFlow/package-lock.json +1908 -0
- package/examples/taskflow/generated/web/TaskFlow/package.json +24 -0
- package/examples/taskflow/generated/web/TaskFlow/src/App.tsx +58 -0
- package/examples/taskflow/generated/web/TaskFlow/src/AppShell.tsx +55 -0
- package/examples/taskflow/generated/web/TaskFlow/src/components/Common.tsx +82 -0
- package/examples/taskflow/generated/web/TaskFlow/src/components/Modals.tsx +191 -0
- package/examples/taskflow/generated/web/TaskFlow/src/components/Nav.tsx +41 -0
- package/examples/taskflow/generated/web/TaskFlow/src/generated/messages.ts +131 -0
- package/examples/taskflow/generated/web/TaskFlow/src/hooks.ts +25 -0
- package/examples/taskflow/generated/web/TaskFlow/src/i18n.ts +39 -0
- package/examples/taskflow/generated/web/TaskFlow/src/locales.en.json +111 -0
- package/examples/taskflow/generated/web/TaskFlow/src/main.tsx +13 -0
- package/examples/taskflow/generated/web/TaskFlow/src/screens/HomeScreen.tsx +111 -0
- package/examples/taskflow/generated/web/TaskFlow/src/screens/ProjectsScreen.tsx +82 -0
- package/examples/taskflow/generated/web/TaskFlow/src/screens/SettingsScreens.tsx +132 -0
- package/examples/taskflow/generated/web/TaskFlow/src/screens/TaskDetail.tsx +105 -0
- package/examples/taskflow/generated/web/TaskFlow/src/store.ts +216 -0
- package/examples/taskflow/generated/web/TaskFlow/src/styles.css +617 -0
- package/examples/taskflow/generated/web/TaskFlow/src/types.ts +64 -0
- package/examples/taskflow/generated/web/TaskFlow/src/utils.ts +78 -0
- package/examples/taskflow/generated/web/TaskFlow/tsconfig.json +21 -0
- package/examples/taskflow/generated/web/TaskFlow/vite.config.ts +6 -0
- package/examples/taskflow/openuispec/README.md +49 -0
- package/examples/todo-orbit/AGENTS.md +44 -19
- package/examples/todo-orbit/CLAUDE.md +44 -19
- package/examples/todo-orbit/openuispec/README.md +2 -2
- package/package.json +1 -1
- package/schema/validate.ts +9 -4
- package/status/index.ts +16 -3
- /package/examples/taskflow/{contracts → openuispec/contracts}/README.md +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/action_trigger.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/collection.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/data_display.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/feedback.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/input_field.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/nav_container.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/surface.yaml +0 -0
- /package/examples/taskflow/{contracts → openuispec/contracts}/x_media_player.yaml +0 -0
- /package/examples/taskflow/{flows → openuispec/flows}/create_task.yaml +0 -0
- /package/examples/taskflow/{flows → openuispec/flows}/edit_task.yaml +0 -0
- /package/examples/taskflow/{locales → openuispec/locales}/en.json +0 -0
- /package/examples/taskflow/{openuispec.yaml → openuispec/openuispec.yaml} +0 -0
- /package/examples/taskflow/{platform → openuispec/platform}/android.yaml +0 -0
- /package/examples/taskflow/{platform → openuispec/platform}/ios.yaml +0 -0
- /package/examples/taskflow/{platform → openuispec/platform}/web.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/calendar.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/home.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/profile_edit.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/project_detail.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/projects.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/settings.yaml +0 -0
- /package/examples/taskflow/{screens → openuispec/screens}/task_detail.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/color.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/elevation.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/icons.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/layout.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/motion.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/spacing.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/themes.yaml +0 -0
- /package/examples/taskflow/{tokens → openuispec/tokens}/typography.yaml +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
enum AppSection: String, CaseIterable, Identifiable {
|
|
4
|
+
case home
|
|
5
|
+
case projects
|
|
6
|
+
case calendar
|
|
7
|
+
case settings
|
|
8
|
+
|
|
9
|
+
var id: String { rawValue }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
enum TaskStatus: String, CaseIterable, Codable {
|
|
13
|
+
case todo
|
|
14
|
+
case inProgress = "in_progress"
|
|
15
|
+
case done
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
enum TaskPriority: String, CaseIterable, Codable {
|
|
19
|
+
case low
|
|
20
|
+
case medium
|
|
21
|
+
case high
|
|
22
|
+
case urgent
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
enum HomeFilter: String, CaseIterable, Codable {
|
|
26
|
+
case all
|
|
27
|
+
case today
|
|
28
|
+
case upcoming
|
|
29
|
+
case done
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
enum SortOrder: String, CaseIterable, Codable {
|
|
33
|
+
case dueDate = "due_date"
|
|
34
|
+
case priority = "priority"
|
|
35
|
+
case createdAt = "created_at"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
enum ThemePreference: String, CaseIterable, Codable {
|
|
39
|
+
case system
|
|
40
|
+
case light
|
|
41
|
+
case dark
|
|
42
|
+
case warm
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
struct Project: Identifiable, Hashable, Codable {
|
|
46
|
+
let id: UUID
|
|
47
|
+
var name: String
|
|
48
|
+
var colorHex: String
|
|
49
|
+
var icon: String
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
struct UserProfile: Identifiable, Hashable, Codable {
|
|
53
|
+
let id: UUID
|
|
54
|
+
var name: String
|
|
55
|
+
var firstName: String
|
|
56
|
+
var email: String
|
|
57
|
+
var avatarSymbol: String?
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
struct TaskAttachment: Hashable, Codable {
|
|
61
|
+
var mediaType: String
|
|
62
|
+
var title: String
|
|
63
|
+
var url: URL?
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
struct Task: Identifiable, Hashable, Codable {
|
|
67
|
+
let id: UUID
|
|
68
|
+
var title: String
|
|
69
|
+
var description: String?
|
|
70
|
+
var status: TaskStatus
|
|
71
|
+
var priority: TaskPriority
|
|
72
|
+
var dueDate: Date?
|
|
73
|
+
var projectID: UUID?
|
|
74
|
+
var assigneeID: UUID?
|
|
75
|
+
var tags: [String]
|
|
76
|
+
var createdAt: Date
|
|
77
|
+
var updatedAt: Date
|
|
78
|
+
var attachment: TaskAttachment?
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
struct Preferences: Codable {
|
|
82
|
+
var theme: ThemePreference
|
|
83
|
+
var defaultPriority: TaskPriority
|
|
84
|
+
var notificationsEnabled: Bool
|
|
85
|
+
var remindersEnabled: Bool
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
struct TaskDraft {
|
|
89
|
+
var title = ""
|
|
90
|
+
var description = ""
|
|
91
|
+
var projectID: UUID?
|
|
92
|
+
var priority: TaskPriority = .medium
|
|
93
|
+
var dueDateEnabled = false
|
|
94
|
+
var dueDate = Date()
|
|
95
|
+
var tagsText = ""
|
|
96
|
+
var assignToSelf = true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
struct ProjectDraft {
|
|
100
|
+
var name = ""
|
|
101
|
+
var colorHex = "#5B4FE8"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
enum PresentedSheet: Identifiable {
|
|
105
|
+
case createTask
|
|
106
|
+
case editTask(UUID)
|
|
107
|
+
case newProject
|
|
108
|
+
case assignTask(UUID)
|
|
109
|
+
|
|
110
|
+
var id: String {
|
|
111
|
+
switch self {
|
|
112
|
+
case .createTask:
|
|
113
|
+
return "createTask"
|
|
114
|
+
case let .editTask(id):
|
|
115
|
+
return "editTask-\(id.uuidString)"
|
|
116
|
+
case .newProject:
|
|
117
|
+
return "newProject"
|
|
118
|
+
case let .assignTask(id):
|
|
119
|
+
return "assignTask-\(id.uuidString)"
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct CalendarView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
|
|
6
|
+
var body: some View {
|
|
7
|
+
VStack(spacing: 18) {
|
|
8
|
+
Image(systemName: "calendar.badge.clock")
|
|
9
|
+
.font(.system(size: 52))
|
|
10
|
+
.foregroundStyle(AppPalette.brandPrimary)
|
|
11
|
+
Text(model.localized("calendar.title"))
|
|
12
|
+
.font(.largeTitle.weight(.bold))
|
|
13
|
+
Text(model.localized("calendar.coming_soon"))
|
|
14
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
15
|
+
}
|
|
16
|
+
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
17
|
+
.padding()
|
|
18
|
+
.background(Color(.systemGroupedBackground))
|
|
19
|
+
.navigationTitle(model.localized("calendar.title"))
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct HomeView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
|
|
6
|
+
var body: some View {
|
|
7
|
+
GeometryReader { geometry in
|
|
8
|
+
let expanded = geometry.size.width >= 900
|
|
9
|
+
ScrollView {
|
|
10
|
+
VStack(alignment: .leading, spacing: 24) {
|
|
11
|
+
header
|
|
12
|
+
searchField
|
|
13
|
+
filterRow
|
|
14
|
+
if expanded {
|
|
15
|
+
HStack(alignment: .top, spacing: 24) {
|
|
16
|
+
taskList(expanded: true)
|
|
17
|
+
.frame(maxWidth: .infinity)
|
|
18
|
+
detailPanel
|
|
19
|
+
.frame(maxWidth: 420)
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
taskList(expanded: false)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.padding(24)
|
|
26
|
+
}
|
|
27
|
+
.background(Color(.systemGroupedBackground))
|
|
28
|
+
.navigationTitle(model.localized("nav.tasks"))
|
|
29
|
+
.toolbar {
|
|
30
|
+
ToolbarItem(placement: .topBarTrailing) {
|
|
31
|
+
Button {
|
|
32
|
+
model.presentedSheet = .createTask
|
|
33
|
+
} label: {
|
|
34
|
+
Label(model.localized("home.new_task"), systemImage: "plus")
|
|
35
|
+
}
|
|
36
|
+
.buttonStyle(.borderedProminent)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private var header: some View {
|
|
43
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
44
|
+
Text(model.greeting())
|
|
45
|
+
.font(.system(size: 30, weight: .bold, design: .rounded))
|
|
46
|
+
Text(model.todayCountText())
|
|
47
|
+
.font(.body)
|
|
48
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private var searchField: some View {
|
|
53
|
+
VStack(alignment: .leading, spacing: 8) {
|
|
54
|
+
Text(model.localized("home.search_label"))
|
|
55
|
+
.font(.caption.weight(.semibold))
|
|
56
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
57
|
+
TextField(model.localized("home.search_placeholder"), text: $model.searchQuery)
|
|
58
|
+
.textFieldStyle(.roundedBorder)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private var filterRow: some View {
|
|
63
|
+
ScrollView(.horizontal, showsIndicators: false) {
|
|
64
|
+
HStack(spacing: 10) {
|
|
65
|
+
filterChip(.all)
|
|
66
|
+
filterChip(.today)
|
|
67
|
+
filterChip(.upcoming)
|
|
68
|
+
filterChip(.done)
|
|
69
|
+
Picker("Sort", selection: $model.sortOrder) {
|
|
70
|
+
Text("Due").tag(SortOrder.dueDate)
|
|
71
|
+
Text("Priority").tag(SortOrder.priority)
|
|
72
|
+
Text("Created").tag(SortOrder.createdAt)
|
|
73
|
+
}
|
|
74
|
+
.pickerStyle(.menu)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
private func filterChip(_ filter: HomeFilter) -> some View {
|
|
80
|
+
let selected = model.homeFilter == filter
|
|
81
|
+
let title: String
|
|
82
|
+
switch filter {
|
|
83
|
+
case .all: title = model.localized("home.filter.all")
|
|
84
|
+
case .today: title = model.localized("home.filter.today")
|
|
85
|
+
case .upcoming: title = model.localized("home.filter.upcoming")
|
|
86
|
+
case .done: title = model.localized("home.filter.done")
|
|
87
|
+
}
|
|
88
|
+
return Button {
|
|
89
|
+
model.homeFilter = filter
|
|
90
|
+
} label: {
|
|
91
|
+
Text("\(title) (\(model.count(for: filter)))")
|
|
92
|
+
.font(.subheadline.weight(.semibold))
|
|
93
|
+
.padding(.horizontal, 12)
|
|
94
|
+
.padding(.vertical, 8)
|
|
95
|
+
.background(selected ? AppPalette.brandPrimary : AppPalette.surfaceSecondary)
|
|
96
|
+
.foregroundStyle(selected ? .white : .primary)
|
|
97
|
+
.clipShape(Capsule())
|
|
98
|
+
}
|
|
99
|
+
.buttonStyle(.plain)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
private func taskList(expanded: Bool) -> some View {
|
|
103
|
+
VStack(alignment: .leading, spacing: 14) {
|
|
104
|
+
if model.filteredTasks.isEmpty {
|
|
105
|
+
ContentUnavailableView(
|
|
106
|
+
model.localized("home.empty_title"),
|
|
107
|
+
systemImage: "checkmark.circle.fill",
|
|
108
|
+
description: Text(model.localized("home.empty_body"))
|
|
109
|
+
)
|
|
110
|
+
.frame(maxWidth: .infinity)
|
|
111
|
+
.padding(.top, 40)
|
|
112
|
+
} else {
|
|
113
|
+
ForEach(model.filteredTasks) { task in
|
|
114
|
+
if expanded {
|
|
115
|
+
taskRow(task)
|
|
116
|
+
} else {
|
|
117
|
+
NavigationLink {
|
|
118
|
+
TaskDetailView(model: model, taskID: task.id)
|
|
119
|
+
} label: {
|
|
120
|
+
taskCard(task)
|
|
121
|
+
}
|
|
122
|
+
.buttonStyle(.plain)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private func taskRow(_ task: Task) -> some View {
|
|
130
|
+
Button {
|
|
131
|
+
model.selectedTaskID = task.id
|
|
132
|
+
} label: {
|
|
133
|
+
taskCard(task)
|
|
134
|
+
.overlay {
|
|
135
|
+
RoundedRectangle(cornerRadius: 24)
|
|
136
|
+
.stroke(model.selectedTaskID == task.id ? AppPalette.brandPrimary : .clear, lineWidth: 2)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
.buttonStyle(.plain)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private func taskCard(_ task: Task) -> some View {
|
|
143
|
+
HStack(alignment: .top, spacing: 14) {
|
|
144
|
+
Image(systemName: task.status == .done ? "checkmark.circle.fill" : "circle")
|
|
145
|
+
.font(.title3)
|
|
146
|
+
.foregroundStyle(task.status == .done ? AppPalette.success : AppPalette.textTertiary)
|
|
147
|
+
|
|
148
|
+
VStack(alignment: .leading, spacing: 6) {
|
|
149
|
+
Text(task.title)
|
|
150
|
+
.font(.headline)
|
|
151
|
+
Text([model.project(for: task)?.name, relativeDate(task.dueDate)].compactMap { $0 }.joined(separator: " · "))
|
|
152
|
+
.font(.subheadline)
|
|
153
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
154
|
+
if !task.tags.isEmpty {
|
|
155
|
+
HStack(spacing: 6) {
|
|
156
|
+
ForEach(task.tags, id: \.self) { tag in
|
|
157
|
+
Text(tag)
|
|
158
|
+
.font(.caption.weight(.medium))
|
|
159
|
+
.padding(.horizontal, 8)
|
|
160
|
+
.padding(.vertical, 4)
|
|
161
|
+
.background(AppPalette.surfaceSecondary)
|
|
162
|
+
.clipShape(Capsule())
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
Spacer()
|
|
168
|
+
Circle()
|
|
169
|
+
.fill(priorityColor(task.priority))
|
|
170
|
+
.frame(width: 10, height: 10)
|
|
171
|
+
}
|
|
172
|
+
.padding(18)
|
|
173
|
+
.background(.background)
|
|
174
|
+
.clipShape(RoundedRectangle(cornerRadius: 24))
|
|
175
|
+
.shadow(color: .black.opacity(0.05), radius: 12, y: 4)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private var detailPanel: some View {
|
|
179
|
+
Group {
|
|
180
|
+
if let selectedTask = model.selectedTask {
|
|
181
|
+
TaskDetailPanel(model: model, taskID: selectedTask.id)
|
|
182
|
+
} else {
|
|
183
|
+
ContentUnavailableView("Select a task", systemImage: "sidebar.right", description: Text("Choose a task to inspect its details."))
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private func relativeDate(_ date: Date?) -> String? {
|
|
189
|
+
guard let date else { return nil }
|
|
190
|
+
return date.formatted(.relative(presentation: .named))
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
private func priorityColor(_ priority: TaskPriority) -> Color {
|
|
194
|
+
switch priority {
|
|
195
|
+
case .low: Color(hex: "#9CA3AF")
|
|
196
|
+
case .medium: AppPalette.info
|
|
197
|
+
case .high: AppPalette.warning
|
|
198
|
+
case .urgent: AppPalette.danger
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProfileEditView.swift
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct ProfileEditView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
@Environment(\.dismiss) private var dismiss
|
|
6
|
+
@State private var name = ""
|
|
7
|
+
@State private var email = ""
|
|
8
|
+
|
|
9
|
+
var body: some View {
|
|
10
|
+
Form {
|
|
11
|
+
Section {
|
|
12
|
+
VStack(spacing: 12) {
|
|
13
|
+
Image(systemName: model.currentUser.avatarSymbol ?? "person.crop.circle.fill")
|
|
14
|
+
.font(.system(size: 54))
|
|
15
|
+
.foregroundStyle(AppPalette.brandPrimary)
|
|
16
|
+
Text(model.currentUser.name)
|
|
17
|
+
.font(.headline)
|
|
18
|
+
Text(model.currentUser.email)
|
|
19
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
20
|
+
Button(model.localized("profile.change_photo")) {}
|
|
21
|
+
}
|
|
22
|
+
.frame(maxWidth: .infinity)
|
|
23
|
+
.padding(.vertical, 12)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Section {
|
|
27
|
+
TextField(model.localized("profile.field_name"), text: $name)
|
|
28
|
+
TextField(model.localized("profile.field_email"), text: $email)
|
|
29
|
+
.textInputAutocapitalization(.never)
|
|
30
|
+
.keyboardType(.emailAddress)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Section {
|
|
34
|
+
Button(model.localized("profile.save")) {
|
|
35
|
+
model.updateProfile(name: name, email: email)
|
|
36
|
+
dismiss()
|
|
37
|
+
}
|
|
38
|
+
.buttonStyle(.borderedProminent)
|
|
39
|
+
.frame(maxWidth: .infinity, alignment: .center)
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
.navigationTitle(model.localized("profile.save"))
|
|
43
|
+
.onAppear {
|
|
44
|
+
name = model.currentUser.name
|
|
45
|
+
email = model.currentUser.email
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
package/examples/taskflow/generated/ios/TaskFlow/Sources/TaskFlow/Screens/ProjectDetailView.swift
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct ProjectDetailView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
let projectID: UUID
|
|
6
|
+
|
|
7
|
+
private var project: Project? {
|
|
8
|
+
model.projects.first(where: { $0.id == projectID })
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var body: some View {
|
|
12
|
+
Group {
|
|
13
|
+
if let project {
|
|
14
|
+
List {
|
|
15
|
+
Section {
|
|
16
|
+
VStack(alignment: .leading, spacing: 12) {
|
|
17
|
+
HStack {
|
|
18
|
+
Image(systemName: project.icon)
|
|
19
|
+
.foregroundStyle(Color(hex: project.colorHex))
|
|
20
|
+
Text(project.name)
|
|
21
|
+
.font(.largeTitle.weight(.bold))
|
|
22
|
+
}
|
|
23
|
+
Text("\(model.tasks(for: project).count) tasks")
|
|
24
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
25
|
+
}
|
|
26
|
+
.padding(.vertical, 8)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Section {
|
|
30
|
+
if model.tasks(for: project).isEmpty {
|
|
31
|
+
ContentUnavailableView(
|
|
32
|
+
model.localized("project_detail.empty_title"),
|
|
33
|
+
systemImage: "checkmark.circle.fill",
|
|
34
|
+
description: Text(model.localized("project_detail.empty_body"))
|
|
35
|
+
)
|
|
36
|
+
.padding(.vertical, 24)
|
|
37
|
+
} else {
|
|
38
|
+
ForEach(model.tasks(for: project)) { task in
|
|
39
|
+
NavigationLink {
|
|
40
|
+
TaskDetailView(model: model, taskID: task.id)
|
|
41
|
+
} label: {
|
|
42
|
+
VStack(alignment: .leading, spacing: 4) {
|
|
43
|
+
Text(task.title)
|
|
44
|
+
Text(task.dueDate?.formatted(.relative(presentation: .named)) ?? "No due date")
|
|
45
|
+
.font(.subheadline)
|
|
46
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
.navigationTitle(project.name)
|
|
54
|
+
} else {
|
|
55
|
+
ContentUnavailableView("Project missing", systemImage: "folder.badge.questionmark")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct ProjectsView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
|
|
6
|
+
private let gridColumns = [
|
|
7
|
+
GridItem(.adaptive(minimum: 220), spacing: 16)
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
var body: some View {
|
|
11
|
+
ScrollView {
|
|
12
|
+
LazyVGrid(columns: gridColumns, spacing: 16) {
|
|
13
|
+
ForEach(model.projects) { project in
|
|
14
|
+
NavigationLink {
|
|
15
|
+
ProjectDetailView(model: model, projectID: project.id)
|
|
16
|
+
} label: {
|
|
17
|
+
ProjectCard(project: project, taskCount: model.tasks(for: project).count)
|
|
18
|
+
}
|
|
19
|
+
.buttonStyle(.plain)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
.padding(24)
|
|
23
|
+
}
|
|
24
|
+
.background(Color(.systemGroupedBackground))
|
|
25
|
+
.navigationTitle(model.localized("projects.title"))
|
|
26
|
+
.toolbar {
|
|
27
|
+
ToolbarItem(placement: .topBarTrailing) {
|
|
28
|
+
Button {
|
|
29
|
+
model.presentedSheet = .newProject
|
|
30
|
+
} label: {
|
|
31
|
+
Label(model.localized("projects.new_project"), systemImage: "plus.circle")
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private struct ProjectCard: View {
|
|
39
|
+
let project: Project
|
|
40
|
+
let taskCount: Int
|
|
41
|
+
|
|
42
|
+
var body: some View {
|
|
43
|
+
VStack(alignment: .leading, spacing: 14) {
|
|
44
|
+
Image(systemName: project.icon)
|
|
45
|
+
.font(.title2.weight(.semibold))
|
|
46
|
+
.foregroundStyle(Color(hex: project.colorHex))
|
|
47
|
+
.frame(width: 48, height: 48)
|
|
48
|
+
.background(Color(hex: project.colorHex).opacity(0.12))
|
|
49
|
+
.clipShape(RoundedRectangle(cornerRadius: 16))
|
|
50
|
+
Text(project.name)
|
|
51
|
+
.font(.headline)
|
|
52
|
+
.multilineTextAlignment(.leading)
|
|
53
|
+
Text(taskCount == 1 ? "1 task" : "\(taskCount) tasks")
|
|
54
|
+
.font(.subheadline)
|
|
55
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
56
|
+
}
|
|
57
|
+
.frame(maxWidth: .infinity, alignment: .leading)
|
|
58
|
+
.padding(20)
|
|
59
|
+
.background(.background)
|
|
60
|
+
.clipShape(RoundedRectangle(cornerRadius: 24))
|
|
61
|
+
.shadow(color: .black.opacity(0.05), radius: 12, y: 4)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import SwiftUI
|
|
2
|
+
|
|
3
|
+
struct SettingsView: View {
|
|
4
|
+
@Bindable var model: AppModel
|
|
5
|
+
@State private var showDeleteAlert = false
|
|
6
|
+
|
|
7
|
+
var body: some View {
|
|
8
|
+
List {
|
|
9
|
+
Section {
|
|
10
|
+
NavigationLink {
|
|
11
|
+
ProfileEditView(model: model)
|
|
12
|
+
} label: {
|
|
13
|
+
HStack(spacing: 12) {
|
|
14
|
+
Image(systemName: model.currentUser.avatarSymbol ?? "person.crop.circle.fill")
|
|
15
|
+
.font(.largeTitle)
|
|
16
|
+
.foregroundStyle(AppPalette.brandPrimary)
|
|
17
|
+
VStack(alignment: .leading) {
|
|
18
|
+
Text(model.currentUser.name)
|
|
19
|
+
.font(.headline)
|
|
20
|
+
Text(model.currentUser.email)
|
|
21
|
+
.font(.subheadline)
|
|
22
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.padding(.vertical, 4)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Section {
|
|
30
|
+
Picker(model.localized("settings.theme"), selection: $model.preferences.theme) {
|
|
31
|
+
Text(model.localized("settings.theme_system")).tag(ThemePreference.system)
|
|
32
|
+
Text(model.localized("settings.theme_light")).tag(ThemePreference.light)
|
|
33
|
+
Text(model.localized("settings.theme_dark")).tag(ThemePreference.dark)
|
|
34
|
+
Text(model.localized("settings.theme_warm")).tag(ThemePreference.warm)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Picker(model.localized("settings.default_priority"), selection: $model.preferences.defaultPriority) {
|
|
38
|
+
Text(model.localized("priority.low")).tag(TaskPriority.low)
|
|
39
|
+
Text(model.localized("priority.medium")).tag(TaskPriority.medium)
|
|
40
|
+
Text(model.localized("priority.high")).tag(TaskPriority.high)
|
|
41
|
+
Text(model.localized("priority.urgent")).tag(TaskPriority.urgent)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Toggle(model.localized("settings.notifications"), isOn: $model.preferences.notificationsEnabled)
|
|
45
|
+
Toggle(model.localized("settings.reminders"), isOn: $model.preferences.remindersEnabled)
|
|
46
|
+
} header: {
|
|
47
|
+
Text(model.localized("settings.preferences"))
|
|
48
|
+
} footer: {
|
|
49
|
+
Text(model.localized("settings.reminders_helper"))
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Section {
|
|
53
|
+
Button(model.localized("settings.export")) {
|
|
54
|
+
model.exportData()
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
Button(model.localized("settings.delete_account"), role: .destructive) {
|
|
58
|
+
showDeleteAlert = true
|
|
59
|
+
}
|
|
60
|
+
} header: {
|
|
61
|
+
Text(model.localized("settings.data"))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Section {
|
|
65
|
+
VStack(spacing: 4) {
|
|
66
|
+
Text(model.localized("settings.app_version"))
|
|
67
|
+
Text(model.localized("settings.app_credit"))
|
|
68
|
+
}
|
|
69
|
+
.font(.caption)
|
|
70
|
+
.foregroundStyle(AppPalette.textSecondary)
|
|
71
|
+
.frame(maxWidth: .infinity)
|
|
72
|
+
}
|
|
73
|
+
.listRowBackground(Color.clear)
|
|
74
|
+
}
|
|
75
|
+
.navigationTitle(model.localized("nav.settings"))
|
|
76
|
+
.alert(model.localized("settings.delete_title"), isPresented: $showDeleteAlert) {
|
|
77
|
+
Button(model.localized("common.cancel"), role: .cancel) {}
|
|
78
|
+
Button(model.localized("settings.delete_confirm"), role: .destructive) {
|
|
79
|
+
model.toastMessage = model.localized("settings.delete_title")
|
|
80
|
+
}
|
|
81
|
+
} message: {
|
|
82
|
+
Text(model.localized("settings.delete_message"))
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|