Explorar o código

delete useless code

tumao %!s(int64=4) %!d(string=hai) anos
pai
achega
459f798635

+ 0 - 37
client/src/hooks/CommonStyle.ts

@@ -1,37 +0,0 @@
-import { makeStyles } from '@material-ui/core';
-
-const useStyles = makeStyles(theme => ({
-  root: {
-    padding: `${theme.spacing(4)}px ${theme.spacing(4)}px`,
-    backgroundColor: '#f4f4f4',
-  },
-  titleWrapper: {
-    background: theme.palette.primary.light,
-    color: '#fff',
-    padding: theme.spacing(2),
-    '& h2': {
-      fontSize: '26px',
-    },
-  },
-  paper: {
-    color: theme.palette.text.secondary,
-    padding: theme.spacing(4),
-  },
-  titleContainer: {
-    display: 'flex',
-    padding: theme.spacing(1, 0, 2),
-  },
-  h2: {
-    fontSize: '26px',
-    fontWeight: 'bold',
-    margin: '0 10px 0 0',
-  },
-  tab: {
-    background: theme.palette.primary.main,
-    color: '#fff',
-  },
-}));
-
-export function usePageStyles() {
-  return useStyles();
-}

+ 0 - 29
client/src/hooks/Polling.ts

@@ -1,29 +0,0 @@
-import dayjs from 'dayjs';
-import { useEffect, useRef } from 'react';
-import { PollingTypeEnum } from '../consts/Polling';
-
-export const useInterval = (
-  callback: (isInterval?: boolean) => void,
-  delay: number | null,
-  type: PollingTypeEnum
-) => {
-  const savedCallback = useRef<(isInterval?: boolean) => void>(() => {});
-  useEffect(() => {
-    savedCallback.current = callback;
-  }, [callback]);
-
-  useEffect(() => {
-    const cb = () => {
-      console.log(
-        `starting fetch data for ${type}`,
-        dayjs().format('YYYY-MM-DD HH:mm:ss')
-      );
-      savedCallback.current(true);
-    };
-
-    if (delay !== null) {
-      let timer = setInterval(cb, delay);
-      return () => clearInterval(timer);
-    }
-  }, [delay, type]);
-};

+ 0 - 29
client/src/hooks/__test__/CommonStyle.spec.tsx

@@ -1,29 +0,0 @@
-import { render } from '@testing-library/react';
-
-import { usePageStyles } from '../CommonStyle';
-
-const setupUsePageStyles = () => {
-  const returnVal = {};
-
-  const TestComponent = () => {
-    Object.assign(returnVal, usePageStyles());
-    return null;
-  };
-
-  render(<TestComponent />);
-  return returnVal;
-};
-
-test('test usePageStyles', () => {
-  const style = setupUsePageStyles();
-  const expectedStyle = {
-    root: 'makeStyles-root-1',
-    titleWrapper: 'makeStyles-titleWrapper-2',
-    paper: 'makeStyles-paper-3',
-
-    titleContainer: 'makeStyles-titleContainer-4',
-    h2: 'makeStyles-h2-5',
-    tab: 'makeStyles-tab-6',
-  };
-  expect(style).toEqual(expectedStyle);
-});

+ 0 - 27
client/src/utils/Time.ts

@@ -1,27 +0,0 @@
-import dayjs from 'dayjs';
-
-export const getMonthOptions = (
-  start: number
-): { label: string; value: number }[] => {
-  const current = dayjs().endOf('month').valueOf();
-  let options: { label: string; value: number }[] = [];
-  let month = dayjs(start).endOf('month').valueOf();
-
-  while (month <= current) {
-    options = [
-      ...options,
-      {
-        label: dayjs(month).format('MMMM YYYY'),
-        value: dayjs(month).endOf('month').valueOf(),
-      },
-    ];
-
-    month = dayjs(month).add(1, 'M').valueOf();
-  }
-
-  return options;
-};
-
-export const formatDate = (time: number): string => {
-  return dayjs(time * 1000).format('YYYY-MM-DD HH:mm:ss');
-};

+ 0 - 10
client/src/utils/User.ts

@@ -1,10 +0,0 @@
-export const getEmailAndCode = (search: string): { [key: string]: string } => {
-  const s = search.slice(1);
-  const result: { [key: string]: string } = {};
-  s.split('&').forEach(item => {
-    const [key, value] = item.split('=');
-    result[key] = value;
-  });
-
-  return result;
-};