diff --git a/client/src/components/withCourse.tsx b/client/src/components/withCourse.tsx deleted file mode 100644 index 5fcc4b264..000000000 --- a/client/src/components/withCourse.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Alert, Col, Row } from 'antd'; -import * as React from 'react'; - -export function withCourse(WrappedComponent: React.ComponentType) { - return (props: any) => { - if (props.course || props.course === undefined) { - return ; - } - return ( - - - - - - ); - }; -} diff --git a/client/src/components/withCourseData.tsx b/client/src/components/withCourseData.tsx deleted file mode 100644 index 6c953219c..000000000 --- a/client/src/components/withCourseData.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { Alert, Col, Row } from 'antd'; -import { NextPageContext } from 'next'; -import * as React from 'react'; -import { Course } from 'services/models'; -import { UserService } from 'services/user'; -import { Session } from './withSession'; -import { getTokenFromContext } from 'utils/server'; - -function withCourseData(WrappedComponent: React.ComponentType, courseId?: number) { - return class extends React.PureComponent<{ course?: Course | null; session: Session }> { - static async getInitialProps(ctx: NextPageContext) { - try { - const alias = ctx.query.course; - const token = getTokenFromContext(ctx); - const courses = await new UserService(token).getCourses(); - const course = courses.find(c => (courseId ? c.id === courseId : c.alias === alias)) || null; - return { course }; - } catch (err) { - const error = err as Error; - console.error(error?.message); - return { course: undefined }; - } - } - - render() { - if (this.props.course || this.props.course === undefined) { - return ; - } - return ( - - - - - - ); - } - }; -} - -export default withCourseData; diff --git a/client/src/components/withCourses.tsx b/client/src/components/withCourses.tsx deleted file mode 100644 index 9207a1be8..000000000 --- a/client/src/components/withCourses.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { NextPageContext } from 'next'; -import * as React from 'react'; -import { UserService } from 'services/user'; -import { getTokenFromContext } from 'utils/server'; - -function withCourses(WrappedComponent: React.ComponentType) { - return class extends React.PureComponent { - static async getInitialProps(ctx: NextPageContext) { - try { - const token = getTokenFromContext(ctx); - if (token == null) { - return { courses: [] }; - } - const courses = await new UserService(token).getCourses(); - return { courses }; - } catch (err) { - const error = err as Error; - console.error(error?.message); - return { courses: [] }; - } - } - - render() { - return ; - } - }; -} - -export default withCourses; diff --git a/client/src/components/withLoader.tsx b/client/src/components/withLoader.tsx deleted file mode 100644 index 1a0599120..000000000 --- a/client/src/components/withLoader.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from 'react'; -import { LoadingScreen } from './LoadingScreen'; - -export const withLoader = - ({ type }: any) => - (WrappedComponent: React.ComponentType) => - (props: any) => { - if (type === 'display') { - return ( - - - - - ); - } else if (type === 'replace') { - return props.isLoading ? : ; - } - };