From be84384f9188c4c0edb5b340eecd4e6de1d954b5 Mon Sep 17 00:00:00 2001 From: altaskur <105789412+altaskur@users.noreply.github.com> Date: Tue, 10 Feb 2026 20:14:43 +0100 Subject: [PATCH 1/2] refactor(calendar): use p-table for layout --- PR_DESCRIPTION.md | 107 ++ .../open-calendar/open-calendar.html | 296 ++--- .../open-calendar/open-calendar.scss | 121 +- .../open-calendar/open-calendar.spec.ts | 9 + .../components/open-calendar/open-calendar.ts | 14 + test.log | 1117 +++++++++++++++++ test_app.log | Bin 0 -> 635744 bytes test_focus.log | Bin 0 -> 41846 bytes test_focus_second.log | Bin 0 -> 45156 bytes test_focus_service.log | Bin 0 -> 52888 bytes test_output.txt | Bin 0 -> 283868 bytes 11 files changed, 1465 insertions(+), 199 deletions(-) create mode 100644 PR_DESCRIPTION.md create mode 100644 test.log create mode 100644 test_app.log create mode 100644 test_focus.log create mode 100644 test_focus_second.log create mode 100644 test_focus_service.log create mode 100644 test_output.txt diff --git a/PR_DESCRIPTION.md b/PR_DESCRIPTION.md new file mode 100644 index 0000000..24fde86 --- /dev/null +++ b/PR_DESCRIPTION.md @@ -0,0 +1,107 @@ +## Description + +This PR refactors the applications update system to improve user experience, security, and maintainability. It introduces a redesigned update settings UI, securely handles external links via IPC, and fixes several bugs related to dialog visibility and change detection. Additionally, it addresses unit test failures by updating mocks to match new interfaces. + +### Goal + +- **Improve UX:** Provide a clear and responsive interface for checking updates and viewing release notes. +- **Enhance Security:** Replace direct `shell.openExternal` calls in the renderer with a secure IPC handler. +- **Fix Bugs:** Resolve issues where the release notes dialog would not appear immediately due to Angular change detection timing. +- **Maintain Code Quality:** Fix linting errors and update unit tests to reflect recent changes in `UpdateService`. + +### Key Changes + +- **Refactored Update UI:** Redesigned `OpenSettingsUpdatesComponent` and introduced `UpdateDialogComponent` to display release notes with proper formatting. +- **Secure External Links:** Implemented a new `open-external` IPC handler in the main process and exposed it via `preload.ts`, ensuring all links open in the default browser securely. +- **Dialog Visibility Fix:** Implemented `setTimeout` and `NgZone.run` in `showCurrentVersionNotes` to force Angular change detection and ensure the dialog opens immediately. +- **Type Safety:** Added `GitHubRelease` interface and updated `electron.d.ts` and `UpdateService` to use strict typing instead of `any`. +- **Unit Test Fixes:** Updated mocks in `app.spec.ts` and `open-settings-updates.spec.ts` to include the missing `lastChecked` signal and correct `GitHubRelease` structure, resolving generic `TypeError` failures. + +## Type of Change + +- [x] 🐛 Bug fix (non-breaking change which fixes an issue) +- [x] ✨ New feature (non-breaking change which adds functionality) +- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] 📝 Documentation update +- [x] 🎨 Style/UI changes +- [x] ♻️ Refactoring (no functional changes) +- [ ] ⚡ Performance improvement +- [x] ✅ Test updates +- [ ] 🔧 Build/configuration changes + +## Impact Assessment + +### Database Impact + +- [x] No database changes +- [ ] New migration(s) included +- [ ] Existing data migration required + +### Backup Impact + +- [x] No impact on backups +- [ ] Backup format changed +- [ ] Restore compatibility maintained + +## Testing + +### How Has This Been Tested? + +- [x] Unit tests +- [ ] Integration tests +- [x] Manual testing +- [x] Tested with SonarQube analysis + +### Test Steps + +1. **Check for Updates:** Go to Settings -> Updates and click "Check for updates". Verify the spinner appears and the result (up to date or new version) is displayed. +2. **View Release Notes:** Click "View Release Notes". Verify the dialog opens immediately and the markdown content is rendered correctly. +3. **External Links:** Click on any link within the release notes or the "View Releases on GitHub" button. Verify the link opens in your default system browser, not inside the Electron app. +4. **Auto-check:** Toggle the "Check for updates automatically" switch and verify the preference is saved (check LocalStorage or restart app). + +### Test Configuration + +- **Node version**: v20.x +- **npm version**: 10.x +- **Platform tested**: Windows 11 + +## UI Changes + +### Before + +_Previous update settings screen (simple buttons, no dialog for notes)._ + +### After + +_New `OpenSettingsUpdatesComponent` with "Check for updates" card, "Current Version" display, and a dedicated `UpdateDialogComponent` for viewing formatted release notes._ + +## Checklist + +- [x] My code follows the project's coding standards +- [x] I have performed a self-review of my code +- [x] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [x] My changes generate no new warnings or errors +- [x] I have added tests that prove my fix is effective or that my feature works +- [x] New and existing unit tests pass locally with my changes +- [x] I have run `npm run lint` and fixed any issues +- [x] I have run `npm test` and all tests pass +- [x] I have run `npm run test:electron` and all tests pass +- [x] I have run `npm run sonar:check` and the analysis passes +- [ ] Any dependent changes have been merged and published + +## Breaking Changes + +- [ ] This PR contains breaking changes + +## Related Issues + +Closes # (Add issue number if applicable) + +## Additional Context + +The unit test failures were caused by a mismatch between the `UpdateService` implementation (which uses Signals like `lastChecked`) and the mock objects used in tests, which were missing these properties. This PR aligns the mocks with the actual service implementation. + +## Reviewer Notes + +Please focus on the `preload.ts` changes regarding `openExternal` to ensure no security regressions were introduced, and verify that the `NgZone` fix in `OpenSettingsUpdatesComponent` effectively solves the dialog visibility issue on all platforms. diff --git a/src/app/components/open-calendar/open-calendar.html b/src/app/components/open-calendar/open-calendar.html index af1c21c..ddb9625 100644 --- a/src/app/components/open-calendar/open-calendar.html +++ b/src/app/components/open-calendar/open-calendar.html @@ -62,156 +62,166 @@
U+Yj
zq2mf`VrjyP=sv$S*8i$-(*0^2&PVUp&UImgw$DTX>%c`PonM5XZaCc$dafX99nmuj
zo;e CQBOcWpvvG4sC7a9niL5mxfNAyRMF-cnfbrze{h+nBwlqU>9l3
zC5h0}GMFQi@(>Z{f|TJT?Jqj8n`>CeyqbgF`P+c6E03aWiyN@NE+U1FI#93G`jf#^
z&`OqOp?{gSNbU`aGeD2E?!1nDtD?A#$Z8+nlzw$x9oHzrGOB;1tPLxJf?`Xf*o9y9
zv&Fl|Xq$1@Ej~?rPY@$9B51~9H@0^^IH^-OV&eAjwP}_f=&R((;bbsR4C9frxHl-a
z5&O~>=YrVcA@0&qn~0qk)iYh+*3r#4Y>`=nE>N8Hwne*MJVJEJ?`wPxYL6Pgn-+_1
zh$35}{PpvwHj3No1?s~i)Qz*K9beb=Vh|kjJ!%X3p4BMM2SITk2p+)>ci~r$Y81zY
zBB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