Skip to content

❇️ Add live preview panel with real-time configuration syncing. - #2

Merged
shazee-04 merged 1 commit into
mainfrom
feat/upgrade
Jul 5, 2026
Merged

❇️ Add live preview panel with real-time configuration syncing.#2
shazee-04 merged 1 commit into
mainfrom
feat/upgrade

Conversation

@shazee-04

Copy link
Copy Markdown
Owner

This pull request introduces a live preview feature to the bio link editor, allowing users to see real-time updates of their changes in a simulated phone preview panel. It also refactors the scroll animation logic for better encapsulation and adds style improvements for the new preview mode. The most important changes are grouped below:

Live Preview Feature:

  • Added a persistent preview panel (.preview-panel) to the editor UI in edit.html, displaying a simulated phone with an iframe that loads index.html. [1] [2]
  • Implemented a polling loop in edit.js to detect configuration changes and post updated config data to the preview iframe for live updates.
  • Updated script.js to listen for UPDATE_CONFIG messages in the iframe and re-render the page with the new configuration, enabling true live preview.

Scroll Animation Refactor:

  • Moved scroll-entrance animation logic into a new initScrollAnimations function, now called inside renderPage for correct re-initialization on config changes. [1] [2]

Styling and Layout Improvements:

  • Added styles to hide scrollbars in preview mode and improved layout for the preview panel and editor controls in edit.css and style.css. [1] [2] [3] [4] [5]
  • Adjusted editor controls and banners to accommodate the new preview panel layout. [1] [2]

Preview Mode Detection:

  • Updated script.js to detect when running inside an iframe and apply the .in-preview class for style adjustments.

These changes collectively enable a seamless, real-time editing and preview experience in the bio link editor.

Copilot AI 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.

Pull request overview

This PR adds a live preview panel to the bio link editor so edits sync in real time to an index.html iframe, and refactors scroll-entrance animation initialization to support re-rendering when config changes.

Changes:

  • Added a persistent preview panel (phone simulator + iframe) to edit.html with supporting layout/styles in edit.css.
  • Implemented live-preview config syncing from edit.js to the preview iframe, and added script.js support for re-rendering on UPDATE_CONFIG messages.
  • Refactored scroll animation logic into a reusable initScrollAnimations() and added preview-mode scrollbar hiding via .in-preview styles.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
style.css Adds .in-preview scrollbar-hiding styles for the iframe preview mode.
script.js Introduces renderPage(config) re-rendering and listens for UPDATE_CONFIG messages; moves scroll animation init into a reusable function.
edit.js Adds polling-based config change detection and posts updated config to the preview iframe.
edit.html Adds the preview panel markup with an iframe loading index.html; relocates top-right controls.
edit.css Adjusts editor layout to accommodate preview panel and adds preview panel / phone simulator styles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread script.js
Comment on lines +527 to +532
window.addEventListener('message', (event) => {
if (event.data && event.data.type === 'UPDATE_CONFIG') {
window.APP_CONFIG = event.data.config;
renderPage(window.APP_CONFIG);
}
});
Comment thread edit.js
Comment on lines +1125 to +1139
// --- Live Preview Polling Loop ---
let lastPreviewStr = JSON.stringify(currentConfig);
setInterval(() => {
const currentStr = JSON.stringify(currentConfig);
if (currentStr !== lastPreviewStr) {
lastPreviewStr = currentStr;
const iframe = document.getElementById('preview-iframe');
if (iframe && iframe.contentWindow) {
iframe.contentWindow.postMessage({
type: 'UPDATE_CONFIG',
config: JSON.parse(currentStr)
}, '*');
}
}
}, 300);
Comment thread edit.html
<!-- Preview Panel -->
<div class="preview-panel">
<div class="phone-simulator">
<iframe id="preview-iframe" src="index.html"></iframe>
Comment thread script.js
Comment on lines +11 to +15
function renderPage(config) {
if (!config) {
console.error('Configuration data (config.js) not found.');
return;
}
@shazee-04
shazee-04 merged commit f9ea6a3 into main Jul 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants