Skip to content

Conversation

infomiho
Copy link
Contributor

@infomiho infomiho commented Jun 3, 2025

Closes #2740

This PR touches only the examples/todoApp and nothing in the compiler. The idea was to make it easy to see all the different demos we have in the app and make it a bit nicer visually so we can deploy it and share it with users to test Wasp features.

Some screenshots

Screenshot 2025-06-04 at 12 13 36
Screenshot 2025-06-04 at 12 13 53
Screenshot 2025-06-04 at 14 59 00

The way to think about this PR:

  • First check out the headless tests changes to see the actual functional changes. Ideally, you'll notice that there weren't many functional changes. There are some new tests for the new APIs and Jobs demo pages.
  • Next, look at the new folder structure, most of the features live in the features dir. I've used pages to group pages at different dir levels and components to group components.
  • Next, there are two new components Button and Input that are used in most demos. I've generated them with LLMs and then minimized the code to still be useful to us.
  • Lastly, there are lot of styles added to make the kitchen sink app more modern and consistent. I mostly went for modern and clean look while using LLMs. I believe the style shouldn't bother anyone, but please let me know if there is something we can improve.

infomiho added 3 commits May 26, 2025 17:38
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
@infomiho infomiho changed the title Miho kitchen sink Update the todoApp to be a proper kitchen sink app Jun 3, 2025
Copy link

cloudflare-workers-and-pages bot commented Jun 3, 2025

Deploying wasp-docs-on-main with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0615b42
Status: ✅  Deploy successful!
Preview URL: https://5f064aad.wasp-docs-on-main.pages.dev
Branch Preview URL: https://miho-kitchen-sink.wasp-docs-on-main.pages.dev

View logs

@infomiho infomiho marked this pull request as ready for review June 4, 2025 10:43
"Value of user.isOnAfterLoginHookCalled is true.",
);
await expect(
page.getByTestId("hook-status-onAfterSignup").getByTestId("status"),
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've found out about data-testid helpers which enable us to be really precise when writing selectors in headless tests.

Comment on lines 37 to 51
const variantStyles: Record<ButtonVariant, string> = {
primary:
"bg-primary-500 hover:bg-primary-400 text-gray-800 border-transparent shadow-sm hover:shadow-md",
secondary:
"bg-gray-600 hover:bg-gray-700 text-white border-transparent shadow-sm hover:shadow-md",
outline:
"bg-transparent hover:bg-primary-50 text-primary-600 border-primary-300 hover:border-primary-400",
ghost: "bg-transparent hover:bg-gray-100 text-gray-700 border-transparent",
danger:
"bg-red-600 hover:bg-red-700 text-white border-transparent shadow-sm hover:shadow-md",
success:
"bg-green-600 hover:bg-green-700 text-white border-transparent shadow-sm hover:shadow-md",
warning:
"bg-amber-600 hover:bg-amber-700 text-white border-transparent shadow-sm hover:shadow-md",
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not all variants are used now - but they should be useful for the future.

import { Link, type Routes } from "wasp/client/router";
import { cn } from "../cn";

export function FeatureContainer({ children }: React.PropsWithChildren<{}>) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is wrapper for most demo pages which renders a sidebar with the list of the features on the left and the demo content on the right.

} from "wasp/server/api";

export const fooBar: FooBar = (_req, res, context) => {
if (!context.user) {
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 found it better to do this (and easier to test in headless tests) than to return Hello, undefined

@@ -0,0 +1,23 @@
import { Link } from "wasp/client/router";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code stayed the same mostly, the difference is the import of customisationProps that are applied to all Auth UI components.

@@ -0,0 +1,35 @@
import { Link } from "wasp/client/router";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code stayed the same mostly, the difference is the import of customisationProps that are applied to all Auth UI components.

@@ -0,0 +1,23 @@
import { Link } from "wasp/client/router";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code stayed the same mostly, the difference is the import of customisationProps that are applied to all Auth UI components.

@@ -0,0 +1,14 @@
import { ForgotPasswordForm } from "wasp/client/auth";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code stayed the same mostly, the difference is the import of customisationProps that are applied to all Auth UI components.

@@ -0,0 +1,45 @@
import { FormItemGroup, SignupForm } from "wasp/client/auth";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code stayed the same mostly, the difference is the import of customisationProps that are applied to all Auth UI components.

@@ -0,0 +1,99 @@
import React, { useRef, useState } from "react";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code is mostly the same, just style updates and uses the new Button and Input compnents.

@infomiho
Copy link
Contributor Author

infomiho commented Jun 6, 2025

@FranjoMindek I've tried to address all of your comments, which were great and made the app much better IMHO

@infomiho infomiho requested a review from FranjoMindek June 6, 2025 13:52
Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

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

I was doing pair reviewing with Franjo so here are some comments! Only reviewed first couple of files (tests).

page.getByTestId("job-request").getByTestId("status"),
).toContainText("pending");

await page.waitForTimeout(2000);
Copy link
Member

Choose a reason for hiding this comment

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

Any other way to know how ong we need to wait here? Or to wait for something else? Waiting for fixed period of time is always fragile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Playwright tests usually have internal timeout and they retry the test until it passes. I put here extra 2000ms to be extra safe - but I can simply remove it and it would still work.

Copy link
Member

Choose a reason for hiding this comment

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

But will it wait long enough? If so, sure, let's remove it. If not sure, then how do we know how long do we need to wait? How did you come up with 2s?

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've now removed the waitForTimeout and it will work since Playwright keeps retrying for some time (5 seconds I believe, which is plenty). I've come up with 2s since that's the fake delay I added in the job to simulate longer processing.

Copy link
Member

@Martinsos Martinsos Jun 18, 2025

Choose a reason for hiding this comment

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

Ok great!

If we decided to stay with 2s, then it would be good if we at least documented why it is 2s (because of the delay in job being 2 seconds) or even better, connecting the two via code if not too hard.

This way we avoid it completely so even better.

RAW

Copy link
Contributor

@FranjoMindek FranjoMindek left a comment

Choose a reason for hiding this comment

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

Peer code review with @Martinsos.

Copy link
Contributor

@FranjoMindek FranjoMindek left a comment

Choose a reason for hiding this comment

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

I think we improved the app a lot together.
This is probably my last scan through the code.

Glad we left it much cleaner than it was. Nice job.

Copy link
Member

@cprecioso cprecioso left a comment

Choose a reason for hiding this comment

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

Tested it on my local machine, gave a general look, works fine! 💪 Also, awesome job on look-and-feel, and organization 🔥
Just two things:

  • the .env.server.example doesn't have the SLACK_* env vars, so the app will not run if we do npm run env:pull
  • (see comment below)

Copy link
Contributor

@FranjoMindek FranjoMindek left a comment

Choose a reason for hiding this comment

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

Love what we did with todoApp here.

@infomiho
Copy link
Contributor Author

infomiho commented Jun 16, 2025

@cprecioso the .env.server.example has the Slack dummy variables, but we don't have them in the remote https://www.dotenv.org/ storage, that's true. I'll do that in separate PR since it's out of scope here: #2842

I'll put some dummy Slack credentials because sharing a real client ID and secret is problematic. Slack requires HTTPS even when working locally. The easiest way for me to get HTTPS is to use something like Localtunnel which gives me a way to have HTTPS for the server easily but then that URL is random (or at least you'd need to use a specific subdomain) which is then hard to share amongst team members. Having the dummy values will not crash the app, but to get functional Slack auth you'll need to get your own client ID and secret.

@Martinsos
Copy link
Member

@infomiho just a ping that there are some unresolved comments of mine, in case you missed them!

@infomiho
Copy link
Contributor Author

@Martinsos Please take another look

@infomiho infomiho requested a review from Martinsos June 17, 2025 14:37
@Martinsos
Copy link
Member

@Martinsos Please take another look

Took another look! Two main comments are resolved, great (I left comment on one for you to read and then resolve). I think one you maybe missed still: #2812 (comment) since there is no reaction (I didn't check the code though). But it is a tiny one so I won't be taking another look.

I will approve now but with a "comment", not the "approve", since I reviewed only a tiny bit of a PR.

Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

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

My comments are taken care of! I reviewed only small part of the PR so I am not giving explicit approval though, but that is ok.

@infomiho infomiho merged commit 092aaec into main Jun 18, 2025
7 checks passed
@infomiho infomiho deleted the miho-kitchen-sink branch June 18, 2025 14:24
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.

Improve the waspc/example/todoApp to be a proper kitchen sink app
4 participants