Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove feature check
  • Loading branch information
regalijan committed Mar 26, 2024
1 parent 80be02d commit a7c7b42
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions app/routes/report.tsx
Expand Up @@ -39,7 +39,6 @@ export function meta() {
export default function () {
const [fileProgress, setFileProgress] = useState(0);
const [showSuccess, setShowSuccess] = useState(false);
const [supportsRequestStreams, setSupportsRequestStreams] = useState(false);
const toast = useToast();
const [uploading, setUploading] = useState(false);
const [loading, setLoading] = useState(false);
Expand All @@ -53,26 +52,6 @@ export default function () {
wmv: "video/x-ms-wmv",
};

useEffect(() => {
setSupportsRequestStreams(
(() => {
let duplexAccessed = false;

const hasContentType = new Request("", {
body: new ReadableStream(),
method: "POST",
// @ts-ignore
get duplex() {
duplexAccessed = true;
return "half";
},
}).headers.has("Content-Type");

return duplexAccessed && !hasContentType;
})(),
);
}, []);

const { logged_in, site_key } = useLoaderData<typeof loader>();

async function submit() {
Expand Down Expand Up @@ -213,6 +192,8 @@ export default function () {
xhr.send(files[i]);
}

setUploading(false);

if (shouldRecall) {
setLoading(false);
await fetch("/api/reports/recall", {
Expand Down Expand Up @@ -328,13 +309,10 @@ export default function () {
Submit
</Button>
<CircularProgress
display={uploading ? "" : "none"}
isIndeterminate={!supportsRequestStreams}
value={supportsRequestStreams ? fileProgress : undefined}
display={uploading ? undefined : "none"}
value={fileProgress}
>
{supportsRequestStreams ? (
<CircularProgressLabel>{fileProgress}%</CircularProgressLabel>
) : null}
<CircularProgressLabel>{fileProgress}%</CircularProgressLabel>
</CircularProgress>
</HStack>
</Container>
Expand Down

0 comments on commit a7c7b42

Please sign in to comment.