Skip to main content

StreamBoost React Plugin

This page explains how to use the StreamBoost components in React.

Installation​

First login to the QUANTEEC npm repo, then install the StreamBoost React plugin:

npm install @quanteec/streamboost-plugin-react --registry https://npm.quanteec.com/

Usage​

  • Minimal config:
import { StreamboostButton } from '@quanteec/streamboost-plugin-react';

function Example(props: { userID: string }) {
return <StreamboostButton userID={props.userID} />;
}
  • All parameters:
import type Quanteec from '@quanteec/quanteec-plugin/quanteec-my-player.min.js';

import { StreamboostButton } from '@quanteec/streamboost-plugin-react';

function Example(props: { quanteecPlugin: Quanteec, userID: string }) {

return (
<StreamboostButton
backdropBlur={true}
backdropMode='fullscreen'
buttonSize={40}
color='#116af8'
dashboardCards={['Ranking', 'Peers', 'Water', 'Shared', 'Power', 'Speed']}
defaultIsOpen={true}
defaultIsStreamboostOn={true}
defaultSection='dashboard'
panelAnchor='bottom right'
panelMaxHeight={250}
quanteecPlugin={props.quanteecPlugin}
sponsor={{
id: '<my-sponsor>',
image: 'https://my-sponsor.com/ad-banner.png',
url: 'https://my-sponsor.com/ad-campaign.html',
}}
style={{
backgroundColor: 'grey',
padding: '10px',
}}
superStream={false}
userID={props.userID}
/>
);
}

Attributes​

Mandatory attributes​

AttributeDescription
userIDA unique id to identify the viewer.
isOpen (panel only)A boolean to open or close the panel.
close (panel only)A callback function that closes the panel, so the panel can close itself.

Panel configuration attributes​

AttributeDescription
dashboardCardsA comma-separated list of card names for the dashboard. Default is "Peers, Shared, Energy, Speed". Allowed card names are: CO2, Energy, Peers, Power, Ranking, Shared, Speed, Water.
defaultIsOpen (button only)A boolean to open the panel by default when the page load.
defaultIsStreamboostOnA boolean to enable/disable the boost by default (the user can still change the vale afterward).
defaultSection"dashboard" or "status" to force the default open section.
quanteecPluginAn instance of the Quanteec plugin.
setClaimAvailable (panel only)A callback function so the parent component can be informed when the claim becomes available.
AttributeDescription
sponsorAn object containing the sponsor information, with the keys:
sponsor.idA unique id to identify the advertising campaign. It is required to activate the sponsoring functionality.
sponsor.imageA link to an ad banner with a 4/1 ratio.
sponsor.urlA link to make the image clickable.

Styling attributes​

AttributeDescription
backdropBlurA boolean to enable/disable the blurry background when the panel is open. Default is true.
backdropMode"fullscreen" or "contained", wether the backdrop covers only it's parent or the all the screen. Default is "fullscreen".
buttonSize (button only)A number that will be the button width and height in px. Default is 30.
style (button only)An inline css style to customize the button.
colorA custom color for the panel.
panelAnchor (button only)The position of the panel relatively to the button. Allowed values are: "center", "bottom left", "bottom right", "top left", "top right". Default is "center". Centering is made relatively to the backdropMode value.
panelMaxHeightA number used as the maximal height of the panel in pixels, default is 350.
position (panel only)An object containing two of top, right, bottom, and left properties. The panel can be manually positionned using the following attributes. They take a <length> value. A valid pair (listed in the panelAnchor description) is needed. The panel is centered by default.