Speed up downloads by combining multiple network connections in parallel
TypeScript bandwidth-aggregationcross-platformdesktop-appdownloaderdownloadmanagerlinuxmacosmulticonnectionparallel-downloadswindows
Keep the end date calendar mounted, and wait for history before moving a file in a test (#150)
Arpit Khandelwalef81b530c54c
diff --git a/e2e/selection.spec.ts b/e2e/selection.spec.tsindex 6bdcace..c151d16 100644--- a/e2e/selection.spec.ts+++ b/e2e/selection.spec.ts@@ -139,13 +139,19 @@ test('showing a file that has moved says so in a dialog, not on the page', asyncconst complete = await plexo.waitForStatus('completed')const { rename } = await import('node:fs/promises')const page = plexo.page+ // The window lists history again just after a download finishes and whenever it's focused,+ // checking each file. Move the file only once that listing is in (there are finished ones to+ // clear) and the menu is open, so neither can see it gone first.+ await expect(page.getByRole('button', { name: 'Clear finished list', exact: true })).toBeVisible()+ await page.getByRole('button', { name: `Open ${complete.fileName}`, exact: true }).click({+ button: 'right'+ })+ const showIn = page.getByRole('menuitem', { name: /^Show in/ })+ await expect(showIn).toBeVisible()// The window hasn't been told yet, so the menu still offers it.await rename(complete.destinationPath, `${complete.destinationPath}.moved`)try {- await page.getByRole('button', { name: `Open ${complete.fileName}`, exact: true }).click({- button: 'right'- })- await page.getByRole('menuitem', { name: /^Show in/ }).click()+ await showIn.click()const dialog = page.getByRole('alertdialog')await expect(dialog.getByText('Couldn’t show file', { exact: true })).toBeVisible()await expect(dialog.getByText('That file is no longer where it was saved.')).toBeVisible()diff --git a/src/renderer/src/components/ui/calendar.tsx b/src/renderer/src/components/ui/calendar.tsxindex 2b5d147..eafb2e6 100644--- a/src/renderer/src/components/ui/calendar.tsx+++ b/src/renderer/src/components/ui/calendar.tsx@@ -8,7 +8,8 @@ import {type DayButton,type Locale,type Root,- type Chevron+ type Chevron,+ type WeekNumber} from 'react-day-picker'import { Button, buttonVariants } from '@renderer/components/ui/button'@@ -28,6 +29,21 @@ function Calendar({buttonVariant?: React.ComponentProps<typeof Button>['variant']}): React.JSX.Element {const defaultClassNames = getDefaultClassNames()+ // Kept the same from one render to the next: a component made anew on each render is a new+ // type to React, so it would replace the calendar's DOM (and lose focus inside it) every time+ // the screen holding it re-renders.+ const calendarComponents = React.useMemo(+ () => ({+ Root: CalendarRoot,+ Chevron: CalendarChevron,+ DayButton: (props: React.ComponentProps<typeof DayButton>) => (+ <CalendarDayButton locale={locale} {...props} />+ ),+ WeekNumber: CalendarWeekNumber,+ ...components+ }),+ [locale, components]+ )return (<DayPicker@@ -119,38 +135,49 @@ function Calendar({hidden: cn('invisible', defaultClassNames.hidden),...classNames}}- components={{- Root: ({ className, rootRef, ...props }: React.ComponentProps<typeof Root>) => {- return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />- },- Chevron: ({ className, orientation, ...props }: React.ComponentProps<typeof Chevron>) => {- if (orientation === 'left') {- return <ChevronLeftIcon className={cn('size-4', className)} {...props} />- }-- if (orientation === 'right') {- return <ChevronRightIcon className={cn('size-4', className)} {...props} />- }-- return <ChevronDownIcon className={cn('size-4', className)} {...props} />- },- DayButton: ({ ...props }) => <CalendarDayButton locale={locale} {...props} />,- WeekNumber: ({ children, ...props }) => {- return (- <td {...props}>- <div className="flex size-(--cell-size) items-center justify-center text-center">- {children}- </div>- </td>- )- },- ...components- }}+ components={calendarComponents}{...props}/>)}+function CalendarRoot({+ className,+ rootRef,+ ...props+}: React.ComponentProps<typeof Root>): React.JSX.Element {+ return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />+}++function CalendarChevron({+ className,+ orientation,+ ...props+}: React.ComponentProps<typeof Chevron>): React.JSX.Element {+ if (orientation === 'left') {+ return <ChevronLeftIcon className={cn('size-4', className)} {...props} />+ }++ if (orientation === 'right') {+ return <ChevronRightIcon className={cn('size-4', className)} {...props} />+ }++ return <ChevronDownIcon className={cn('size-4', className)} {...props} />+}++function CalendarWeekNumber({+ children,+ ...props+}: React.ComponentProps<typeof WeekNumber>): React.JSX.Element {+ return (+ <td {...props}>+ <div className="flex size-(--cell-size) items-center justify-center text-center">+ {children}+ </div>+ </td>+ )+}+function CalendarDayButton({className,day,