fix: remove history on select

This commit is contained in:
MAZE 2023-10-11 20:51:20 +03:30
parent 8966d59d75
commit 5bd1dd3016
3 changed files with 9 additions and 3 deletions

View file

@ -25,8 +25,10 @@
line-height: 0; line-height: 0;
outline: none; outline: none;
&:disabled { &:disabled,
&.disabled {
cursor: default; cursor: default;
opacity: 0.8;
} }
& span { & span {
@ -53,8 +55,10 @@
outline: none; outline: none;
transition: 0.2s; transition: 0.2s;
&:disabled { &:disabled,
&.disabled {
cursor: default; cursor: default;
opacity: 0.8;
} }
&.restore { &.restore {

View file

@ -27,7 +27,7 @@ export function Buttons() {
return ( return (
<div className={styles.buttons}> <div className={styles.buttons}>
<button <button
className={styles.playButton} className={cn(styles.playButton, noSelected && styles.disabled)}
disabled={noSelected} disabled={noSelected}
onClick={handleClick} onClick={handleClick}
> >
@ -56,6 +56,7 @@ export function Buttons() {
className={cn( className={cn(
styles.smallButton, styles.smallButton,
hasHistory ? styles.restore : styles.delete, hasHistory ? styles.restore : styles.delete,
noSelected && !hasHistory && styles.disabled,
)} )}
onClick={() => { onClick={() => {
if (hasHistory) restoreHistory(); if (hasHistory) restoreHistory();

View file

@ -27,6 +27,7 @@ export const createActions: StateCreator<
select(id) { select(id) {
set({ set({
history: null,
sounds: { sounds: {
...get().sounds, ...get().sounds,
[id]: { ...get().sounds[id], isSelected: true }, [id]: { ...get().sounds[id], isSelected: true },