Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App Extensibility] Detect conflicting homepage url (@W-17599554@) #2215

Open
wants to merge 13 commits into
base: feature/extensibility-v2
Choose a base branch
from

Conversation

vmarta
Copy link
Contributor

@vmarta vmarta commented Jan 21, 2025

This PR handles the scenario of an app extension adding a homepage at the root /. For example: the typescript-minimal template has its own homepage, but if you use the chakra-storefront extension, it'll also try to add its own homepage at the same url. Thus, there are 2 routes that target the same / path.

With this PR, there will no longer be a conflict in the routes:

  • When the dev server runs, it'll open at /__pwa-kit/start path by default. The base template's homepage will thus be rendered.

  • while the storefront extension's homepage is still at the / route.

  • Fix tests and maybe add new ones

How to test-drive the PR

  1. Generate a project with node packages/pwa-kit-create-app/scripts/create-mobify-app-dev.js --outputDir /tmp/foo
  2. Select chakra-storefront as one of the extensions to install
  3. Then run your generated project via npm start
  4. Verify that the resulting page is the typescript-minimal page.

With storefront extension installed:
Arc 2025-01-24 at 13 27 27

Without any extensions installed:
Arc 2025-01-24 at 13 26 53

@vmarta vmarta added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Jan 21, 2025
</a>
</p>

<p>You have installed the following application extensions:</p>
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 typescript-minimal homepage now has a more minimal content.

100% { opacity: 1 }
}
.fade-in {
.content {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed and constrained the css selectors to avoid the styles leaking to other unexpected elements.

@@ -48,6 +49,166 @@
"mobify": {
"app": {
"extensions": [
["@salesforce/extension-chakra-storefront", {
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'll revert this change before the PR is merged.

@vmarta vmarta requested a review from alexvuong January 24, 2025 23:41
Comment on lines +42 to +52
.button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
color: white;
background-color: #0176D3;
text-align: center;
text-decoration: none;
border-radius: 5px;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like that it looks like a chakra button without being one 👍

</p>
))
) : (
<li>None</li>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This "none" is very computer sounding. Maybe we can make that look a little better. Like:

If you have extensions installed:

You have 2 extensions installed.
    - Chakra Storefront
    - Chakra Store Locator

If you don't have extensions installed:

You currently do not have any extensions installed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This by no means is what we'll have in the end. But it's a little cleaner. It would be nice to have friendly names like my examples above, but using the package name is ok for now.

It was complaining about the unnecessary type assertion.
@vmarta vmarta marked this pull request as ready for review January 24, 2025 23:54
@vmarta vmarta requested a review from a team as a code owner January 24, 2025 23:54
`

const Home = ({value}: Props) => {
const [counter, setCounter] = useState(0)
const Home = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any reason why we don't want to called this "Start" or "GettingStarted"? I personally like the later, but I would that the path is in alignment with the page name.. so /_pwa-kit/getting-started and GettingStarted or /_pwa-kit/start and Start

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed with Ben on this

@@ -27,6 +27,9 @@ const options = {
// except by Safari.
protocol: 'http',

// The path that the local dev server would open initially
startPath: '/__pwa-kit/start',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: it seems like there is a small chance the Home page will result in a 404 if the value here is mismatched with the one in the path in routes. I don't think creating a constant would make much sense since it is likely to change when devepers starts to alternate the routes during developerment. Maybe leaving a comment in the routes to give more context for this value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants