Leaderboard Management
Welcome to Fans United Leaderboard Management Widget. The widget allows staff members with sufficient permissions to create new template leaderboard. You can use this widget as it is and embed it in your platform, or you can use the Management Panel to create template leaderboard. Leaderboards can be linked to competitions, teams, matches or markets. With successfull installiation, you can create and edit template leaderboard or see the report about specific template.
Installation and usage
The easiest way to use fansunited-widget-leaderboard is to install it from npm as follows:
npm install fansunited-widget-leaderboard
or:
yarn add fansunited-widget-leaderboard
Here is an example how you can integrate Fans United Leaderboard Management Widget:
import 'fansunited-widget-leaderboard/style.css';
import { LeaderboardManager } from 'fansunited-widget-leaderboard';
const App = () => {
return (
<LeaderboardManager
fansUnitedApiKey={'your-api-key'}
fansUnitedClientId={'your-client-id'} />
);
}
Notes
-
The widget is bundled as a React component and its usage is as simple as the above example
-
Don't worry about your project's CSS. The widget's styling is done with Tailwind CSS and all classes are prefixed to avoid collisions with your existing CSS. This means that the widget's CSS will NOT affect yours. One important thing is that you need to import
style.css
file from package folder:
import 'fansunited-widget-leaderboard/style.css';
N.B: If you are using an entry point for importing all your stylings, you need to import fansunited-widget-leaderboard/style.css
there as well
- Easy translation in every language. For more information check our Translation heading.
Props
type LeaderboardManagerProps = {
fansUnitedApiKey: string;
fansUnitedClientId: string;
fansUnitedLanguage?: string;
fansUnitedEnvironment?: string;
sportal365Project?: string;
sportal365Infrastructure?: 'shared' | 'betway';
labels?: LabelsModel;
};
Fans United Leaderboard Management Widget depends on Fans United JS SDK and Fans United Client API. Thats why fansUnitedApiKey
and fansUnitedClientId
are required. They will be provided to you from Fans United team. For other optional props here is some information:
-
fansUnitedLanguage
- for our sports APIs FansUnited platform supports different languages. For now they are Bulgarian (bg), English (en) and Romanian (ro). If no value given it will be set to English (en). -
fansUnitedEnvironment
- You can run the widget in the following environments: staging, production and watg. If no value given it will be set to production (prod). -
labels
- you can easily translate all labels, UI messages, descriptions, placeholders and etc. with this prop. By default, Fans United Match Quiz Management Widget is available in English so if no value is given, the widget will be translated in English. -
sportal365Project
- The Sportal365 project. Used as a request header when communicating with Sportal365 APIs. -
sportal365Infrastructure
- The Sportal365 infrastructure. Used to determine what authorization should be used when communicating with Sportal365 APIs. If no value given (when sportal365Project props is provided) it will be set to shared .
Translation
You can easily translate Fans United Leaderboard Management Widget in your language! You just need to pass an object to labels
prop with concrete keys and values and that's it! Here's an example how you can do it:
import 'fansunited-widget-leaderboard/style.css';
import { LeaderboardManager } from 'fansunited-widget-leaderboard';
const labels = {
userNotFound: 'User not found. Please try again.',
clientConfigErrorMessage: "There was a problem fetching client's configuration. Please check again your API key and client ID. For more information contact Fans United staff.",
featureDisabled: "Feature disabled!",
noPermissionMessage: "You have no permission for this feature!",
tryAgainButton: "Try again",
noTemplatesFound: "No templates were found. You can create a template by clicking the button 'Create template'",
createTemplate: 'Create template',
signOut: 'Create template',
name: 'Name',
type: 'Type',
markets: "Markets",
fromDate: 'From Date',
toDate: 'To Date',
actions: 'Actions',
primaryTemplate: 'Primary',
customTemplate: 'Custom',
edit: 'Edit',
report: 'Report',
timeFormat: 'DD-MM-YYYY',
back: 'Back',
id: 'ID',
namePlaceholder: 'Please provide a name for your template leaderboard.',
description: 'Description',
descriptionPlaceholder: 'Please describe your template leaderboard.',
templateDuration: "Template leaderboard duration",
templateDurationDescription: "Users can participate in this template during given period.",
clear: "Clear",
clearDurationTimeMessage: "You have cleared your duration template time.",
marketSelection: 'Market Selection',
marketSelectionDescription: "Check what market users can predict for the specified template.",
marketFt1x2: 'Full time',
marketHt1x2: 'Half time',
marketBothTeamsScore: 'Both teams score',
marketDoubleChance: 'Double chance',
marketHtFt: 'Half time/Full time',
marketRedCardMatch: 'Red card in match',
marketPenaltyMatch: 'Pentalty in match',
marketCornersMatch: 'Corners in match',
marketCorrectScore: 'Correct score',
marketCorrectScoreHalfTime: 'Half time correct score',
marketCorrectScoreAdvanced: 'Advanced correct score',
marketPlayerScore: 'Player score',
marketPlayerYellowCard: 'Yellow card for player',
marketPlayerRedCard: 'Red card for player',
marketPlayerScoreFirstGoal: 'Player to score first goal',
marketPlayerScoreTwice: 'Player to score twice',
marketPlayerScoreHattrick: 'Player to score hattrick',
marketOverZeroGoals: 'Over zero and a half goals',
marketOverOneGoals: 'Over one and a half goals',
marketOverTwoGoals: 'Over two and a half goals',
marketOverThreeGoals: 'Over three and a half goals',
marketOverFourGoals: 'Over four and a half goals',
marketOverFiveGoals: 'Over five and a half goals',
marketOverSixGoals: 'Over six and a half goals',
marketOverSixCorners: 'Over six and a half corners',
marketOverSevenCorners: 'Over seven and a half corners',
marketOverEightCorners: 'Over eight and a half corners',
marketOverNineCorners: 'Over nine and a half corners',
marketOverTenCorners: 'Over ten and a half corners',
marketOverElevenCorners: 'Over eleven and a half corners',
marketOverTwelveCorners: 'Over twelve and a half corners',
marketOverThirteenCorners: 'Over thirteen and a half corners',
competitionsSelection: "Competitions Selection",
competitionsSelectionDescription: "Type the name of the competition and select one. You can add as many as you want.",
teamsSelection: "Teams Selection",
teamsSelectionDescription: "Type the name of the team and select one. You can add as many as you want.",
matchesSelection: "Matches Selection",
matchesSelectionDescription: "Type the name of the team and select one. Then there will be loaded next matches for teams.",
selectCompetitionsNoCompetitionFound: "No competitions were found. Please try again.",
selectCompetitionsPlaceholder: "Type the name of your competition",
selectTeamsNoTeamFound: "No teams were found. Please try again.",
selectTeamsNoMatchesFound: "No matches were found for these teams",
selectTeamsPlaceholder: "Type the name of your team",
loadingMessage: "Loading...",
loadMore: "Load more",
exportButton: "Export",
rules: "Rules",
rulesDescription: "Describe your rules for participating in template. You can type plain text or html tags.",
adContent: 'Ad content',
adContentDescription: 'Place your ad content in the template. It can be plain text or html tags.',
flagsLabel: "Flags",
flagsPlaceholder: "Type your flag and hit enter",
repeatedValueMessage: "You have entered a repeated value. Please enter a different one.",
images: "Images",
mainImage: "Main",
coverImage: "Cover",
mobileImage: "Mobile",
imagePlaceholder: "Paste your image as valid URL or as relative path",
related: "Related",
relatedDescription: "Choose which games or templates you wish to be related to this template.",
games: "Games",
gamesPlaceholder: "Select which games (TOP_X and MATCH_QUIZ) are related to this template",
templates: "Templates",
templatesPlaceholder: "Select which templates are related to this template",
position: "Position",
points: "Points",
reportFor: "Report for",
leaderboardNotAvailable: "There is no leaderboard for this template yet. Please come back later.",
csvModalTitle: "Enter how many users should be exported",
csvModalDescription: "Download a .csv file with the first 100 number of users.",
csvModalPlaceholder: "Export the first X users...",
cancel: "Cancel",
csvModalDownloadButton: "Download as CSV file",
csvModalValidationMessage: "Input value has to be an integer number between 1 and 100",
csvModalErrorMessage: "There was a problem with fetching game's report data",
leaderboardErrorMessage: "There was a problem with displaying leaderboard. Please try again.",
getTemplatesErrorMessage: "There was a problem with fetching templates. Please try again. For more information contact Fans United staff.",
createTemplateMessage: "You have successfully created a template.",
editTemplateMessage: "You have successfully edited the template.",
editTemplateErrorMessage: "There was a problem with editing the template. Please try again.",
provideNameTemplateErrorMessage: "You need to provide a name to your template!",
provideDurationTemplateErrorMessage: "You need to provide a duration to your template!",
durationExceededTemplateErrorMessage: "The template duration should be no longer than a year!",
createTemplateErrorMessage: "There was a problem with creating the template. Please try again.",
manageWinners: 'Manage winners',
winners: 'Winners',
title: 'Title',
winnersDescription: 'Describe the winners...',
winner: 'Winner',
winnerDescription: 'Select the winner of the template',
insertWinners: 'Insert winners',
insertWinnersDescription: 'Type information about each winner of the template.',
note: 'Note',
notePlaceholder: 'Provide some note for the winner...',
tags: 'Tags',
tagsPlaceholder: 'Provide tags for the winner...',
save: 'Save',
preview: 'Preview',
addWinner: 'Add winner',
removeWinner: 'Remove winner',
templateWinnersErrorMessage: 'There was a problem with fetching information about template winners. Please try again.',
templateNoSetWinnersMessage: 'No winners are set for this template.',
positionAndWinnerRequiredMessage: 'Position and winner are required!',
sameChosenWinnerMessage: 'You have selected same winners. Each winner has to be unique!',
createTemplateWinnersMessage: 'You have successfully created winners for the template.',
createTemplateWinnersErrorMessage: 'There was a problem with creating winners for the template. Please try again.',
editTemplateWinnersMessage: 'You have successfully edited winners for the template.',
editTemplateWinnersErrorMessage: 'There was a problem with editing winners for the template. Please try again.',
relatedEntitiesErrorMessage: "There was a problem with fetching entities. Please try again.",
labelsHeading: 'Labels',
customFields: 'Custom fields',
dynamicFieldsDescription: 'You can create your custom records for easier way to connect your template.',
keyDynamicFields: 'Key',
valueDynamicFields: 'Value',
addRecord: 'Add record',
dynamicFieldsKeysErrorMessage: 'Only lowercase letters, numbers and underscore are accepted as keys!',
templateByIdErrorMessage: 'There was a problem retrieving full information about the template.',
uploadingImageMessage: 'You have successfully uploaded image',
generateSignedInUrlErrorMessage: 'There was a problem generating signed in URL to store the image in bucket. Please try again',
uploadingImageErrorMessage: 'There was a problem with uploading image to bucket. Please try again',
encryptingImageErrorMessage: 'There was a problem with encrypting image before uploading it to bucket. Please try again',
searchSportal365ImagesErrorMessage: 'There was a problem with searching images from Sportal 365 API. Please try again',
searchImage: 'Search image',
clearFromToFilterSportal365ImagesMessage: 'You have cleared from/to filter for Sportal365 search images',
hideFilters: 'Hide filters',
showFilters: 'Show filters',
dateFromTo: 'Date from/to',
dateFromToPlaceholder: 'Select Date...'
};
const App = () => {
return (
<LeaderboardManager
fansUnitedApiKey={'your-api-key'}
fansUnitedClientId={'your-client-id'}
labels={labels}/>
);
}
Here is all information about LabelsModel
:
Key | Description | Default Value |
---|---|---|
userNotFound | On login screen when client gives invalid information about email or password. | User not found. Please try again. |
clientConfigErrorMessage | react-toastify error message when client is providing invalid value to fansUnitedApiKey or fansUnitedClientId prop. | There was a problem fetching client's configuration. Please check again your API key and client ID. For more information contact Fans United staff. |
featureDisabled | Title for NoPermissionModal. This Modal is displayed when client does NOT have permission to use Fans United Match Quiz Widget. | Feature disabled!. |
noPermissionMessage | Description for NoPermissionModal. This Modal is displayed when client does NOT have permission to use Fans United Match Quiz Widget. | You have no permission for this feature! |
tryAgainButton | Label for name of a game | Name |
noTemplatesFound | When there are no created templates for specific client, this message will appear on screen. | No templates were found. You can create a template by clicking the button 'Create template' |
createTemplate | Used as label on create button and as a title on screen when creating a template. | Create template |
signOut | Used as label on sign out button. | Sign out |
manageWinners | Used as label in Winners screen heading. | Manage winners |
name | Label for name of a template or participant | Name |
type | Displayed in header of list of templates. | Type |
markets | Displayed in header of list of templates. | Markets |
fromDate | Displayed in header of list of templates. | From Date |
toDate | Displayed in header of list of templates. | To Date |
actions | Displayed in header of list of games. Two icon buttons with different actions. | Actions |
primaryTemplate | Template type label. | Primary |
customTemplate | Template type label. | Custom |
edit | Tooltip for icon button edit. | Edit |
report | Tooltip for icon button report. | Report |
winners | Tooltip for icon button winners. | Winners |
timeFormat | Timeformat for displaying dates. Widgets uses dayjs as a date dependency. | DD.MM.YYYY |
back | Tooltip for back button. | Back |
id | Label for template ID read only input field. | ID |
namePlaceholder | Placeholder/desciption about input field for template name when creating/editing a template. | Please provide a name for your template leaderboard. |
title | Label in Winners screen heading | Title |
description | Title for desciption input field when creating/editing a template. | Description |
descriptionPlaceholder | Placeholder/desciption about input field for template description when creating/editing a template. | Please describe your template leaderboard. |
templateDuration | Title for template duration input field | Template leaderboard duration |
templateDurationDescription | Description about template duration input | Users can participate in this template during given period. |
templateGameTypeTitle | Title for template game type input field | Game type template |
clear | Tooltip for clear button. | Clear |
searchImage | Label for search image input | Search image |
hideFilters | Label for hyperlink to hide filters for image search | Hide filters |
showFilters | Label for hyperlink to show filters for image search | Show filters |
dateFromTo | Label for date from/to filter for image search | Date from/to |
dateFromToPlaceholder | Placeholder for input date from/to filter for image search | Select Date... |
clearDurationTimeMessage | react-toastify info message when template duration is cleared. | You have cleared your duration template time. |
marketSelection | Title for market selection. | Market Selection |
marketSelectionDescription | Description about market selection. | Check what market users can predict for the specified template. |
marketFt1x2 | Label for market full Time | Full time |
marketHt1x2 | Label for market half Time | Half time |
marketBothTeamsScore | Label for market both teams score | Both teams score |
marketDoubleChance | Label for market double chance | Double chance |
marketHtFt | Label for market half time/full time | Half time/Full time |
marketRedCardMatch | Label for market read card match | Red card in match |
marketPenaltyMatch | Label for market penalty match | Pentalty in match |
marketCornersMatch | Label for market corners match | Corners in match |
marketCorrectScore | Label for market correct score | Correct score |
marketCorrectScoreHalfTime | Label for market half time correct score | Half time correct score |
marketCorrectScoreAdvanced | Label for market advanced correct score | Advanced correct score |
marketPlayerScore | Label for market player score | Player score |
marketPlayerYellowCard | Label for market player yellow card | Yellow card for player |
marketPlayerRedCard | Label for market player red card | Red card for player |
marketPlayerScoreFirstGoal | Label for market player score first goal | Player to score first goal |
marketPlayerScoreTwice | Label for market player score twice | Player to score twice |
marketPlayerScoreHattrick | Label for market player score hattrick | Player to score hattrick |
marketOverZeroGoals | Label for market over zero goals | Over zero and a half goals |
marketOverOneGoals | Label for market over one goals | Over one and a half goals |
marketOverTwoGoals | Label for market over two goals | Over two and a half goals |
marketOverThreeGoals | Label for market over three goals | Over three and a half goals |
marketOverFourGoals | Label for market over four goals | Over four and a half goals |
marketOverFiveGoals | Label for market over five goals | Over five and a half goals |
marketOverSixGoals | Label for market over six goals | Over six and a half goals |
marketOverSixCorners | Label for market over six corners | Over six and a half corners |
marketOverSevenCorners | Label for market over seven corners | Over seven and a half corners |
marketOverEightCorners | Label for market over eight corners | Over eight and a half corners |
marketOverNineCorners | Label for market over nine corners | Over nine and a half corners |
marketOverTenCorners | Label for market over ten corners | Over ten and a half corners |
marketOverElevenCorners | Label for market over eleven corners | Over eleven and a half corners |
marketOverTwelveCorners | Label for market over twelve corners | Over twelve and a half corners |
marketOverThirteenCorners | Label for market over thirteen corners | Over thirteen and a half corners |
competitionsSelection | Title for competitions selection. | Competitions Selection |
competitionsSelectionDescription | Description about competitions selection. | Type the name of the competition and select one. You can add as many as you want. |
teamsSelection | Title for teams selection | Teams Selection |
teamsSelectionDescription | Description about teams selection | Type the name of the team and select one. You can add as many as you want. |
matchesSelection | Title about matches selection. | Matches Selection |
matchesSelectionDescription | Description about matches selection. | Type the name of the team and select one. Then there will be loaded next matches for teams. |
selectCompetitionsNoCompetitionFound | Placeholder when no competitions were found. | No competitions were found. Please try again. |
selectCompetitionsPlaceholder | Placeholder for competitions selection input. | Type the name of your competition |
selectTeamsNoTeamFound | Placeholder for teams selection input when no teams were found. | No teams were found. Please try again. |
selectTeamsNoMatchesFound | Heading when no matches were found for provided teams. | No matches were found for these teams |
selectTeamsPlaceholder | Placeholder for teams selection input. | Type the name of your team |
loadingMessage | Loading message as a button label when creating/editing template. | Loading... |
loadMore | Label for button to load more next matches for provided teams. | Load more |
rules | Title for choosing template leaderboard rules. | Rules |
rulesDescription | Description about choosing template leaderboard rules. | Describe your rules for participating in template. |
adContent | Title for template's ad content. | Ad content |
adContentDescription | Description for template's ad content. | Place your ad content in the template. |
flagsLabel | Title for choosing template leaderboard flags. | Flags |
flagsPlaceholder | Placeholder on input field for template leaderboard flags | Type your flag and hit enter |
repeatedValueMessage | react-toastify warning message when client submits same value. | You have entered a repeated value. Please enter a different one. |
images | Title for images container. | Images |
mainImage | Title for main image. | Main |
coverImage | Title for cover image. | Cover |
mobileImage | Title for mobile image. | Mobile |
imagePlaceholder | Placeholder for image inputs. | Paste your image as valid URL or as relative path |
related | Title for related container. | Related |
relatedDescription | Description for related container. | Choose which games or templates you wish to be related to this template. |
games | Title for games select. | Games |
gamesPlaceholder | Placeholder for games select input. | Select which games (TOP_X and MATCH_QUIZ) are related to this template |
templates | Title for templates select. | Templates |
templatesPlaceholder | Placeholder for templates select input. | Select which templates are related to this template |
labelsHeading | Title for labels container. | Labels |
customFields | Title for custom fields container. | Custom fields |
dynamicFieldsDescription | Description about labels and custom fields. | You can create your custom records for easier way to connect your template. |
keyDynamicFields | Label for key input. | Key |
valueDynamicFields | Label for value input. | Value |
addRecord | Tooltip for add button in labels and custom fields containers. | Add record |
position | Label for Position cell in Report Screen | Position |
points | Label for Points cell in Report Screen | Points |
winnersDescription | Description for winners description | Describe the winners... |
winner | Title of card and label for the single winner input | Winner |
winnerDescription | Description for the single winner | Select the winner of the game |
insertWinners | Heading for the single winner container | Insert winners |
insertWinnersDescription | Description for the single winner container | Type information about each winner of the game. |
note | Label for note input | Note |
notePlaceholder | Placeholder for note input | Provide some note for the winner... |
tags | Label for tags input | Tags |
tagsPlaceholder | Placeholder for tags input | Provide tags for the winner... |
save | Label for save button | Save |
preview | Heading for preview container | Preview |
addWinner | Label for add button. This add button is displayed on Winners screen. | Add winner |
removeFixture | Label for remove button. Remove button is displayed on your winner. | Remove winner |
reportFor | First part of the title of Report Screen | Report for |
leaderboardNotAvailable | Label for alert message when there is no leaderboard available yet. | There is no leaderboard for this template. |
exportButton | Label for button to open export modal screen on Report screen. | Export |
csvModalTitle | Title of the export modal. | Enter how many users should be exported |
csvModalDescription | Description of the export modal. | Download a .csv file with the first 100 number of users. |
csvModalPlaceholder | Placeholder for input on export modal. | Export the first X users... |
cancel | Label for cancel button to exit export modal. | Cancel |
csvModalDownloadButton | Label for button to download report as CSV file. Keep in mind that this label is uppercase. | Download as CSV file |
csvModalValidationMessage | Error message when invalid value is provided in input. | Input value has to be an integer number between 1 and 100 |
csvModalErrorMessage | Error message when exporting leaderboard as CSV file. | There was a problem with fetching game's report data |
leaderboardErrorMessage | react-toastify error message when GET request fails for displaying leaderboard. | There was a problem with displaying leaderboard. Please try again. |
getTemplatesErrorMessage | react-toastify error message when GET request fails for displaying templates. | There was a problem with fetching templates. Please try again. For more information contact Fans United staff. |
createTemplateMessage | react-toastify succesful message when creating a template. | You have successfully created a template. |
editTemplateMessage | react-toastify succesful message when editing a template. | You have successfully edited the template. |
provideNameTemplateErrorMessage | react-toastify error message when trying to create/edit template with empty input name field. | You need to provide a name to your template! |
provideDurationTemplateErrorMessage | react-toastify error message when trying to create/edit template with empty duration field. | You need to provide a duration to your template! |
durationExceededTemplateErrorMessage | react-toastify error message when trying to create/edit template with exceeded duration (one year). | The template duration should be no longer than a year! |
createTemplateErrorMessage | react-toastify error message when creating new template. | There was a problem with creating the template. Please try again. |
editTemplateErrorMessage | react-toastify error message when editing new template. | There was a problem with editing the template. Please try again. |
templateNoSetWinnersMessage | When winners are set for the first time this message will appear in the preview block. | No winners are set for this template. |
positionAndWinnerRequiredMessage | When managing winners for a template displaying a react-toastify validation error message. | Position and winner are required! |
sameChosenWinnerMessage | When managing winners for a template displaying a react-toastify validation error message. | You have selected same winners. Each winner has to be unique! |
templateWinnersErrorMessage | When fetching winners for a template displaying a react-toastify error message. | There was a problem with fetching information about template winners. Please try again. |
createTemplateWinnersMessage | When creating winners for a template displaying a react-toastify success message. | You have successfully created winners for the template. |
createTemplateWinnersErrorMessage | When creating winners for a template displaying a react-toastify error message. | There was a problem with creating winners for the template. Please try again. |
editTemplateWinnersMessage | When editing winners for a template displaying a react-toastify success message. | You have successfully edited winners for the template. |
editTemplateWinnersErrorMessage | When editing winners for a template displaying a react-toastify error message. | There was a problem with editing winners for the template. Please try again. |
relatedEntitiesErrorMessage | When creating or editing a template displaying a react-toastify error message when the request fails for fetching related entities. | There was a problem with fetching entities. Please try again. |
dynamicFieldsKeysValidationMessage | Error react-toastify message when provided keys are invalid. | Only lowercase letters, numbers and underscore are accepted as keys! |
templateByIdErrorMessage | When editing a game displaying a react-toastify error message when request fails for retrieving full information about the game. | There was a problem retrieving full information about the template. |
uploadingImageMessage | react-toastify success message when uploading image to bucket | You have successfully uploaded image |
generateSignedInUrlErrorMessage | react-toastify error message when trying to receive a signed in URL. | There was a problem generating signed in URL to store the image in bucket. Please try again |
uploadingImageErrorMessage | react-toastify error message when uploading image to bucket | There was a problem with uploading image to bucket. Please try again |
encryptingImageErrorMessage | react-toastify error message when encrypting image before uploading it to bucket | There was a problem with encrypting image before uploading it to bucket. Please try again |
clearFromToFilterSportal365ImagesMessage | react-toastify info message when clearing date from/to filter | You have cleared from/to filter for Sportal365 search images |
searchSportal365ImagesErrorMessage | react-toastify error message when searching images from Sportal 365 API | There was a problem with searching images from Sportal 365 API. Please try again |
Updated 9 months ago