disable buttons and leaderboard iterator

This commit is contained in:
Mateusz Tylka 2023-08-11 12:28:24 +02:00
parent aa1c1c3737
commit 6c4da8c181
6 changed files with 11 additions and 7 deletions

View File

@ -2,17 +2,17 @@ import React from 'react';
import { FlexRow, Svg } from '../../../../../utils/containers'; import { FlexRow, Svg } from '../../../../../utils/containers';
import theme from '../../../../../utils/theme'; import theme from '../../../../../utils/theme';
const TableRowButtons = ({ buttons, i }) => { const TableRowButtons = ({ buttons, i, active }) => {
return ( return (
<FlexRow gap="12px"> <FlexRow gap="12px">
{buttons.map((button, j) => { {buttons.map((button, j) => {
return ( return (
<Svg <Svg
key={`table-item-button-${i}-${j}`} key={`table-item-button-${i}-${j}`}
onClick={button.handler} onClick={active ? button.handler : null}
src={button.icon} src={button.icon}
backgroundColor={theme.colors.dark} backgroundColor={active ? theme.colors.dark : theme.colors.dark05}
cursor="pointer" cursor={active ? 'pointer' : 'auto'}
size="cover" size="cover"
width="16px" width="16px"
height="16px" height="16px"

View File

@ -4,6 +4,7 @@ import TableRowTags from '../TableRowTags/TableRowTags';
import TableRowButtons from '../TableRowButtons/TableRowButtons'; import TableRowButtons from '../TableRowButtons/TableRowButtons';
import pensilIco from '../../../../../assets/pencil_ico.svg'; import pensilIco from '../../../../../assets/pencil_ico.svg';
import deleteIco from '../../../../../assets/delete_ico.svg'; import deleteIco from '../../../../../assets/delete_ico.svg';
import KeyCloakService from '../../../../../services/KeyCloakService';
const TableRowFooter = ({ rowFooter, item, i, deleteItem, editItem }) => { const TableRowFooter = ({ rowFooter, item, i, deleteItem, editItem }) => {
if (rowFooter) { if (rowFooter) {
@ -15,6 +16,8 @@ const TableRowFooter = ({ rowFooter, item, i, deleteItem, editItem }) => {
{ icon: pensilIco, handler: () => editItem() }, { icon: pensilIco, handler: () => editItem() },
{ icon: deleteIco, handler: () => deleteItem() }, { icon: deleteIco, handler: () => deleteItem() },
]} ]}
active={KeyCloakService.isLoggedIn()}
i={i}
/> />
</FlexRow> </FlexRow>
); );

View File

@ -24,6 +24,7 @@ const TableRowItems = ({ orderedKeys, item, i }) => {
<Container className="mobile-table-header">{keyValue}</Container> <Container className="mobile-table-header">{keyValue}</Container>
)} )}
{renderValue(keyValue)} {renderValue(keyValue)}
{keyValue === '#' && i + 1}
</td> </td>
); );
})} })}

View File

@ -110,7 +110,7 @@ const AllEntries = (props) => {
); );
const n = (pageNr - 1) * (ELEMENTS_PER_PAGE * 2); const n = (pageNr - 1) * (ELEMENTS_PER_PAGE * 2);
let elements = entries.slice(n, n + ELEMENTS_PER_PAGE * 2); const elements = entries.slice(n, n + ELEMENTS_PER_PAGE * 2);
return ( return (
<FlexColumn <FlexColumn

View File

@ -1,6 +1,6 @@
const orderKeys = (elem) => { const orderKeys = (elem) => {
if (elem) { if (elem) {
let result = ['id', 'submitter']; let result = ['id', 'submitter', 'description'];
const elemKeys = Object.keys(elem); const elemKeys = Object.keys(elem);
const dev0keys = elemKeys const dev0keys = elemKeys
.filter((key) => key.split('.')[1] === 'dev-0') .filter((key) => key.split('.')[1] === 'dev-0')

View File

@ -1,6 +1,6 @@
const orderKeys = (elem) => { const orderKeys = (elem) => {
if (elem) { if (elem) {
let result = ['id', 'submitter', 'description']; let result = ['#', 'submitter', 'description'];
const elemKeys = Object.keys(elem); const elemKeys = Object.keys(elem);
const dev0keys = elemKeys const dev0keys = elemKeys
.filter((key) => key.split('.')[1] === 'dev-0') .filter((key) => key.split('.')[1] === 'dev-0')