Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
fix: heroku type errors (temporary fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
vycdev committed Apr 16, 2020
1 parent a0c7edd commit aaa80c2
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
6 changes: 3 additions & 3 deletions packages/web/src/components/common/typingBox/dataBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useState, useEffect, useRef } from "react";
import { LineChart, XAxis, YAxis, Line, Tooltip, Legend } from "recharts";
import { DataBoxWrapper } from "./style";

import { DataBoxType } from "./helpers/interfaces";
import { DataBoxType, typedArrayInterface } from "./helpers/interfaces";

export const DataBox = (props: React.Component<DataBoxType, {}>) => {
export const DataBox = (props: DataBoxType<typedArrayInterface>) => {
return (
<DataBoxWrapper>
<LineChart
width={725}
height={300}
data={props.data}
data={props.dataProp}
margin={{ top: 30, bottom: 5 }}
>
<Line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export interface typingBoxProps {
export interface typedArrayInterface {
word: string;
state: "correct" | "wrong";
time: number;
time: number | null;
wpm: number;
accuracy: number;
timeUsed: string;
}

export interface DataBoxType {
data: Array<typingBoxProps>;
export interface DataBoxType<T> {
dataProp: Array<T>;
}
16 changes: 11 additions & 5 deletions packages/web/src/components/common/typingBox/typingBox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React, { useState, useEffect, useRef } from "react";

import { getText } from "./helpers/gettext";
import { typingBoxProps, typedArrayInterface } from "./helpers/interfaces";
import {
typingBoxProps,
typedArrayInterface,
DataBoxType
} from "./helpers/interfaces";
import { DataBox } from "./dataBox";

import {
Expand All @@ -16,8 +20,10 @@ import {
export const TypingBox = (props: typingBoxProps) => {
const [input, setInput] = useState("");
const [text, setText] = useState(getText(props.mode));
const [visibleText, setVisibleText] = useState(text.join(" "));
const [typed, setTyped] = useState([]);
const [visibleText, setVisibleText] = useState([
<div key={"default"}></div>
]);
const [typed, setTyped] = useState<Array<typedArrayInterface>>([]);
const [time, setTime] = useState(60);
const [cpm, setCpm] = useState(0);

Expand Down Expand Up @@ -120,7 +126,7 @@ export const TypingBox = (props: typingBoxProps) => {
<Displayer>
CPM: {cpm} WPM: {Math.floor(cpm / 5)} Time: {time}
</Displayer>
{time > 0 ? "" : <DataBox data={typed}></DataBox>}
{time > 0 ? "" : <DataBox dataProp={typed}></DataBox>}
{time > 0 ? (
""
) : (
Expand All @@ -143,7 +149,7 @@ export const TypingBox = (props: typingBoxProps) => {
readOnly={!(time > 0)}
autoFocus
value={input}
onChange={(e: React.FormEvent<HTMLInputElement>) => {
onChange={(e: any) => {
const timeLeft = typed.length
? 60 -
Math.floor(
Expand Down
9 changes: 4 additions & 5 deletions packages/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
"moduleResolution": "node",
"alwaysStrict": true,
"downlevelIteration": true,
"strictNullChecks": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"strictPropertyInitialization": true,
"importHelpers": true,
"sourceMap": true,
}
}
"sourceMap": true
},
"exclude": ["node_modules"]
}

0 comments on commit aaa80c2

Please sign in to comment.