mirror of
https://github.com/nimbold/Firelink.git
synced 2026-07-27 20:40:12 +00:00
fix: resolve UI bugs and pasting behavior
- Add global Cmd+V keyboard paste support for downloading links - Restore striped background styling for alternate rows in download list - Add ghost rows to seamlessly fill empty download space - Map correctly formatted item size into the queue immediately - Remove unused Tauri manager imports from backend
This commit is contained in:
+19
@@ -155,6 +155,25 @@ function App() {
|
||||
initNotifications();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handlePaste = (e: ClipboardEvent) => {
|
||||
if (
|
||||
e.target instanceof HTMLInputElement ||
|
||||
e.target instanceof HTMLTextAreaElement ||
|
||||
e.target instanceof HTMLSelectElement ||
|
||||
(e.target as HTMLElement).isContentEditable
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const text = e.clipboardData?.getData('text/plain');
|
||||
if (text && text.trim().length > 0) {
|
||||
useDownloadStore.getState().openAddModalWithUrls(text.trim());
|
||||
}
|
||||
};
|
||||
window.addEventListener('paste', handlePaste);
|
||||
return () => window.removeEventListener('paste', handlePaste);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const root = window.document.documentElement;
|
||||
|
||||
|
||||
@@ -613,7 +613,8 @@ export const AddDownloadsModal = () => {
|
||||
destination: finalLocation,
|
||||
isMedia: item.isMedia,
|
||||
mediaFormatSelector: formatSelector,
|
||||
queueId: selectedQueueId
|
||||
queueId: selectedQueueId,
|
||||
size: item.size || (item.sizeBytes ? formatBytes(item.sizeBytes) : undefined)
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Invalid URL or failed to add:", e);
|
||||
|
||||
@@ -209,10 +209,10 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
|
||||
|
||||
<div className="download-table-body">
|
||||
<div className="h-full overflow-auto flex flex-col">
|
||||
{filteredDownloads.map(d => (
|
||||
{filteredDownloads.map((d, index) => (
|
||||
<div
|
||||
key={d.id}
|
||||
className="download-row group cursor-default relative"
|
||||
className={`download-row group cursor-default relative ${index % 2 !== 0 ? 'striped' : ''}`}
|
||||
style={{ gridTemplateColumns: tableGridTemplate }}
|
||||
onContextMenu={(e) => {
|
||||
e.preventDefault();
|
||||
@@ -292,6 +292,15 @@ export const DownloadTable: React.FC<DownloadTableProps> = ({ filter }) => {
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
{Array.from({ length: Math.max(0, 50 - filteredDownloads.length) }).map((_, i) => {
|
||||
const globalIndex = filteredDownloads.length + i;
|
||||
return (
|
||||
<div
|
||||
key={`ghost-${i}`}
|
||||
className={`download-ghost-row ${globalIndex % 2 !== 0 ? 'striped' : ''}`}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
<div className="flex-1 bg-transparent pointer-events-none"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-1
@@ -1026,7 +1026,8 @@
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.download-ghost-row.striped {
|
||||
.download-ghost-row.striped,
|
||||
.download-row.striped {
|
||||
background: hsl(var(--stripe-bg));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user