diff --git a/.prettierrc b/.prettierrc index 36301bc5..c64c02e9 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ { "semi": false, - "singleQuote": true, - "trailingComma": "es5" + "singleQuote": false, + "trailingComma": "all" } diff --git a/src/components/Banner.js b/src/components/Banner.js index 8bfcdbbc..20f18e08 100644 --- a/src/components/Banner.js +++ b/src/components/Banner.js @@ -1,7 +1,7 @@ -import React from 'react' -import styled from 'styled-components' -import Bruce from '../images/banner.svg' -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary' +import React from "react" +import styled from "styled-components" +import Bruce from "../images/banner.svg" +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" const BannerWrapper = styled.header` height: 30rem; @@ -21,9 +21,9 @@ const BannerWrapper = styled.header` ` const Heading = styled.div` - font-family: 'Roboto Slab', -apple-system, BlinkMacSystemFont, 'Segoe UI', - Roboto, 'Helvetica Neue', Arial, Noto Sans, sans-serif, 'Apple Color Emoji', - 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; + font-family: "Roboto Slab", -apple-system, BlinkMacSystemFont, "Segoe UI", + Roboto, "Helvetica Neue", Arial, Noto Sans, sans-serif, "Apple Color Emoji", + "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; font-weight: 500; font-size: 2rem; color: #c0392b; diff --git a/src/components/Button.js b/src/components/Button.js index b6ee0b96..35719061 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -1,14 +1,14 @@ -import React from 'react' -import { Link } from 'gatsby' -import styled from 'styled-components' -import { Button as MaterialButton } from '@material-ui/core' -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary' +import React from "react" +import { Link } from "gatsby" +import styled from "styled-components" +import { Button as MaterialButton } from "@material-ui/core" +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" const StyledLink = styled(Link)` margin: 1rem 0.5rem; ` -const Button = ({ children, to, onClick, disabled, variant = 'outlined' }) => ( +const Button = ({ children, to, onClick, disabled, variant = "outlined" }) => ( diff --git a/src/components/EndOfSubSection.js b/src/components/EndOfSubSection.js index 661b0ae3..ddd81aa9 100644 --- a/src/components/EndOfSubSection.js +++ b/src/components/EndOfSubSection.js @@ -1,12 +1,12 @@ -import React, { Fragment } from 'react' -import styled from 'styled-components' -import PagesContext from '../contexes/PagesContext' -import { nthIndex } from '../util/strings' -import { Link } from 'gatsby' +import React, { Fragment } from "react" +import styled from "styled-components" +import PagesContext from "../contexes/PagesContext" +import { nthIndex } from "../util/strings" +import { Link } from "gatsby" -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faArrowRight as icon } from '@fortawesome/free-solid-svg-icons' -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary' +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" +import { faArrowRight as icon } from "@fortawesome/free-solid-svg-icons" +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" const StyledLink = styled(Link)` color: black; @@ -47,7 +47,7 @@ class EndOfSubSection extends React.Component { {value => { const currentPath = value.current.path let sectionPath = currentPath - const sectionSeparator = nthIndex(currentPath, '/', 2) + const sectionSeparator = nthIndex(currentPath, "/", 2) if (sectionSeparator !== -1) { sectionPath = currentPath.substr(0, sectionSeparator) } @@ -79,10 +79,10 @@ class EndOfSubSection extends React.Component { } return (
- Pääsit aliluvun loppuun!{' '} + Pääsit aliluvun loppuun!{" "} {nextPart && ( - Jatka tästä seuraavaan osaan:{' '} + Jatka tästä seuraavaan osaan:{" "} diff --git a/src/components/Footer.js b/src/components/Footer.js index 736d3616..b24ecab4 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -1,22 +1,22 @@ -import React from 'react' -import styled from 'styled-components' -import BackgroundImage from '../images/banner.svg' -import { SIDEBAR_WIDTH } from './Sidebar' -import { Card, CardContent } from '@material-ui/core' -import { OutboundLink } from 'gatsby-plugin-google-analytics' -import { Link } from 'gatsby' +import React from "react" +import styled from "styled-components" +import BackgroundImage from "../images/banner.svg" +import { SIDEBAR_WIDTH } from "./Sidebar" +import { Card, CardContent } from "@material-ui/core" +import { OutboundLink } from "gatsby-plugin-google-analytics" +import { Link } from "gatsby" -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary' +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" -import UHLogo from '../images/uh-logo.png' -import MoocfiLogo from '../images/moocfi-logo-bw.png' -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import UHLogo from "../images/uh-logo.png" +import MoocfiLogo from "../images/moocfi-logo-bw.png" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { faTwitter, faFacebook, faYoutube, faGithub, -} from '@fortawesome/free-brands-svg-icons' +} from "@fortawesome/free-brands-svg-icons" const StyledIcon = styled(FontAwesomeIcon)` color: black; @@ -118,7 +118,7 @@ class Footer extends React.Component { - Kurssin on tehnyt Helsingin yliopiston{' '} + Kurssin on tehnyt Helsingin yliopiston{" "} Tähän tulee visualisaatio edistymisestäsi heti kun olemme saaneet tämän ominaisuuden toteutettua. Odotellessasi voit - tutkia edistymisestäsi ohjelmointitehtävissä - TMC:ssä:{' '} + tutkia edistymisestäsi ohjelmointitehtävissä TMC:ssä:{" "} https://tmc.mooc.fi/participants/me - . Huomaathan, että pisteisiisi vaikuttaa muutkin tehtävät kuin ohjelmointitehtävät, kuten vaikka materiaalin seassa olevat kyselyt. Näiden tehtävien pisteet eivät näy TMC:ssä. Kiitos kärsivällisyydestäsi! + . Huomaathan, että pisteisiisi vaikuttaa muutkin tehtävät kuin + ohjelmointitehtävät, kuten vaikka materiaalin seassa olevat + kyselyt. Näiden tehtävien pisteet eivät näy TMC:ssä. Kiitos + kärsivällisyydestäsi!

diff --git a/src/components/PointsBalloon/index.js b/src/components/PointsBalloon/index.js index 31360992..35444018 100644 --- a/src/components/PointsBalloon/index.js +++ b/src/components/PointsBalloon/index.js @@ -1,10 +1,10 @@ -import React, { Fragment } from 'react' -import LoginStateContext from '../../contexes/LoginStateContext' -import withSimpleErrorBoundary from '../../util/withSimpleErrorBoundary' -import styled from 'styled-components' +import React, { Fragment } from "react" +import LoginStateContext from "../../contexes/LoginStateContext" +import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" +import styled from "styled-components" -import PointsBalloonBalloon from './PointsBalloonBalloon' -import PointsBalloonContent from './PointsBalloonContent' +import PointsBalloonBalloon from "./PointsBalloonBalloon" +import PointsBalloonContent from "./PointsBalloonContent" const PoitsBalloonContainer = styled.div` position: fixed; diff --git a/src/components/Sidebar.js b/src/components/Sidebar.js index 5f0613c4..f04fa092 100644 --- a/src/components/Sidebar.js +++ b/src/components/Sidebar.js @@ -1,15 +1,15 @@ -import React from 'react' -import styled from 'styled-components' -import { graphql, StaticQuery } from 'gatsby' -import { Button } from '@material-ui/core' +import React from "react" +import styled from "styled-components" +import { graphql, StaticQuery } from "gatsby" +import { Button } from "@material-ui/core" -import Logo from './Logo' -import TreeView from './TreeView' -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary' +import Logo from "./Logo" +import TreeView from "./TreeView" +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import { faBars, faTimes } from '@fortawesome/free-solid-svg-icons' +import { faBars, faTimes } from "@fortawesome/free-solid-svg-icons" const StyledIcon = styled(FontAwesomeIcon)` vertical-align: middle; @@ -19,7 +19,7 @@ const StyledIcon = styled(FontAwesomeIcon)` font-size: 1.5em; ` -export const SIDEBAR_WIDTH = '20rem' +export const SIDEBAR_WIDTH = "20rem" const SidebarContainer = styled.div` display: flex; @@ -86,43 +86,43 @@ const MenuExpanderWrapper = styled.div` var content2 = [ { - title: 'Tietoa kurssista', - path: '/', + title: "Tietoa kurssista", + path: "/", }, { - title: 'Osaamistavoitteet', - path: '/osaamistavoitteet', + title: "Osaamistavoitteet", + path: "/osaamistavoitteet", }, { - title: 'Arvostelu ja kokeet', - path: '/arvostelu-ja-kokeet', + title: "Arvostelu ja kokeet", + path: "/arvostelu-ja-kokeet", }, { - title: 'Mahdollisuus opinto-oikeuteen', - path: '/opinto-oikeus', + title: "Mahdollisuus opinto-oikeuteen", + path: "/opinto-oikeus", }, - { title: 'Tukiväylät', path: '/tukivaylat' }, + { title: "Tukiväylät", path: "/tukivaylat" }, { - title: 'Opettajille ja opinto-ohjaajille', - path: '/opettajille', + title: "Opettajille ja opinto-ohjaajille", + path: "/opettajille", }, { separator: true }, ] var futurePages = [ - { title: 'Osa 3', tba: '11.1.2019' }, - { title: 'Osa 4', tba: '25.1.2019' }, - { title: 'Osa 5', tba: '1.2.2019' }, - { title: 'Osa 6', tba: '8.2.2019' }, - { title: 'Osa 7', tba: '15.2.2019' }, + { title: "Osa 3", tba: "11.1.2019" }, + { title: "Osa 4", tba: "25.1.2019" }, + { title: "Osa 5", tba: "1.2.2019" }, + { title: "Osa 6", tba: "8.2.2019" }, + { title: "Osa 7", tba: "15.2.2019" }, { separator: true }, - { title: 'Osa 8', tba: '1.3.2019' }, - { title: 'Osa 9', tba: '8.3.2019' }, - { title: 'Osa 10', tba: '15.3.2019' }, - { title: 'Osa 11', tba: '22.3.2019' }, - { title: 'Osa 12', tba: '29.3.2019' }, - { title: 'Osa 13', tba: '12.4.2019' }, - { title: 'Osa 14', tba: '19.4.2019' }, + { title: "Osa 8", tba: "1.3.2019" }, + { title: "Osa 9", tba: "8.3.2019" }, + { title: "Osa 10", tba: "15.3.2019" }, + { title: "Osa 11", tba: "22.3.2019" }, + { title: "Osa 12", tba: "29.3.2019" }, + { title: "Osa 13", tba: "12.4.2019" }, + { title: "Osa 14", tba: "19.4.2019" }, ] const MobileWrapper = styled.div` diff --git a/src/components/TopBar.js b/src/components/TopBar.js index a3e8c458..accf01c9 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -1,7 +1,7 @@ -import React from 'react' -import styled from 'styled-components' -import LoginControls from './LoginControls'; -import withSimpleErrorBoundary from '../util/withSimpleErrorBoundary'; +import React from "react" +import styled from "styled-components" +import LoginControls from "./LoginControls" +import withSimpleErrorBoundary from "../util/withSimpleErrorBoundary" const TopBarContainer = styled.div` height: 4rem; @@ -15,9 +15,11 @@ const TopBarContainer = styled.div` class TopBar extends React.Component { render() { - return - - + return ( + + + + ) } } diff --git a/src/components/TreeView/TreeViewItem.js b/src/components/TreeView/TreeViewItem.js index f0ec61bb..e401ad24 100644 --- a/src/components/TreeView/TreeViewItem.js +++ b/src/components/TreeView/TreeViewItem.js @@ -1,19 +1,19 @@ -import React from 'react' -import styled from 'styled-components' +import React from "react" +import styled from "styled-components" -import { Motion, spring } from 'react-motion' +import { Motion, spring } from "react-motion" -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faCaretRight } from '@fortawesome/free-solid-svg-icons' -import { trackElementHeight } from '../../util/trackHeight' -import GatsbyLink from 'gatsby-link' -import { Location } from '@reach/router' -import Avatar from '@material-ui/core/Avatar' -import Chip from '@material-ui/core/Chip' -import Divider from '@material-ui/core/Divider'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" +import { faCaretRight } from "@fortawesome/free-solid-svg-icons" +import { trackElementHeight } from "../../util/trackHeight" +import GatsbyLink from "gatsby-link" +import { Location } from "@reach/router" +import Avatar from "@material-ui/core/Avatar" +import Chip from "@material-ui/core/Chip" +import Divider from "@material-ui/core/Divider" -import { faCalendarAlt as icon } from '@fortawesome/free-regular-svg-icons' -import withSimpleErrorBoundary from '../../util/withSimpleErrorBoundary' +import { faCalendarAlt as icon } from "@fortawesome/free-regular-svg-icons" +import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" const ChildrenList = styled.ul` height: calc(var(--open-ratio) * var(--calculated-height) * 1px); @@ -39,7 +39,7 @@ const NavigationLink = styled(GatsbyLink)` width: 100%; background-color: white; ${props => - props.active === 't' && + props.active === "t" && ` border-color: #f75b4b !important; background-color: #ffeeed; @@ -126,7 +126,7 @@ class TreeViewItem extends React.Component { {({ navigate, location }) => { let active = location.pathname.startsWith(this.props.item.path) - if (this.props.item.path === '/') { + if (this.props.item.path === "/") { active = location.pathname === this.props.item.path } return ( @@ -140,18 +140,18 @@ class TreeViewItem extends React.Component { {this.props.item.children && ( )} @@ -172,7 +172,7 @@ class TreeViewItem extends React.Component { {this.props.item.children && ( {this.props.item.children.map(i => ( diff --git a/src/components/TreeView/index.js b/src/components/TreeView/index.js index 36bd4008..f80b1f50 100644 --- a/src/components/TreeView/index.js +++ b/src/components/TreeView/index.js @@ -1,7 +1,7 @@ -import React from 'react' -import TreeViewItem from './TreeViewItem' -import styled from 'styled-components' -import withSimpleErrorBoundary from '../../util/withSimpleErrorBoundary' +import React from "react" +import TreeViewItem from "./TreeViewItem" +import styled from "styled-components" +import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" const StyledUl = styled.ul` margin-left: 0; diff --git a/src/components/user/ConfirmEmail.js b/src/components/user/ConfirmEmail.js index ac0a6868..b883d593 100644 --- a/src/components/user/ConfirmEmail.js +++ b/src/components/user/ConfirmEmail.js @@ -1,10 +1,10 @@ -import React from 'react' -import { Link } from 'gatsby' +import React from "react" +import { Link } from "gatsby" -import EmailExample from '../../images/email-example.png' +import EmailExample from "../../images/email-example.png" -import styled from 'styled-components' -import withSimpleErrorBoundary from '../../util/withSimpleErrorBoundary'; +import styled from "styled-components" +import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" const InfoBox = styled.div` margin-bottom: 2rem; @@ -39,12 +39,10 @@ class ConfirmEmail extends React.Component {

Olemme lähettäneet sähköpostiisi sähköpostiosoitteen - varmistuslinkin. Käy nyt sähköpostissasi ja varmista osoitteesi.{' '} + varmistuslinkin. Käy nyt sähköpostissasi ja varmista osoitteesi.{" "}

-

- Sähköpostin pitäisi näyttää tälläiseltä: -

+

Sähköpostin pitäisi näyttää tälläiseltä:

diff --git a/src/components/user/CourseOptionsEditor.js b/src/components/user/CourseOptionsEditor.js index 9b37df58..950ee701 100644 --- a/src/components/user/CourseOptionsEditor.js +++ b/src/components/user/CourseOptionsEditor.js @@ -1,4 +1,4 @@ -import React from 'react' +import React from "react" import { TextField, Button, @@ -6,16 +6,16 @@ import { Checkbox, Radio, RadioGroup, -} from '@material-ui/core' +} from "@material-ui/core" -import { OutboundLink } from 'gatsby-plugin-google-analytics' +import { OutboundLink } from "gatsby-plugin-google-analytics" -import Loading from '../Loading' +import Loading from "../Loading" -import { updateUserDetails, userDetails } from '../../services/moocfi' +import { updateUserDetails, userDetails } from "../../services/moocfi" -import styled from 'styled-components' -import withSimpleErrorBoundary from '../../util/withSimpleErrorBoundary' +import styled from "styled-components" +import withSimpleErrorBoundary from "../../util/withSimpleErrorBoundary" const Row = styled.div` margin-bottom: 1.5rem; @@ -48,7 +48,7 @@ class CourseOptionsEditor extends React.Component { }, () => { this.validate() - } + }, ) } @@ -143,7 +143,7 @@ class CourseOptionsEditor extends React.Component { InputLabelProps={{ shrink: this.state.first_name || - this.state.focused === 'first_name', + this.state.focused === "first_name", }} fullWidth value={this.state.first_name} @@ -163,7 +163,7 @@ class CourseOptionsEditor extends React.Component { InputLabelProps={{ shrink: this.state.last_name || - this.state.focused === 'last_name', + this.state.focused === "last_name", }} fullWidth value={this.state.last_name} @@ -182,7 +182,7 @@ class CourseOptionsEditor extends React.Component { InputLabelProps={{ shrink: this.state.student_number || - this.state.focused === 'student_number', + this.state.focused === "student_number", }} fullWidth value={this.state.student_number} @@ -262,7 +262,7 @@ class CourseOptionsEditor extends React.Component {

Tällaisesta oppimisanalytiikaksi kutsutusta tutkimuksesta - kiinnostuneiden kannattaa tutustua esimerkiksi artikkeliin{' '} + kiinnostuneiden kannattaa tutustua esimerkiksi artikkeliin{" "} { const key = o[0] const value = o[1] value.forEach(msg => { let newMessage = capitalizeFirstLetter( - `${key.replace(/_/g, ' ')} ${msg}.` + `${key.replace(/_/g, " ")} ${msg}.`, ) - if (newMessage === 'Email has already been taken.') { + if (newMessage === "Email has already been taken.") { newMessage = - 'Sähköpostiosoitteesi on jo käytössä. Oletko tehnyt aikaisemmin mooc.fi:n kursseja?' + "Sähköpostiosoitteesi on jo käytössä. Oletko tehnyt aikaisemmin mooc.fi:n kursseja?" } message = `${message} ${newMessage}` }) }) - if (message === '') { + if (message === "") { message = - 'Ongelma tunnuksen luonnissa. Virhe oli: ' + JSON.stringify(error) + "Ongelma tunnuksen luonnissa. Virhe oli: " + JSON.stringify(error) } this.setState({ error: message, submitting: false, errorObj: error }) } catch (_error2) { @@ -85,7 +85,7 @@ class CreateAccountForm extends React.Component { validate = () => { let newState = { - error: '', + error: "", errorObj: {}, } const { @@ -97,11 +97,11 @@ class CreateAccountForm extends React.Component { triedSubmitting, } = this.state if (email && validateEmail) { - if (email.indexOf('@') === -1) { + if (email.indexOf("@") === -1) { newState.error += "Sähköpostiosoitessa ei ole '@'-merkkiä. " newState.errorObj.email = "Sähköpostiosoitessa ei ole '@'-merkkiä. " } - if (email && email.indexOf('.') === -1) { + if (email && email.indexOf(".") === -1) { newState.error += "Sähköpostiosoitessa ei ole '.'-merkkiä. " newState.errorObj.email = "Sähköpostiosoitessa ei ole '.'-merkkiä. " } @@ -109,15 +109,15 @@ class CreateAccountForm extends React.Component { if (password && password_confirmation && validatePassword) { if (password !== password_confirmation) { - newState.error += 'Salasana ja salasana uudestaan eivät olleet samoja. ' + newState.error += "Salasana ja salasana uudestaan eivät olleet samoja. " newState.errorObj.password = - 'Salasana ja salasana uudestaan eivät olleet samoja.' + "Salasana ja salasana uudestaan eivät olleet samoja." newState.errorObj.password_confirmation = - 'Salasana ja salasana uudestaan eivät olleet samoja.' + "Salasana ja salasana uudestaan eivät olleet samoja." } } - if (newState.error === '') { + if (newState.error === "") { newState.error = false newState.canSubmit = true } @@ -147,7 +147,7 @@ class CreateAccountForm extends React.Component { render() { if (this.context.loggedIn) { - navigate('/') + navigate("/") return

Redirecting...
} return ( @@ -155,10 +155,14 @@ class CreateAccountForm extends React.Component {

Luo käyttäjätunnus

- Tämä kurssi käyttää{' '} - + Tämä kurssi käyttää{" "} + mooc.fi - {' '} + {" "} käyttäjätunnuksia. Jos olet aikaisemmin tehnyt mooc.fi -kursseja, voit käyttää sisäänkirjautumissivulla olemassaolevia tunnuksiasi. Tällä sivulla voit luoda uuden tunnuksen, joka toimii suurimmassa @@ -186,7 +190,7 @@ class CreateAccountForm extends React.Component { {this.props.postBodyComponents} - - + +