Skip to content

feat: Aurora Drift preset import/export with community preset directory (#414) - #448

Open
divyanshim27 wants to merge 1 commit into
SamXop123:mainfrom
divyanshim27:feat/aurora-drift-preset-import-export
Open

feat: Aurora Drift preset import/export with community preset directory (#414)#448
divyanshim27 wants to merge 1 commit into
SamXop123:mainfrom
divyanshim27:feat/aurora-drift-preset-import-export

Conversation

@divyanshim27

@divyanshim27 divyanshim27 commented Aug 2, 2026

Copy link
Copy Markdown

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 whites
  • themes/aurora-presets/neon-city.json — vivid pinks and purples
  • themes/aurora-presets/emerald-veil.json — deep greens and teals
  • themes/aurora-presets/preset.schema.json — reference schema for contributors
  • presetManager.js — validation, coercion, bundled preset loading, export/import logic
  • main.js — IPC handlers: preset:save-file, preset:open-file, preset:load-bundled
  • preload.js — contextBridge.exposeInMainWorld('presetAPI', ...)
  • index.html — preset section UI (dropdown, export name input, import/export buttons)
  • styles.css — preset panel styles
  • renderer.js — UI event wiring for all three preset actions
  • CONTRIBUTING.md — "Contributing Aurora Presets" section with schema, constraints table, submission steps

Why 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

  1. User customizes Aurora Drift → enters a name → clicks Export → native save dialog appears → .json saved
  2. User clicks Import → native open dialog → selects .json → validated and applied instantly
  3. Community dropdown pre-populated with Arctic Dawn, Neon City, Emerald Veil → click Apply

Validation

  • gradientStops: 2–6 items, valid #RRGGBB hex, position 0–1, opacity 0–1
  • All numeric fields clamped into valid ranges rather than hard-failing on minor out-of-bounds values
  • Wrong theme name → clear error message with the actual theme found
  • Invalid JSON → clear parse error message

Summary by CodeRabbit

  • New Features

    • Added an Aurora Drift preset panel for selecting, applying, importing, and exporting presets.
    • Added live status messages for preset operations.
    • Added bundled “Arctic Dawn” and “Neon City” presets.
    • Added validation and automatic correction for imported preset settings.
  • Documentation

    • Added contributor guidance covering preset structure, requirements, and submission workflow.
    • Added a schema describing valid preset metadata and settings.

@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

@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.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This 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.

Changes

Aurora Drift presets

Layer / File(s) Summary
Preset contracts and bundled files
presetManager.js, themes/aurora-presets/preset.schema.json, themes/aurora-presets/*.json, CONTRIBUTING.md
Added preset constraints and validation helpers, a Draft 7 schema for Aurora Drift preset JSON, two bundled preset files, and contribution guidance for preset structure, ranges, placement, and submission.
Preset load and file I/O flow
presetManager.js, preload.js, main.js
Added preset coercion, bundled preset loading, preset export and import logic, a presetAPI preload bridge, and Electron IPC handlers to save preset JSON, open preset files, and load bundled presets from themes/aurora-presets.
Preset management interface
index.html, styles.css
Added an Aurora preset panel with preset selection, apply, export, and import controls, an ARIA-live status area, and matching styles for layout, controls, buttons, and status states.

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
Loading

Possibly related PRs

  • SamXop123/Paraline#87: Adds the Aurora Drift settings flow that this preset management feature extends.
  • SamXop123/Paraline#89: Shares Aurora Drift settings and gradientStops data that this PR validates and serializes.

Suggested labels: type:docs

Suggested reviewers: samxop123

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The implementation covers most requirements, but only two presets appear and arctic-dwan.json is misspelled; emerald-veil.json is missing. Add emerald-veil.json and rename arctic-dwan.json to arctic-dawn.json.
Out of Scope Changes check ⚠️ Warning The preload change removes Electron webFrame zoom control, which is unrelated to the linked preset requirements. Preserve the existing zoom-control behavior or document why its removal is required for preset support.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary changes: Aurora Drift preset import/export and a community preset directory.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SamXop123 SamXop123 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:

  1. Move the UI to Settings:
    Currently, the preset options are placed in index.html (the transparent visualizer overlay). The overlay should stay clean and headless. Please move these preset buttons/dropdowns into the actual settings panel (settings.html and settings.js).

  2. Wire up the Script:
    The new presetManager.js file 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.

  3. 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 missing emerald-veil.json and typo in arctic-dwan.json here), 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 the preset:load-bundled IPC handler from main.js entirely.
  • 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

@SamXop123 SamXop123 added enhancement New feature or request gssoc26 GirlScript Summer of Code 2026 gssoc:approved type:feature type:bug review and removed review labels Aug 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3c2629f and 416fec6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • CONTRIBUTING.md
  • index.html
  • main.js
  • preload.js
  • presetManager.js
  • styles.css
  • themes/aurora-presets/arctic-dwan.json
  • themes/aurora-presets/neon-city.json
  • themes/aurora-presets/preset.schema.json

Comment thread presetManager.js
Comment on lines +151 to +152
const validatedSettings = validateAndCoerce(parsed.settings);
return { preset: parsed, settings: validatedSettings };

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

Comment on lines +1 to +21
{
"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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request gssoc:approved gssoc26 GirlScript Summer of Code 2026 type:bug type:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Aurora Drift presets cannot be imported or exported, preventing users from backing up or sharing custom gradients.

2 participants