Skip to content

Commit

Permalink
feat: add select all button to selection toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
vinceau committed Jun 23, 2021
1 parent 4a761d0 commit f811063
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/renderer/containers/ReplayBrowser/FileSelectionToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
import { css, jsx } from "@emotion/react";
import styled from "@emotion/styled";
import Button from "@material-ui/core/Button";
import BlockIcon from "@material-ui/icons/Block";
import DeleteIcon from "@material-ui/icons/Delete";
import PlayArrowIcon from "@material-ui/icons/PlayArrow";
import SelectAllIcon from "@material-ui/icons/SelectAll";
import React from "react";

export interface FileSelectionToolbarProps {
totalSelected: number;
onSelectAll: () => void;
onPlay: () => void;
onClear: () => void;
onDelete: () => void;
}

export const FileSelectionToolbar: React.FC<FileSelectionToolbarProps> = ({
totalSelected,
onSelectAll,
onPlay,
onClear,
onDelete,
Expand Down Expand Up @@ -43,14 +49,23 @@ export const FileSelectionToolbar: React.FC<FileSelectionToolbarProps> = ({
{totalSelected} files selected
</div>
<div>
<Button color="secondary" variant="contained" size="small" onClick={onPlay}>
Play All
<Button color="secondary" variant="contained" size="small" onClick={onDelete} startIcon={<DeleteIcon />}>
Delete
</Button>
<Button color="secondary" variant="contained" size="small" onClick={onClear}>
<Button color="secondary" variant="contained" size="small" onClick={onClear} startIcon={<BlockIcon />}>
Clear
</Button>
<Button color="secondary" variant="contained" size="small" onClick={onDelete}>
Delete
<Button
color="secondary"
variant="contained"
size="small"
onClick={onSelectAll}
startIcon={<SelectAllIcon />}
>
Select All
</Button>
<Button color="primary" variant="contained" size="small" onClick={onPlay} startIcon={<PlayArrowIcon />}>
Play All
</Button>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/renderer/containers/ReplayBrowser/ReplayBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export const ReplayBrowser: React.FC = () => {
)}
<FileSelectionToolbar
totalSelected={selectedFiles.length}
onSelectAll={fileSelection.selectAll}
onPlay={() => playFiles(selectedFiles.map((path) => ({ path })))}
onClear={fileSelection.clearSelection}
onDelete={() => {
Expand Down

0 comments on commit f811063

Please sign in to comment.