"Stockfight" is a simple frontend to compare stocks on the swedish stock market
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixed typescript errors for build

+16 -12
-3
.eslintrc.json
··· 1 - { 2 - "extends": "next/core-web-vitals" 3 - }
+3 -1
pages/api/[stockA]/[stockB].ts
··· 1 1 // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 2 import type { NextApiRequest, NextApiResponse } from 'next' 3 3 import YahooStockAPI from '../../../src/dist/index' 4 + import APIResponse from '../../../src/dist/index' 4 5 5 6 type Data = { 6 - name: string 7 + stockA: any, 8 + stockB: any 7 9 } 8 10 9 11 export default async function handler(
+4 -3
pages/index.tsx
··· 155 155 // Initialize state with undefined width/height so server and client renders match 156 156 // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/ 157 157 const [windowSize, setWindowSize] = useState({ 158 - width: undefined, 159 - height: undefined, 158 + width: 0 , 159 + height: 0, 160 160 }); 161 161 162 162 useEffect(() => { ··· 179 179 // Remove event listener on cleanup 180 180 return () => window.removeEventListener("resize", handleResize); 181 181 }, []); // Empty array ensures that effect is only run on mount 182 - return windowSize; 182 + 183 + return windowSize 183 184 }
+9 -5
src/PieChart.tsx
··· 4 4 import { Pie } from "react-chartjs-2"; 5 5 import styles from '@/styles/Home.module.css' 6 6 7 - const PieChart = (props) => { 7 + type PieChartProps = { 8 + labelA: string, 9 + labelB: string, 10 + dataA: string, 11 + dataB: string, 12 + class: string, 13 + } 14 + 15 + const PieChart = (props: PieChartProps) => { 8 16 9 17 let labels = [props.labelA ? props.labelA : "stockA", props.labelB ? props.labelA : "stockB" ]; 10 18 let datasets = [ ··· 17 25 return ( 18 26 <Pie 19 27 className={`${props.class} ${styles.pieChart}`} 20 - options={{ 21 - width: "64", 22 - height: "64" 23 - }} 24 28 data={{ 25 29 labels: labels, 26 30 datasets: datasets