Spaces:
Running
Running
private preview
Browse files
components/editor/preview/index.tsx
CHANGED
|
@@ -555,6 +555,27 @@ export const Preview = ({ isNew }: { isNew: boolean }) => {
|
|
| 555 |
</button>
|
| 556 |
</div>
|
| 557 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
<iframe
|
| 559 |
key={iframeKey}
|
| 560 |
id="preview-iframe"
|
|
@@ -580,14 +601,17 @@ export const Preview = ({ isNew }: { isNew: boolean }) => {
|
|
| 580 |
: undefined
|
| 581 |
}
|
| 582 |
srcDoc={
|
| 583 |
-
!currentCommit && (isNew || hasUnsavedChanges)
|
| 584 |
? isNew
|
| 585 |
? throttledHtml || defaultHTML
|
| 586 |
: stableHtml
|
| 587 |
: undefined
|
| 588 |
}
|
| 589 |
onLoad={() => {
|
| 590 |
-
if (
|
|
|
|
|
|
|
|
|
|
| 591 |
if (iframeRef?.current?.contentWindow?.document?.body) {
|
| 592 |
iframeRef.current.contentWindow.document.body.scrollIntoView({
|
| 593 |
block: isAiWorking ? "end" : "start",
|
|
|
|
| 555 |
</button>
|
| 556 |
</div>
|
| 557 |
)}
|
| 558 |
+
{!isNew &&
|
| 559 |
+
!hasUnsavedChanges &&
|
| 560 |
+
!currentCommit &&
|
| 561 |
+
!project?.space_id && (
|
| 562 |
+
<div className="top-0 left-0 right-0 z-20 bg-blue-500/90 backdrop-blur-sm border-b border-blue-600 px-4 py-2 flex items-center justify-between gap-3 text-sm w-full">
|
| 563 |
+
<div className="flex items-center gap-2 flex-1">
|
| 564 |
+
<TriangleAlert className="size-4 text-blue-900 flex-shrink-0" />
|
| 565 |
+
<span className="text-blue-900 font-medium">
|
| 566 |
+
Private project preview. This project is not deployed
|
| 567 |
+
publicly.
|
| 568 |
+
</span>
|
| 569 |
+
</div>
|
| 570 |
+
<button
|
| 571 |
+
onClick={refreshIframe}
|
| 572 |
+
className="px-3 py-1 bg-blue-900 hover:bg-blue-800 text-blue-50 rounded-md font-medium transition-colors whitespace-nowrap flex items-center gap-1.5"
|
| 573 |
+
>
|
| 574 |
+
<RefreshCcw className="size-4 text-blue-50 flex-shrink-0" />
|
| 575 |
+
Refresh
|
| 576 |
+
</button>
|
| 577 |
+
</div>
|
| 578 |
+
)}
|
| 579 |
<iframe
|
| 580 |
key={iframeKey}
|
| 581 |
id="preview-iframe"
|
|
|
|
| 601 |
: undefined
|
| 602 |
}
|
| 603 |
srcDoc={
|
| 604 |
+
!currentCommit && (isNew || hasUnsavedChanges || project?.private)
|
| 605 |
? isNew
|
| 606 |
? throttledHtml || defaultHTML
|
| 607 |
: stableHtml
|
| 608 |
: undefined
|
| 609 |
}
|
| 610 |
onLoad={() => {
|
| 611 |
+
if (
|
| 612 |
+
!currentCommit &&
|
| 613 |
+
(isNew || hasUnsavedChanges || project?.private)
|
| 614 |
+
) {
|
| 615 |
if (iframeRef?.current?.contentWindow?.document?.body) {
|
| 616 |
iframeRef.current.contentWindow.document.body.scrollIntoView({
|
| 617 |
block: isAiWorking ? "end" : "start",
|