Open source CapCut alternative.
TypeScript
feat(ios): screen headers, the backlit mark, and the Cut accent
David Lecce237a92bc5
diff --git a/apps/ios/Donkey.xcodeproj/project.pbxproj b/apps/ios/Donkey.xcodeproj/project.pbxprojindex 141552af..f176c705 100644--- a/apps/ios/Donkey.xcodeproj/project.pbxproj+++ b/apps/ios/Donkey.xcodeproj/project.pbxproj@@ -223,7 +223,7 @@DEVELOPMENT_TEAM = Q593LLEXEN;GENERATE_INFOPLIST_FILE = YES;INFOPLIST_FILE = Donkey/Info.plist;- INFOPLIST_KEY_CFBundleDisplayName = Donkey;+ INFOPLIST_KEY_CFBundleDisplayName = "Donkey Cut";INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;INFOPLIST_KEY_NSCameraUsageDescription = "Donkey Cut uses the camera to record your videos.";INFOPLIST_KEY_NSMicrophoneUsageDescription = "Donkey Cut uses the microphone to record audio with your videos.";@@ -260,7 +260,7 @@DEVELOPMENT_TEAM = Q593LLEXEN;GENERATE_INFOPLIST_FILE = YES;INFOPLIST_FILE = Donkey/Info.plist;- INFOPLIST_KEY_CFBundleDisplayName = Donkey;+ INFOPLIST_KEY_CFBundleDisplayName = "Donkey Cut";INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;INFOPLIST_KEY_NSCameraUsageDescription = "Donkey Cut uses the camera to record your videos.";INFOPLIST_KEY_NSMicrophoneUsageDescription = "Donkey Cut uses the microphone to record audio with your videos.";diff --git a/apps/ios/Donkey/Assets.xcassets/AccentColor.colorset/Contents.json b/apps/ios/Donkey/Assets.xcassets/AccentColor.colorset/Contents.jsonindex c6f897e1..ba142414 100644--- a/apps/ios/Donkey/Assets.xcassets/AccentColor.colorset/Contents.json+++ b/apps/ios/Donkey/Assets.xcassets/AccentColor.colorset/Contents.json@@ -3,7 +3,7 @@{"color" : {"color-space" : "srgb",- "components" : { "alpha" : "1.000", "blue" : "0x60", "green" : "0x1B", "red" : "0xD8" }+ "components" : { "alpha" : "1.000", "blue" : "0xFF", "green" : "0x84", "red" : "0x0A" }},"idiom" : "universal"}diff --git a/apps/ios/Donkey/Assets.xcassets/AppIcon.appiconset/AppIcon.png b/apps/ios/Donkey/Assets.xcassets/AppIcon.appiconset/AppIcon.pngindex 1f9c8987..b3eed43e 100644Binary files a/apps/ios/Donkey/Assets.xcassets/AppIcon.appiconset/AppIcon.png and b/apps/ios/Donkey/Assets.xcassets/AppIcon.appiconset/AppIcon.png differdiff --git a/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/Contents.json b/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/Contents.jsonnew file mode 100644index 00000000..41c4c10f--- /dev/null+++ b/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/Contents.json@@ -0,0 +1,21 @@+{+ "images" : [+ {+ "filename" : "DonkeyMark.png",+ "idiom" : "universal",+ "scale" : "1x"+ },+ {+ "idiom" : "universal",+ "scale" : "2x"+ },+ {+ "idiom" : "universal",+ "scale" : "3x"+ }+ ],+ "info" : {+ "author" : "xcode",+ "version" : 1+ }+}diff --git a/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/DonkeyMark.png b/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/DonkeyMark.pngnew file mode 100644index 00000000..92f46758Binary files /dev/null and b/apps/ios/Donkey/Assets.xcassets/DonkeyMark.imageset/DonkeyMark.png differdiff --git a/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/Contents.json b/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/Contents.jsonnew file mode 100644index 00000000..1b5c18a6--- /dev/null+++ b/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/Contents.json@@ -0,0 +1,21 @@+{+ "images" : [+ {+ "filename" : "DonkeySilhouette.png",+ "idiom" : "universal",+ "scale" : "1x"+ },+ {+ "idiom" : "universal",+ "scale" : "2x"+ },+ {+ "idiom" : "universal",+ "scale" : "3x"+ }+ ],+ "info" : {+ "author" : "xcode",+ "version" : 1+ }+}diff --git a/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/DonkeySilhouette.png b/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/DonkeySilhouette.pngnew file mode 100644index 00000000..8bc8da6aBinary files /dev/null and b/apps/ios/Donkey/Assets.xcassets/DonkeySilhouette.imageset/DonkeySilhouette.png differdiff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Components.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Components.swiftindex 12dc2630..c6433eee 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Components.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Components.swift@@ -2,6 +2,25 @@import SwiftUIimport DonkeyKitModels+/// The tab screens' title row: large title on the left, the profile avatar+/// on the same line.+struct ScreenHeader: View {+ let title: String+ @Bindable var app: AppModel+ var auth: AuthModel++ var body: some View {+ HStack {+ Text(title)+ .font(.largeTitle.weight(.bold))+ Spacer()+ AvatarMenu(app: app, auth: auth)+ }+ .padding(.horizontal, 20)+ .padding(.top, 8)+ }+}+struct AvatarMenu: View {@Bindable var app: AppModelvar auth: AuthModel@@ -18,6 +37,7 @@ struct AvatarMenu: View {Button("Log Out", systemImage: "rectangle.portrait.and.arrow.right", role: .destructive) {Task { await auth.signOut() }}+ .tint(.red)} label: {Circle().fill(LinearGradient(diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/IdeasScreen.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/IdeasScreen.swiftindex ef8963de..0d848774 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/IdeasScreen.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/IdeasScreen.swift@@ -10,61 +10,75 @@ struct IdeasScreen: View {var auth: AuthModellet onRecordNote: (Note) -> Void- @State private var showsInspirationSheet = false+ @State private var showsLinkSheet = false+ @State private var showsPhotoPicker = false+ @State private var pickerItems: [PhotosPickerItem] = []private let columns = [GridItem(.adaptive(minimum: 160, maximum: 260), spacing: 14)]var body: some View {- NavigationStack {+ VStack(spacing: 0) {+ ScreenHeader(title: "Ideas", app: app, auth: auth)ScrollView {VStack(alignment: .leading, spacing: 18) {filterChipscontent}.padding(.horizontal, 20)+ .padding(.top, 14).padding(.bottom, 24)}- .navigationTitle("Ideas")- .toolbar {- ToolbarItem(placement: .topBarTrailing) {- AvatarMenu(app: app, auth: auth)+ }+ .overlay(alignment: .bottomTrailing) { addMenu }+ .fullScreenCover(item: $ideas.draft) { _ in+ NoteEditorView(app: app, ideas: ideas, onRecordNote: onRecordNote)+ }+ .sheet(isPresented: $showsLinkSheet) {+ LinkSheet(app: app, ideas: ideas)+ .presentationDetents([.medium])+ }+ .photosPicker(+ isPresented: $showsPhotoPicker,+ selection: $pickerItems,+ matching: .any(of: [.images, .videos])+ )+ .onChange(of: pickerItems) { _, items in+ guard !items.isEmpty else { return }+ Task {+ for item in items {+ guard let data = try? await item.loadTransferable(type: Data.self) else { continue }+ let isVideo = item.supportedContentTypes.contains { $0.conforms(to: .movie) }+ ideas.addInspiration(mediaData: data, isVideo: isVideo)}- }- .overlay(alignment: .bottomTrailing) { fab }- .fullScreenCover(item: $ideas.draft) { _ in- NoteEditorView(app: app, ideas: ideas, onRecordNote: onRecordNote)- }- .sheet(isPresented: $showsInspirationSheet) {- InspirationSheet(app: app, ideas: ideas)- .presentationDetents([.height(240)])+ pickerItems = []+ app.show(toast: "Saved to Inspiration")}}}+ private var addMenu: some View {+ Menu {+ Button("Paste link", systemImage: "link") { showsLinkSheet = true }+ Button("Camera roll", systemImage: "photo") { showsPhotoPicker = true }+ Button("New note", systemImage: "pencil") { ideas.openEditor() }+ } label: {+ Image(systemName: "plus")+ .font(.title2.weight(.bold))+ .frame(width: 60, height: 60)+ }+ .glassEffect(.regular.interactive())+ .padding(.trailing, 20)+ .padding(.bottom, 20)+ .accessibilityLabel("Add")+ }+private var filterChips: some View {- HStack(spacing: 10) {+ Picker("Filter", selection: $ideas.filter) {ForEach(IdeasFilter.allCases, id: \.self) { filter in- Button {- ideas.filter = filter- } label: {- Text(filter.rawValue.capitalized)- .font(.subheadline.weight(.semibold))- .padding(.horizontal, 16)- .padding(.vertical, 9)- }- .buttonStyle(.plain)- .background(- Capsule().fill(ideas.filter == filter ? Color.primary.opacity(0.12) : Color.clear)- )- .overlay(- Capsule().strokeBorder(- ideas.filter == filter ? Color.primary : Color.secondary.opacity(0.35),- lineWidth: 1.5- )- )+ Text(filter.rawValue.capitalized).tag(filter)}- Spacer()}+ .pickerStyle(.segmented)}@ViewBuilder private var content: some View {@@ -122,6 +136,7 @@ struct IdeasScreen: View {Button("Delete", systemImage: "trash", role: .destructive) {ideas.deleteNote(id: note.id)}+ .tint(.red)}}}@@ -135,28 +150,12 @@ struct IdeasScreen: View {Button("Delete", systemImage: "trash", role: .destructive) {ideas.deleteInspiration(id: item.id)}+ .tint(.red)}}}}- private var fab: some View {- Button {- if ideas.filter == .inspiration {- showsInspirationSheet = true- } else {- ideas.openEditor()- }- } label: {- Image(systemName: "plus")- .font(.title2.weight(.bold))- .frame(width: 60, height: 60)- }- .glassEffect(.regular.interactive())- .padding(.trailing, 20)- .padding(.bottom, 20)- .accessibilityLabel(ideas.filter == .inspiration ? "Save inspiration" : "New note")- }}struct NoteCard: View {@@ -241,54 +240,37 @@ struct InspirationCard: View {}}-struct InspirationSheet: View {+struct LinkSheet: View {@Bindable var app: AppModelvar ideas: IdeasModel@State private var urlText = ""- @State private var pickerItems: [PhotosPickerItem] = []@FocusState private var urlFocused: Bool@Environment(\.dismiss) private var dismissvar body: some View {- VStack(alignment: .leading, spacing: 16) {- Text("Save inspiration")- .font(.headline)- TextField("TikTok, Reels, YouTube, link...", text: $urlText)- .textFieldStyle(.roundedBorder)- .keyboardType(.URL)- .textInputAutocapitalization(.never)- .autocorrectionDisabled()- .focused($urlFocused)- .onSubmit(saveURL)- HStack(spacing: 10) {- PhotosPicker(selection: $pickerItems, matching: .any(of: [.images, .videos])) {- Label("Camera roll", systemImage: "photo.on.rectangle")- .frame(maxWidth: .infinity)- }- .buttonStyle(.bordered)- Button("Save", action: saveURL)- .buttonStyle(.borderedProminent)- .frame(maxWidth: .infinity)- .disabled(urlText.trimmingCharacters(in: .whitespaces).isEmpty)+ NavigationStack {+ Form {+ TextField("TikTok, Reels, YouTube, link...", text: $urlText)+ .keyboardType(.URL)+ .textInputAutocapitalization(.never)+ .autocorrectionDisabled()+ .focused($urlFocused)+ .onSubmit(saveURL)}- }- .padding(20)- .presentationDragIndicator(.visible)- .task { urlFocused = true }- .onChange(of: pickerItems) { _, items in- guard !items.isEmpty else { return }- Task {- for item in items {- guard let data = try? await item.loadTransferable(type: Data.self) else { continue }- let isVideo = item.supportedContentTypes.contains { $0.conforms(to: .movie) }- ideas.addInspiration(mediaData: data, isVideo: isVideo)+ .navigationTitle("Paste Link")+ .navigationBarTitleDisplayMode(.inline)+ .toolbar {+ ToolbarItem(placement: .cancellationAction) {+ Button("Cancel") { dismiss() }+ }+ ToolbarItem(placement: .confirmationAction) {+ Button("Save", action: saveURL)+ .disabled(urlText.trimmingCharacters(in: .whitespaces).isEmpty)}- pickerItems = []- dismiss()- app.show(toast: "Saved to Inspiration")}}+ .task { urlFocused = true }}private func saveURL() {diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/LoggedOutView.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/LoggedOutView.swiftindex 042df186..7167d08b 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/LoggedOutView.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/LoggedOutView.swift@@ -9,26 +9,11 @@ struct LoggedOutView: View {var body: some View {VStack(spacing: 8) {- RoundedRectangle(cornerRadius: 24)- .fill(LinearGradient(- colors: [Color(hex: "#ff8a3d"), Color.recordPink],- startPoint: .topLeading,- endPoint: .bottomTrailing- ))- .frame(width: 84, height: 84)- .overlay {- Image(systemName: "record.circle")- .font(.system(size: 40, weight: .semibold))- .foregroundStyle(.white)- }- .shadow(color: Color.recordPink.opacity(0.35), radius: 20, y: 14)- .padding(.bottom, 18)+ BacklitDonkeyMark(width: 108)+ .padding(.bottom, 26)- Text("Turn ideas into videos")+ Text("Send Donkey back to work.").font(.title2.weight(.bold))- Text("Write a note, load it into the teleprompter, and record. Everything lives in one place.")- .font(.subheadline)- .foregroundStyle(.secondary).multilineTextAlignment(.center)VStack(spacing: 12) {@@ -65,9 +50,11 @@ struct LoggedOutView: View {.padding(.top, 10)}- Text("By continuing you agree to the Terms and Privacy Policy.")+ Text("By continuing, you agree to the **[Terms of Use](https://donkeycut.com/terms)** and **[Privacy Policy](https://donkeycut.com/privacy)**.").font(.caption2).foregroundStyle(.secondary)+ .tint(.primary)+ .multilineTextAlignment(.center).padding(.top, 18)}.padding(.horizontal, 40)@@ -107,4 +94,45 @@ struct LoggedOutView: View {auth.state == .signingIn(provider)}}++/// The donkey mark. In dark mode it gets the backlit treatment from+/// docs/guides/backlit-icon.md: three white silhouette sources behind the+/// mark, each drawn as a tight halo and a wide bloom, every length a+/// multiple of the rendered width. Light mode shows the mark at its own fills.+struct BacklitDonkeyMark: View {+ let width: CGFloat++ @Environment(\.colorScheme) private var colorScheme++ private static let sources: [(dx: CGFloat, dy: CGFloat, halo: Double, bloom: Double)] = [+ (-0.0297, 0.0043, 0.80, 0.192),+ (-0.0095, -0.0285, 0.62, 0.149),+ (0.0190, 0.0232, 0.35, 0.084),+ ]++ var body: some View {+ ZStack {+ if colorScheme == .dark {+ glow(blurFactor: 0.088, wide: true)+ glow(blurFactor: 0.030, wide: false)+ }+ Image("DonkeyMark", bundle: .main)+ .resizable()+ .scaledToFit()+ }+ // The mark's artwork is 264 x 318.+ .frame(width: width, height: width * 318 / 264)+ }++ private func glow(blurFactor: CGFloat, wide: Bool) -> some View {+ ForEach(Array(Self.sources.enumerated()), id: \.offset) { _, source in+ Image("DonkeySilhouette", bundle: .main)+ .resizable()+ .scaledToFit()+ .blur(radius: width * blurFactor)+ .opacity(wide ? source.bloom : source.halo)+ .offset(x: width * source.dx, y: width * source.dy)+ }+ }+}#endifdiff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/MediaScreen.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/MediaScreen.swiftindex a113d1c7..b2a6e9a4 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/MediaScreen.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/MediaScreen.swift@@ -13,7 +13,8 @@ struct MediaScreen: View {private let columns = [GridItem(.adaptive(minimum: 150, maximum: 240), spacing: 12)]var body: some View {- NavigationStack {+ VStack(spacing: 0) {+ ScreenHeader(title: "Library", app: app, auth: auth)Group {if media.recordings.isEmpty {EmptyState(@@ -35,23 +36,19 @@ struct MediaScreen: View {Button("Delete", systemImage: "trash", role: .destructive) {media.delete(recording)}+ .tint(.red)}}}.padding(.horizontal, 20)+ .padding(.top, 14).padding(.bottom, 24)}}}- .navigationTitle("Library")- .toolbar {- ToolbarItem(placement: .topBarTrailing) {- AvatarMenu(app: app, auth: auth)- }- }- .fullScreenCover(item: $playing) { recording in- RecordingPlayerView(url: media.movieURL(for: recording))- }+ }+ .fullScreenCover(item: $playing) { recording in+ RecordingPlayerView(url: media.movieURL(for: recording))}}}diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/NoteEditorView.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/NoteEditorView.swiftindex 1dcd1747..2b9c6611 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/NoteEditorView.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/NoteEditorView.swift@@ -77,6 +77,9 @@ struct NoteEditorView: View {} label: {Text("Save").font(.body.weight(.bold))+ // The editor paints everything in the note's ink, which+ // would hide the label on the ink-tinted prominent pill.+ .foregroundStyle(.white).padding(.horizontal, 14).padding(.vertical, 6)}diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/ProjectsScreen.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/ProjectsScreen.swiftindex 03dc8ed2..fc1b29f7 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/ProjectsScreen.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/ProjectsScreen.swift@@ -12,25 +12,29 @@ struct ProjectsScreen: View {private let columns = [GridItem(.flexible(), spacing: 12), GridItem(.flexible(), spacing: 12)]var body: some View {- NavigationStack {- ScrollView {- LazyVGrid(columns: columns, spacing: 12) {- ForEach(projects.projects) { project in- ProjectCard(project: project) { playing = project }+ VStack(spacing: 0) {+ ScreenHeader(title: "Projects", app: app, auth: auth)+ if projects.projects.isEmpty {+ EmptyState(+ title: "No projects yet",+ message: "Projects you create in Donkey Cut will show up here."+ )+ .frame(maxHeight: .infinity)+ } else {+ ScrollView {+ LazyVGrid(columns: columns, spacing: 12) {+ ForEach(projects.projects) { project in+ ProjectCard(project: project) { playing = project }+ }}- }- .padding(.horizontal, 20)- .padding(.bottom, 24)- }- .navigationTitle("Projects")- .toolbar {- ToolbarItem(placement: .topBarTrailing) {- AvatarMenu(app: app, auth: auth)+ .padding(.horizontal, 20)+ .padding(.top, 14)+ .padding(.bottom, 24)}}- .fullScreenCover(item: $playing) { project in- ProjectPlayerView(project: project)- }+ }+ .fullScreenCover(item: $playing) { project in+ ProjectPlayerView(project: project)}}}@@ -70,7 +74,6 @@ struct ProjectCard: View {GhostCard(title: project.name, subtitle: "Exporting \(percent)%").overlay(alignment: .bottom) {ProgressView(value: Double(percent), total: 100)- .tint(.recordPink).padding(.horizontal, 12).padding(.bottom, 12)}diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/RootView.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/RootView.swiftindex 4ee1c3d8..2f283265 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/RootView.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/RootView.swift@@ -47,7 +47,7 @@ public struct RootView<CameraPreview: View>: View {ProjectsScreen(app: app, projects: projects, auth: auth)}Tab("Camera", systemImage: "camera", value: .camera) {- CameraScreen(camera: camera, ideas: ideas, cameraPreview: cameraPreview)+ CameraScreen(camera: camera, ideas: ideas, media: media, cameraPreview: cameraPreview)}}.tabViewStyle(.sidebarAdaptable)@@ -59,6 +59,7 @@ public struct RootView<CameraPreview: View>: View {ToastOverlay(app: app)}+ .tint(.accentBlue).animation(.default, value: auth.isSignedIn).preferredColorScheme(app.appearance.colorScheme).task { await auth.restore() }diff --git a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Theme.swift b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Theme.swiftindex 5b1b5f4f..7b739247 100644--- a/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Theme.swift+++ b/apps/ios/DonkeyKit/Sources/DonkeyKitUI/Theme.swift@@ -15,6 +15,8 @@ extension Color {}static let recordPink = Color(hex: "#d81b60")+ /// The Cut app's accent blue; tints everything except recording controls.+ static let accentBlue = Color(hex: "#0a84ff")static let notePaperInk = Color(hex: "#201a0d")}