seven-ten
v3.4.6
Published
React client for Seven-Ten
Downloads
4
Keywords
Readme
Seven-Ten Client
Client for Seven-Ten
Getting started
# clone the repository and install the dependencies
git clone https://github.com/zooniverse/Seven-Ten-Client.git
cd Seven-Ten-Client
npm install .
- Run the tests with
npm test
- Lint the code with
npm run lint
- Release a version with
npm run version
, also- Transpiles the source
- Tags a release
Client usage
Client
Communicates with the API.
Client.config = {
host: 'https://seven-ten-staging.zooniverse.org', // The API host
headers: zooAPI.headers // Headers (e.g. Authentication) to send with requests
};
Client.current(); // Provides a singleton client instance
Split
Manages the current splits
Split.load('owner/project-name').then((splits) => {
// ...
}); // Load all active splits by project slug
// To create metric-tracking events for splits;
Split.classificationCreated(classification);
// or
Split.classifierVisited();
Component usage
TextSplit
Provides a component that displays a text split.
splitKey
corresponds to split.key
textKey
corresponds to the property storing text in variant.value
<TextSplit
splitKey="landing.text"
textKey="description"
splits={this.props.splits}
default="The default description"
/>
VisibilitySplit
Provides a component that toggles element visibility
splitKey
corresponds to split.key
elementKey
corresponds to the property storing the on/off boolean in variant.value
<VisibilitySplit
splitKey="mini-course.visible"
elementKey="button"
splits={this.props.splits}
>
<p>This will be shown if it's visible, otherwise it won't</p>
</VisibilitySplit>