-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 20.2 KB
/
.eslintcache
1
[{"/Users/jimboy/Documents/CS/sempoainvest/src/App.tsx":"1","/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/rechart.ts":"2","/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/index.tsx":"3","/Users/jimboy/Documents/CS/sempoainvest/src/reportWebVitals.ts":"4","/Users/jimboy/Documents/CS/sempoainvest/src/index.tsx":"5","/Users/jimboy/Documents/CS/sempoainvest/src/utils/calculations.ts":"6","/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/chartComponents.tsx":"7","/Users/jimboy/Documents/CS/sempoainvest/src/containers/Answers/index.tsx":"8","/Users/jimboy/Documents/CS/sempoainvest/src/containers/Answers/modals.tsx":"9"},{"size":8332,"mtime":1610685220155,"results":"10","hashOfConfig":"11"},{"size":786,"mtime":1610344658267,"results":"12","hashOfConfig":"11"},{"size":3659,"mtime":1610259816121,"results":"13","hashOfConfig":"11"},{"size":425,"mtime":1610344658272,"results":"14","hashOfConfig":"11"},{"size":457,"mtime":1610343684273,"results":"15","hashOfConfig":"11"},{"size":7755,"mtime":1611972355694,"results":"16","hashOfConfig":"11"},{"size":1497,"mtime":1610344658266,"results":"17","hashOfConfig":"11"},{"size":5037,"mtime":1610683245678,"results":"18","hashOfConfig":"11"},{"size":15362,"mtime":1610682887149,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"22"},"1efpoyd",{"filePath":"23","messages":"24","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"25","messages":"26","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"29","messages":"30","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"31","messages":"32","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"33"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/Users/jimboy/Documents/CS/sempoainvest/src/App.tsx",["40","41"],"import React, {useState, useEffect} from 'react';\nimport { MuiThemeProvider, createMuiTheme, makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport './App.css';\nimport CircularProgress from '@material-ui/core/CircularProgress';\nimport Answers from './containers/Answers';\nimport {InvestasiModal, KreditModal , SocialMediaButtons} from './containers/Answers/modals';\nimport LinkedInIcon from '@material-ui/icons/LinkedIn';\nimport GitHubIcon from '@material-ui/icons/GitHub';\nimport AlternateEmailIcon from '@material-ui/icons/AlternateEmail';\nimport HttpIcon from '@material-ui/icons/Http';\nimport {\n anuitas,\n generateCreditData,\n generateInvestData,\n loadData,\n filterNotNumber\n} from './utils/calculations';\nimport {\n dataProps,\n dataPoint,\n anuitasParams,\n investDataType,\n tickerDataProps\n} from './utils/@types.calculations';\n\nconst theme = createMuiTheme({\n palette: {\n secondary: {\n main: '#FF5E7A'\n },\n primary: {\n main: '#8CD881'\n },\n text: {\n primary: '#002',\n secondary: '#90caf9',\n }\n }\n});\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n socialMediaIcon: {\n marginRight: '0.5vw',\n marginLeft: '0.5vw',\n '&:hover': {\n cursor: 'pointer',\n color: '#FF5E7A'\n }\n },\n }),\n);\n\nconst App = () => {\n const initData: dataProps = {\n kredit: '0',\n dp: '0',\n bunga: '0',\n bulan: '0',\n tahun: '1',\n frekuensi: '1',\n saham: '',\n syariah: false\n };\n const [index, setIndex] = useState(0);\n const [data, setData] = useState(initData);\n const [isShow, setIsShow] = useState(true);\n const [isShowSocial, setIsShowSocial] = useState(false);\n const [isShare, setIsShare] = useState(false);\n const classes = useStyles();\n const {analytics} = window as any\n useEffect(() => {\n try {\n const search = window.location.search.substring(1);\n if (!search) {\n return;\n }\n const newData = JSON.parse('{\"' + decodeURIComponent(decodeURI(search).replace(/\"/g, '\\\\\"').replace(/&/g, '\",\"').replace(/=/g,'\":\"')) + '\"}');\n const {\n kredit,\n dp,\n bunga,\n bulan,\n tahun,\n saham,\n frekuensi,\n }:dataProps = newData;\n const syariah = newData['syariah'] === 'true'\n newData['syariah'] = syariah\n const lama:number = (filterNotNumber(tahun as string) + (filterNotNumber(bulan as string) / 12));\n const cashOutInterval:number = filterNotNumber(frekuensi as string);\n const input:anuitasParams = {\n kredit: filterNotNumber(kredit as string) * (1 - (filterNotNumber(dp as string) / 100)),\n bungaPerBulan: filterNotNumber(bunga as string) / 100 / 12,\n tenor: lama * 12,\n isSyariah: syariah\n };\n const rawTickerData: tickerDataProps = loadData(saham as string);\n const bulanan:number = anuitas(input); \n const {investData, marginOfError}: investDataType = generateInvestData({\n ...input,\n bulanan,\n tickerData: rawTickerData,\n cashOutInterval\n });\n const kreditData: number[] = generateCreditData({\n ...input,\n bulanan\n });\n newData['investData'] = investData;\n newData['kreditData'] = kreditData;\n newData['marginOfError'] = marginOfError;\n newData['bulanan'] = bulanan;\n newData['lama'] = lama;\n newData['cashOutInterval'] = cashOutInterval;\n newData['data'] = rawTickerData\n analytics('event', 'purchase', {\n items: [{\n item_id: newData.saham,\n discount: newData.bungaPerBulan * 12,\n item_category: newData.syariah ? 'syariah' : 'conventional',\n price: filterNotNumber(kredit as string),\n quantity: cashOutInterval\n }],\n transaction_id: `${Date.now()} ${window.location.search.substring(1)}`,\n shipping: (newData.investData[newData.investData.length - 1] / (bulanan * lama * 12)) * 100,\n value: bulanan * lama * 12,\n tax: dp\n })\n setData(newData);\n if (index !== 3) {\n setIsShow(true);\n setIndex(2);\n setTimeout(() => {\n setIndex(3)\n setIsShow(true);\n }, 3000);\n }\n } catch (error) {\n console.log(error.message);\n }\n }, [window.location.href])\n try {\n const handleNext = (inputData?: dataProps) => {\n if (inputData) {\n const newDataBuffer: dataProps = { ...data, ...inputData};\n if (newDataBuffer.saham) {\n const {\n kredit,\n dp,\n bunga,\n bulan,\n tahun,\n saham,\n frekuensi,\n syariah\n }:dataProps = newDataBuffer;\n const rawUrlData = {\n kredit,\n dp,\n bunga,\n bulan,\n tahun,\n saham,\n frekuensi,\n syariah\n };\n const url = new URL(window.location.href);\n const urlData = Object.entries(rawUrlData).map(([key, value]) => {\n url.searchParams.set(key, value);\n return `${encodeURI(key)}=${encodeURI(value)}`;\n }).join('&');\n window.history.pushState({before: urlData}, '', url.href);\n setIsShowSocial(true);\n }\n setData(newDataBuffer);\n }\n if (index === 3) {\n return;\n }\n setIsShow(false);\n setIndex((index + 1) % 3);\n setTimeout(() => {\n setIsShow(true);\n }, 50);\n if (index + 1 === 2) {\n if (!inputData.saham) {\n setIndex(0);\n }else{\n setTimeout(() => {\n setIndex(3)\n setIsShow(true);\n }, 3000);\n }\n }\n };\n return (\n <div className=\"App\">\n <MuiThemeProvider theme={theme}>\n <header className=\"App-header\">\n <h1>{\"💵🗽 Sempoa 🤑 Investasi 🏦🏠\"}</h1>\n {index === 0 ? <KreditModal initDisable={false} isShown={isShow} handleSubmit={handleNext} initData={data} /> : null}\n {index === 1 ? <InvestasiModal initDisable={false} isShown={isShow} handleSubmit={handleNext} initData={data} /> : null}\n {index === 2 ? <CircularProgress /> : null}\n {data.saham && index === 3 ? (<Answers data={data} handleSubmit={handleNext} />) : null}\n {index === 3 && data.saham && !isShare \n ? (<SocialMediaButtons\n handleClose={() => {\n setIsShowSocial(false);\n setIsShare(true);\n }}\n initData={data}\n isShown={isShowSocial} />)\n : null}\n </header>\n <footer>\n <LinkedInIcon\n fontSize=\"small\"\n className={classes.socialMediaIcon}\n onClick={() => {\n analytics('event', 'join_group', {\n group_id: 'LinkedIn'\n });\n window.location.href = 'https://www.linkedin.com/in/faza-jimmy-hikmatullah-48bb54152/'\n }}/>\n <GitHubIcon\n fontSize=\"small\"\n className={classes.socialMediaIcon}\n onClick={() => {\n analytics('event', 'join_group', {\n group_id: 'Github'\n });\n window.location.href = 'https://github.com/Fazatholomew'\n }}/>\n <div>\n <p>Copyright © 2021 Jimmy 'Bang Koboi'</p>\n <p>Buatan Bandung.</p>\n </div>\n <AlternateEmailIcon\n fontSize=\"small\"\n className={classes.socialMediaIcon}\n onClick={() => {\n analytics('event', 'join_group', {\n group_id: 'Email'\n });\n window.location.href = 'mailto:TheManHimself@jimmyganteng.com'\n }}/>\n <HttpIcon\n fontSize=\"small\"\n className={classes.socialMediaIcon}\n onClick={() => {\n analytics('event', 'join_group', {\n group_id: 'Website'\n });\n window.location.href = 'https://jimmyganteng.com'\n }} />\n </footer>\n </MuiThemeProvider>\n </div>\n );\n } catch (error) {\n console.log(error.message);\n }\n}\n\nexport default App;\n","/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/rechart.ts",[],"/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/index.tsx",[],"/Users/jimboy/Documents/CS/sempoainvest/src/reportWebVitals.ts",[],"/Users/jimboy/Documents/CS/sempoainvest/src/index.tsx",[],"/Users/jimboy/Documents/CS/sempoainvest/src/utils/calculations.ts",["42","43"],"import jsonData from '../data.json';\nimport {\n allData,\n dataPoint,\n anuitasParams,\n generateCreditDataParams,\n generateInvestDataParams,\n bigNumber,\n investDataType,\n tickerDataProps\n} from './@types.calculations';\n\nconst satuan: string[] = ['', 'Ribu', 'Juta', 'Milyar', 'Triliun', 'Kuadriliun', 'Kuantiliun', 'Sekstiliun']\n\n/**\n * Scale Up small numbers and print them in proper way.\n * @param {number} inputNumber - Big Number.\n * @return {string} Number in Rp.\n */\n\nconst printNumber = (inputValue: number, _zeros: number = 0, isPrintRp=true): string => {\n const formatter = new Intl.NumberFormat('id-ID', {\n style: 'currency',\n currency: 'IDR',\n });\n const {smallNumber, zeros}: bigNumber = bigNumberConverter(inputValue * 10 ** (3 * _zeros));\n if (!isPrintRp) {\n const f = new Intl.NumberFormat('id-ID');\n return f.format(inputValue);\n }\n return `${formatter.format(smallNumber)} ${satuan[zeros]}`;\n};\n\n/**\n * Convert string into number with garbage in it.\n * @param {string} str - Big Number.\n * @return {number} Number.\n */\n\nconst filterNotNumber = (str: string): number => {\n const matches = str.replace(/\\./g, '').replace(/,/g, '.').match(/[+-]?\\d+(\\.\\d+)?/g);\n if (!matches) {\n return null;\n }\n return parseFloat(matches.join(''));\n};\n\n/**\n * Scale down big numbers into scientific notation.\n * @param {number} inputNumber - Big Number.\n * @return {object} Converted number and How many zero's.\n */\nconst bigNumberConverter = (inputNumber: number, zeros: number | null=null): bigNumber => {\n if (zeros) {\n const returnZero: number = zeros ? zeros : 1;\n return {\n zeros: returnZero,\n smallNumber: Math.round((inputNumber / (1000 ** returnZero) * 100)) / 100,\n }\n }\n const isNegative: boolean = inputNumber < 0;\n for (let k:number = 0; k < 6; k += 1) {\n\n const smallNumber:number = (isNegative ? inputNumber * -1 : inputNumber ) / (10 ** (3 * k));\n if (smallNumber > 0.01 && smallNumber < 999) {\n return {\n smallNumber: Math.round((isNegative ? smallNumber * -1 : smallNumber) * 100) / 100,\n zeros: k\n }\n }\n }\n return {\n smallNumber: inputNumber,\n zeros: 0\n };\n};\n\n/**\n * Load JSON file of Stocks history and return the one requested.\n * @param {string} ticker - Saham Investasi.\n * @return {array} Data Saham Investasi.\n */\nconst loadData = (ticker: string): tickerDataProps => {\n const data:any = jsonData;\n return data[ticker];\n};\n\n/**\n * Load JSON file of Stocks history and return all tickers.\n * @return {array} All tickers.\n */\nconst loadTickers = (): string[] => {\n const data:any = jsonData;\n return Object.keys(data);\n};\n\n/**\n * Calculated monthly payment given interest.\n * @param {object} anuitasParams - Object of params.\n * @return {number} Cicilan per bulan.\n */\nconst anuitas = ({kredit, bungaPerBulan, tenor, isSyariah}: anuitasParams): number => { \n if (bungaPerBulan === 0) {\n return Math.ceil(kredit / tenor);\n }\n if (isSyariah) {\n const bunga:number = bungaPerBulan * tenor * kredit;\n return Math.ceil((kredit + bunga) / tenor);\n }\n const upper:number = kredit * bungaPerBulan;\n const exponen:number = (-1 * tenor)\n const lower:number = 1-((1 + bungaPerBulan) ** exponen);\n return Math.ceil(upper / lower); \n};\n\n/**\n * Generate data point for each month payment.\n * @param {object} generateCreditDataParams - Object of params.\n * @return {array} Data setiap bulan dan bayaran per bulan.\n */\nconst generateCreditData = ({kredit, bungaPerBulan, tenor, bulanan, isSyariah}: generateCreditDataParams): number[] => { \n const results:number[] = [kredit];\n let sisa:number = kredit;\n const bunga: number = bulanan - (kredit * bungaPerBulan)\n for (let i:number = 0; i < tenor; i += 1) {\n if (isSyariah) {\n sisa -= bunga;\n } else {\n const currentBunga:number = sisa * bungaPerBulan;\n const bayar:number = bulanan - currentBunga;\n sisa -= bayar;\n }\n sisa = sisa < 1000 ? 0 : sisa;\n results.push(sisa);\n }\n \n return results;\n};\n\n/**\n * Generate data point for each month investment value.\n * @param {object} generateInvestDataParams - Object of params.\n * @return {array} Data setiap bulan.\n */\nconst generateInvestData = ({bulanan, tenor, cashOutInterval, tickerData}: generateInvestDataParams): investDataType => {\n const cashOutValue = cashOutInterval === tenor ? 0 : bulanan * cashOutInterval;\n const kredit:number = bulanan * tenor;\n let cash:number = kredit - cashOutValue;\n let counter:number = 0;\n const length = tickerData['Data Length']\n const marginOfErrorData = tenor + 1 > length ? tickerData.Data['Margin of Error'] : tickerData.Data['Margin of Error'].reverse().slice(0, tenor + 1).reverse();\n const changesData = tenor + 1 > length ? tickerData.Data.Changes : tickerData.Data.Changes.reverse().slice(0, tenor + 1).reverse();\n const marginOfError: investDataType[\"marginOfError\"] = [[cash, cash]];\n const results:number[] = [cash];\n for (let i:number = 0; i < tenor; i += 1) {\n counter += 1;\n if (counter === cashOutInterval) {\n cash -= cashOutValue;\n counter = 0;\n }\n marginOfError.push([\n (cash + (cash * ((marginOfErrorData[i % length][0] / 100)))),\n (cash + (cash * ((marginOfErrorData[i % length][1] / 100)))),\n ]);\n cash += cash * (changesData[i % length] / 100);\n results.push(cash);\n \n }\n return {\n investData: results,\n marginOfError\n };\n};\n\n/**\n * Detect if this is a mobile browser\n * @return {boolean} true if it is.\n */\nconst detectMobile = (): boolean => {\n let check = false;\n (function(a){if(/(android|bb\\d+|meego).+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor);\n return check;\n};\n\nexport {\n anuitas,\n generateCreditData,\n generateInvestData,\n loadData,\n bigNumberConverter,\n printNumber,\n detectMobile,\n loadTickers,\n filterNotNumber\n};","/Users/jimboy/Documents/CS/sempoainvest/src/components/chart/chartComponents.tsx",[],"/Users/jimboy/Documents/CS/sempoainvest/src/containers/Answers/index.tsx",[],"/Users/jimboy/Documents/CS/sempoainvest/src/containers/Answers/modals.tsx",[],{"ruleId":"44","severity":1,"message":"45","line":20,"column":3,"nodeType":"46","messageId":"47","endLine":20,"endColumn":12},{"ruleId":"48","severity":1,"message":"49","line":142,"column":6,"nodeType":"50","endLine":142,"endColumn":28,"suggestions":"51"},{"ruleId":"44","severity":1,"message":"52","line":3,"column":3,"nodeType":"46","messageId":"47","endLine":3,"endColumn":10},{"ruleId":"44","severity":1,"message":"45","line":4,"column":3,"nodeType":"46","messageId":"47","endLine":4,"endColumn":12},"@typescript-eslint/no-unused-vars","'dataPoint' is defined but never used.","Identifier","unusedVar","react-hooks/exhaustive-deps","React Hook useEffect has missing dependencies: 'analytics' and 'index'. Either include them or remove the dependency array. Outer scope values like 'window.location.href' aren't valid dependencies because mutating them doesn't re-render the component.","ArrayExpression",["53"],"'allData' is defined but never used.",{"desc":"54","fix":"55"},"Update the dependencies array to be: [analytics, index]",{"range":"56","text":"57"},[4276,4298],"[analytics, index]"]