Commit cd8ab7d7 authored by Patrik Kotúček's avatar Patrik Kotúček
Browse files

Merge branch '264-improve-the-select-all-option-in-tables-in-assign-equally' into 'main'

264: Improve tables in asign equally

Closes inject-issues#264

See merge request inject/frontend!816
parents fdd1e5db bd6496fc
Loading
Loading
Loading
Loading
+34 −8
Original line number Diff line number Diff line
import {
  Alert,
  Button,
  ButtonGroup,
  Dialog,
  DialogBody,
  DialogFooter,
  Divider,
} from '@blueprintjs/core'
import { css, cx } from '@emotion/css'
import type { IUser } from '@inject/graphql'
@@ -30,6 +32,11 @@ const body = css`
  overflow: auto;
`

const filtersToolbar = css`
  display: flex;
  justify-content: flex-end;
`

interface AssignEquallyProps {
  exerciseId: string
  teamCount: number
@@ -122,6 +129,8 @@ const AssignEqually: FC<AssignEquallyProps> = ({ exerciseId, teamCount }) => {
    onDeselectAll: () => setSelectedUsers([]),
  })

  const { onSelectAll, onDeselectAll, allSelected } = tableProps

  return (
    <>
      <Button
@@ -130,7 +139,6 @@ const AssignEqually: FC<AssignEquallyProps> = ({ exerciseId, teamCount }) => {
        onClick={() => setOpen(true)}
        active={open}
      />

      <Dialog
        isOpen={open}
        onClose={reset}
@@ -139,13 +147,31 @@ const AssignEqually: FC<AssignEquallyProps> = ({ exerciseId, teamCount }) => {
        icon='align-justify'
      >
        <DialogBody className={cx(dialogBody, body)}>
          <div className={filtersToolbar}>
            <ButtonGroup minimal>
              <TagFilters
                selected={tags}
                setSelected={setTags}
                fill={false}
            position='bottom-left'
                position='bottom-right'
              />

              <Divider />
              <Button
                icon='maximize'
                disabled={allSelected}
                onClick={() => onSelectAll?.()}
              >
                {t('teamSelection.selectAll')}
              </Button>
              <Button
                icon='minimize'
                disabled={selectedUsers.length === 0}
                onClick={() => onDeselectAll?.()}
              >
                {t('teamSelection.selectNone')}
              </Button>
            </ButtonGroup>
          </div>
          <Table<IUser> {...tableProps} />
        </DialogBody>
        <DialogFooter
+1 −1
Original line number Diff line number Diff line
@@ -703,7 +703,7 @@
    "teams": "Týmy",
    "assignEqually": "Přiřadit rovnoměrně",
    "assignUsersEqually": "Přiřadit uživatele do týmů rovnoměrně",
    "tags": "Štítky",
    "tags": "Filtrovat podle štítků",
    "noTags": "Nejsou dostupné žádné štítky",
    "selectUsers": "Vyberte některé uživatele",
    "assign": "Přiřadit",
+1 −1
Original line number Diff line number Diff line
@@ -703,7 +703,7 @@
    "teams": "Teams",
    "assignEqually": "Assign equally",
    "assignUsersEqually": "Assign users to teams equally",
    "tags": "Tags",
    "tags": "Filter by tags",
    "noTags": "No tags available",
    "selectUsers": "Select some users",
    "assign": "Assign",