Skip to content

Commit 71d0a4c

Browse files
authored
update task description and acceptance criteria (#1862)
* fix: links * fix: class components * fix: error * fix: ModResponse
1 parent 07df94a commit 71d0a4c

File tree

2 files changed

+117
-50
lines changed

2 files changed

+117
-50
lines changed

react/modules/class-component/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ Students will:
2424
Students are encouraged to study the following resources:
2525

2626
1. **Understanding Class Components:**
27-
- [**React Docs** - Component API](https://react.dev/reference/react/Component) - [1 hour]
27+
- **React Docs** - Component API - [1 hour]
2828
- [Defining a class component](https://react.dev/reference/react/Component#defining-a-class-component)
2929
- [Adding state to a class component](https://react.dev/reference/react/Component#adding-state-to-a-class-component)
3030
- [Adding lifecycle methods to a class component](https://react.dev/reference/react/Component#adding-lifecycle-methods-to-a-class-component)
31-
- [**React Docs (Legacy)** - React.Component](https://legacy.reactjs.org/docs/react-component.html) - [1 hour]
31+
- **React Docs (Legacy)** - React.Component - [1 hour]
3232
- [Components and Props](https://legacy.reactjs.org/docs/components-and-props.html)
3333
- [State and Lifecycle](https://legacy.reactjs.org/docs/state-and-lifecycle.html)
3434
- [Handling Events](https://legacy.reactjs.org/docs/handling-events.html)
@@ -44,3 +44,8 @@ Expand your knowledge with these additional materials:
4444

4545
- [**DigitalOcean Tutorial** - Understanding Constructors with React Components](https://www.digitalocean.com/community/tutorials/react-constructors-with-react-components) - [30 minutes]
4646
- [**freeCodeCamp Article** - This is why we need to bind event handlers in Class Components in React](https://www.freecodecamp.org/news/this-is-why-we-need-to-bind-event-handlers-in-class-components-in-react-f7ea1a6f93eb/) - [30 minutes]
47+
48+
Official documentation:
49+
50+
- [**React Docs** - Component API](https://react.dev/reference/react/Component)
51+
- [**React Docs (Legacy)** - React.Component](https://legacy.reactjs.org/docs/react-component.html)

react/modules/tasks/class-components.md

Lines changed: 110 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# React project setup. Class components. Error boundary
22

3-
## Functional Requirements
3+
## Functional Requirements (max **100 points**)
44

55
### Feature 1: Application Layout Structure (**5 points**)
66

7-
**As a** user
8-
**I want** to see a clearly organized page layout
7+
**As a** user
8+
**I want** to see a clearly organized page layout
99
**So that** I can easily interact with the search functionality and view results
1010

1111
**Scenario:** Page Layout Organization
@@ -15,10 +15,15 @@
1515
- A smaller search section at the top
1616
- A larger results section at the bottom
1717

18+
**Acceptance Criteria:**
19+
20+
- The page contains exactly two main sections: a search area and a results area.
21+
- Both sections are visually distinct and clearly separated by layout or styling (e.g., spacing, borders, or background).
22+
1823
### Feature 2: Search Functionality with Local Storage (**15 points**)
1924

20-
**As a** user
21-
**I want** to have a search interface that remembers my last search
25+
**As a** user
26+
**I want** to have a search interface that remembers my last search
2227
**So that** I can continue my previous search session
2328

2429
**Scenario:** Initial Search Component Load
@@ -29,10 +34,16 @@
2934
- **And** populate the search input if a term exists
3035
- **Or** leave it empty if no previous term is found
3136

37+
**Acceptance Criteria:**
38+
39+
- When the application loads, the search component checks local storage for a previously saved search term:
40+
- If a saved search term exists, it is automatically displayed in the search input field.
41+
- If no saved search term exists in local storage, the search input field remains empty.
42+
3243
### Feature 3: Search Results Display (**10 points**)
3344

34-
**As a** user
35-
**I want** to see search results clearly displayed
45+
**As a** user
46+
**I want** to see search results clearly displayed
3647
**So that** I can easily review the found items
3748

3849
**Scenario:** Results Display Format
@@ -42,10 +53,18 @@
4253
- Item name
4354
- Item description
4455

56+
**Acceptance Criteria:**
57+
58+
- Search results are displayed in the results section after a search is performed.
59+
- Each result item includes at least the following fields:
60+
- Name
61+
- Description
62+
- Results are presented in a clear and readable format (consistent spacing, alignment, and typography).
63+
4564
### Feature 4: Initial Data Load (**10 points**)
4665

47-
**As a** user
48-
**I want** to see relevant items when I first open the application
66+
**As a** user
67+
**I want** to see relevant items when I first open the application
4968
**So that** I can start browsing immediately
5069

5170
**Scenario:** Default Data Load
@@ -56,10 +75,18 @@
5675
- The search term from input if it exists
5776
- All available items if no search term exists
5877

78+
**Acceptance Criteria:**
79+
80+
- On initial load, the application **sends a data request** according to the defined logic:
81+
- If a search term exists in the input, the request includes that term.
82+
- If no search term exists, the request retrieves all available items.
83+
- The items **returned by the request** are correctly **displayed** in the results section.
84+
- The displayed items **match the query** used in the request.
85+
5986
### Feature 5: Search Execution (**20 points**)
6087

61-
**As a** user
62-
**I want** to search for specific items
88+
**As a** user
89+
**I want** to search for specific items
6390
**So that** I can find relevant content
6491

6592
**Scenario:** Perform Search
@@ -72,10 +99,18 @@
7299
- Fetch the first page of matching results
73100
- Update the display with new results
74101

102+
**Acceptance Criteria:**
103+
104+
- When the **Search** button is clicked, if the input text hasn’t changed, **no new request** is made.
105+
- **Extra spaces** at the start or end of the search text are **removed**.
106+
- The app sends a **request for the first page** of results only.
107+
- The **search term** is included in the request.
108+
- The **results area** shows the items from the server response.
109+
75110
### Feature 6: Search Term Persistence (**5 points**)
76111

77-
**As a** user
78-
**I want** my search terms to be saved
112+
**As a** user
113+
**I want** my search terms to be saved
79114
**So that** I can resume my search later
80115

81116
**Scenario:** Save Search Term
@@ -85,10 +120,15 @@
85120
- **Then** the search term should be saved to local storage
86121
- **And** overwrite any existing saved term
87122

123+
**Acceptance Criteria:**
124+
125+
- If the search text **has not changed**, nothing happens.
126+
- If the text **has changed**, the **trimmed value** (without extra spaces) is **saved to local storage**, replacing the previous one.
127+
88128
### Feature 7: Loading State Indication (**10 points**)
89129

90-
**As a** user
91-
**I want** to know when the application is loading data
130+
**As a** user
131+
**I want** to know when the application is loading data
92132
**So that** I understand when to wait for results
93133

94134
**Scenario:** API Request Loading State
@@ -97,10 +137,16 @@
97137
- **Then** I should see a loading indicator (Spinner/Skeleton/Loading Bar/Blur)
98138
- **And** the indicator should remain until data loads
99139

140+
**Acceptance Criteria:**
141+
142+
- A **loading indicator** (e.g., spinner, skeleton, or loading bar) appears **while data is being loaded**.
143+
- The indicator **remains visible** until the data is fully received and displayed.
144+
- Once loading is complete, the **indicator is hidden**.
145+
100146
### Feature 8: Error Handling (**10 points**)
101147

102-
**As a** user
103-
**I want** to be informed when something goes wrong
148+
**As a** user
149+
**I want** to be informed when something goes wrong
104150
**So that** I understand why my request failed
105151

106152
**Scenario:** Failed API Request
@@ -109,10 +155,15 @@
109155
- **When** the server returns an error (4xx or 5xx)
110156
- **Then** I should see a meaningful error message
111157

158+
**Acceptance Criteria:**
159+
160+
- A **clear, human-readable error message** is shown to the user when the server returns an error (4xx or 5xx).
161+
- The **console remains clean** — no uncaught errors or unnecessary error logs are displayed.
162+
112163
### Feature 9: Application Error Boundary (**15 points**)
113164

114-
**As a** user
115-
**I want** the application to handle errors gracefully
165+
**As a** user
166+
**I want** the application to handle errors gracefully
116167
**So that** I can still use the app even if parts of it fail
117168

118169
**Scenario:** Error Boundary Implementation
@@ -122,10 +173,15 @@
122173
- **And** a fallback UI should be displayed
123174
- **And** there should be a test button to simulate errors
124175

125-
## Template
176+
**Acceptance Criteria:**
126177

127-
This template represents the possible layout for your app, but you can create your app based on your own preferences.
178+
- A **test button** is available to simulate an application error.
179+
- Clicking the test button **triggers an error** that is **logged in the console**.
180+
- A **fallback UI** is displayed when an error occurs.
128181

182+
## Template
183+
184+
This template represents the **possible layout** for your app, but you can create your app based on your own preferences. Feel free to customize it — your creativity is not limited, and **you can design the UI** your users truly deserve.
129185
Successful response.
130186

131187
```text
@@ -183,6 +239,34 @@ Non-successful response.
183239

184240
6. You can use CSS frameworks (e.g. Tailwind CSS).
185241

242+
### Penalties
243+
244+
- **1. Project setup**
245+
- Project has been set up without using [Vite](https://vitejs.dev/guide/) with the [_react-ts_ template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts): **-95 points**
246+
247+
- **2. TypeScript & Code Quality**
248+
- TypeScript isn't used: **-95 points**
249+
- Usage of _any_: **-20 points per each**
250+
- Usage of _ts-ignore_: **-20 points per each**
251+
- Presence of _code-smells_ (God-object, chunks of duplicate code), commented code sections: **-10 points per each**
252+
253+
- **3. React Best Practices**
254+
- Direct DOM manipulations inside the React components: **-50 points per each**
255+
- React hooks are used to get access to either state, or to the component lifecycle: **-70 points**
256+
257+
- **4. External Dependencies**
258+
- Usage of Redux or other state management libraries: **-100 points**
259+
- Usage of component libraries, e.g. Material UI, Ant Design: **-100 points**
260+
261+
- **5. Project Management**
262+
- Pull Request doesn't follow guideline (including checkboxes in Score) [PR example](https://rs.school/docs/en/pull-request-review-process#pull-request-description-must-contain-the-following): **-10 points**
263+
264+
- **6. Technical Requirements**
265+
- React setup files are located in the `main` branch: **-100 points**
266+
- Missing dedicated branch named `class-components`: **-100 points**
267+
- Usage of React hooks: **-100 points**
268+
- Lack of component decomposition (everything in one file or poorly structured): **-50 points**
269+
186270
## FAQ (Frequently Asked Questions)
187271

188272
### ❓ Does the search input require an exact name match?
@@ -195,7 +279,11 @@ Fetch the full list (or first page) of items from the API.
195279

196280
### ❓ How to simulate a failed request?
197281

198-
Use ModResponse or set an invalid endpoint to trigger a 4xx/5xx response.
282+
Use [ModResponse](https://chromewebstore.google.com/detail/modresponse-mock-and-repl/bbjcdpjihbfmkgikdkplcalfebgcjjpm?pli=1) or set an invalid endpoint to trigger a 4xx/5xx response.
283+
284+
### ❓ How to see the loader during a request?
285+
286+
In your browser’s **Developer Tools → Network** tab, you can **throttle the network speed** to observe the loading indicator.
199287

200288
### ❓ My loader is not visible — API is too fast. What to do?
201289

@@ -214,29 +302,3 @@ No. The PR will update automatically as long as it's not merged.
214302

215303
Function components are allowed, but **state and lifecycle functionality must be implemented using class components**.
216304
Hooks are not permitted in this task.
217-
218-
### Penalties
219-
220-
- **1. Project setup**
221-
222-
- Project has been set up without using [Vite](https://vitejs.dev/guide/) with the [_react-ts_ template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts): **-95 points**
223-
224-
- **2. TypeScript & Code Quality**
225-
226-
- TypeScript isn't used: **-95 points**
227-
- Usage of _any_: **-20 points per each**
228-
- Usage of _ts-ignore_: **-20 points per each**
229-
- Presence of _code-smells_ (God-object, chunks of duplicate code), commented code sections: **-10 points per each**
230-
231-
- **3. React Best Practices**
232-
233-
- Direct DOM manipulations inside the React components: **-50 points per each**
234-
- React hooks are used to get access to either state, or to the component lifecycle: **-70 points**
235-
236-
- **4. External Dependencies**
237-
238-
- Usage of Redux or other state management libraries: **-100 points**
239-
- Usage of component libraries, e.g. Material UI, Ant Design: **-100 points**
240-
241-
- **5. Project Management**
242-
- Pull Request doesn't follow guideline (including checkboxes in Score) [PR example](https://rs.school/docs/en/pull-request-review-process#pull-request-description-must-contain-the-following): **-10 points**

0 commit comments

Comments
 (0)