Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

refactor(omnibox): remove torrent file dialog and associated button, streamline drag-and-drop functionality

Tonho9e06eebaf155
diff --git a/src/components/omnibox/OmniboxInput.svelte b/src/components/omnibox/OmniboxInput.svelte
index 6264a68e..09202ad0 100644
--- a/src/components/omnibox/OmniboxInput.svelte
+++ b/src/components/omnibox/OmniboxInput.svelte
@@ -1,5 +1,4 @@
<script lang="ts">
- import { open } from "@tauri-apps/plugin-dialog";
import { t } from "$lib/i18n";
import ContextHint from "$components/hints/ContextHint.svelte";
@@ -7,18 +6,6 @@
let dragOver = $state(false);
- async function openTorrentFile() {
- const selected = await open({
- title: "Select .torrent file",
- filters: [{ name: "Torrent", extensions: ["torrent"] }],
- multiple: false,
- });
- if (selected && typeof selected === "string") {
- url = selected;
- onInput?.();
- }
- }
-
function handleDragOver(e: DragEvent) {
e.preventDefault();
if (e.dataTransfer) {
@@ -67,24 +54,6 @@
bind:value={url}
oninput={onInput}
/>
- <button
- class="torrent-btn"
- onclick={openTorrentFile}
- title="Open .torrent file"
- aria-label="Open .torrent file"
- >
- <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
- <circle cx="12" cy="12" r="3" />
- <circle cx="5" cy="6" r="2" />
- <circle cx="19" cy="6" r="2" />
- <circle cx="5" cy="18" r="2" />
- <circle cx="19" cy="18" r="2" />
- <path d="M9.5 10.5L6.5 7.5" />
- <path d="M14.5 10.5l3-3" />
- <path d="M9.5 13.5l-3 3" />
- <path d="M14.5 13.5l3 3" />
- </svg>
- </button>
<ContextHint text={$t('hints.omnibox')} dismissKey="omnibox" />
</div>
@@ -92,64 +61,30 @@
.omnibox-wrapper {
width: 100%;
position: relative;
- display: flex;
- align-items: center;
- gap: 0;
- border: 1px solid var(--input-border);
- border-radius: var(--border-radius);
- background: var(--button);
transition: border-color 0.15s;
}
- .omnibox-wrapper:focus-within {
- border-color: var(--secondary);
- }
-
- .omnibox-wrapper.drag-over {
+ .omnibox-wrapper.drag-over .omnibox {
border-color: var(--blue);
background: color-mix(in srgb, var(--blue) 8%, var(--button));
}
.omnibox {
- flex: 1;
+ width: 100%;
padding: var(--padding) calc(var(--padding) + 4px);
font-size: 14.5px;
- background: transparent;
+ background: var(--button);
+ border-radius: var(--border-radius);
color: var(--secondary);
- border: none;
- border-radius: var(--border-radius) 0 0 var(--border-radius);
- outline: none;
+ border: 1px solid var(--input-border);
}
.omnibox::placeholder {
color: var(--gray);
}
- .torrent-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 38px;
- height: 38px;
- flex-shrink: 0;
- background: none;
- border: none;
- border-left: 1px solid var(--input-border);
- border-radius: 0 var(--border-radius) var(--border-radius) 0;
- color: var(--gray);
- cursor: pointer;
- padding: 0;
- }
-
- @media (hover: hover) {
- .torrent-btn:hover {
- color: var(--secondary);
- background: var(--sidebar-highlight);
- }
- }
-
- .torrent-btn:focus-visible {
- outline: var(--focus-ring);
- outline-offset: var(--focus-ring-offset);
+ .omnibox:focus-visible {
+ border-color: var(--secondary);
+ outline: none;
}
</style>