Commit b251324
authored
feat: sync Customization Studio settings to URL for shareability (JhaSourav07#2252)
## Description
This PR adds URL synchronization to the Customization Studio.
Previously, all settings were stored only in component state, meaning
configurations could not be bookmarked or shared. Now, as the user
adjusts any setting, the page URL updates in real-time using
`router.replace`. On page load, the URL search params are read to
restore the previous configuration, making every customization fully
shareable via a single link.
Fixes JhaSourav07#2245
## Pillar
- [x] 🛠️ Other (Bug fix, refactoring, docs)
**Changes made:**
- Added `useSearchParams` hook to initialize all state from URL params
on mount
- Added `useEffect` to sync state changes to the URL using
`router.replace` with `scroll: false`
## Visual Preview
Before: Changing settings in the Customization Studio never updated the
page URL. Refreshing the page or sharing the link would lose all
configuration.
<img width="1920" height="967"
alt="{98D0A76E-6735-4DFE-A22B-F14D8B863C29}"
src="https://github.com/user-attachments/assets/c9673ec0-08fd-421e-acd1-dd93a862e2fb"
/>
After: The URL updates in real-time as settings change (e.g.
/customize?user=jhasourav07&theme=neon&font=Orbitron). Visiting a shared
URL restores the exact same configuration automatically.
https://github.com/user-attachments/assets/8c8b46df-035f-4b9f-a6d1-09f53ee1cea2
## Checklist
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have started the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [x] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).2 files changed
Lines changed: 59 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
39 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
59 | 93 | | |
60 | 94 | | |
61 | 95 | | |
| |||
114 | 148 | | |
115 | 149 | | |
116 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
117 | 157 | | |
118 | 158 | | |
119 | 159 | | |
| |||
573 | 613 | | |
574 | 614 | | |
575 | 615 | | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
0 commit comments