Skip to content

Commit 7272404

Browse files
committed
Disable old points visualization since its deps aren't working
1 parent 23227af commit 7272404

File tree

3 files changed

+107
-107
lines changed

3 files changed

+107
-107
lines changed

src/partials/Points/PointsImpl.js

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
import React from "react"
2-
import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary"
3-
import CourseSettings from "../../../course-settings"
1+
// import React from "react"
2+
// import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary"
3+
// import CourseSettings from "../../../course-settings"
44

5-
import { useQuery } from "@apollo/client/react"
6-
import { gql } from "apollo-boost"
7-
import { Button } from "@material-ui/core"
8-
import OverallPoints from "./OverallPoints"
5+
// import { useQuery } from "@apollo/client/react"
6+
// import { gql } from "apollo-boost"
7+
// import { Button } from "@material-ui/core"
8+
// import OverallPoints from "./OverallPoints"
99

10-
const PROGRESS = gql`
11-
{
12-
currentUser {
13-
email
14-
progress(course_id: "59314cb4-a9ca-43c9-b9a7-58c19325b44c") {
15-
course {
16-
id
17-
name
18-
}
19-
user_course_progress {
20-
id
21-
progress
22-
}
23-
user_course_service_progresses {
24-
id
25-
progress
26-
service {
27-
id
28-
name
29-
}
30-
}
31-
}
32-
}
33-
}
34-
`
10+
// const PROGRESS = gql`
11+
// {
12+
// currentUser {
13+
// email
14+
// progress(course_id: "59314cb4-a9ca-43c9-b9a7-58c19325b44c") {
15+
// course {
16+
// id
17+
// name
18+
// }
19+
// user_course_progress {
20+
// id
21+
// progress
22+
// }
23+
// user_course_service_progresses {
24+
// id
25+
// progress
26+
// service {
27+
// id
28+
// name
29+
// }
30+
// }
31+
// }
32+
// }
33+
// }
34+
// `
3535

36-
const Points = (props) => {
37-
const course = props.course || CourseSettings.default.slug
38-
const { data, loading, error, refetch } = useQuery(PROGRESS)
36+
// const Points = (props) => {
37+
// const course = props.course || CourseSettings.default.slug
38+
// const { data, loading, error, refetch } = useQuery(PROGRESS)
3939

40-
if (loading) {
41-
return <>Loading...</>
42-
}
40+
// if (loading) {
41+
// return <>Loading...</>
42+
// }
4343

44-
if (error) {
45-
return <>Error while fetching progress: {error}</>
46-
}
44+
// if (error) {
45+
// return <>Error while fetching progress: {error}</>
46+
// }
4747

48-
if (!data || !data.currentUser) {
49-
return (
50-
<>
51-
<Button
52-
onClick={() => {
53-
refetch()
54-
}}
55-
>
56-
Refresh
57-
</Button>
58-
<p>Please log in to see your points.</p>
59-
</>
60-
)
61-
}
48+
// if (!data || !data.currentUser) {
49+
// return (
50+
// <>
51+
// <Button
52+
// onClick={() => {
53+
// refetch()
54+
// }}
55+
// >
56+
// Refresh
57+
// </Button>
58+
// <p>Please log in to see your points.</p>
59+
// </>
60+
// )
61+
// }
6262

63-
const points = data.currentUser.progress.user_course_progress.progress[0]
64-
const courseName = data.currentUser.progress.course.name
65-
return (
66-
<>
67-
<OverallPoints
68-
refetch={refetch}
69-
courseName={courseName}
70-
progress={data.currentUser.progress}
71-
/>
72-
</>
73-
)
74-
}
63+
// const points = data.currentUser.progress.user_course_progress.progress[0]
64+
// const courseName = data.currentUser.progress.course.name
65+
// return (
66+
// <>
67+
// <OverallPoints
68+
// refetch={refetch}
69+
// courseName={courseName}
70+
// progress={data.currentUser.progress}
71+
// />
72+
// </>
73+
// )
74+
// }
7575

76-
export default withSimpleErrorBoundary(Points)
76+
// export default withSimpleErrorBoundary(Points)

src/partials/Points/index.js

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
import React from "react"
2-
import PointsImpl from "./PointsImpl"
3-
import ApolloClient from "apollo-boost"
4-
import { ApolloProvider } from "@apollo/client/react"
5-
import { accessToken } from "../../services/moocfi"
1+
// import React from "react"
2+
// import PointsImpl from "./PointsImpl"
3+
// import ApolloClient from "apollo-boost"
4+
// import { ApolloProvider } from "@apollo/client/react"
5+
// import { accessToken } from "../../services/moocfi"
66

7-
export default class Points extends React.Component {
8-
state = {
9-
render: false,
10-
}
11-
componentDidMount() {
12-
this.setState({ render: true })
13-
}
14-
render() {
15-
if (!this.state.render) {
16-
return <div>Loading...</div>
17-
}
18-
const apolloClient = new ApolloClient({
19-
uri: "https://www.mooc.fi/api",
20-
request: async (operation) => {
21-
const token = accessToken()
22-
if (!token) {
23-
return
24-
}
25-
operation.setContext({
26-
headers: {
27-
Authorization: `Bearer ${token}`,
28-
},
29-
})
30-
},
31-
})
32-
return (
33-
<ApolloProvider client={apolloClient}>
34-
<PointsImpl />{" "}
35-
</ApolloProvider>
36-
)
37-
}
38-
}
7+
// export default class Points extends React.Component {
8+
// state = {
9+
// render: false,
10+
// }
11+
// componentDidMount() {
12+
// this.setState({ render: true })
13+
// }
14+
// render() {
15+
// if (!this.state.render) {
16+
// return <div>Loading...</div>
17+
// }
18+
// const apolloClient = new ApolloClient({
19+
// uri: "https://www.mooc.fi/api",
20+
// request: async (operation) => {
21+
// const token = accessToken()
22+
// if (!token) {
23+
// return
24+
// }
25+
// operation.setContext({
26+
// headers: {
27+
// Authorization: `Bearer ${token}`,
28+
// },
29+
// })
30+
// },
31+
// })
32+
// return (
33+
// <ApolloProvider client={apolloClient}>
34+
// <PointsImpl />{" "}
35+
// </ApolloProvider>
36+
// )
37+
// }
38+
// }

src/partials/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ import RegistrationLink from "./RegistrationLink"
6363
import RegistrationLink2 from "./RegistrationLink2"
6464
import OnlyForCourseVariant from "./OnlyForCourseVariant"
6565
import OnlyForNotLoggedIn from "./OnlyForNotLoggedIn"
66-
import Points from "./Points"
66+
// import Points from "./Points"
6767
import WorkshopSchedule from "./WorkshopSchedule"
6868

6969
const mapping = {
@@ -108,7 +108,7 @@ const mapping = {
108108
h5: H5,
109109
h6: H6,
110110
hr: Hr,
111-
points: Points,
111+
// points: Points,
112112
}
113113

114114
export default () => {

0 commit comments

Comments
 (0)