Skip to content

Commit

Permalink
Remove linting + comment out all unecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBacas committed Jul 19, 2024
1 parent 82ff9ab commit f27bfdb
Show file tree
Hide file tree
Showing 15 changed files with 538 additions and 604 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

8 changes: 0 additions & 8 deletions .github/workflows/CI_CD_Master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ jobs:
CI: 'true'
run: yarn install

- name: yarn lint
env:
CI: 'true'
NODE_ENV: 'production'
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY_STAGING }}
run: yarn lint

- name: yarn test
env:
CI: 'true'
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ jobs:
CI: 'true'
run: yarn install

- name: yarn lint
env:
CI: 'true'
NODE_ENV: 'production'
NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.SUPABASE_URL_STAGING }}
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY_STAGING }}
run: yarn lint

- name: yarn test
env:
CI: 'true'
Expand Down
46 changes: 0 additions & 46 deletions components/common/Spinner.tsx

This file was deleted.

216 changes: 108 additions & 108 deletions components/files/FileList.tsx
Original file line number Diff line number Diff line change
@@ -1,116 +1,116 @@
import { List, Box, Spinner, Button, Flex } from '@chakra-ui/react';
import React from 'react';
import { useQuery } from 'react-query';
import { FaSync, FaArrowUp } from 'react-icons/fa';
import { useDropzone } from 'react-dropzone';
// import { List, Box, Spinner, Button, Flex } from '@chakra-ui/react';
// import React from 'react';
// import { useQuery } from 'react-query';
// import { FaSync, FaArrowUp } from 'react-icons/fa';
// import { useDropzone } from 'react-dropzone';

import FileListeItem from './FileListItem';
// import FileListeItem from './FileListItem';

function arrayBufferToBase64(buffer) {
let binary = '';
let bytes = new Uint8Array(buffer);
let len = bytes.byteLength;
for (let i = 0; i < len; i++) {
binary += String.fromCharCode(bytes[i]);
}
return window.btoa(binary);
}
// function arrayBufferToBase64(buffer) {
// let binary = '';
// let bytes = new Uint8Array(buffer);
// let len = bytes.byteLength;
// for (let i = 0; i < len; i++) {
// binary += String.fromCharCode(bytes[i]);
// }
// return window.btoa(binary);
// }

function uploadFiles(refetchMethod: (value: any) => any) {
return function processFiles(acceptedFiles: File[]) {
const processes = acceptedFiles.map((file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
// function uploadFiles(refetchMethod: (value: any) => any) {
// return function processFiles(acceptedFiles: File[]) {
// const processes = acceptedFiles.map((file) => {
// return new Promise((resolve, reject) => {
// const reader = new FileReader();

reader.onabort = () => reject('file reading was aborted');
reader.onerror = () => reject('file reading has failed');
reader.onload = () => {
const fileContent = reader.result;
if (fileContent instanceof ArrayBuffer) {
return resolve({});
// return resolve(CreateFile(file.name, arrayBufferToBase64(fileContent)));
}
return reject('Wrong type recognized.');
};
reader.readAsArrayBuffer(file);
});
});
Promise.all(processes).then(refetchMethod);
};
}
// reader.onabort = () => reject('file reading was aborted');
// reader.onerror = () => reject('file reading has failed');
// reader.onload = () => {
// const fileContent = reader.result;
// if (fileContent instanceof ArrayBuffer) {
// return resolve({});
// // return resolve(CreateFile(file.name, arrayBufferToBase64(fileContent)));
// }
// return reject('Wrong type recognized.');
// };
// reader.readAsArrayBuffer(file);
// });
// });
// Promise.all(processes).then(refetchMethod);
// };
// }

function UploadFileButton(props) {
const { getRootProps, getInputProps } = useDropzone({
// onDrop: uploadFiles(props.refetch),
noDrag: true,
});
// function UploadFileButton(props) {
// const { getRootProps, getInputProps } = useDropzone({
// // onDrop: uploadFiles(props.refetch),
// noDrag: true,
// });

return (
<Button
{...getRootProps()}
aria-label="Upload file"
rightIcon={<FaArrowUp />}
width={{ base: 'auto', md: 150 }}
mr={{ base: 0, md: 10 }}
mb={{ base: 5, md: 10 }}
>
<input {...getInputProps()} />
Upload file
</Button>
);
}
// return (
// <Button
// {...getRootProps()}
// aria-label="Upload file"
// rightIcon={<FaArrowUp />}
// width={{ base: 'auto', md: 150 }}
// mr={{ base: 0, md: 10 }}
// mb={{ base: 5, md: 10 }}
// >
// <input {...getInputProps()} />
// Upload file
// </Button>
// );
// }

export default function FileList() {
const { isLoading, data, isFetching, refetch } = {
isLoading: true,
data: [],
isFetching: true,
refetch: (f) => f,
};
// const { isLoading, data, isFetching, refetch } = useQuery('files', () => ListFiles());
const { getRootProps } = useDropzone({
// onDrop: uploadFiles(refetch),
noClick: true,
});
// export default function FileList() {
// const { isLoading, data, isFetching, refetch } = {
// isLoading: true,
// data: [],
// isFetching: true,
// refetch: (f) => f,
// };
// // const { isLoading, data, isFetching, refetch } = useQuery('files', () => ListFiles());
// const { getRootProps } = useDropzone({
// // onDrop: uploadFiles(refetch),
// noClick: true,
// });

return isLoading ? (
<Box minHeight="250px" display="flex" alignItems="center" justifyContent="center">
<Spinner size="xl" />
</Box>
) : (
<Box
{...getRootProps({
style: {
outline: 'none',
},
})}
>
<Flex flexDirection={{ base: 'column', md: 'row' }}>
<Button
aria-label="Refresh"
rightIcon={isFetching ? <Spinner size="sm" /> : <FaSync />}
// onClick={() => refetch()}
width={{ base: 'auto', md: 150 }}
mr={{ base: 0, md: 10 }}
mb={{ base: 5, md: 10 }}
isDisabled={isFetching}
>
Refresh
</Button>
<UploadFileButton refetch={refetch} />
</Flex>
<List>
{data &&
data.map((f) => {
return (
<FileListeItem
key={f.name + '-' + f.properties.etag}
refetch={refetch}
{...f}
></FileListeItem>
);
})}
</List>
</Box>
);
}
// return isLoading ? (
// <Box minHeight="250px" display="flex" alignItems="center" justifyContent="center">
// <Spinner size="xl" />
// </Box>
// ) : (
// <Box
// {...getRootProps({
// style: {
// outline: 'none',
// },
// })}
// >
// <Flex flexDirection={{ base: 'column', md: 'row' }}>
// <Button
// aria-label="Refresh"
// rightIcon={isFetching ? <Spinner size="sm" /> : <FaSync />}
// // onClick={() => refetch()}
// width={{ base: 'auto', md: 150 }}
// mr={{ base: 0, md: 10 }}
// mb={{ base: 5, md: 10 }}
// isDisabled={isFetching}
// >
// Refresh
// </Button>
// <UploadFileButton refetch={refetch} />
// </Flex>
// <List>
// {data &&
// data.map((f) => {
// return (
// <FileListeItem
// key={f.name + '-' + f.properties.etag}
// refetch={refetch}
// {...f}
// ></FileListeItem>
// );
// })}
// </List>
// </Box>
// );
// }
Loading

0 comments on commit f27bfdb

Please sign in to comment.