style(ui): redesign app layout to native macOS density and refine visual theme

- Adjusted overall layout scale to perfectly match original native macOS density.

- Refined sidebar into a floating rounded slab with proper padding, border, and toggle button placement.

- Fixed drag region overlap preventing button interactions in the title bar.

- Removed artificial shadow lines and scrollbars from the sidebar.

- Updated Tauri backend configuration, dependencies, and scheduler functions for improved stability.
This commit is contained in:
NimBold
2026-06-14 08:36:53 +03:30
parent 4ec1c4fdf6
commit 796d00d527
12 changed files with 941 additions and 597 deletions
+155 -153
View File
@@ -5,7 +5,6 @@ import { SidebarFilter } from './Sidebar';
import { Play, Pause, Plus, Trash2, FileText, Image as ImageIcon, Music, Film, Box, Archive, FileQuestion, MoreVertical, PanelLeft } from 'lucide-react';
import { invoke } from '@tauri-apps/api/core';
import { homeDir } from '@tauri-apps/api/path';
import { WindowDragRegion } from './WindowDragRegion';
interface DownloadTableProps {
filter: SidebarFilter;
@@ -13,7 +12,7 @@ interface DownloadTableProps {
export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
const { downloads, toggleAddModal, updateDownload, removeDownload, clearFinished, redownload } = useDownloadStore();
const { isSidebarVisible, toggleSidebar, listRowDensity } = useSettingsStore();
const { isSidebarVisible, toggleSidebar } = useSettingsStore();
const [contextMenu, setContextMenu] = useState<{ x: number; y: number; id: string } | null>(null);
@@ -87,11 +86,7 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
};
const contextItem = contextMenu ? downloads.find(d => d.id === contextMenu.id) : null;
const rowPadding = {
compact: 'py-2',
standard: 'py-2.5',
relaxed: 'py-3.5'
}[listRowDensity];
const getCategoryIcon = (category: string) => {
switch(category) {
@@ -107,174 +102,181 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
}
return (
<div className="flex-1 flex flex-col bg-transparent h-full relative p-3 pb-0">
<div className="app-surface shrink-0 rounded-xl mb-3 z-10">
<WindowDragRegion className={!isSidebarVisible ? 'pl-20' : ''} />
{/* Download Toolbar */}
<div className={`flex px-3 pb-2.5 pt-0.5 items-center ${!isSidebarVisible ? 'pl-20' : ''}`}>
<div className="downloads-view flex-1 flex flex-col h-full min-w-0">
<div className={`main-titlebar ${!isSidebarVisible ? 'pl-[80px]' : ''}`} data-tauri-drag-region>
{!isSidebarVisible && (
<button
onClick={toggleSidebar}
className="app-icon-button mr-2"
title="Toggle Sidebar"
className="app-icon-button relative z-50 h-7 w-7 mr-2"
title="Show Sidebar"
>
<PanelLeft size={17} strokeWidth={2} />
<PanelLeft size={16} strokeWidth={2} />
</button>
<div className="mr-auto">
<h2 className="text-[14px] font-semibold text-text-primary tracking-tight cursor-default">{getFilterTitle()}</h2>
<p className="mt-0.5 text-[10px] text-text-muted tabular-nums">
{filteredDownloads.length} {filteredDownloads.length === 1 ? 'item' : 'items'}
</p>
</div>
)}
<div className="main-titlebar-title cursor-default" data-tauri-drag-region>Firelink</div>
<div className="flex items-center gap-0.5">
<button
onClick={() => toggleAddModal(true)}
className="app-icon-button text-accent"
title="Add Download"
>
<Plus size={17} strokeWidth={2.25} />
</button>
<div className="mx-1 h-4 w-px bg-border-color"></div>
<button
onClick={() => {
filteredDownloads.filter(d => d.status === 'paused').forEach(d => handleResume(d));
}}
className="app-icon-button"
title="Resume All"
>
<Play size={15} fill="currentColor" className="opacity-80" />
</button>
<button
onClick={() => {
filteredDownloads.filter(d => d.status === 'downloading').forEach(d => handlePause(d.id));
}}
className="app-icon-button"
title="Pause All"
>
<Pause size={15} fill="currentColor" className="opacity-80" />
</button>
<div className="mx-1 h-4 w-px bg-border-color"></div>
<button
onClick={clearFinished}
className="app-icon-button hover:text-red-400"
title="Clear Finished"
>
<Trash2 size={15} strokeWidth={1.9} />
</button>
</div>
<div className="main-control-group">
<button className="main-control-button primary" onClick={() => toggleAddModal(true)} title="Add Download">
<Plus size={16} />
</button>
<button
className="main-control-button"
disabled={filteredDownloads.length === 0}
onClick={() => {
filteredDownloads.filter(d => d.status === 'paused').forEach(d => handleResume(d));
}}
title="Resume All"
>
<Play size={15} fill="currentColor" />
</button>
<button
className="main-control-button"
disabled={filteredDownloads.length === 0}
onClick={() => {
filteredDownloads.filter(d => d.status === 'downloading').forEach(d => handlePause(d.id));
}}
title="Pause All"
>
<Pause size={15} fill="currentColor" />
</button>
<button
className="main-control-button hover:!text-red-400"
disabled={filteredDownloads.length === 0}
onClick={clearFinished}
title="Clear Finished"
>
<Trash2 size={15} />
</button>
</div>
</div>
{/* List */}
<div className="flex-1 overflow-auto bg-transparent pb-3 relative">
<div className="w-full text-left">
<div className="flex text-text-muted text-[9px] font-bold tracking-[0.12em] uppercase px-4 pb-2 pt-1 sticky top-0 z-0 bg-main-bg/85 backdrop-blur-md">
<div className="flex-1 min-w-[200px]">FILE</div>
<div className="w-32">SIZE</div>
<div className="w-32">STATUS</div>
<div className="w-28">SPEED</div>
<div className="w-28">ETA</div>
<div className="w-32 text-right pr-4">DATE ADDED</div>
</div>
<div className="flex flex-col gap-2">
{filteredDownloads.length === 0 ? (
<div className="app-card mx-1 mt-2 py-14 text-center">
<div className="flex flex-col items-center justify-center gap-3">
<div className="flex h-12 w-12 items-center justify-center rounded-2xl border border-border-color bg-bg-input text-text-muted">
<Box size={23} strokeWidth={1.6} />
</div>
<div>
<p className="text-[13px] font-semibold text-text-primary">No downloads here</p>
<p className="mt-1 text-[11px] text-text-muted">Add a link to start a new transfer.</p>
</div>
<button onClick={() => toggleAddModal(true)} className="app-button app-button-primary mt-1 px-3 text-[11px]">
<Plus size={14} /> Add Download
</button>
<div className="downloads-content-header">
<div className="downloads-title">
{getFilterTitle()}
<span className="downloads-count">{filteredDownloads.length}</span>
</div>
</div>
<div className="downloads-table flex-1 flex flex-col">
<div className="download-table-header">
<div>File Name</div>
<div>Size</div>
<div>Status</div>
<div>Speed</div>
<div>ETA</div>
<div className="download-cell-right">Date Added</div>
</div>
<div className="download-table-body">
{filteredDownloads.length === 0 ? (
<div className="h-full overflow-auto">
<div className="download-row download-empty-row">
<div className="download-file-cell">
<FileQuestion size={15} />
<span className="download-file-name">
No downloads yet · Use + to add a link
</span>
</div>
<div></div>
<div>Idle</div>
<div></div>
<div></div>
<div className="download-cell-right"></div>
</div>
) : (
filteredDownloads.map(d => (
{Array.from({ length: 12 }).map((_, index) => (
<div key={index} className="download-ghost-row" />
))}
</div>
) : (
<div className="h-full overflow-auto">
{filteredDownloads.map(d => (
<div
key={d.id}
className={`group mx-1 flex items-center rounded-lg border border-border-color bg-bg-modal/30 px-4 ${rowPadding} cursor-default transition-colors duration-150 hover:border-border-modal hover:bg-item-hover/50`}
className="download-row group cursor-default relative"
onContextMenu={(e) => {
e.preventDefault();
setContextMenu({
x: e.clientX,
y: e.clientY,
id: d.id
});
setContextMenu({ x: e.clientX, y: e.clientY, id: d.id });
}}
>
<div className="flex-1 min-w-[200px] text-[13px] text-text-primary pr-4">
<div className="flex items-center gap-3">
<div className="flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] border border-border-color bg-bg-input text-text-muted">
{getCategoryIcon(d.category)}
</div>
<span className="font-medium truncate max-w-[280px]">{d.fileName}</span>
</div>
</div>
<div className="w-32 pr-4">
{d.status === 'downloading' || d.status === 'paused' ? (
<div className="w-full">
<div className="w-full bg-border-color/30 rounded-full h-1.5 mb-1.5 overflow-hidden">
<div className={`h-1.5 rounded-full transition-all duration-300 ${d.status === 'paused' ? 'bg-orange-500' : 'bg-accent'}`} style={{ width: `${(d.fraction || 0) * 100}%` }}></div>
</div>
<div className="text-[11px] text-text-muted font-medium">
{((d.fraction || 0) * 100).toFixed(1)}%
</div>
</div>
) : (
<span className="text-[12px] text-text-secondary font-medium">{d.size || '-'}</span>
)}
</div>
<div className="w-32">
<span className={`inline-flex items-center px-2 py-0.5 rounded-md text-[10px] font-bold tracking-widest uppercase shadow-sm ${
d.status === 'completed' ? 'bg-green-500/10 text-green-500 border border-green-500/20' :
d.status === 'downloading' ? 'bg-accent/10 text-accent border border-accent/20' :
d.status === 'failed' ? 'bg-red-500/10 text-red-500 border border-red-500/20' :
d.status === 'paused' ? 'bg-orange-500/10 text-orange-500 border border-orange-500/20' :
'bg-item-hover text-text-muted border border-border-color/30'
}`}>
{d.status}
<div className="download-file-cell">
<span className="shrink-0 text-text-muted">
{getCategoryIcon(d.category)}
</span>
<span className="download-file-name">
{d.fileName}
</span>
</div>
<div className="w-28 text-[12px] text-text-secondary font-medium">{d.speed}</div>
<div className="w-28 text-[12px] text-text-secondary font-medium">{d.eta}</div>
<div className="w-32 relative text-right pr-4">
<div className="flex items-center justify-end">
<span className="text-[12px] text-text-secondary font-medium group-hover:opacity-0 transition-opacity duration-200">
{d.dateAdded ? new Date(d.dateAdded).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }) : '-'}
</span>
<div className="flex justify-end gap-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-200 absolute right-4 top-1/2 -translate-y-1/2">
{d.status === 'downloading' && (
<button onClick={() => handlePause(d.id)} className="app-icon-button h-7 w-7 border border-border-color bg-bg-modal hover:text-orange-400" title="Pause">
<Pause size={14} fill="currentColor" />
</button>
)}
{d.status === 'paused' && (
<button onClick={() => handleResume(d)} className="app-icon-button h-7 w-7 border border-border-color bg-bg-modal hover:text-green-400" title="Resume">
<Play size={14} fill="currentColor" />
</button>
)}
<button
onClick={(e) => {
e.stopPropagation();
setContextMenu({ x: e.clientX, y: e.clientY, id: d.id });
}}
className="app-icon-button h-7 w-7 border border-border-color bg-bg-modal hover:text-accent"
title="More Actions"
>
<MoreVertical size={14} />
</button>
<div>
<span className="tabular-nums">
{d.status === 'downloading' || d.status === 'paused'
? `${((d.fraction || 0) * parseInt((d.size || '').replace(/[^0-9.]/g, '') || '0')).toFixed(1)} GB / ${d.size || '-'}`
: d.size || '-'}
</span>
</div>
<div>
<div className="flex flex-col justify-center gap-1.5">
<div className="download-progress-status">
<span className={`truncate text-[12px] ${d.status === 'completed' ? 'download-status-completed' : d.status === 'paused' ? 'download-status-paused' : d.status === 'failed' ? 'download-status-failed' : 'download-status-downloading'}`}>
{d.status === 'downloading' || d.status === 'paused' ? `${((d.fraction || 0) * 100).toFixed(0)}%` : d.status.charAt(0).toUpperCase() + d.status.slice(1)}
</span>
</div>
{(d.status === 'downloading' || d.status === 'paused') && (
<div className="download-progress-track">
<div className={`download-progress-fill transition-all duration-300 ease-out ${d.status === 'paused' ? 'paused' : ''}`} style={{ width: `${(d.fraction || 0) * 100}%` }}></div>
</div>
)}
</div>
</div>
<div>
<span className="tabular-nums">{d.status === 'downloading' ? d.speed : '-'}</span>
</div>
<div>
<span className="tabular-nums">{d.status === 'downloading' ? d.eta : '-'}</span>
</div>
<div className="download-cell-right">
<span className="truncate group-hover:hidden tabular-nums ml-auto">
{d.dateAdded ? new Date(d.dateAdded).toLocaleDateString() : '-'}
</span>
<div className="hidden group-hover:flex items-center justify-end gap-0.5 w-full ml-auto">
{d.status === 'downloading' && (
<button onClick={() => handlePause(d.id)} className="app-icon-button h-7 w-7" title="Pause">
<Pause size={14} fill="currentColor" />
</button>
)}
{d.status === 'paused' && (
<button onClick={() => handleResume(d)} className="app-icon-button h-7 w-7" title="Resume">
<Play size={14} fill="currentColor" />
</button>
)}
<button
onClick={(e) => {
e.stopPropagation();
setContextMenu({ x: e.clientX, y: e.clientY, id: d.id });
}}
className="app-icon-button h-7 w-7"
title="Options"
>
<MoreVertical size={14} />
</button>
</div>
</div>
</div>
))
)}
</div>
))}
{Array.from({ length: Math.max(0, 10 - filteredDownloads.length) }).map((_, index) => (
<div key={`ghost-${index}`} className="download-ghost-row" />
))}
</div>
)}
</div>
</div>
+145 -213
View File
@@ -236,89 +236,69 @@ export default function SettingsView() {
{/* Downloads Pane */}
{activeTab === 'downloads' && (
<div className="settings-pane space-y-6 max-w-[760px]">
<h3 className="text-base font-bold text-text-primary border-b border-border-color/30 pb-2">Download Options</h3>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">Parallel downloads:</label>
<div className="flex items-center gap-4">
<input
type="range" min="1" max="12"
value={settings.maxConcurrentDownloads}
onChange={(e) => settings.setMaxConcurrentDownloads(Number(e.target.value))}
className="flex-1 accent-accent"
/>
<span className="w-8 text-center font-mono font-bold bg-item-hover px-2 py-1 rounded border border-border-modal text-text-secondary">
{settings.maxConcurrentDownloads}
</span>
<div className="settings-pane max-w-[760px]">
<div className="mac-settings-group">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Parallel downloads</span>
<div className="flex items-center gap-3">
<span className="text-text-muted text-[13px] w-6 text-right">{settings.maxConcurrentDownloads}</span>
<input
type="range" min="1" max="12"
value={settings.maxConcurrentDownloads}
onChange={(e) => settings.setMaxConcurrentDownloads(Number(e.target.value))}
className="accent-accent w-24"
/>
</div>
</div>
</div>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">Default connections:</label>
<div className="flex items-center gap-4">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Default connections</span>
<input
type="number" min="1" max="16"
value={settings.perServerConnections}
onChange={(e) => settings.setPerServerConnections(Number(e.target.value))}
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 w-24 text-text-primary focus:outline-none focus:border-accent"
className="app-control w-16 text-center"
/>
<span className="text-text-muted text-xs">For new downloads (1 to 16)</span>
</div>
</div>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">Global speed limit:</label>
<div className="flex items-center gap-4">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Global speed limit</span>
<input
type="text"
value={settings.globalSpeedLimit}
onChange={(e) => settings.setGlobalSpeedLimit(e.target.value)}
placeholder="Unlimited"
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 w-32 font-mono text-text-primary focus:outline-none focus:border-accent"
placeholder="0"
className="app-control w-24 text-center font-mono"
/>
<span className="text-text-muted text-xs">e.g. 500K, 1M, or 0 for unlimited</span>
</div>
</div>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">Automatic retries:</label>
<div className="flex items-center gap-4">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Automatic retries</span>
<input
type="number" min="0" max="10"
value={settings.maxAutomaticRetries}
onChange={(e) => settings.setMaxAutomaticRetries(Number(e.target.value))}
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 w-24 text-text-primary focus:outline-none focus:border-accent"
className="app-control w-16 text-center"
/>
<span className="text-text-muted text-xs">If a connection fails (0 to 10)</span>
</div>
</div>
<div className="border-t border-border-color/30 pt-4 space-y-3">
<label className="flex items-start gap-3 cursor-default select-none text-[13px] text-text-secondary">
<div className="mac-settings-group">
<label className="mac-settings-row cursor-default">
<span className="text-[13px] text-text-primary">Show completion notifications</span>
<input
type="checkbox"
checked={settings.showNotifications}
onChange={(e) => settings.setShowNotifications(e.target.checked)}
className="mt-0.5 rounded accent-accent"
className="mac-switch"
/>
<div>
<p className="font-semibold text-text-primary">Show notification when download completes</p>
<p className="text-text-muted text-xs mt-0.5">Alerts you in the System Notification Center</p>
</div>
</label>
<label className="flex items-start gap-3 cursor-default select-none text-[13px] text-text-secondary pl-6">
<label className="mac-settings-row cursor-default" style={{ opacity: settings.showNotifications ? 1 : 0.5 }}>
<span className="text-[13px] text-text-primary">Play completion sound</span>
<input
type="checkbox"
checked={settings.playCompletionSound && settings.showNotifications}
checked={settings.playCompletionSound}
disabled={!settings.showNotifications}
onChange={(e) => settings.setPlayCompletionSound(e.target.checked)}
className="mt-0.5 rounded accent-accent disabled:opacity-40"
className="mac-switch"
/>
<div>
<p className={`font-semibold ${settings.showNotifications ? 'text-text-primary' : 'text-text-muted'}`}>Play sound when download completes</p>
</div>
</label>
</div>
</div>
@@ -326,89 +306,69 @@ export default function SettingsView() {
{/* Look & Feel Pane */}
{activeTab === 'lookandfeel' && (
<div className="settings-pane space-y-6 max-w-[760px]">
<h3 className="text-base font-semibold text-text-primary border-b border-border-color pb-2">App Theme</h3>
<div className="grid grid-cols-[180px_1fr] items-start gap-4 text-[13px]">
<label className="text-text-secondary font-medium pt-1">Theme:</label>
<div className="space-y-2">
{[
{ value: 'system', label: 'System Default' },
{ value: 'light', label: 'Light' },
{ value: 'dark', label: 'Dark' },
{ value: 'dracula', label: 'Dracula' },
{ value: 'nord', label: 'Nord' },
].map(({ value, label }) => (
<label key={value} className="flex items-center gap-2 cursor-default select-none text-text-primary">
<input
type="radio"
name="themeRadio"
value={value}
checked={settings.theme === value}
onChange={() => settings.setTheme(value as typeof settings.theme)}
className="accent-accent"
/>
{label}
</label>
))}
<p className="text-text-muted text-xs mt-2">Select a color palette for the app's user interface.</p>
<div className="settings-pane max-w-[760px]">
<div className="mac-settings-group">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">App Theme</span>
<select
value={settings.theme}
onChange={(e) => settings.setTheme(e.target.value as any)}
className="app-control w-40"
>
<option value="system">System Default</option>
<option value="light">Light</option>
<option value="dark">Dark</option>
<option value="dracula">Dracula</option>
<option value="nord">Nord</option>
</select>
</div>
</div>
<h3 className="text-base font-semibold text-text-primary border-b border-border-color pb-2 pt-2">Display</h3>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">Font Size:</label>
<select
value={settings.appFontSize}
onChange={(e) => settings.setAppFontSize(e.target.value as any)}
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 text-[13px] text-text-primary focus:outline-none focus:border-accent max-w-[200px]"
>
<option value="small">Small</option>
<option value="standard">Standard</option>
<option value="large">Large</option>
</select>
<div className="mac-settings-group">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Font Size</span>
<select
value={settings.appFontSize}
onChange={(e) => settings.setAppFontSize(e.target.value as any)}
className="app-control w-40"
>
<option value="small">Small</option>
<option value="standard">Standard</option>
<option value="large">Large</option>
</select>
</div>
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">List Row Density</span>
<select
value={settings.listRowDensity}
onChange={(e) => settings.setListRowDensity(e.target.value as any)}
className="app-control w-40"
>
<option value="compact">Compact</option>
<option value="standard">Standard</option>
<option value="relaxed">Relaxed</option>
</select>
</div>
</div>
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary font-medium">List Row Density:</label>
<select
value={settings.listRowDensity}
onChange={(e) => settings.setListRowDensity(e.target.value as any)}
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 text-[13px] text-text-primary focus:outline-none focus:border-accent max-w-[200px]"
>
<option value="compact">Compact</option>
<option value="standard">Standard</option>
<option value="relaxed">Relaxed</option>
</select>
</div>
<h3 className="text-base font-semibold text-text-primary border-b border-border-color pb-2 pt-2">macOS Integration</h3>
<div className="space-y-4">
<label className="flex items-start gap-3 cursor-default select-none text-[13px] text-text-secondary">
<div className="mac-settings-group">
<label className="mac-settings-row cursor-default">
<span className="text-[13px] text-text-primary">Show badge on Dock icon</span>
<input
type="checkbox"
checked={settings.showDockBadge}
onChange={(e) => settings.setShowDockBadge(e.target.checked)}
className="mt-0.5 rounded accent-accent"
className="mac-switch"
/>
<div>
<p className="font-semibold text-text-primary">Show badge on Dock/Taskbar icon</p>
<p className="text-text-muted text-xs mt-0.5">Displays the number of active downloads on the icon badge.</p>
</div>
</label>
<label className="flex items-start gap-3 cursor-default select-none text-[13px] text-text-secondary">
<label className="mac-settings-row cursor-default">
<span className="text-[13px] text-text-primary">Show menu bar icon</span>
<input
type="checkbox"
checked={settings.showMenuBarIcon}
onChange={(e) => settings.setShowMenuBarIcon(e.target.checked)}
className="mt-0.5 rounded accent-accent"
className="mac-switch"
/>
<div>
<p className="font-semibold text-text-primary">Show menu bar icon</p>
<p className="text-text-muted text-xs mt-0.5">Provides quick access to downloads and queues from the system menu bar.</p>
</div>
</label>
</div>
</div>
@@ -416,77 +376,55 @@ export default function SettingsView() {
{/* Network Pane */}
{activeTab === 'network' && (
<div className="settings-pane space-y-6 max-w-[760px]">
<h3 className="text-base font-bold text-text-primary border-b border-border-color/30 pb-2">Proxy & User Agent</h3>
<div className="grid grid-cols-[180px_1fr] items-start gap-4 text-[13px]">
<label className="text-text-secondary font-medium pt-1">Proxy Mode:</label>
<div className="space-y-2">
<label className="flex items-center gap-2 cursor-default select-none text-text-secondary">
<input
type="radio" name="proxyMode" value="none"
checked={settings.proxyMode === 'none'}
onChange={() => settings.setProxyMode('none')}
className="accent-accent"
/>
No proxy
</label>
<label className="flex items-center gap-2 cursor-default select-none text-text-secondary">
<input
type="radio" name="proxyMode" value="system"
checked={settings.proxyMode === 'system'}
onChange={() => settings.setProxyMode('system')}
className="accent-accent"
/>
Use system proxy
</label>
<label className="flex items-center gap-2 cursor-default select-none text-text-secondary">
<input
type="radio" name="proxyMode" value="custom"
checked={settings.proxyMode === 'custom'}
onChange={() => settings.setProxyMode('custom')}
className="accent-accent"
/>
Set proxy
</label>
<div className="settings-pane max-w-[760px]">
<div className="mac-settings-group">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Proxy Mode</span>
<select
value={settings.proxyMode}
onChange={(e) => settings.setProxyMode(e.target.value as any)}
className="app-control w-40"
>
<option value="none">No proxy</option>
<option value="system">Use system proxy</option>
<option value="custom">Set custom proxy</option>
</select>
</div>
{settings.proxyMode === 'custom' && (
<>
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary pl-4">Proxy Host</span>
<input
type="text"
value={settings.proxyHost}
onChange={(e) => settings.setProxyHost(e.target.value)}
placeholder="127.0.0.1"
className="app-control w-40 font-mono"
/>
</div>
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary pl-4">Proxy Port</span>
<input
type="number"
value={settings.proxyPort}
onChange={(e) => settings.setProxyPort(Number(e.target.value))}
className="app-control w-24 text-center"
/>
</div>
</>
)}
</div>
{settings.proxyMode === 'custom' && (
<div className="bg-item-hover/30 border border-border-modal rounded-lg p-4 pl-6 space-y-4 max-w-[420px] ml-[180px]">
<div className="grid grid-cols-[80px_1fr] items-center gap-2 text-[13px]">
<label className="text-text-secondary">Host:</label>
<input
type="text"
value={settings.proxyHost}
onChange={(e) => settings.setProxyHost(e.target.value)}
placeholder="127.0.0.1"
className="bg-bg-input border border-border-modal rounded-md px-3 py-1 text-text-primary font-mono text-xs focus:outline-none"
/>
</div>
<div className="grid grid-cols-[80px_1fr] items-center gap-2 text-[13px]">
<label className="text-text-secondary">Port:</label>
<input
type="number"
value={settings.proxyPort}
onChange={(e) => settings.setProxyPort(Number(e.target.value))}
className="bg-bg-input border border-border-modal rounded-md px-3 py-1 text-text-primary font-mono text-xs w-[100px] focus:outline-none"
/>
</div>
</div>
)}
<div className="grid grid-cols-[180px_1fr] items-center gap-4 text-[13px] border-t border-border-color/30 pt-4">
<label className="text-text-secondary font-medium">User Agent:</label>
<div className="space-y-1">
<div className="mac-settings-group">
<div className="mac-settings-row">
<span className="text-[13px] text-text-primary">Custom User Agent</span>
<input
type="text"
value={settings.customUserAgent}
onChange={(e) => settings.setCustomUserAgent(e.target.value)}
placeholder="e.g. Mozilla/5.0..."
className="bg-bg-input border border-border-modal rounded-md px-3 py-1.5 w-full font-mono text-[11px] text-text-primary focus:outline-none focus:border-accent"
className="app-control flex-1 ml-4 font-mono text-[11px]"
/>
<p className="text-text-muted text-xs">Spoofs browser User-Agent to bypass download restrictions. Leave blank for default.</p>
</div>
</div>
</div>
@@ -494,69 +432,63 @@ export default function SettingsView() {
{/* Locations Pane */}
{activeTab === 'locations' && (
<div className="settings-pane space-y-6 max-w-[760px]">
<h3 className="text-base font-bold text-text-primary border-b border-border-color/30 pb-2">Download Directories</h3>
<div className="settings-pane max-w-[760px]">
<div className="mac-settings-group">
<label className="mac-settings-row cursor-default">
<span className="text-[13px] text-text-primary">Ask where to save each file</span>
<input
type="checkbox"
checked={settings.askWhereToSaveEachFile}
onChange={(e) => settings.setAskWhereToSaveEachFile(e.target.checked)}
className="mac-switch"
/>
</label>
</div>
<label className="flex items-start gap-3 cursor-default select-none text-[13px] text-text-secondary">
<input
type="checkbox"
checked={settings.askWhereToSaveEachFile}
onChange={(e) => settings.setAskWhereToSaveEachFile(e.target.checked)}
className="mt-0.5 rounded accent-accent"
/>
<div>
<p className="font-semibold text-text-primary">Ask where to save each file before downloading</p>
<p className="text-text-muted text-xs mt-0.5">When enabled, you choose the download location each time you add links.</p>
</div>
</label>
<div className="space-y-4 border-t border-border-color/30 pt-4">
<h4 className="text-[13px] font-bold text-text-primary">Default Categories Paths</h4>
{/* Bulk Directory Selector */}
<div className="grid grid-cols-[150px_1fr] items-center gap-4 text-[13px] bg-item-hover/35 p-3 rounded-lg border border-border-modal/40">
<label className="font-semibold text-text-primary">All Categories Base:</label>
<div className="mac-settings-group">
<div className="mac-settings-row bg-item-hover/20">
<span className="text-[13px] font-semibold text-text-primary">All Categories Base</span>
<div className="flex gap-2">
<input
type="text" readOnly placeholder="Choose base folder to sub-categorize..."
className="flex-1 bg-bg-input border border-border-modal rounded-md px-3 py-1 text-xs text-text-muted"
type="text" readOnly placeholder="Choose base folder..."
className="app-control w-48 text-text-muted text-[11px]"
/>
<button
onClick={handleBrowseBulk}
className="bg-accent hover:bg-accent text-white px-3 py-1 rounded-md text-xs font-semibold shadow transition-colors"
className="app-icon-button bg-accent/10 hover:bg-accent/20 text-accent font-semibold px-3"
>
Choose Base
Browse
</button>
</div>
</div>
{['Musics', 'Movies', 'Compressed', 'Documents', 'Pictures', 'Applications', 'Other'].map((category) => (
<div key={category} className="grid grid-cols-[150px_1fr] items-center gap-4 text-[13px]">
<label className="text-text-secondary capitalize">{category} folder:</label>
<div key={category} className="mac-settings-row">
<span className="text-[13px] text-text-primary pl-4">{category}</span>
<div className="flex gap-2">
<input
type="text"
value={(settings.downloadDirectories || {})[category] || ''}
onChange={(e) => settings.setCategoryDirectory(category, e.target.value)}
className="flex-1 bg-bg-input border border-border-modal rounded-md px-3 py-1 text-xs text-text-primary font-mono"
className="app-control w-48 text-[11px]"
/>
<button
onClick={() => handleBrowseCategory(category)}
className="bg-item-hover hover:bg-item-hover/80 text-text-primary border border-border-modal px-2.5 py-1 rounded-md text-xs"
className="app-icon-button hover:bg-item-hover text-text-secondary px-3"
>
Choose
Browse
</button>
</div>
</div>
))}
<div className="flex justify-end gap-2 pt-2 border-t border-border-color/30">
<div className="mac-settings-row justify-end border-t-0">
<button
onClick={() => {
settings.resetCategoryDirectories();
showToast("Reset directories to default");
}}
className="bg-item-hover hover:bg-item-hover/80 text-text-primary border border-border-modal px-4 py-1.5 rounded-md text-xs"
className="app-control hover:bg-item-hover text-text-secondary px-4 py-1"
>
Reset Defaults
</button>
+37 -44
View File
@@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
import {
Inbox, Zap, CheckCircle2, CircleDashed,
Film, Music, FileText, Box, Image as ImageIcon, Archive, FileQuestion,
List, CalendarClock, Gauge, Settings, Plus, Play, Pause, Edit2, Trash2
List, CalendarClock, Gauge, Settings, Plus, Play, Pause, Edit2, Trash2, PanelLeft
} from 'lucide-react';
import { useDownloadStore, DownloadCategory, Queue } from '../store/useDownloadStore';
import { ActiveView, useSettingsStore } from '../store/useSettingsStore';
@@ -18,7 +18,7 @@ interface SidebarProps {
export const Sidebar: React.FC<SidebarProps> = (props) => {
const { selectedFilter, onSelectFilter } = props;
const { downloads, queues, addQueue, renameQueue, removeQueue, startQueue, pauseQueue } = useDownloadStore();
const { activeView, setActiveView } = useSettingsStore();
const { activeView, setActiveView, toggleSidebar } = useSettingsStore();
const [isAddingQueue, setIsAddingQueue] = useState(false);
const [newQueueName, setNewQueueName] = useState('');
@@ -64,19 +64,13 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
<button
type="button"
data-active={isSelected}
className={`sidebar-nav-item group flex h-8 w-full items-center px-3.5 rounded-lg text-[12px] text-left cursor-default transition-colors duration-150 mb-0.5 ${
isSelected
? 'bg-item-selected text-text-primary font-semibold'
: 'text-text-secondary hover:bg-item-hover hover:text-text-primary'
}`}
className="sidebar-nav-item group flex w-full items-center text-[13px] text-left cursor-default font-medium"
onClick={() => onSelectFilter(filter)}
>
<Icon className={`w-4 h-4 mr-2.5 transition-colors ${isSelected ? 'text-accent' : 'text-text-muted group-hover:text-text-secondary'}`} strokeWidth={isSelected ? 2.25 : 1.8} />
<Icon className="w-[18px] h-[18px] mr-3 shrink-0" strokeWidth={isSelected ? 2.5 : 2} />
<span className="truncate">{label}</span>
{getCount(filter) > 0 && (
<span className={`ml-auto min-w-5 px-1.5 py-0.5 rounded-full text-center text-[10px] leading-none font-semibold transition-colors ${
isSelected ? 'bg-accent/15 text-accent' : 'bg-item-hover text-text-muted'
}`}>
<span className="sidebar-count ml-auto min-w-5 px-1.5 py-0.5 rounded-full text-center text-[10px] leading-none font-bold">
{getCount(filter)}
</span>
)}
@@ -134,18 +128,12 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
data-active={isSelected}
onContextMenu={e => handleQueueContextMenu(e, queue.id)}
onClick={() => onSelectFilter(filterId)}
className={`sidebar-nav-item group flex h-8 w-full items-center px-3.5 rounded-lg text-[12px] text-left cursor-default transition-colors duration-150 mb-0.5 ${
isSelected
? 'bg-item-selected text-text-primary font-semibold'
: 'text-text-secondary hover:bg-item-hover hover:text-text-primary'
}`}
className="sidebar-nav-item group flex w-full items-center text-[13px] text-left cursor-default font-medium"
>
<List className={`w-4 h-4 mr-2.5 shrink-0 transition-colors ${isSelected ? 'text-accent' : 'text-text-muted group-hover:text-text-secondary'}`} strokeWidth={isSelected ? 2.25 : 1.8} />
<List className="w-[18px] h-[18px] mr-3 shrink-0" strokeWidth={isSelected ? 2.5 : 2} />
<span className="truncate">{queue.name}</span>
{getCount(filterId) > 0 && (
<span className={`ml-auto min-w-5 px-1.5 py-0.5 rounded-full text-center text-[10px] leading-none font-semibold shrink-0 transition-colors ${
isSelected ? 'bg-accent/15 text-accent' : 'bg-item-hover text-text-muted'
}`}>
<span className="sidebar-count ml-auto min-w-5 px-1.5 py-0.5 rounded-full text-center text-[10px] leading-none font-bold shrink-0">
{getCount(filterId)}
</span>
)}
@@ -160,30 +148,39 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
type="button"
data-active={isSelected}
onClick={() => setActiveView(view)}
className={`sidebar-nav-item group flex h-8 w-full items-center px-3.5 rounded-lg text-[12px] text-left cursor-default transition-colors duration-150 mb-0.5 ${
isSelected ? 'bg-item-selected text-text-primary font-semibold' : 'text-text-secondary hover:bg-item-hover hover:text-text-primary'
}`}
className="sidebar-nav-item group flex w-full items-center text-[13px] text-left cursor-default font-medium"
>
<Icon className={`w-4 h-4 mr-2.5 transition-colors ${isSelected ? 'text-accent' : 'text-text-muted group-hover:text-text-secondary'}`} strokeWidth={isSelected ? 2.25 : 1.8} />
<Icon className="w-[18px] h-[18px] mr-3 shrink-0" strokeWidth={isSelected ? 2.5 : 2} />
<span>{label}</span>
</button>
);
};
return (
<aside className="w-full h-full flex flex-col relative shrink-0">
<WindowDragRegion />
<div className="overflow-y-auto flex-1 px-3 pb-3">
<section className="mb-4">
<div className="text-[9px] font-bold tracking-[0.14em] text-text-muted uppercase px-3.5 mb-1.5">Library</div>
<aside className="sidebar-inner">
<div className="sidebar-top-region">
<WindowDragRegion />
<button
type="button"
onClick={toggleSidebar}
className="sidebar-toggle-button"
title="Hide Sidebar"
>
<PanelLeft size={14} strokeWidth={1.9} />
</button>
</div>
<div className="sidebar-scroll">
<section className="sidebar-section">
<div className="sidebar-section-label">Library</div>
<NavItem icon={Inbox} label="All" filter="all" />
<NavItem icon={Zap} label="Active" filter="active" />
<NavItem icon={CheckCircle2} label="Completed" filter="completed" />
<NavItem icon={CircleDashed} label="Unfinished" filter="unfinished" />
</section>
<section className="mb-4">
<div className="text-[9px] font-bold tracking-[0.14em] text-text-muted uppercase px-3.5 mb-1.5">Folders</div>
<section className="sidebar-section">
<div className="sidebar-section-label">Folders</div>
<NavItem icon={Music} label="Musics" filter="Musics" />
<NavItem icon={Film} label="Movies" filter="Movies" />
<NavItem icon={Archive} label="Compressed" filter="Compressed" />
@@ -193,13 +190,13 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
<NavItem icon={FileQuestion} label="Other" filter="Other" />
</section>
<section className="mb-4">
<div className="text-[9px] font-bold tracking-[0.14em] text-text-muted uppercase px-3.5 mb-1.5">Queues</div>
<section className="sidebar-section">
<div className="sidebar-section-label">Queues</div>
{queues.map(queue => (
<QueueItem key={queue.id} queue={queue} />
))}
{isAddingQueue ? (
<div className="flex items-center px-2.5 py-1 rounded-lg bg-item-hover">
<div className="flex items-center px-3.5 py-1.5 rounded-lg bg-item-hover mb-1">
<Plus className="w-4 h-4 mr-2 text-text-secondary shrink-0" strokeWidth={2} />
<input
ref={addInputRef}
@@ -219,7 +216,7 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
<button
type="button"
onClick={() => { setIsAddingQueue(true); setNewQueueName(''); }}
className="flex w-full items-center px-3.5 py-1.5 rounded-lg text-[12px] text-text-muted hover:bg-item-hover hover:text-text-secondary cursor-default transition-colors"
className="flex w-full items-center px-3.5 py-1.5 rounded-lg text-[13px] text-text-muted hover:bg-item-hover hover:text-text-secondary cursor-default transition-colors mb-1"
>
<Plus className="w-4 h-4 mr-2 shrink-0" strokeWidth={2} />
<span className="truncate">Add new queue</span>
@@ -227,25 +224,21 @@ export const Sidebar: React.FC<SidebarProps> = (props) => {
)}
</section>
<section className="mt-auto pt-4 border-t border-border-color/30">
<div className="text-[9px] font-bold tracking-[0.14em] text-text-muted uppercase px-3.5 mb-1.5">Tools</div>
<section className="sidebar-section">
<div className="sidebar-section-label">Tools</div>
<ToolItem icon={CalendarClock} label="Scheduler" view="scheduler" />
<ToolItem icon={Gauge} label="Speed Limiter" view="speedLimiter" />
</section>
</div>
<div className="shrink-0 border-t border-border-color bg-sidebar-bg px-3 py-2">
<div className="sidebar-footer">
<button
type="button"
data-active={activeView === 'settings'}
onClick={() => setActiveView('settings')}
className={`sidebar-nav-item flex h-8 w-full items-center px-3.5 rounded-lg text-[12px] text-left cursor-default transition-colors ${
activeView === 'settings'
? 'bg-item-selected text-text-primary font-semibold'
: 'text-text-secondary hover:bg-item-hover hover:text-text-primary'
}`}
className="sidebar-nav-item sidebar-settings-button group flex w-full items-center text-[13px] text-left cursor-default font-medium transition-colors"
>
<Settings className={`w-4 h-4 mr-2 ${activeView === 'settings' ? 'text-accent' : 'text-text-muted'}`} strokeWidth={activeView === 'settings' ? 2.25 : 1.8} />
<Settings className={`w-[18px] h-[18px] mr-3 shrink-0 ${activeView === 'settings' ? 'text-white' : 'text-text-muted'}`} strokeWidth={activeView === 'settings' ? 2.5 : 2} />
<span>Settings</span>
</button>
</div>