Skip to content

Commit

Permalink
Added unittests and docs for WorkerOpinion feature
Browse files Browse the repository at this point in the history
  • Loading branch information
meta-paul committed Jul 25, 2024
1 parent 847647d commit 0890ed2
Show file tree
Hide file tree
Showing 76 changed files with 1,063 additions and 716 deletions.
2 changes: 0 additions & 2 deletions docker/docker-compose.dev.vscode.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version: "3"

services:
mephisto_dc_vscode:
container_name: mephisto_dc_vscode
Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

version: "3"

services:
mephisto_dc:
container_name: mephisto_dc
Expand Down
6 changes: 6 additions & 0 deletions docs/web/docs/guides/how_to_use/review_app/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,9 @@ _Note that a custom view of Task results is included (at the bottom) only if you
![Task statistics](./screenshots/task_stats.png)
<br/>
<br/>

### Task worker opinions

![Task statistics](./screenshots/task_worker_opinions.png)
<br/>
<br/>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 0 additions & 104 deletions docs/web/docs/guides/how_to_use/worker_experience/feedback.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---

# Copyright (c) Meta Platforms and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

sidebar_position: 1
---

# Mephisto Task Addons

## Overview

The `mephisto-task-addons` package provides:
- `WorkerOpinion` widget: collect workers' feedback for each completed unit

## Usage

1. Add `mephisto-task-addons` library to your webpack config:
```js
// Specifies location of your packages (e.g. `../../dir`)
var PATH_TO_PACKAGES = "<path>"

module.exports = {
...
resolve: {
alias: {
...
"mephisto-task-addons": path.resolve(
__dirname,
`${PATH_TO_PACKAGES}/packages/mephisto-task-addons`
),
}
}
};
```

2. Import desired widgets from `mephisto-task-addons` in your code like so:

```jsx
import { WorkerOpinion } from "mephisto-task-addons";
...
<WorkerOpinion
maxTextLength={500}
questions={[
"Was this task hard?",
"Is this a good example?",
]}
/>
```

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 0 additions & 94 deletions docs/web/docs/guides/how_to_use/worker_experience/tips.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---

# Copyright (c) Meta Platforms and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

sidebar_position: 2
---

# WorkerOpinion widget

Workers can leave their feedback about a Task if you add a `WorkerOpinion` feature to it.

WorkerOpinion widget currently may contain a set of textarea form fields, and a multi-file attachment form field.


## How to enable `WorkerOpinion`

1. Add `mephisto-task-addons` library to your webpack config
2. Import `WorkerOpinion` component to your Task's React application code and define questions.

### 1. Webpack config

```js
// Specifies location of your packages (e.g. `../../dir`)
var PATH_TO_PACKAGES = "<path>"

module.exports = {
...
resolve: {
alias: {
...
"mephisto-task-addons": path.resolve(
__dirname,
`${PATH_TO_PACKAGES}/packages/mephisto-task-addons`
),
}
}
};
```

### 2. `WorkerOpinion` component

```jsx
import { WorkerOpinion } from "mephisto-task-addons";
...
return(
<div ...>
<WorkerOpinion
maxTextLength={500}
questions={[
"Was this task hard?",
"Is this a good example?",
]}
/>
</div>
)
```

Supported properties for `WorkerOpinion` component:

- `handleSubmit` (optional) - your custom callback that will run on opinion submit
- `maxTextLength` (optional) - max amount of characters for all textarea fields
- `questions` (optional, array of strings) - list of questions for the worker, where each response is a textarea field
- `required` (optional) - if `false`, adds `" (optional)"` suffix to question text (default: `false`)
- `textAreaWidth` (optional) - width of all textarea fields (default: `100%`)
- `title` (optional) - title of the WorkerOpinion widget. Default: `Your Feedback`

Here's how `WorkerOpinion` component looks like:

![Worker Opinion](./screenshots/worker_opinion_widget.png)


## How `WorkerOpinion` works

1. After completing each unit, workers can submit an opinion about the completed unit.
2. **Once the task is shut down**, you can review all collected opinions for the task in TaskReview app.
3. When reviewing units in TaskReview app, you will see an extra accordion section "Worker Opinion" if a worker submitted their opinion.
Loading

0 comments on commit 0890ed2

Please sign in to comment.