-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
373 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<script setup lang="ts"> | ||
import { computed, ref, watch } from 'vue' | ||
import { useStore } from '@/store' | ||
import WaveSurfer from 'wavesurfer.js' | ||
import type { Sample } from 'root/types' | ||
const store = useStore() | ||
const mode = computed(() => store.ui.mode) | ||
const activeSample = computed(() => store.ui.activeSample) | ||
const wavecontainer = ref(null) | ||
const player = ref<WaveSurfer>() | ||
const isPlaying = ref(false) | ||
const props = defineProps<{ | ||
sample: Sample | ||
}>() | ||
function selectSample() { | ||
console.log('SAMPLE CLICKED') | ||
if (mode.value === 'play') { | ||
if (isPlaying.value) { | ||
player.value?.stop() | ||
isPlaying.value = false | ||
} else { | ||
player.value?.play() | ||
isPlaying.value = true | ||
} | ||
} | ||
if (activeSample.value === props.sample.id) { | ||
store.setActiveSample('') | ||
} else { | ||
store.setActiveSample(props.sample.id) | ||
} | ||
} | ||
watch(wavecontainer, (newContainer) => { | ||
if (newContainer) { | ||
player.value = WaveSurfer.create({ | ||
container: newContainer, | ||
waveColor: 'violet', | ||
progressColor: 'purple', | ||
// cursorColor: '#fff', | ||
// barWidth: 2, | ||
// barHeight: 1, | ||
// barGap: 1, | ||
interact: false, | ||
height: 100, | ||
hideScrollbar: true, | ||
// responsive: true, | ||
}) | ||
player.value.on('finish', () => { | ||
store.setActiveSample('') | ||
player.value?.stop() | ||
}) | ||
player.value.load('slip-board://' + props.sample.path) | ||
// player.value.load('file://' + props.sample.path) | ||
} | ||
}) | ||
</script> | ||
<template> | ||
<div | ||
class="h-[100px] w-[200px] border-2 rounded flex flex-col overflow-hidden mx-1 my-1 bg-white/5" | ||
:class="{ | ||
'border-indigo-500/60': activeSample === sample.id, | ||
'border-[#1C1E20]': activeSample !== sample.id, | ||
}" | ||
@click="selectSample" | ||
> | ||
<div class="flex-1 px-3 pt-2"> | ||
<h4>{{ sample.name }}</h4> | ||
|
||
<div ref="wavecontainer"></div> | ||
</div> | ||
<div v-if="mode === 'edit'" class="flex justify-end w-full px-2 py-1"> | ||
<button class="btn">Edit</button> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
import { computed, ref, watch, toRaw } from 'vue' | ||
import { useStore } from '@/store' | ||
import type { Sample } from 'root/types' | ||
const store = useStore() | ||
const mode = computed(() => store.ui.mode) | ||
const sample = computed(() => store.getSelectedSample) | ||
function confirmDelete() { | ||
const obj = toRaw(sample.value) | ||
console.log('confirmSampleDelete', obj) | ||
window.api.send('confirmSampleDelete', obj) | ||
} | ||
</script> | ||
<template> | ||
<div | ||
v-if="sample && mode === 'edit'" | ||
class="bg-black absolute top-[52px] bottom-0 right-0 w-[280px] px-3 py-3" | ||
> | ||
<h4>{{ sample.name }}</h4> | ||
|
||
<p class="my-4 text-xs">{{ sample.path }}</p> | ||
|
||
<hr /> | ||
|
||
<button class="btn" @click="confirmDelete">Delete sample</button> | ||
</div> | ||
</template> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.