Skip to content

Commit

Permalink
quickfix: frontend filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bentechy66 committed Oct 9, 2023
1 parent 96608bd commit 8cd99b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/pages/Leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ const Leaderboard = React.memo(() => {

const teamTab = (
<>
{groups.data && groups.data.length > 1 ? (
{groups.data && groups.data.filter(i => i.has_own_leaderboard).length > 1 ? (
<TabbedView center initial={0}>
<Tab label={t("teams.all_leaderboard_groups")}>
{defaultTabContent}
</Tab>
{groups.data.map(g => {
{groups.data.filter(i => i.has_own_leaderboard).map(g => {
const filteredGraphData = teamGraphData.filter(i => i.leaderboard_group_name === g.name);
const filteredTeamData = tState.data.filter(i => i.leaderboard_group_name === g.name);

Expand Down
8 changes: 5 additions & 3 deletions src/plugins/base/auth/components/Teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const CreateTeam = () => {

const [message, setMessage] = useState("");
const [success, setSuccess] = useState(false);
const [groups, , gRefresh] = usePaginated(ENDPOINTS.LEADERBOARD_GROUPS);
const [groups, , ] = usePaginated(ENDPOINTS.LEADERBOARD_GROUPS);
const [locked, setLocked] = useState(false);
const team = useSelector(state => state.team);
const hasTeams = useConfig("enable_teams");
Expand Down Expand Up @@ -149,9 +149,11 @@ export const CreateTeam = () => {
<Input autofill={"off"} name={"name"} limit={36} placeholder={t("team_name")} required />
<Input autofill={"off"} name={"password"} placeholder={t("team_secret")} required password />
<SubtleText>{t("team_secret_warn")}</SubtleText>
{groups && groups.data.length &&
{groups && groups.data.filter(i => i.is_self_assignable).length &&
<Form.Group htmlFor={"leaderboard_group"} label={"Select your leaderboard group!"}>
<Select options={groups.data.map(i => ({key: i.id, value: i.name}))} name={"leaderboard_group"} />
<Select options={
groups.data.filter(i => i.is_self_assignable).map(i => ({key: i.id, value: i.name}))
} name={"leaderboard_group"} />
</Form.Group>
}
</Form.Group>
Expand Down

0 comments on commit 8cd99b0

Please sign in to comment.