Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions packages/playground/blueprints/public/blueprint-schema-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -10340,7 +10340,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the indentation a little messed up here?

errors = vErrors.length;
}
var valid21 =
Expand Down Expand Up @@ -11019,7 +11019,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors = vErrors.length;
}
var valid27 =
Expand Down Expand Up @@ -11435,7 +11435,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -11467,7 +11467,7 @@ function validate14(
? validate18.errors
: vErrors.concat(
validate18.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -11553,7 +11553,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -12101,7 +12101,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -12133,7 +12133,7 @@ function validate14(
? validate18.errors
: vErrors.concat(
validate18.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -12219,7 +12219,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -13969,7 +13969,7 @@ function validate14(
? validate30.errors
: vErrors.concat(
validate30.errors
);
);
errors = vErrors.length;
}
var valid54 =
Expand Down Expand Up @@ -15456,7 +15456,7 @@ function validate14(
? validate32.errors
: vErrors.concat(
validate32.errors
);
);
errors = vErrors.length;
}
var valid68 =
Expand Down Expand Up @@ -16180,7 +16180,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors = vErrors.length;
}
var valid76 =
Expand Down Expand Up @@ -16810,7 +16810,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors = vErrors.length;
}
var valid83 =
Expand Down Expand Up @@ -17589,7 +17589,7 @@ function validate14(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -18636,7 +18636,7 @@ function validate14(
? validate18.errors
: vErrors.concat(
validate18.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -20513,7 +20513,7 @@ function validate11(
? validate12.errors
: vErrors.concat(
validate12.errors
);
);
errors =
vErrors.length;
}
Expand Down Expand Up @@ -21127,7 +21127,7 @@ function validate11(
? validate14.errors
: vErrors.concat(
validate14.errors
);
);
errors =
vErrors.length;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
} from '@wp-playground/blueprints';
import { lazy, Suspense, useState, useEffect, useCallback } from 'react';
import { logger } from '@php-wasm/logger';
import { encodeStringAsBase64 } from '../../../lib/base64';

const SiteFileBrowser = lazy(() =>
import('../site-file-browser').then((m) => ({ default: m.SiteFileBrowser }))
Expand Down Expand Up @@ -187,6 +188,24 @@ export function SiteInfoPanel({
return () => clearTimeout(timeoutId);
}, [blueprintCode, autoRecreate, isTemporary, handleRecreateFromBlueprint]);

// Update URL hash when blueprint changes for shareable URLs
useEffect(() => {
if (!isTemporary || !blueprintCode) {
return;
}

try {
// Validate that it's valid JSON before updating the URL
JSON.parse(blueprintCode);
const encodedBlueprint = encodeStringAsBase64(blueprintCode);
const newUrl = new URL(window.location.href);
newUrl.hash = encodedBlueprint;
window.history.replaceState(null, '', newUrl.toString());
} catch {
// Don't update URL if blueprint is invalid JSON
}
}, [blueprintCode, isTemporary]);

const removeSiteAndCloseMenu = async (onClose: () => void) => {
// TODO: Replace with HTML-based dialog
const proceed = window.confirm(
Expand Down
Loading