Skip to content

Commit c789c14

Browse files
committed
chore: cleanup language
1 parent 22c7755 commit c789c14

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

docs/contributing/frontend.md

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
11
# Frontend
22

3-
This is a guide to help the Coder community and also Coder members contribute to
4-
our UI. It is ongoing work but we hope it provides some useful information to
5-
get started. If you have any questions or need help, please send us a message on
6-
our [Discord server](https://discord.com/invite/coder). We'll be happy to help
3+
Welcome to the guide for contributing to the Coder frontend. Whether you’re part
4+
of the community or a Coder team member, this documentation will help you get
5+
started.
6+
7+
If you have any questions, feel free to reach out on our
8+
[Discord server](https://discord.com/invite/coder), and we’ll be happy to assist
79
you.
810

911
## Running the UI
1012

1113
You can run the UI and access the Coder dashboard in two ways:
1214

13-
- Build the UI pointing to an external Coder server:
14-
`CODER_HOST=https://mycoder.com pnpm dev` inside of the `site` folder. This is
15-
helpful when you are building something in the UI and already have the data on
16-
your deployed server.
17-
- Build the entire Coder server + UI locally: `./scripts/develop.sh` in the root
18-
folder. This is useful for contributing to features that are not deployed yet
19-
or that involve both the frontend and backend.
15+
1. Build the UI pointing to an external Coder server:
16+
`CODER_HOST=https://mycoder.com pnpm dev` inside of the `site` folder. This
17+
is helpful when you are building something in the UI and already have the
18+
data on your deployed server.
19+
2. Build the entire Coder server + UI locally: `./scripts/develop.sh` in the
20+
root folder. This is useful for contributing to features that are not
21+
deployed yet or that involve both the frontend and backend.
2022

21-
In both cases, you can access the dashboard on `http://localhost:8080`. If you
22-
are running `./scripts/develop.sh` you can log in using the default credentials.
23+
In both cases, you can access the dashboard on `http://localhost:8080`. If using
24+
`./scripts/develop.sh` you can log in with the default credentials.
2325

2426
### Default Credentials: `admin@coder.com` and `SomeSecurePassword!`.
2527

26-
## Tech Stack
28+
## Tech Stack Overview
2729

2830
All our dependencies are described in `site/package.json` but the following are
2931
the most important:
3032

31-
- [React](https://reactjs.org/) as framework
33+
- [React](https://reactjs.org/) for the UI framework
3234
- [Typescript](https://www.typescriptlang.org/) to keep our sanity
3335
- [Vite](https://vitejs.dev/) to build the project
3436
- [Material V5](https://mui.com/material-ui/getting-started/) for UI components
@@ -40,64 +42,62 @@ the most important:
4042
- [Jest](https://jestjs.io/) for integration testing
4143
- [Storybook](https://storybook.js.org/) and
4244
[Chromatic](https://www.chromatic.com/) for visual testing
43-
- [PNPM](https://pnpm.io/) as package manager
45+
- [PNPM](https://pnpm.io/) as the package manager
4446

4547
## Structure
4648

47-
All the code related to the UI resides in the `site` folder.
49+
All UI-related code is in the `site` folder. Key directories include:
4850

4951
- **e2e** - End-to-end (E2E) tests
5052
- **src** - Source code
5153
- **mocks** - [Manual mocks](https://jestjs.io/docs/manual-mocks) used by Jest
5254
- **@types** - Custom types for dependencies that don't have defined types
5355
(largely code that has no server-side equivalent)
54-
- **api** - API code as function calls and types
56+
- **api** - API function calls and types
5557
- **queries** - react-query queries and mutations
56-
- **components** - Generic UI components without Coder specific business logic
57-
- **hooks** - React hooks that can be used across the application
58-
- **modules** - Coder specific UI components
59-
- **pages** - Page components
60-
- **testHelpers** - Helper functions to help with integration tests
61-
- **theme** - configuration and color definitions for the color themes
58+
- **components** - Reusable UI components without Coder specific business
59+
logic
60+
- **hooks** - Custom React hooks
61+
- **modules** - Coder-specific UI components
62+
- **pages** - Page-level components
63+
- **testHelpers** - Helper functions for integration testing
64+
- **theme** - theme configuration and color definitions
6265
- **util** - Helper functions that can be used across the application
63-
- **static** - Static UI assets like images, fonts, icons, etc
66+
- **static** - Static assets like images, fonts, icons, etc
6467

6568
## Routing
6669

6770
We use [react-router](https://reactrouter.com/en/main) as our routing engine.
6871

69-
- Authenticated routes - routes needing authentication should be placed inside
70-
the `<RequireAuth>` route. The `RequireAuth` component handles all the
72+
- Authenticated routes - Place routes requiring authentication inside the
73+
`<RequireAuth>` route. The `RequireAuth` component handles all the
7174
authentication logic for the routes.
7275
- Dashboard routes - routes that live in the dashboard should be placed under
7376
the `<DashboardLayout>` route. The `DashboardLayout` adds a navbar and passes
7477
down common dashboard data.
7578

7679
## Pages
7780

78-
Pages are the top-level components of the app. The page component lives under
79-
the `src/pages` folder and each page should have its own folder to better group
80-
the views, tests, utility functions and so on. The code is structured so that a
81-
page component is responsible for fetching all the data and passing it down to
82-
the view. We explain this decision a bit better in the next section.
81+
Page components are the top-level components of the app and reside in the
82+
`src/pages` folder. Each page should have its own folder to group relevant
83+
views, tests, and utility functions. The page component fetches necessary data
84+
and passes to the view. We explain this decision a bit better in the next
85+
section.
8386

84-
> ℹ️ Code that is only related to the page should live inside of the page folder
85-
> but if at some point it is used in other pages or components, you should
86-
> consider moving it to the `src` level in the `utils`, `hooks`, `components`,
87-
> or `modules` folder.
87+
> ℹ️ If code within a page becomes reusable across other parts of the app,
88+
> consider moving it to `src/utils`, `hooks`, `components`, or `modules`.
8889
89-
### States
90+
### Handling States
9091

91-
A page usually has at least three states: **loading**, **ready**/**success**,
92-
and **error**, so always remember to handle these scenarios while you are coding
93-
a page. Visual testing is expected for these three states using a `*.stories.ts`
94-
file.
92+
A page typically has three states: **loading**, **ready**/**success**, and
93+
**error**. Ensure you manage these states when developing pages. Use visual
94+
tests for these states with `*.stories.ts` files.
9595

96-
## Fetching data
96+
## Data Fetching
9797

9898
We use [TanStack Query v4](https://tanstack.com/query/v4/docs/react/quick-start)
99-
to fetch data from the API. The queries and mutation should be placed inside of
100-
the api/queries folder.
99+
to fetch data from the API. Queries and mutation should be placed in the
100+
`api/queries` folder.
101101

102102
### Where to fetch data
103103

@@ -143,10 +143,10 @@ export const WithQuota: Story = {
143143

144144
### API
145145

146-
Our project utilizes [axios](https://github.com/axios/axios) as the HTTP client
147-
for making API requests. The API functions are centralized in
148-
`site/src/api/api.ts`. We leverage auto-generated TypeScript types derived from
149-
our Go server, which are located in `site/src/api/typesGenerated.ts`.
146+
Our project uses [axios](https://github.com/axios/axios) as the HTTP client for
147+
making API requests. The API functions are centralized in `site/src/api/api.ts`.
148+
Auto-generated TypeScript types derived from our Go server are located in
149+
`site/src/api/typesGenerated.ts`.
150150

151151
Typically, each API endpoint corresponds to its own `Request` and `Response`
152152
types. However, some endpoints require additional parameters for successful
@@ -177,9 +177,9 @@ export const updateWorkspaceVersion = async (
177177

178178
## Components and Modules
179179

180-
Components should be atomic, generic and should not describe any specific
181-
business logic. Modules are similar to components except that they can be more
182-
complex and they do contain business logic specific to the product.
180+
Components should be atomic, reusable and free of business logic. Modules are
181+
similar to components except that they can be more complex and can contain
182+
business logic specific to the product.
183183

184184
### MUI
185185

0 commit comments

Comments
 (0)