feat: added quick paste and clear buttons in downloader

This commit is contained in:
2025-10-27 14:27:32 +05:30
parent 5956fd050b
commit 618edceebb
9 changed files with 391 additions and 51 deletions

View File

@@ -472,7 +472,7 @@ export default function App({ children }: { children: React.ReactNode }) {
command.stdout.on('data', line => {
if (line.startsWith('status:') || line.startsWith('[#')) {
console.log(line);
// console.log(line);
if (DEBUG_MODE && LOG_PROGRESS) LOG.progress(`YT-DLP Download ${downloadId}`, line);
const currentProgress = parseProgressLine(line);
const state: DownloadState = {
@@ -533,7 +533,7 @@ export default function App({ children }: { children: React.ReactNode }) {
}
})
} else {
console.log(line);
// console.log(line);
if (line.trim() !== '') LOG.info(`YT-DLP Download ${downloadId}`, line);
if (line.startsWith('Finalpath: ')) {

View File

@@ -12,7 +12,7 @@ export default function Navbar() {
const logs = useLogger().getLogs();
return (
<nav className="flex justify-between items-center py-3 px-4 sticky top-0 backdrop-blur supports-[backdrop-filter]:bg-background/60 border-b z-50">
<nav className="flex justify-between items-center py-3 px-4 sticky top-0 backdrop-blur supports-backdrop-filter:bg-background/60 border-b z-50">
<div className="flex justify-center">
<SidebarTrigger />
<h1 className="text-lg text-primary font-semibold ml-4">{getRouteName(location.pathname)}</h1>

View File

@@ -9,7 +9,7 @@ import { toast } from "sonner";
import { useAppContext } from "@/providers/appContextProvider";
import { useCurrentVideoMetadataStore, useDownloaderPageStatesStore, useSettingsPageStatesStore } from "@/services/store";
import { determineFileType, fileFormatFilter, formatBitrate, formatDurationString, formatFileSize, formatReleaseDate, formatYtStyleCount, isObjEmpty, sortByBitrate } from "@/utils";
import { Calendar, Clock, DownloadCloud, Eye, Info, Loader2, Music, ThumbsUp, Video, File, ListVideo, PackageSearch, AlertCircleIcon, X, Settings2 } from "lucide-react";
import { Calendar, Clock, DownloadCloud, Eye, Info, Loader2, Music, ThumbsUp, Video, File, ListVideo, PackageSearch, AlertCircleIcon, X, Settings2, Clipboard } from "lucide-react";
import { FormatSelectionGroup, FormatSelectionGroupItem } from "@/components/custom/formatSelectionGroup";
import { useEffect, useRef } from "react";
import { ToggleGroup, ToggleGroupItem } from "@/components/custom/legacyToggleGroup";
@@ -29,6 +29,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import { readText } from '@tauri-apps/plugin-clipboard-manager';
const searchFormSchema = z.object({
url: z.url({
@@ -391,6 +392,36 @@ export default function DownloaderPage() {
<X className="size-4" />
</Button>
)}
{!isMetadataLoading && !videoUrl && (
<Button
type="button"
size="icon"
disabled={isMetadataLoading}
onClick={async () => {
const text = await readText();
if (text) {
searchForm.setValue("url", text);
setVideoUrl(text);
}
}}
>
<Clipboard className="size-4" />
</Button>
)}
{!isMetadataLoading && videoUrl && (
<Button
type="button"
variant="outline"
size="icon"
disabled={isMetadataLoading}
onClick={() => {
searchForm.setValue("url", '');
setVideoUrl('');
}}
>
<X className="size-4" />
</Button>
)}
<Button
type="submit"
disabled={!videoUrl || Object.keys(searchFormErrors).length > 0 || isMetadataLoading}
@@ -945,7 +976,7 @@ export default function DownloaderPage() {
)}
</div>
<div className="flex flex-col gap-1">
<span className="text-sm text-nowrap max-w-[30rem] xl:max-w-[50rem] overflow-hidden text-ellipsis">{videoMetadata._type === 'video' ? videoMetadata.title : videoMetadata._type === 'playlist' ? videoMetadata.entries[Number(selectedPlaylistVideoIndex) - 1].title : 'Unknown' }</span>
<span className="text-sm text-nowrap max-w-120 xl:max-w-200 overflow-hidden text-ellipsis">{videoMetadata._type === 'video' ? videoMetadata.title : videoMetadata._type === 'playlist' ? videoMetadata.entries[Number(selectedPlaylistVideoIndex) - 1].title : 'Unknown' }</span>
<span className="text-xs text-muted-foreground">{selectedFormatFinalMsg}</span>
</div>
</div>