add navigate to editor function to pattern detail.
This commit is contained in:
parent
13d32fb0e0
commit
3296eba4b2
|
@ -3,6 +3,7 @@ import { ask } from '@tauri-apps/plugin-dialog';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { useAtomValue, useSetAtom } from 'jotai';
|
import { useAtomValue, useSetAtom } from 'jotai';
|
||||||
import { FC, useCallback, useMemo } from 'react';
|
import { FC, useCallback, useMemo } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { NotificationType, useNotification } from '../../components/Notifications';
|
import { NotificationType, useNotification } from '../../components/Notifications';
|
||||||
import PatternPreview from '../../components/PatternPreview';
|
import PatternPreview from '../../components/PatternPreview';
|
||||||
import {
|
import {
|
||||||
|
@ -27,6 +28,7 @@ const EmptyPromption: FC = () => {
|
||||||
|
|
||||||
const Detail: FC<{ pattern: Pattern }> = ({ pattern }) => {
|
const Detail: FC<{ pattern: Pattern }> = ({ pattern }) => {
|
||||||
const { showToast } = useNotification();
|
const { showToast } = useNotification();
|
||||||
|
const navigate = useNavigate();
|
||||||
const refreshPatterns = useSetAtom(PatternsAtom);
|
const refreshPatterns = useSetAtom(PatternsAtom);
|
||||||
const resetSelected = useSetAtom(SelectedPatternIdAtom);
|
const resetSelected = useSetAtom(SelectedPatternIdAtom);
|
||||||
const patternDuration = useMemo(() => totalDuration(pattern), [pattern]);
|
const patternDuration = useMemo(() => totalDuration(pattern), [pattern]);
|
||||||
|
@ -60,7 +62,9 @@ const Detail: FC<{ pattern: Pattern }> = ({ pattern }) => {
|
||||||
<div className={styles.pattern_detail}>
|
<div className={styles.pattern_detail}>
|
||||||
<div className={styles.control_panel}>
|
<div className={styles.control_panel}>
|
||||||
<div className={styles.button_row}>
|
<div className={styles.button_row}>
|
||||||
<button className="tonal">Edit Pattern</button>
|
<button className="tonal" onClick={() => navigate('/pattern-editor/edit')}>
|
||||||
|
Edit Pattern
|
||||||
|
</button>
|
||||||
<button className="tonal danger" onClick={handleDeleteAction}>
|
<button className="tonal danger" onClick={handleDeleteAction}>
|
||||||
Delete Pattern
|
Delete Pattern
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user