Skip to content

Conversation

@kelbyhawn
Copy link
Contributor

@kelbyhawn kelbyhawn commented Dec 12, 2025

Separates the page not found 404 and preview empty states in the preview panel in Codebridge.

Links

Jira ticket: AFL-351
Related PR comment: #69348 (comment)

Testing story

Tested locally across browsers


Web Lab 2

Screen.Recording.2025-12-12.at.1.19.02.PM.mov

Local 404

Screenshot 2025-12-12 at 1 17 15 PM

@kelbyhawn kelbyhawn requested a review from Copilot December 12, 2025 22:01
Copy link
Contributor

Copilot AI left a comment

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 separates the 404 "Page not found" state from the generic "Nothing to preview" empty state in Codebridge's HTML preview panel. Previously, both scenarios used the same component; now they display distinct messages and images based on whether the project has files.

  • Created a new PreviewEmptyState component for when projects have no files
  • Updated PageNotFound to use a new image and different messaging for actual 404 errors
  • Added logic to conditionally render the appropriate empty state based on project file count

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/src/codebridge/images/page-not-found.png Adds new 404 error image asset
apps/src/codebridge/components/CodebridgeEmptyState.module.scss Adds Safari-specific fix for image rendering
apps/src/codebridge/FilePreview/styles/page-not-found.module.scss Removes old dedicated stylesheet (styles moved to shared location)
apps/src/codebridge/FilePreview/styles/inner-html-preview.module.scss Consolidates placeholder container styles for both empty states
apps/src/codebridge/FilePreview/PreviewEmptyState.tsx Creates new component for empty project state
apps/src/codebridge/FilePreview/PageNotFound.tsx Updates to use new 404 image and messaging
apps/src/codebridge/FilePreview/InnerHTMLPreview.tsx Adds conditional logic to render appropriate empty state
apps/src/codebridge/FileBrowser/styles/filebrowser.module.scss Ensures consistent background color for child elements

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

@kelbyhawn kelbyhawn requested a review from a team December 12, 2025 22:08
@kelbyhawn kelbyhawn changed the title Codebridge: separate page not found and preview empty state views Codebridge: separate page not found and preview empty views Dec 12, 2025
Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

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

Looks great! Just had a question about InnerHTMLPreview2.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is so cute!

updateLinksToNonHtmlFiles,
} from './htmlParsingHelpers';
import PageNotFound from './PageNotFound';
import PreviewEmptyState from './PreviewEmptyState';
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to implement this for InnerHTMLPreview2 as well? #69422 - or will that be done in a follow-up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, @molly-moen does this need to be added here too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we'll have to handle it for the new preview too. It will be handled differently though. The 404 page should stay the same, and maybe in HTMLPreview instead of trying to show the preview if we have no sources we can show the empty state instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do that separately though/wait for the new preview to be the default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Continuing the convo from Slack, here's the commit to move the PreviewEmptyState into HTMLPreview: 9c331e6

Screen.Recording.2025-12-12.at.4.02.37.PM.mov

@alex-m-brown alex-m-brown changed the base branch from staging-next to staging December 15, 2025 15:21
Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

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

Left a couple small comments/questions. thanks for following up on my previous question about InnerHTMLPreview2!

if (event.data.type === IframeMessageType.IFRAME_READY) {
setIsIframeLoaded(true);
// Send the source immediately when iframe is ready
if (debouncedSource) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why you added this since I see there's already a useEffect below (line 306) which sends the source to the iframe when isIframeLoaded is set to true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The iframe in InnerHTMLPreview was showing the PageNotFound view when a file is added after being empty (see video). This reloads the source right away so the iframe loads the preview.

Screen.Recording.2025-12-15.at.9.30.02.AM.mov

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the explanation!

Copy link
Contributor

Choose a reason for hiding this comment

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

Was it showing a flash of page not found or would it never show the new file? I'm curious why it would never update 🤔

Copy link
Contributor Author

@kelbyhawn kelbyhawn Dec 15, 2025

Choose a reason for hiding this comment

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

It would never show the new file. It would reload the preview if another file was added or you make a change on the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Sounds good. As we move to the new preview we may be able to clean this up, but I think it's good for now!

state.lab2Project.projectSources?.source as MultiFileSource | undefined
);

const emptyProject =
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit - could rename toisEmptyProject

box-sizing: border-box;
}

// Styles for the PageNotFound and PreviewEmptyState components
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: the PreviewEmptyState is not always used in the inner html previews.
...and code loading states

if (event.data.type === IframeMessageType.IFRAME_READY) {
setIsIframeLoaded(true);
// Send the source immediately when iframe is ready
if (debouncedSource) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Was it showing a flash of page not found or would it never show the new file? I'm curious why it would never update 🤔

@kelbyhawn kelbyhawn merged commit ab9e9f1 into staging Dec 16, 2025
6 checks passed
@kelbyhawn kelbyhawn deleted the AFL-351/web-lab2/separate-no-preview-and-404-views branch December 16, 2025 16:36
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.

3 participants