diff --git a/frontend/package.json b/frontend/package.json index c903c36..291de41 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,19 +1,18 @@ { - "name": "frontend", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "svelte": "^3.49.0", - "vite": "^3.0.7" - }, - "dependencies": { - "@fortawesome/fontawesome-free": "^6.6.0" - } + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@sveltejs/vite-plugin-svelte": "^4.0.0", + "svelte": "^5" + }, + "dependencies": { + "@fortawesome/fontawesome-free": "^6.6.0" + } } diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 2b1c0cf..55f1b29 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -9,13 +9,13 @@ import Link from "./components/Link.svelte"; import "@fortawesome/fontawesome-free/css/all.min.css"; -let url = ""; -let videoResult; -let loading = false; +let url = $state(""); +let videoResult = $state(); +let loading = $state(false); -let showModal = false; +let showModal = $state(false); -let visibleToasts = []; +let visibleToasts = $state([]); // Function to open the modal function openModal() { @@ -171,10 +171,10 @@ const handleClose = (id) => {

Youtube Downloader

-
+ -
diff --git a/frontend/src/components/ExpandableToast.svelte b/frontend/src/components/ExpandableToast.svelte index 48ddb03..ace2453 100644 --- a/frontend/src/components/ExpandableToast.svelte +++ b/frontend/src/components/ExpandableToast.svelte @@ -1,11 +1,9 @@ - OpenBrowser(href)}> - + + { event.preventDefault(); OpenBrowser(href); }} + role="button" + tabindex="0"> + {@render children?.()} \ No newline at end of file diff --git a/frontend/src/components/ThemeSwitcher.svelte b/frontend/src/components/ThemeSwitcher.svelte index 7940bdc..5bbda42 100644 --- a/frontend/src/components/ThemeSwitcher.svelte +++ b/frontend/src/components/ThemeSwitcher.svelte @@ -3,7 +3,7 @@ import { onMount } from "svelte"; import { onAccesibilityKeydown } from "../utils/accessibility.js"; import "@fortawesome/fontawesome-free/css/all.min.css"; -let isDarkMode; +let isDarkMode = $state(); function setTheme(theme) { document.querySelector("html").setAttribute("data-theme", theme); @@ -37,6 +37,8 @@ function toggleTheme() { -
+
+ diff --git a/frontend/src/components/Toast.svelte b/frontend/src/components/Toast.svelte deleted file mode 100644 index 7e9e043..0000000 --- a/frontend/src/components/Toast.svelte +++ /dev/null @@ -1,33 +0,0 @@ - - - - -
- {message} -
diff --git a/frontend/src/components/VideoModal.svelte b/frontend/src/components/VideoModal.svelte index ba06ede..4dd3e2c 100644 --- a/frontend/src/components/VideoModal.svelte +++ b/frontend/src/components/VideoModal.svelte @@ -3,11 +3,11 @@ import { onAccesibilityKeydown } from "../utils/accessibility.js"; import { DownloadVideo } from "../../wailsjs/go/controllers/App.js"; import "@fortawesome/fontawesome-free/css/all.min.css"; -export let onClose; -export let videoInfo; +/** @type {{onClose: any, videoInfo: any}} */ +let { onClose, videoInfo } = $props(); -let selectedOption; -let currentTab = "video"; // Default tab is video +let selectedOption = $state(); +let currentTab = $state("video"); // Default tab is video function onDownloadButtonClick() { if (selectedOption) { @@ -47,7 +47,8 @@ const audioOptions = audioExtOptions.map((ext) => ({ })); // Switch between video and audio tab and reset the selected option -function switchTab(tab) { +function switchTab(event, tab) { + event.preventDefault(); currentTab = tab; selectedOption = ""; // Reset the selected option when tab changes } @@ -170,8 +171,14 @@ function switchTab(tab) { } -