-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
42 add typescript #104
42 add typescript #104
Conversation
@ivanbkovacevicIt may require some time for me to go through this thoroughly. In the future for similar tasks, we should consider breaking it down into smaller parts. |
@itmilos yes yes.... Offcourse |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@itmilos I extracted types to constant but now Im getting conflicts in some files that was not there yesterday. Help needed |
src/components/Input.tsx
Outdated
width: number; | ||
label: string; | ||
value: string | number; | ||
whenChanged: (e:any) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whenChanged: (e: React.ChangeEvent<HTMLInputElement>) => void;
}
src/components/Input.tsx
Outdated
@@ -1,16 +1,33 @@ | |||
import React from 'react'; | |||
import { deviceBrakepoints } from '../config/device-brakepoints' | |||
import Label from './Label.jsx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove .jsx
@@ -1,14 +1,22 @@ | |||
import ErrorMessage from './ErrorMessage.jsx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove .jsx
src/components/InputGroup.tsx
Outdated
@@ -1,14 +1,22 @@ | |||
import ErrorMessage from './ErrorMessage.jsx' | |||
import React from 'react' | |||
import ErrorMessage from './ErrorMessage.js' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove .js
src/components/InputGroup.tsx
Outdated
import S from 'styled-components' | ||
import { useState } from 'react' | ||
import { InputsProps } from './SplittedInput.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itmilos I do not know why is that happening. The app is constantly injecting .jsx imports
src/components/SavedTemplates.tsx
Outdated
const handleUseTemplate = (template) => { | ||
const pullTemplates = localStorage.getItem('templates'); | ||
const templates = pullTemplates !== null ? JSON.parse(pullTemplates) : []; | ||
console.log(templates); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@itmilos I have made the recommended changes.
Please test the branch before merging into master. It is a big change and also configuration changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we using in Payslip:1067
const accountNumber = params.get('account-number')
const amount = params.get('amount')
helpText: string; | ||
label: string; | ||
value: string | number; | ||
whenChanged: (e:any) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whenChanged: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
@@ -959,38 +990,39 @@ function Payslip() { | |||
const [state, dispatch] = useReducer(reducer, initialState, init) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [state, dispatch] = useReducer<React.Reducer<ReducerState, ReducerAction>>(reducer, initialState, init)
|
||
const appendZeros = value => { | ||
const appendZeros = (value: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const appendZeros = (value: string)
not sure please double check
let newValue = value | ||
while (newValue.length < 13) newValue = '0' + newValue | ||
dispatch({ type: ACTIONS.ACCOUNT_NUMBER_CHANGE, payload: newValue }) | ||
} | ||
const onFixBankNumberChange = event => { | ||
const onFixBankNumberChange = (event: { target: { value: string } }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const onFixBankNumberChange = (event: React.ChangeEvent) => {
if (/^[1-9]{0,1}[0-9]{0,2}$/.test(event.target.value))
dispatch({ type: ACTIONS.BANK_NUMBER_CHANGE, payload: event.target.value })
}
const onAccountNumberChange = (event: React.ChangeEvent) => {
if (/^[0-9]{0,13}$/.test(event.target.value)) {
dispatch({ type: ACTIONS.ACCOUNT_NUMBER_CHANGE, payload: event.target.value })
}
}
const onControlNumberChange = (event: React.ChangeEvent) => {
if (/^[1-9]{0,1}[0-9]{0,1}$/.test(event.target.value))
dispatch({ type: ACTIONS.CONTROL_NUMBER_CHANGE, payload: event.target.value })
}
const onSetModelCodeChange = event => dispatch({ type: ACTIONS.MODEL_CODE, payload: event }) | ||
const onPaymentNumberChange = event => dispatch({ type: ACTIONS.PAYMENT_NUMBER, payload: event.target.value }) | ||
const onSetModelCodeChange = (event: { value: string; label: string }) => dispatch({ type: ACTIONS.MODEL_CODE, payload: event }) | ||
const onPaymentNumberChange = (event: { target: { value: any } }) => dispatch({ type: ACTIONS.PAYMENT_NUMBER, payload: event.target.value }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const onPaymentNumberChange = (event: React.ChangeEvent)
src/pages/Payslip.tsx
Outdated
const resetValues = () => dispatch({ type: ACTIONS.RESET_VALUES }) | ||
|
||
const storeTemplate = (templateName) => { | ||
const templates = JSON.parse(localStorage.getItem('templates')) ?? []; | ||
const storeTemplate = (templateName: any) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const storeTemplate = (templateName: string)
# Conflicts: # package-lock.json # package.json # src/components/BankCard.tsx # src/pages/Payslip.tsx
Added TS to the project.
Maybe tsconfig.json some other settings to be put.
Modelselect.tsx causing some little problems