Skip to content
Merged
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
16 changes: 7 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions src/docs/src/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ const playgroundHtml = `
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://js.puter.com/v2/"></script>

<div style="height: 50px; padding: 10px; background-color: #474e5d; display: flex; flex-direction: row;">
<h1 class="logo"><a href="/playground/">Puter.js Playground</a></h1>
<div style="height: 70px; padding: 10px; background-color: #474e5d; display: flex; flex-direction: row;">
<h1 class="logo">
<a href="/playground/">Puter.js Playground</a>
<span class="playground-page-title" style="margin: 0; font-size: 16px; color: #ccc;">{{PAGE_TITLE}}</span>
</h1>
<div style="float:right;" class="navbar">
<a href="/" target="_blank" style="margin-right: 35px;">Docs</a>
<a style="display: flex; flex-direction: row; align-items: center;"
Expand Down Expand Up @@ -167,7 +170,11 @@ const generatePlayground = () => {
htmlTemplate = htmlTemplate.replaceAll('{{DESCRIPTION}}', pageDescription);
const canonicalUrl = `https://docs.puter.com/playground/${example.slug ? `${example.slug }/` : ''}`;
htmlTemplate = htmlTemplate.replaceAll('{{CANONICAL}}', canonicalUrl);
const finalHtml = htmlTemplate.replace('{{CODE}}', sourceContent);
htmlTemplate = htmlTemplate.replaceAll('{{PAGE_TITLE}}', example.title);
const codeWithDescription = example.description
? `<!-- ${example.description} -->\n\n${sourceContent}`
: sourceContent;
const finalHtml = htmlTemplate.replace('{{CODE}}', codeWithDescription);

// Create output directory
const outputDir = path.join('dist', 'playground', example.slug);
Expand Down
16 changes: 11 additions & 5 deletions src/docs/src/playground/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ body {

.main-container {
display: flex;
height: calc(100vh - 50px);
height: calc(100vh - 70px);
width: 100%;
}

Expand Down Expand Up @@ -147,7 +147,9 @@ body {
font-weight: 300;
font-size: 21px;
display: flex;
align-items: center;
flex-direction: column;
align-items: start;
gap: 8px;
}

.logo a {
Expand All @@ -167,6 +169,10 @@ body {
font-size: 16px;
}

.logo .playground-page-title {
font-size: 12px;
}

.navbar a {
font-size: 14px;
margin-right: 10px;
Expand All @@ -180,7 +186,7 @@ body {

#sidebar-container {
position: fixed;
top: 50px;
top: 70px;
left: 0;
right: 0;
width: 100%;
Expand All @@ -197,7 +203,7 @@ body {

/* When sidebar is open on mobile, it overlays the content */
#sidebar-container:not(.collapsed) {
height: calc(100vh - 50px);
height: calc(100vh - 70px);
}

/* When sidebar is collapsed, only the header is shown */
Expand All @@ -210,7 +216,7 @@ body {
flex-direction: column !important;
flex: 1;
min-height: 0;
margin-top: 50px;
margin-top: 70px;
}

#code-container {
Expand Down
8 changes: 8 additions & 0 deletions src/docs/src/playground/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ document.addEventListener('DOMContentLoaded', function () {
editor = monaco.editor.create(editorElement, {
language: 'html',
fontFamily: 'monospace',
wordWrap: 'on',
minimap: {
enabled: false,
},
Expand Down Expand Up @@ -246,6 +247,13 @@ document.addEventListener('click', function (e) {
document.title = newTitle.textContent;
}

// Update the playground page title in the header
const newPageTitle = doc.querySelector('.playground-page-title');
const currentPageTitle = document.querySelector('.playground-page-title');
if ( newPageTitle && currentPageTitle ) {
currentPageTitle.textContent = newPageTitle.textContent;
}

// Update meta description
const newDescription = doc.querySelector('meta[name="description"]');
if ( newDescription ) {
Expand Down
Loading