diff --git a/src/partials/Points/PointsImpl.js b/src/partials/Points/PointsImpl.js index cbd8788b..abcecfa3 100644 --- a/src/partials/Points/PointsImpl.js +++ b/src/partials/Points/PointsImpl.js @@ -1,76 +1,76 @@ -import React from "react" -import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" -import CourseSettings from "../../../course-settings" +// import React from "react" +// import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" +// import CourseSettings from "../../../course-settings" -import { useQuery } from "@apollo/client/react" -import { gql } from "apollo-boost" -import { Button } from "@material-ui/core" -import OverallPoints from "./OverallPoints" +// import { useQuery } from "@apollo/client/react" +// import { gql } from "apollo-boost" +// import { Button } from "@material-ui/core" +// import OverallPoints from "./OverallPoints" -const PROGRESS = gql` - { - currentUser { - email - progress(course_id: "59314cb4-a9ca-43c9-b9a7-58c19325b44c") { - course { - id - name - } - user_course_progress { - id - progress - } - user_course_service_progresses { - id - progress - service { - id - name - } - } - } - } - } -` +// const PROGRESS = gql` +// { +// currentUser { +// email +// progress(course_id: "59314cb4-a9ca-43c9-b9a7-58c19325b44c") { +// course { +// id +// name +// } +// user_course_progress { +// id +// progress +// } +// user_course_service_progresses { +// id +// progress +// service { +// id +// name +// } +// } +// } +// } +// } +// ` -const Points = (props) => { - const course = props.course || CourseSettings.default.slug - const { data, loading, error, refetch } = useQuery(PROGRESS) +// const Points = (props) => { +// const course = props.course || CourseSettings.default.slug +// const { data, loading, error, refetch } = useQuery(PROGRESS) - if (loading) { - return <>Loading... - } +// if (loading) { +// return <>Loading... +// } - if (error) { - return <>Error while fetching progress: {error} - } +// if (error) { +// return <>Error while fetching progress: {error} +// } - if (!data || !data.currentUser) { - return ( - <> - -

Please log in to see your points.

- - ) - } +// if (!data || !data.currentUser) { +// return ( +// <> +// +//

Please log in to see your points.

+// +// ) +// } - const points = data.currentUser.progress.user_course_progress.progress[0] - const courseName = data.currentUser.progress.course.name - return ( - <> - - - ) -} +// const points = data.currentUser.progress.user_course_progress.progress[0] +// const courseName = data.currentUser.progress.course.name +// return ( +// <> +// +// +// ) +// } -export default withSimpleErrorBoundary(Points) +// export default withSimpleErrorBoundary(Points) diff --git a/src/partials/Points/index.js b/src/partials/Points/index.js index 2f01b9a1..635ace8e 100644 --- a/src/partials/Points/index.js +++ b/src/partials/Points/index.js @@ -1,38 +1,38 @@ -import React from "react" -import PointsImpl from "./PointsImpl" -import ApolloClient from "apollo-boost" -import { ApolloProvider } from "@apollo/client/react" -import { accessToken } from "../../services/moocfi" +// import React from "react" +// import PointsImpl from "./PointsImpl" +// import ApolloClient from "apollo-boost" +// import { ApolloProvider } from "@apollo/client/react" +// import { accessToken } from "../../services/moocfi" -export default class Points extends React.Component { - state = { - render: false, - } - componentDidMount() { - this.setState({ render: true }) - } - render() { - if (!this.state.render) { - return
Loading...
- } - const apolloClient = new ApolloClient({ - uri: "https://www.mooc.fi/api", - request: async (operation) => { - const token = accessToken() - if (!token) { - return - } - operation.setContext({ - headers: { - Authorization: `Bearer ${token}`, - }, - }) - }, - }) - return ( - - {" "} - - ) - } -} +// export default class Points extends React.Component { +// state = { +// render: false, +// } +// componentDidMount() { +// this.setState({ render: true }) +// } +// render() { +// if (!this.state.render) { +// return
Loading...
+// } +// const apolloClient = new ApolloClient({ +// uri: "https://www.mooc.fi/api", +// request: async (operation) => { +// const token = accessToken() +// if (!token) { +// return +// } +// operation.setContext({ +// headers: { +// Authorization: `Bearer ${token}`, +// }, +// }) +// }, +// }) +// return ( +// +// {" "} +// +// ) +// } +// } diff --git a/src/partials/index.js b/src/partials/index.js index 3e15bd24..74109c73 100644 --- a/src/partials/index.js +++ b/src/partials/index.js @@ -63,7 +63,7 @@ import RegistrationLink from "./RegistrationLink" import RegistrationLink2 from "./RegistrationLink2" import OnlyForCourseVariant from "./OnlyForCourseVariant" import OnlyForNotLoggedIn from "./OnlyForNotLoggedIn" -import Points from "./Points" +// import Points from "./Points" import WorkshopSchedule from "./WorkshopSchedule" const mapping = { @@ -108,7 +108,7 @@ const mapping = { h5: H5, h6: H6, hr: Hr, - points: Points, + // points: Points, } export default () => {