Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions src/app/(feed)/feed/import/ImportDropzone.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import clsx from "clsx";
import { type DragEvent, useRef, useState } from "react";
import { type DragEvent, type RefObject, useRef, useState } from "react";

type ImportDropzoneProps = {
inputElement: HTMLInputElement | null;
inputElementRef: RefObject<HTMLInputElement | null> | null;
onSelectFile: () => void;
filename: string;
};

export function ImportDropzone({
inputElement,
inputElementRef,
onSelectFile,
filename,
}: ImportDropzoneProps) {
const dropzoneRef = useRef<HTMLDivElement | null>(null);

Expand All @@ -21,10 +19,6 @@ export function ImportDropzone({
e.stopPropagation();
};

if (!!inputElement?.files?.length) {
return null;
}

return (
<div
ref={dropzoneRef}
Expand All @@ -45,7 +39,7 @@ export function ImportDropzone({
e.stopPropagation();
setIsDraggingOverDropzone(false);

if (!inputElement) return;
if (!inputElementRef?.current) return;

const files = e.dataTransfer.files;
const dataTransfer = new DataTransfer();
Expand All @@ -54,21 +48,21 @@ export function ImportDropzone({
dataTransfer.items.add(file);
});

inputElement.files = dataTransfer.files;
inputElementRef.current.files = dataTransfer.files;
onSelectFile();
}}
onClick={() => {
inputElement?.click();
inputElementRef?.current?.click();
}}
className={clsx(
"hover:bg-muted/30 border-muted grid h-64 w-full cursor-pointer place-items-center rounded-xl border border-dashed transition-colors",
"hover:bg-muted/30 border-foreground/40 grid h-64 w-full cursor-pointer place-items-center rounded-xl border border-dashed transition-colors",
{
"bg-muted/50": isDraggingOverDropzone,
},
)}
>
<div className="max-w-sm text-center">
Drag and drop your {filename} file here, or click/tap to upload
Drag and drop your file here, or click/tap to upload
</div>
</div>
);
Expand Down
65 changes: 0 additions & 65 deletions src/app/(feed)/feed/import/opml/OPMLSubscriptionImport.tsx

This file was deleted.

109 changes: 0 additions & 109 deletions src/app/(feed)/feed/import/opml/parseOPMLSubscriptionInput.ts

This file was deleted.

Loading