Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Welcome UI and Product Dev, Alpha and Beta Icons #1390

Merged
merged 7 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1142,11 +1142,11 @@
581BFB562926431000D251EC /* Views */ = {
isa = PBXGroup;
children = (
6C186209298BF5A800C663EA /* RecentProjectsListView.swift */,
B66A4E4E29C917B8004573B4 /* WelcomeWindow.swift */,
581BFB5A2926431000D251EC /* WelcomeWindowView.swift */,
581BFB5B2926431000D251EC /* WelcomeView.swift */,
581BFB5C2926431000D251EC /* WelcomeActionView.swift */,
B66A4E4E29C917B8004573B4 /* WelcomeWindow.swift */,
6C186209298BF5A800C663EA /* RecentProjectsListView.swift */,
581BFB5E2926431000D251EC /* RecentProjectItem.swift */,
);
path = Views;
Expand Down Expand Up @@ -3995,8 +3995,8 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditTextView";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.6.6;
kind = exactVersion;
version = 0.6.7;
};
};
6C0F3A3A2A1D0D5000223D19 /* XCRemoteSwiftPackageReference "CodeEditKit" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditLanguages.git",
"state" : {
"revision" : "aa7d922b2aa783ae6f2a1a2cb7010ae62b700e17",
"version" : "0.1.16"
"revision" : "af29ab4a15474a0a38ef88ef65c20e58a0812e43",
"version" : "0.1.17"
}
},
{
Expand All @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditTextView",
"state" : {
"revision" : "cc28ae52c8083c313b650784706e339b727646d9",
"version" : "0.6.6"
"revision" : "7f130bd50bb9eb6bacf6a42700cce571ec82bd64",
"version" : "0.6.7"
}
},
{
Expand Down Expand Up @@ -126,6 +126,15 @@
"version" : "1.2.1"
}
},
{
"identity" : "mainoffender",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattmassicotte/MainOffender",
"state" : {
"revision" : "343cc3797618c29b48b037b4e2beea0664e75315",
"version" : "0.1.0"
}
},
{
"identity" : "processenv",
"kind" : "remoteSourceControl",
Expand All @@ -149,8 +158,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/Rearrange",
"state" : {
"revision" : "8f97f721d8a08c6e01ab9f7460e53819bef72dfa",
"version" : "1.5.3"
"revision" : "0fb658e721c68495f6340c211cc6d4719e6b52d8",
"version" : "1.6.0"
}
},
{
Expand All @@ -167,8 +176,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/STTextView.git",
"state" : {
"revision" : "5abb0867a3882b7687218b0b69d8264de59f4a05",
"version" : "0.6.7"
"revision" : "1046965bd62dc05cf17beb4b4e901cdae851395e",
"version" : "0.8.7"
}
},
{
Expand Down Expand Up @@ -239,17 +248,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/TextFormation",
"state" : {
"revision" : "f07ecbdb8daab6cdb5344a88e8685ae55a7a44c3",
"version" : "0.6.8"
"revision" : "2b56879bd7aa753a2ba97b271f456c59614b39d4",
"version" : "0.8.0"
}
},
{
"identity" : "textstory",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/TextStory",
"state" : {
"revision" : "b7b3fc551bd0177c32b3dc46d0478e9f0b6f8c6f",
"version" : "0.7.2"
"revision" : "8883fa739aa213e70e6cb109bfbf0a0b551e4cb5",
"version" : "0.8.0"
}
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeEdit/Assets.xcassets/AppIconAlpha.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeEdit/Assets.xcassets/AppIconBeta.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeEdit/Assets.xcassets/AppIconBeta.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeEdit/Assets.xcassets/AppIconBeta.appiconset/CodeEditBeta-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified CodeEdit/Assets.xcassets/AppIconDev.appiconset/CodeEditDev-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions CodeEdit/Features/Welcome/Views/RecentProjectItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ struct RecentProjectItem: View {
.frame(width: 32, height: 32)
VStack(alignment: .leading) {
Text(projectPath.lastPathComponent)
.font(.system(size: 13))
.foregroundColor(.primary)
.font(.system(size: 13, weight: .semibold))
.lineLimit(1)
Text(projectPath.path(percentEncoded: false).abbreviatingWithTildeInPath())
Text(projectPath.deletingLastPathComponent().path(percentEncoded: false).abbreviatingWithTildeInPath())
.foregroundColor(.secondary)
.font(.system(size: 11))
.lineLimit(1)
.truncationMode(.head)
}.padding(.trailing, 15)
Spacer()
}
}
.frame(height: 36)
.contentShape(Rectangle())
}
}
42 changes: 25 additions & 17 deletions CodeEdit/Features/Welcome/Views/WelcomeActionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,38 @@ import SwiftUI
struct WelcomeActionView: View {
var iconName: String
var title: String
var subtitle: String
var action: () -> Void

init(iconName: String, title: String, subtitle: String) {
init(iconName: String, title: String, action: @escaping () -> Void) {
self.iconName = iconName
self.title = title
self.subtitle = subtitle
self.action = action
}

var body: some View {
HStack(spacing: 16) {
Image(systemName: iconName)
.aspectRatio(contentMode: .fit)
.foregroundColor(.accentColor)
.font(.system(size: 30, weight: .light))
.frame(width: 24)
VStack(alignment: .leading) {
Button(action: action, label: {
HStack(spacing: 7) {
Image(systemName: iconName)
.aspectRatio(contentMode: .fit)
.foregroundColor(.secondary)
.font(.system(size: 20))
.frame(width: 24)
Text(title)
.bold()
.font(.system(size: 13))
Text(subtitle)
.font(.system(size: 12))
.font(.system(size: 13, weight: .semibold))
Spacer()
}
Spacer()
}
.contentShape(Rectangle())
})
.buttonStyle(WelcomeActionButtonStyle())
}
}

struct WelcomeActionButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
.contentShape(Rectangle())
.padding(7)
.frame(height: 36)
.background(Color(.labelColor).opacity(configuration.isPressed ? 0.1 : 0.05))
.cornerRadius(8)
}
}
121 changes: 53 additions & 68 deletions CodeEdit/Features/Welcome/Views/WelcomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ struct WelcomeView: View {
@Environment(\.colorScheme)
var colorScheme

@Environment(\.controlActiveState)
var controlActiveState

@AppSettings(\.general.reopenBehavior)
var reopenBehavior

Expand Down Expand Up @@ -110,13 +113,7 @@ struct WelcomeView: View {
var body: some View {
ZStack(alignment: .topLeading) {
mainContent

if isHovering {
dismissButton
}
if isHovering {
showWhenLaunchedCheckbox
}
dismissButton
}
.onHover { isHovering in
self.isHovering = isHovering
Expand All @@ -139,13 +136,23 @@ struct WelcomeView: View {
}

private var mainContent: some View {
VStack(spacing: 8) {
Spacer().frame(height: 12)
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 128, height: 128)
Text(NSLocalizedString("Welcome to CodeEdit", comment: ""))
.font(.system(size: 38))
VStack(spacing: 0) {
Spacer().frame(height: 32)
ZStack {
if colorScheme == .dark {
Rectangle()
.frame(width: 104, height: 104)
.foregroundColor(.accentColor)
.cornerRadius(24)
.blur(radius: 64)
.opacity(0.5)
}
Image(nsImage: NSApp.applicationIconImage)
.resizable()
.frame(width: 128, height: 128)
}
Text(NSLocalizedString("CodeEdit", comment: ""))
.font(.system(size: 36, weight: .bold))
Text(
String(
format: NSLocalizedString("Version %@%@ (%@)", comment: ""),
Expand All @@ -154,8 +161,9 @@ struct WelcomeView: View {
appBuild
)
)
.textSelection(.enabled)
.foregroundColor(.secondary)
.font(.system(size: 13))
.font(.system(size: 13.5))
.onHover { hover in
if hover {
NSCursor.pointingHand.push()
Expand All @@ -168,86 +176,63 @@ struct WelcomeView: View {
}
.help("Copy System Information to Clipboard")

Spacer().frame(height: 20)
Spacer().frame(height: 40)
HStack {
VStack(alignment: .leading, spacing: 15) {
VStack(alignment: .leading, spacing: 8) {
WelcomeActionView(
iconName: "plus.square",
title: NSLocalizedString("Create a new file", comment: ""),
subtitle: NSLocalizedString("Create a new file", comment: "")
title: NSLocalizedString("Create New File...", comment: ""),
action: {
newDocument()
dismissWindow()
}
)
.onTapGesture {
newDocument()
dismissWindow()
}
WelcomeActionView(
iconName: "folder",
title: NSLocalizedString("Open a file or folder", comment: ""),
subtitle: NSLocalizedString(
"Open an existing file or folder on your Mac",
comment: ""
)
iconName: "square.and.arrow.down.on.square",
title: NSLocalizedString("Clone Git Repository...", comment: ""),
action: {
showGitClone = true
}
)
.onTapGesture {
openDocument(nil, dismissWindow)
}
WelcomeActionView(
iconName: "plus.square.on.square",
title: NSLocalizedString("Clone an existing project", comment: ""),
subtitle: NSLocalizedString(
"Start working on something from a Git repository",
comment: ""
)
iconName: "folder",
title: NSLocalizedString("Open File or Folder...", comment: ""),
action: {
openDocument(nil, dismissWindow)
}
)
.onTapGesture {
showGitClone = true
}
}
}
Spacer()
}
.frame(width: 384)
.padding(.top, 20)
.padding(.horizontal, 56)
.padding(.bottom, 16)
.background(Color(colorScheme == .dark ? NSColor.windowBackgroundColor : .white))
.frame(width: 460)
.background(
colorScheme == .dark
? Color(.black).opacity(0.2)
: Color(.white).opacity(controlActiveState == .inactive ? 1.0 : 0.5)
)
.background(EffectView(.underWindowBackground, blendingMode: .behindWindow))
}

private var dismissButton: some View {
Button(
action: dismissWindow,
label: {
Circle()
.foregroundColor(isHoveringCloseButton ? .secondary : .clear)
.frame(width: 13, height: 13)
.overlay(
Image(systemName: "xmark")
.font(.system(size: 8.5, weight: .heavy, design: .rounded))
.foregroundColor(isHoveringCloseButton ? Color(.windowBackgroundColor) : .secondary)
)
Image(systemName: "xmark.circle.fill")
.foregroundColor(isHoveringCloseButton ? Color(.secondaryLabelColor) : Color(.tertiaryLabelColor))
}
)
.buttonStyle(.plain)
.accessibilityLabel(Text("Close"))
.onHover { hover in
isHoveringCloseButton = hover
}
.padding(13)
.transition(AnyTransition.opacity.animation(.easeInOut(duration: 0.25)))
}

private var showWhenLaunchedCheckbox: some View {
VStack(alignment: .center) {
Spacer()
Toggle(
"Show this window when CodeEdit launches",
isOn: showWhenLaunchedBinding
)
.toggleStyle(.checkbox)
withAnimation(.linear(duration: 0.15)) {
isHoveringCloseButton = hover
}
}
.frame(maxWidth: .infinity)
.padding(.horizontal, 56)
.padding(.bottom, 16)
.padding(10)
.transition(AnyTransition.opacity.animation(.easeInOut(duration: 0.25)))
}
}
2 changes: 1 addition & 1 deletion CodeEdit/Features/Welcome/Views/WelcomeWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct WelcomeWindow: Scene {
var body: some Scene {
Window("Welcome To CodeEdit", id: SceneID.welcome.rawValue) {
ContentView()
.frame(width: 795, height: 460)
.frame(width: 740, height: 432)
.task {
if let window = NSApp.findWindow(.welcome) {
window.standardWindowButton(.closeButton)?.isHidden = true
Expand Down
2 changes: 1 addition & 1 deletion CodeEdit/Features/Welcome/Views/WelcomeWindowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct WelcomeWindowView: View {
dismissWindow: dismissWindow
)
RecentProjectsListView(openDocument: openDocument, dismissWindow: dismissWindow)
.frame(width: 300)
.frame(width: 280)
}
.edgesIgnoringSafeArea(.top)
.onDrop(of: [.fileURL], isTargeted: .constant(true)) { providers in
Expand Down