Revert "feat: floating bar for macos by arsen"#3516
Conversation
This reverts commit 6eb60ab.
There was a problem hiding this comment.
Code Review
This pull request reverts the 'feat: floating bar for macos' feature. The changes correctly remove the resizable window functionality and replace the parent/child window movement synchronization with a manual positioning logic. Additionally, the PR includes several beneficial UI tweaks, such as updating hardcoded colors to adaptive ones like .primary and .secondary, and changing the 'Ask AI' shortcut. I've found one area with unnecessary code duplication that should be addressed to improve maintainability.
| if #available(macOS 26.0, *) { | ||
| Button(action: onPlayPause) { | ||
| Group { | ||
| if state.isInitialising { | ||
| SpinnerView() | ||
| .frame(width: 28, height: 28) | ||
| .background(Color.white) | ||
| .clipShape(Circle()) | ||
| } else { | ||
| Image(systemName: playPauseIcon) | ||
| .font(.system(size: 12, weight: .bold)) | ||
| .frame(width: 28, height: 28) | ||
| .foregroundColor(.black) | ||
| .background(Color.white) | ||
| .clipShape(Circle()) | ||
| .scaleEffect(state.isRecording && !state.isPaused ? 1.0 : 0.9) | ||
| } | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
| } else { | ||
| Button(action: onPlayPause) { | ||
| Group { | ||
| if state.isInitialising { | ||
| SpinnerView() | ||
| .frame(width: 28, height: 28) | ||
| .background(Color.white) | ||
| .clipShape(Circle()) | ||
| } else { | ||
| Image(systemName: playPauseIcon) | ||
| .font(.system(size: 12, weight: .bold)) | ||
| .foregroundColor(.black) | ||
| .frame(width: 28, height: 28) | ||
| .background(Color.white) | ||
| .clipShape(Circle()) | ||
| .scaleEffect(state.isRecording && !state.isPaused ? 1.0 : 0.9) | ||
| } | ||
| } | ||
| } | ||
| .buttonStyle(.plain) | ||
| } |
There was a problem hiding this comment.
The if #available(macOS 26.0, *) block introduces significant code duplication for the play/pause button. The code within the if and else branches is nearly identical, with only a minor, non-functional difference in modifier order. This duplication makes the code harder to read and maintain. It's better to remove the conditional and the duplicated code, keeping a single implementation of the button.
Button(action: onPlayPause) {
Group {
if state.isInitialising {
SpinnerView()
.frame(width: 28, height: 28)
.background(Color.white)
.clipShape(Circle())
} else {
Image(systemName: playPauseIcon)
.font(.system(size: 12, weight: .bold))
.frame(width: 28, height: 28)
.foregroundColor(.black)
.background(Color.white)
.clipShape(Circle())
.scaleEffect(state.isRecording && !state.isPaused ? 1.0 : 0.9)
}
}
}
.buttonStyle(.plain)
Reverts #3368
#3515