From c00880dbde31a1e0c4ce22e14b0fc589478f1cb8 Mon Sep 17 00:00:00 2001 From: Abhijit Date: Wed, 2 Dec 2026 11:25:07 +0530 Subject: [PATCH] roles leaderboar visible role changes --- src/components/form/RankRolesField.jsx | 18 ++++++++++++++- src/modules/leaderboards.js | 2 ++ src/views/leaderboard/Dashboard.jsx | 32 +++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/components/form/RankRolesField.jsx b/src/components/form/RankRolesField.jsx index 76734bb..9a4bb80 100644 --- a/src/components/form/RankRolesField.jsx +++ b/src/components/form/RankRolesField.jsx @@ -1,4 +1,5 @@ import { Controller, useWatch } from 'react-hook-form'; +import Select from 'react-select'; import { Button, Form, Table } from 'react-bootstrap'; function patchRow(rows, index, patch) { @@ -8,11 +9,12 @@ function patchRow(rows, index, patch) { } function emptyRow() { - return { title: '', role: '', limit: 10, sort_order: 0, view_mode: 'versus', scope: 'domain', show_as: 'user', highlight_count: 0, highlight_color: '' }; + return { title: '', role: '', limit: 10, sort_order: 0, view_mode: 'versus', scope: 'domain', show_as: 'user', highlight_count: 0, highlight_color: '', visible_roles: [] }; } export default function RankRolesField({ field, control }) { const roles = field.roles || {}; + const roleOptions = Object.entries(roles).map(([value, label]) => ({ value, label })); const isTeam = useWatch({ control, name: 'leaderboard_roles_type' }) === 'team'; return ( What to show : null} {isTeam ? Show : null} Limit + Visible Roles Highlight Color Sort Order @@ -110,6 +113,19 @@ export default function RankRolesField({ field, control }) { onChange={(e) => rhf.onChange(patchRow(rows, index, { limit: e.target.value }))} /> + +