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

Props

type  LeaderboardManagerProps = {
    fansUnitedApiKey: string;
    fansUnitedClientId: string;
    fansUnitedLanguage?: string;
    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).

  • 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.

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',
    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',
    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',
    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 goals',
    marketOverOneGoals:  'Over one goals',
    marketOverTwoGoals:  'Over two goals',
    marketOverThreeGoals:  'Over three goals',
    marketOverFourGoals:  'Over four goals',
    marketOverFiveGoals:  'Over five goals',
    marketOverSixGoals:  'Over six goals',
    marketOverSixCorners:  'Over six corners',
    marketOverSevenCorners:  'Over seven corners',
    marketOverEightCorners:  'Over eight corners',
    marketOverNineCorners:  'Over nine corners',
    marketOverTenCorners:  'Over ten corners',
    marketOverElevenCorners:  'Over eleven corners',
    marketOverTwelveCorners:  'Over twelve corners',
    marketOverThirteenCorners:  'Over thirteen 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",
    rules: "Rules",
    rulesDescription: "Describe your rules for participating in template. You can type plain text or html tags.",
    flagsLabel: "Flags",
    flagsPlaceholder: "Type your flag and hit enter",
    repeatedFlagMessage: "You have entered a repeated flag. Please enter a different one.",
    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.",
    provideNameTemplateErrorMessage: "You need to provide a name to your template!",
    provideDurationTemplateErrorMessage: "You need to provide a duration to your template!",
    createTemplateErrorMessage: "There was a problem with creating the template. Please try again."
};

const  App = () => {
return (
<LeaderboardManager
    fansUnitedApiKey={'your-api-key'}
    fansUnitedClientId={'your-client-id'}
    labels={labels}/>
);
}

Here is all information about LabelsModel:

KeyDescriptionDefault Value
userNotFoundOn login screen when client gives invalid information about email or password.User not found. Please try again.
clientConfigErrorMessagereact-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.
featureDisabledTitle for NoPermissionModal. This Modal is displayed when client does NOT have permission to use Fans United Match Quiz Widget.Feature disabled!.
noPermissionMessageDescription 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!
tryAgainButtonLabel for name of a gameName
noTemplatesFoundWhen 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'
createTemplateUsed as label on create button and as a title on screen when creating a template.Create template
nameLabel for name of a template or participantName
typeDisplayed in header of list of templates.Type
marketsDisplayed in header of list of templates.Markets
fromDateDisplayed in header of list of templates.From Date
toDateDisplayed in header of list of templates.To Date
actionsDisplayed in header of list of games. Two icon buttons with different actions.Actions
primaryTemplateTemplate type label.Primary
customTemplateTemplate type label.Custom
editTooltip for icon button edit.Edit
reportTooltip for icon button report.Report
timeFormatTimeformat for displaying dates. Widgets uses dayjs as a date dependency.DD.MM.YYYY
backTooltip for back button.Back
namePlaceholderPlaceholder/desciption about input field for template name when creating/editing a template.Please provide a name for your template leaderboard.
descriptionTitle for desciption input field when creating/editing a template.Description
descriptionPlaceholderPlaceholder/desciption about input field for template description when creating/editing a template.Please describe your template leaderboard.
templateDurationTitle for template duration input fieldTemplate leaderboard duration
templateDurationDescriptionDescription about template duration inputUsers can participate in this template during given period.
clearTooltip for clear button.Clear
clearDurationTimeMessagereact-toastify info message when template duration is cleared.You have cleared your duration template time.
marketSelectionTitle for market selection.Market Selection
marketSelectionDescriptionDescription about market selection.Check what market users can predict for the specified template.
marketFt1x2Label for market full TimeFull time
marketHt1x2Label for market half TimeHalf time
marketBothTeamsScoreLabel for market both teams scoreBoth teams score
marketDoubleChanceLabel for market double chanceDouble chance
marketHtFtLabel for market half time/full timeHalf time/Full time
marketRedCardMatchLabel for market read card matchRed card in match
marketPenaltyMatchLabel for market penalty matchPentalty in match
marketCornersMatchLabel for market corners matchCorners in match
marketCorrectScoreLabel for market correct scoreCorrect score
marketPlayerScoreLabel for market player scorePlayer score
marketPlayerYellowCardLabel for market player yellow cardYellow card for player
marketPlayerRedCardLabel for market player red cardRed card for player
marketPlayerScoreFirstGoalLabel for market player score first goalPlayer to score first goal
marketPlayerScoreTwiceLabel for market player score twicePlayer to score twice
marketPlayerScoreHattrickLabel for market player score hattrickPlayer to score hattrick
marketOverZeroGoalsLabel for market over zero goalsOver zero goals
marketOverOneGoalsLabel for market over one goalsOver one goals
marketOverTwoGoalsLabel for market over two goalsOver two goals
marketOverThreeGoalsLabel for market over three goalsOver three goals
marketOverFourGoalsLabel for market over four goalsOver four goals
marketOverFiveGoalsLabel for market over five goalsOver five goals
marketOverSixGoalsLabel for market over six goalsOver six goals
marketOverSixCornersLabel for market over six cornersOver six corners
marketOverSevenCornersLabel for market over seven cornersOver seven corners
marketOverEightCornersLabel for market over eight cornersOver eight corners
marketOverNineCornersLabel for market over nine cornersOver nine corners
marketOverTenCornersLabel for market over ten cornersOver ten corners
marketOverElevenCornersLabel for market over eleven cornersOver eleven corners
marketOverTwelveCornersLabel for market over twelve cornersOver twelve corners
marketOverThirteenCornersLabel for market over thirteen cornersOver thirteen corners
competitionsSelectionTitle for competitions selection.Competitions Selection
competitionsSelectionDescriptionDescription about competitions selection.Type the name of the competition and select one. You can add as many as you want.
teamsSelectionTitle for teams selectionTeams Selection
teamsSelectionDescriptionDescription about teams selectionType the name of the team and select one. You can add as many as you want.
matchesSelectionTitle about matches selection.Matches Selection
matchesSelectionDescriptionDescription about matches selection.Type the name of the team and select one. Then there will be loaded next matches for teams.
selectCompetitionsNoCompetitionFoundPlaceholder when no competitions were found.No competitions were found. Please try again.
selectCompetitionsPlaceholderPlaceholder for competitions selection input.Type the name of your competition
selectTeamsNoTeamFoundPlaceholder for teams selection input when no teams were found.No teams were found. Please try again.
selectTeamsNoMatchesFoundHeading when no matches were found for provided teams.No matches were found for these teams
selectTeamsPlaceholderPlaceholder for teams selection input.Type the name of your team
loadingMessageLoading message when creating/editing template.Loading...
loadMoreLabel for button to load more next matches for provided teams.Load more
rulesTitle for choosing template leaderboard rules.Rules
rulesDescriptionDescription about choosing template leaderboard rules.Describe your rules for participating in template. You can type plain text or html tags.
flagsLabelTitle for choosing template leaderboard flags.Flags
flagsPlaceholderPlaceholder on input field for template leaderboard flagsType your flag and hit enter
repeatedFlagMessagereact-toastify warning message when client submits same flag.You have entered a repeated flag. Please enter a different one.
getTemplatesErrorMessagereact-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.
createTemplateMessagereact-toastify succesful message when creating a template.You have successfully created a template.
editTemplateMessagereact-toastify succesful message when editing a template.You have successfully edited the template.
provideNameTemplateErrorMessagereact-toastify error message when trying to create/edit template with empty input name field.You need to provide a name to your template!
provideDurationTemplateErrorMessagereact-toastify error message when trying to create/edit template with empty duration field.You need to provide a duration to your template!
createTemplateErrorMessagereact-toastify error message when creating new template.There was a problem with creating the template. Please try again.
editTemplateErrorMessagereact-toastify error message when editing new template.There was a problem with editing the template. Please try again.