All files / src/components/music SongEditorRightToolsPanel.tsx

0% Statements 0/14
0% Branches 0/12
0% Functions 0/4
0% Lines 0/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90                                                                                                                                                                                   
import React from "react";
import { useAppSelector } from "store/hooks";
import styled, { css } from "styled-components";
import { ChannelSelectField } from "./ChannelSelectField";
import { StyledButton } from "ui/buttons/style";
 
interface SongEditorRightToolsPanelProps {
  channelStatus: boolean[];
  size?: "small" | "medium";
}
 
interface WrapperProps {
  $size?: "small" | "medium";
}
 
const Wrapper = styled.div<WrapperProps>`
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  background: ${(props) => props.theme.colors.background};
  ${(props) =>
    props.$size === "small"
      ? css`
          ${ChannelSelectGroup} ${StyledButton} {
            min-width: 10px;
          }
        `
      : ""}
`;
 
const ChannelSelectGroup = styled.div`
  display: flex;
  flex-direction: row;
  & > * {
    padding-left: 5px;
  }
`;
 
const SongEditorRightToolsPanel = ({
  channelStatus,
  size,
}: SongEditorRightToolsPanelProps) => {
  const view = useAppSelector((state) => state.tracker.view);
 
  return (
    <Wrapper $size={size}>
      {view === "roll" ? (
        <>
          <ChannelSelectGroup>
            <ChannelSelectField
              name="channelDuty1"
              label={size === "medium" ? "Duty 1" : "D1"}
              title="Duty 1"
              index={0}
              muted={channelStatus[0]}
            />
            <ChannelSelectField
              name="channelDuty2"
              label={size === "medium" ? "Duty 2" : "D2"}
              title="Duty 2"
              index={1}
              muted={channelStatus[1]}
            />
            <ChannelSelectField
              name="channelWave"
              label={size === "medium" ? "Wave" : "W"}
              title="Wave"
              index={2}
              muted={channelStatus[2]}
            />
            <ChannelSelectField
              name="channelNoise"
              label={size === "medium" ? "Noise" : "N"}
              title="Noise"
              index={3}
              muted={channelStatus[3]}
            />
          </ChannelSelectGroup>
        </>
      ) : (
        ""
      )}
    </Wrapper>
  );
};
 
export default SongEditorRightToolsPanel;