-
Notifications
You must be signed in to change notification settings - Fork 2
feat: add Christmas Easter egg with ⌘⇧J keyboard shortcut #223
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
Open
sri-rang
wants to merge
1
commit into
main
Choose a base branch
from
feature/issue-222-christmas-easter-egg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| import SwiftUI | ||
|
|
||
| struct ChristmasEasterEggView: View { | ||
| @Environment(\.dismiss) private var dismiss | ||
| @State private var snowflakes: [Snowflake] = ChristmasEasterEggView.makeSnowflakes() | ||
|
|
||
| var body: some View { | ||
| ZStack { | ||
| Color(red: 0.07, green: 0.13, blue: 0.25) | ||
| .ignoresSafeArea() | ||
|
|
||
| // Animated snowflakes | ||
| TimelineView(.animation) { timeline in | ||
| Canvas { ctx, size in | ||
| let elapsed = timeline.date.timeIntervalSinceReferenceDate | ||
| for flake in snowflakes { | ||
| let progress = (elapsed * flake.speed + flake.offset).truncatingRemainder(dividingBy: 1.0) | ||
| let x = flake.xFraction * size.width + sin(elapsed * flake.sway + flake.offset * .pi * 2) * 18 | ||
| let y = progress * (size.height + 20) - 10 | ||
| let resolved = ctx.resolve(Text(flake.symbol) | ||
| .font(.system(size: flake.size)) | ||
| .foregroundStyle(.white.opacity(flake.opacity))) | ||
| ctx.draw(resolved, at: CGPoint(x: x, y: y)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| VStack(spacing: 0) { | ||
| Spacer() | ||
|
|
||
| // Tree | ||
| VStack(spacing: 2) { | ||
| Text("*") | ||
| .font(.system(size: 28)) | ||
| .foregroundStyle(.yellow) | ||
| Text("^ ^ ^") | ||
| .font(.system(size: 22, design: .monospaced)) | ||
| .foregroundStyle(.green) | ||
| Text("^ ^ ^ ^ ^") | ||
| .font(.system(size: 22, design: .monospaced)) | ||
| .foregroundStyle(.green) | ||
| Text("^ ^ ^ ^ ^ ^ ^") | ||
| .font(.system(size: 22, design: .monospaced)) | ||
| .foregroundStyle(.green) | ||
| Text("^ ^ ^ ^ ^ ^ ^ ^ ^") | ||
| .font(.system(size: 22, design: .monospaced)) | ||
| .foregroundStyle(.green) | ||
| Text("|||") | ||
| .font(.system(size: 20, design: .monospaced)) | ||
| .foregroundStyle(Color(red: 0.55, green: 0.35, blue: 0.15)) | ||
| } | ||
| .padding(.bottom, 28) | ||
|
|
||
| // Message | ||
| VStack(spacing: 10) { | ||
| Text("Merry Christmas!") | ||
| .font(.system(size: 28, weight: .bold)) | ||
| .foregroundStyle(.white) | ||
|
|
||
| Text("May your queries be fast,\nyour indexes never bloat,\nand your vacuums run on time.") | ||
| .font(.system(size: 15)) | ||
| .foregroundStyle(.white.opacity(0.85)) | ||
| .multilineTextAlignment(.center) | ||
| .lineSpacing(4) | ||
|
|
||
| Text("Ho ho ho from the Tusk team.") | ||
| .font(.system(size: 13)) | ||
| .foregroundStyle(.white.opacity(0.5)) | ||
| .padding(.top, 4) | ||
| } | ||
| .padding(.bottom, 36) | ||
|
|
||
| Button("Dismiss") { | ||
| dismiss() | ||
| } | ||
| .keyboardShortcut(.escape, modifiers: []) | ||
| .buttonStyle(.borderedProminent) | ||
| .tint(.white.opacity(0.2)) | ||
| .foregroundStyle(.white) | ||
| .controlSize(.large) | ||
|
|
||
| Spacer() | ||
| } | ||
| .padding(.horizontal, 40) | ||
| } | ||
| .frame(width: 420, height: 480) | ||
| } | ||
|
|
||
| // MARK: - Snowflakes | ||
|
|
||
| private struct Snowflake { | ||
| let xFraction: Double | ||
| let speed: Double | ||
| let offset: Double | ||
| let sway: Double | ||
| let size: Double | ||
| let opacity: Double | ||
| let symbol: String | ||
| } | ||
|
|
||
| private static func makeSnowflakes() -> [Snowflake] { | ||
| let symbols = ["*", "+", "·", "❄"] | ||
| return (0..<40).map { i in | ||
| let rng = Double(i) | ||
| func pseudo(_ seed: Double) -> Double { | ||
| let x = sin(seed * 127.1 + 311.7) * 43758.5453 | ||
| return x - floor(x) | ||
| } | ||
| return Snowflake( | ||
| xFraction: pseudo(rng), | ||
| speed: 0.04 + pseudo(rng + 1) * 0.06, | ||
| offset: pseudo(rng + 2), | ||
| sway: 0.5 + pseudo(rng + 3) * 1.5, | ||
| size: 8 + pseudo(rng + 4) * 10, | ||
| opacity: 0.3 + pseudo(rng + 5) * 0.5, | ||
| symbol: symbols[Int(pseudo(rng + 6) * Double(symbols.count))] | ||
| ) | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,6 +43,14 @@ struct TuskCommands: Commands { | |
| openWindow(id: "help") | ||
| } | ||
| .keyboardShortcut("?", modifiers: .command) | ||
|
|
||
| Button("") { | ||
| appState.isShowingChristmasEasterEgg = true | ||
| } | ||
| .keyboardShortcut("j", modifiers: [.command, .shift]) | ||
| .opacity(0) | ||
| .allowsHitTesting(false) | ||
| .accessibilityHidden(true) | ||
|
Comment on lines
+47
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1. ⌘⇧j doesn’t toggle flag The hidden ⌘⇧J command sets appState.isShowingChristmasEasterEgg to true instead of toggling it true/false. This violates the requirement that the shortcut toggles visibility year-round and prevents using the shortcut to dismiss once shown. Agent Prompt
|
||
| } | ||
|
|
||
| CommandGroup(after: .windowArrangement) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Conflicting sheet presentations
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools