feat: Aurora Drift preset import/export with community preset directory (#414) - #448
Conversation
|
@divyanshim27 is attempting to deploy a commit to the Dot_NotSam's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis PR adds Aurora Drift preset support. It defines a preset schema, ships bundled preset files, adds import and export file handling through Electron IPC, exposes preset management in the UI, adds panel styling, and documents the contribution process. ChangesAurora Drift presets
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant UI as Aurora preset panel
participant Renderer as presetManager
participant Preload as presetAPI
participant Main
participant Files
User->>UI: Choose preset / export / import
UI->>Renderer: Request preset action
Renderer->>Preload: savePresetFile(), openPresetFile(), loadBundledPreset()
Preload->>Main: ipcRenderer.invoke(...)
Main->>Files: Read or write preset JSON
Files-->>Main: File data or save result
Main-->>Preload: IPC response
Preload-->>Renderer: Preset result
Renderer-->>UI: Validated preset data or status
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SamXop123
left a comment
There was a problem hiding this comment.
@divyanshim27 thanks a ton for working on this. but the current implementation is a bit broken and can be simplified quite a bit before we merge.
Here are a few things that need to be cleaned up:
-
Move the UI to Settings:
Currently, the preset options are placed inindex.html(the transparent visualizer overlay). The overlay should stay clean and headless. Please move these preset buttons/dropdowns into the actual settings panel (settings.htmlandsettings.js). -
Wire up the Script:
The newpresetManager.jsfile is added, but it isn't loaded anywhere in the HTML or required by other scripts. Because of this, the new buttons are currently dead and don't do anything when clicked. Please load the script and bind your functions to the UI buttons. -
Simplify the Presets (No separate JSON files):
Instead of loading multiple tiny JSON files from the disk (which adds disk I/O overhead and can easily break due to typos or missing files, like the missingemerald-veil.jsonand typo inarctic-dwan.jsonhere), let's keep it simple:
- Remove the
themes/aurora-presets/folder. - Create a single JS file (e.g.,
themes/auroraPresets.js) that exports a static array of these presets. This way, they load instantly in memory, and we can remove thepreset:load-bundledIPC handler frommain.jsentirely. - Anyone who wants to contribute a new preset in the future can just add an object to that JS array.
We still wanna keep the Import/Export from File buttons, as they are super useful for users who want to share their setups!
Also, one more thing, please don't edit CONTRIBUTING.md
after these fixes are applied it should be good to go
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@presetManager.js`:
- Around line 151-152: Update the preset import flow around validateAndCoerce so
parsed.settings is validated against the complete published preset contract,
including name, author, version, and every required settings field, before
coercion and return. Reject presets with missing required fields instead of
silently defaulting them; keep valid preset handling unchanged.
In `@themes/aurora-presets/arctic-dwan.json`:
- Around line 1-21: Rename the preset file from arctic-dwan.json to
arctic-dawn.json so the existing presetManager.js lookup and main.js file read
resolve the Arctic Dawn preset correctly.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b5a53b40-be7b-4d69-8548-8b78128158ab
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (9)
CONTRIBUTING.mdindex.htmlmain.jspreload.jspresetManager.jsstyles.cssthemes/aurora-presets/arctic-dwan.jsonthemes/aurora-presets/neon-city.jsonthemes/aurora-presets/preset.schema.json
| const validatedSettings = validateAndCoerce(parsed.settings); | ||
| return { preset: parsed, settings: validatedSettings }; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Enforce the published preset contract before returning the preset.
themes/aurora-presets/preset.schema.json requires name, author, version, and every settings field. This path only checks theme. It silently defaults missing numeric fields and returns presets that fail the documented schema.
Reject missing required fields before coercion, or document that import accepts a different contract.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@presetManager.js` around lines 151 - 152, Update the preset import flow
around validateAndCoerce so parsed.settings is validated against the complete
published preset contract, including name, author, version, and every required
settings field, before coercion and return. Reject presets with missing required
fields instead of silently defaulting them; keep valid preset handling
unchanged.
| { | ||
| "name": "Arctic Dawn", | ||
| "author": "Paraline Community", | ||
| "version": "1.0", | ||
| "theme": "Aurora Drift", | ||
| "description": "Cool arctic blues and pale whites — a crisp, ethereal northern morning.", | ||
| "settings": { | ||
| "gradientStops": [ | ||
| { "position": 0.0, "color": "#E0F4FF", "opacity": 0.9 }, | ||
| { "position": 0.25, "color": "#7DD8F8", "opacity": 0.8 }, | ||
| { "position": 0.55, "color": "#3A9FD8", "opacity": 0.75 }, | ||
| { "position": 0.8, "color": "#1A5FA8", "opacity": 0.7 }, | ||
| { "position": 1.0, "color": "#0A2A6E", "opacity": 0.85 } | ||
| ], | ||
| "glowRadius": 18, | ||
| "primaryFrequency": 0.6, | ||
| "secondaryFrequency": 0.35, | ||
| "responseSmoothing": 0.82, | ||
| "activeCurtains": 3 | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Rename this file to arctic-dawn.json.
presetManager.js Lines 71-75 requests arctic-dawn. main.js Lines 2375-2379 then reads arctic-dawn.json. The current arctic-dwan.json name makes the loader return null, so Arctic Dawn does not appear in the preset picker.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@themes/aurora-presets/arctic-dwan.json` around lines 1 - 21, Rename the
preset file from arctic-dwan.json to arctic-dawn.json so the existing
presetManager.js lookup and main.js file read resolve the Arctic Dawn preset
correctly.
Closes #414
Summary
Implements full preset import/export for Aurora Drift, plus a bundled community preset directory with 3 starter presets.
Changes
themes/aurora-presets/arctic-dawn.json— cool blues and whitesthemes/aurora-presets/neon-city.json— vivid pinks and purplesthemes/aurora-presets/emerald-veil.json— deep greens and tealsthemes/aurora-presets/preset.schema.json— reference schema for contributorspresetManager.js— validation, coercion, bundled preset loading, export/import logicmain.js— IPC handlers: preset:save-file, preset:open-file, preset:load-bundledpreload.js— contextBridge.exposeInMainWorld('presetAPI', ...)index.html— preset section UI (dropdown, export name input, import/export buttons)styles.css— preset panel stylesrenderer.js— UI event wiring for all three preset actionsCONTRIBUTING.md— "Contributing Aurora Presets" section with schema, constraints table, submission stepsWhy the IPC approach (not @electron/remote)
Modern Electron (v14+) deprecated @electron/remote for security reasons. All file dialog calls now go through ipcMain.handle / ipcRenderer.invoke, which is the correct, sandboxed pattern for this codebase.
User flow
Validation
Summary by CodeRabbit
New Features
Documentation