diff --git a/src/stores/analysis.ts b/src/stores/analysis.ts new file mode 100644 index 0000000..46e87b5 --- /dev/null +++ b/src/stores/analysis.ts @@ -0,0 +1,28 @@ +// filepath: src/stores/analysis.ts +import { defineStore } from 'pinia' +import { ref } from 'vue' + +export const useAnalysisStore = defineStore('analysis', () => { + const url = ref('') + const loading = ref(false) + const error = ref('') + const metadata = ref(null) + + const options = ref({ + is_audio_only: false, + quality: 'best', + output_path: '' + }) + + function reset() { + url.value = '' + loading.value = false + error.value = '' + metadata.value = null + // We keep options as is, or reset them? + // Usually keeping user preference for "Audio Only" is nice, + // but let's just reset the content-related stuff. + } + + return { url, loading, error, metadata, options, reset } +}) diff --git a/src/views/Home.vue b/src/views/Home.vue index 2be54d4..a80da85 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -1,86 +1,58 @@ // filepath: src/views/Home.vue @@ -110,7 +81,7 @@ async function startDownload() {
-

{{ error }}

+

{{ analysisStore.error }}

-
+
- +
-

{{ metadata.title }}

-

{{ metadata.uploader }}

-

{{ metadata.entries.length }} videos in playlist

+

{{ analysisStore.metadata.title }}

+

{{ analysisStore.metadata.uploader }}

+

{{ analysisStore.metadata.entries.length }} videos in playlist

@@ -146,13 +117,13 @@ async function startDownload() {
Audio Only
@@ -160,9 +131,9 @@ async function startDownload() {