Skip to content

chore: improve content of frontend contributing guide #14619

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

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

jaaydenh
Copy link
Contributor

@jaaydenh jaaydenh commented Sep 9, 2024

The goal of this update are:

  1. Remove any outdated text that I am aware of
  2. Make the language more concise
  3. Add information for modules, emotion, forms specifically highlighting the differences between components and modules

This refactor does not address the testing section

In the future, more information about theming should be included in the guide.

@jaaydenh jaaydenh self-assigned this Sep 9, 2024
Copy link
Member

@Parkreiner Parkreiner left a comment

Choose a reason for hiding this comment

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

I like the changes overall! Just had a few suggestions

Comment on lines +58 to +59
- **components** - Reusable UI components without Coder specific business
logic
Copy link
Member

Choose a reason for hiding this comment

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

@jaaydenh @aslilac @BrunoQuaresma This was actually something I was going to ask about for this week's frontend variety, but do you think that going forward, we should enforce a "no data fetching in the components directory" rule?

We currently have some for the filter options and the autocomplete components, but my hope would be either:

  1. Move these to modules
  2. Decouple the layout concerns for the components from the fetching, and move the fetching somewhere else

Copy link
Member

Choose a reason for hiding this comment

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

The filter options logic technically isn't hitting an API endpoint itself, but it's still doing weird stuff like putting JSX directly inside the query cache

Copy link
Collaborator

Choose a reason for hiding this comment

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

The filter component is a bad example 😓, so we shouldn't consider it a best practice. However, I do think it makes sense not to have fetching logic inside 'shareable' components.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Parkreiner Do you think there is anything specific to call out in the docs about this right now?

should always try to use the base components that are provided by the library or
from the codebase. It's recommended that you always do a quick search before
creating a custom primitive component like dialogs, popovers, buttons, etc.
Do not assume existing components and modules have been categorized correctly.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Do not assume existing components and modules have been categorized correctly.
Our codebase has some legacy components that are being updated to follow these new conventions, but all new components should follow these guidelines.

Copy link
Member

Choose a reason for hiding this comment

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

Feel like the current wording is throwing the team under the bus a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Parkreiner hehe, you are totally correct, I was just trying to be really clear about the current state of things to avoid confusion. But I agree your wording sounds much better.

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 wanted to create another PR eventually to move some components to modules.

In both cases, you can access the dashboard on `http://localhost:8080`. If you
are running the `./scripts/develop.sh` you can log in using the default
credentials: `admin@coder.com` and `SomeSecurePassword!`.
> **Default Credentials:** `admin@coder.com` and `SomeSecurePassword!`.
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is not quite the GHFM "callout" that @Parkreiner was suggesting, this is just a block quote, which is also kind of a misrepresentation

https://github.com/orgs/community/discussions/16925

Comment on lines +147 to +149
making API requests. The API functions are centralized in `site/src/api/api.ts`.
Auto-generated TypeScript types derived from our Go server are located in
`site/src/api/typesGenerated.ts`.
Copy link
Member

Choose a reason for hiding this comment

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

although it looks like we're inconsistent about it... sigh

@jaaydenh jaaydenh merged commit 40688e4 into main Sep 10, 2024
24 checks passed
@jaaydenh jaaydenh deleted the jaaydenh/frontend-guide branch September 10, 2024 19:52
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants