.reorder audio tools
This commit is contained in:
@@ -363,12 +363,12 @@ export function AudioResamplerPage() {
|
|||||||
}} style={{ "--wails-drop-target": "drop" } as React.CSSProperties}>
|
}} style={{ "--wails-drop-target": "drop" } as React.CSSProperties}>
|
||||||
{files.length === 0 ? (<>
|
{files.length === 0 ? (<>
|
||||||
<div className="mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-muted">
|
<div className="mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-muted">
|
||||||
<AudioLinesIcon size={32} className="text-primary"/>
|
<Upload className="h-8 w-8 text-primary"/>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-muted-foreground mb-4 text-center">
|
<p className="text-sm text-muted-foreground mb-4 text-center">
|
||||||
{isDragging
|
{isDragging
|
||||||
? "Drop your FLAC files here"
|
? "Drop your audio files here"
|
||||||
: "Drag and drop FLAC files here, or click the button below to select"}
|
: "Drag and drop audio files here, or click the button below to select"}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex gap-3">
|
<div className="flex gap-3">
|
||||||
<Button onClick={handleSelectFiles} size="lg">
|
<Button onClick={handleSelectFiles} size="lg">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useState, useEffect, useRef } from "react";
|
|||||||
import { Trash2, Copy, Check, FileDown } from "lucide-react";
|
import { Trash2, Copy, Check, FileDown } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { logger, type LogEntry } from "@/lib/logger";
|
import { logger, type LogEntry } from "@/lib/logger";
|
||||||
|
import { useDownloadQueueData } from "@/hooks/useDownloadQueueData";
|
||||||
import { ExportFailedDownloads } from "../../wailsjs/go/main/App";
|
import { ExportFailedDownloads } from "../../wailsjs/go/main/App";
|
||||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||||
const levelColors: Record<string, string> = {
|
const levelColors: Record<string, string> = {
|
||||||
@@ -23,6 +24,13 @@ export function DebugLoggerPage() {
|
|||||||
const [logs, setLogs] = useState<LogEntry[]>([]);
|
const [logs, setLogs] = useState<LogEntry[]>([]);
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
|
const queueInfo = useDownloadQueueData();
|
||||||
|
const hasDownloadActivity = queueInfo.queue.length > 0 ||
|
||||||
|
queueInfo.queued_count > 0 ||
|
||||||
|
queueInfo.completed_count > 0 ||
|
||||||
|
queueInfo.failed_count > 0 ||
|
||||||
|
queueInfo.skipped_count > 0;
|
||||||
|
const canExportFailed = hasDownloadActivity && queueInfo.failed_count > 0;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unsubscribe = logger.subscribe(() => {
|
const unsubscribe = logger.subscribe(() => {
|
||||||
setLogs(logger.getLogs());
|
setLogs(logger.getLogs());
|
||||||
@@ -54,6 +62,9 @@ export function DebugLoggerPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleExportFailed = async () => {
|
const handleExportFailed = async () => {
|
||||||
|
if (!canExportFailed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const message = await ExportFailedDownloads();
|
const message = await ExportFailedDownloads();
|
||||||
if (message.startsWith("Successfully")) {
|
if (message.startsWith("Successfully")) {
|
||||||
@@ -72,7 +83,7 @@ export function DebugLoggerPage() {
|
|||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-2xl font-bold">Debug Logs</h1>
|
<h1 className="text-2xl font-bold">Debug Logs</h1>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button variant="outline" size="sm" className="gap-1.5" onClick={handleExportFailed}>
|
<Button variant="outline" size="sm" className="gap-1.5" onClick={handleExportFailed} disabled={!canExportFailed}>
|
||||||
<FileDown className="h-4 w-4"/>
|
<FileDown className="h-4 w-4"/>
|
||||||
Export Failed
|
Export Failed
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, Pagi
|
|||||||
import { GetDownloadHistory, ClearDownloadHistory, GetPreviewURL, GetFetchHistory, DeleteDownloadHistoryItem, DeleteFetchHistoryItem, ClearFetchHistoryByType } from "../../wailsjs/go/main/App";
|
import { GetDownloadHistory, ClearDownloadHistory, GetPreviewURL, GetFetchHistory, DeleteDownloadHistoryItem, DeleteFetchHistoryItem, ClearFetchHistoryByType } from "../../wailsjs/go/main/App";
|
||||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { openExternal } from "@/lib/utils";
|
import { openExternal } from "@/lib/utils";
|
||||||
|
import { SPOTIFY_PREVIEW_VOLUME } from "@/lib/preview";
|
||||||
import { TidalIcon, QobuzIcon, AmazonIcon } from "./PlatformIcons";
|
import { TidalIcon, QobuzIcon, AmazonIcon } from "./PlatformIcons";
|
||||||
const formatDate = (timestamp: number) => {
|
const formatDate = (timestamp: number) => {
|
||||||
const date = new Date(timestamp * 1000);
|
const date = new Date(timestamp * 1000);
|
||||||
@@ -191,7 +192,7 @@ export function HistoryPage({ onHistorySelect }: HistoryPageProps) {
|
|||||||
if (url) {
|
if (url) {
|
||||||
const audio = new Audio(url);
|
const audio = new Audio(url);
|
||||||
audioRef.current = audio;
|
audioRef.current = audio;
|
||||||
audio.volume = 0.5;
|
audio.volume = SPOTIFY_PREVIEW_VOLUME;
|
||||||
audio.onended = () => setPlayingPreviewId(null);
|
audio.onended = () => setPlayingPreviewId(null);
|
||||||
audio.play();
|
audio.play();
|
||||||
setPlayingPreviewId(id);
|
setPlayingPreviewId(id);
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
|||||||
const [isIssuesDialogOpen, setIsIssuesDialogOpen] = useState(false);
|
const [isIssuesDialogOpen, setIsIssuesDialogOpen] = useState(false);
|
||||||
const [hasIssueAgreement, setHasIssueAgreement] = useState(false);
|
const [hasIssueAgreement, setHasIssueAgreement] = useState(false);
|
||||||
const analyzerIconRef = useRef<ActivityIconHandle>(null);
|
const analyzerIconRef = useRef<ActivityIconHandle>(null);
|
||||||
const converterIconRef = useRef<FileMusicIconHandle>(null);
|
|
||||||
const resamplerIconRef = useRef<AudioLinesIconHandle>(null);
|
const resamplerIconRef = useRef<AudioLinesIconHandle>(null);
|
||||||
|
const converterIconRef = useRef<FileMusicIconHandle>(null);
|
||||||
const fileManagerIconRef = useRef<FilePenIconHandle>(null);
|
const fileManagerIconRef = useRef<FilePenIconHandle>(null);
|
||||||
const handleIssuesDialogChange = (open: boolean) => {
|
const handleIssuesDialogChange = (open: boolean) => {
|
||||||
setIsIssuesDialogOpen(open);
|
setIsIssuesDialogOpen(open);
|
||||||
@@ -116,14 +116,14 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
|||||||
<ActivityIcon ref={analyzerIconRef} size={16}/>
|
<ActivityIcon ref={analyzerIconRef} size={16}/>
|
||||||
<span>Audio Quality Analyzer</span>
|
<span>Audio Quality Analyzer</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => onPageChange("audio-converter")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(converterIconRef)}>
|
|
||||||
<FileMusicIcon ref={converterIconRef} size={16}/>
|
|
||||||
<span>Audio Converter</span>
|
|
||||||
</DropdownMenuItem>
|
|
||||||
<DropdownMenuItem onClick={() => onPageChange("audio-resampler")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(resamplerIconRef)}>
|
<DropdownMenuItem onClick={() => onPageChange("audio-resampler")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(resamplerIconRef)}>
|
||||||
<AudioLinesIcon ref={resamplerIconRef} size={16}/>
|
<AudioLinesIcon ref={resamplerIconRef} size={16}/>
|
||||||
<span>Audio Resampler</span>
|
<span>Audio Resampler</span>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
|
<DropdownMenuItem onClick={() => onPageChange("audio-converter")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(converterIconRef)}>
|
||||||
|
<FileMusicIcon ref={converterIconRef} size={16}/>
|
||||||
|
<span>Audio Converter</span>
|
||||||
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem onClick={() => onPageChange("file-manager")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(fileManagerIconRef)}>
|
<DropdownMenuItem onClick={() => onPageChange("file-manager")} className="gap-3 cursor-pointer py-2 px-3" {...getAnimatedItemHandlers(fileManagerIconRef)}>
|
||||||
<FilePenIcon ref={fileManagerIconRef} size={16}/>
|
<FilePenIcon ref={fileManagerIconRef} size={16}/>
|
||||||
<span>File Manager</span>
|
<span>File Manager</span>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { GetPreviewURL } from "@/../wailsjs/go/main/App";
|
import { GetPreviewURL } from "@/../wailsjs/go/main/App";
|
||||||
|
import { SPOTIFY_PREVIEW_VOLUME } from "@/lib/preview";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
export function usePreview() {
|
export function usePreview() {
|
||||||
const [loadingPreview, setLoadingPreview] = useState<string | null>(null);
|
const [loadingPreview, setLoadingPreview] = useState<string | null>(null);
|
||||||
@@ -38,6 +39,7 @@ export function usePreview() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const audio = new Audio(previewURL);
|
const audio = new Audio(previewURL);
|
||||||
|
audio.volume = SPOTIFY_PREVIEW_VOLUME;
|
||||||
audio.addEventListener("loadeddata", () => {
|
audio.addEventListener("loadeddata", () => {
|
||||||
setLoadingPreview(null);
|
setLoadingPreview(null);
|
||||||
setPlayingTrack(trackId);
|
setPlayingTrack(trackId);
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export const SPOTIFY_PREVIEW_VOLUME = 1;
|
||||||
Reference in New Issue
Block a user