-
Notifications
You must be signed in to change notification settings - Fork 10
feat(basic/ts): add typescript basic react chef #42
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
base: main
Are you sure you want to change the base?
Conversation
| return `import React from 'react' | ||
| import { BrowserRouter as Router } from 'react-router-dom' | ||
| import { createBrowserHistory } from 'history' | ||
| import Routes from './Routes' | ||
| // Block Components. | ||
| import { ErrorHandler, PageLoader } from './components/blocks' | ||
| import { withTranslation } from '@/${sourceDir.i18n}' | ||
| const browserHistory = createBrowserHistory() | ||
| function App() { | ||
| return ( | ||
| <ErrorHandler> | ||
| <PageLoader /> | ||
| <Router history={browserHistory}> | ||
| <Routes /> | ||
| </Router> | ||
| </ErrorHandler> | ||
| ) | ||
| } | ||
| export default withTranslation(App) |
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.
these need to be typescript typed code
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.
Done
| function getSourceCode(appName, { sourceDir }) { | ||
| return `import React from 'react' | ||
| import { useNavigate } from 'react-router-dom' | ||
| import PropTypes from 'prop-types' |
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.
getSourceCode returning code should be typed code.
| // UI Components. | ||
| import { Spinner } from '@/components/ui' | ||
| export default function PageLoader({ loading }) { |
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.
same here
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.
done
| import { RoutePaths } from '@/utils' | ||
| // Lazy-loaded modules | ||
| const SignInModule = React.lazy(() => |
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.
typed code is missing. its javascript
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.
Done
| // Utils. | ||
| import { RoutePaths } from '@/${sourceDir.utility}' | ||
| const Sidebar = (props) => { |
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.
typed code is missing. its javascript
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.
Done
| @@ -0,0 +1,7 @@ | |||
| import React from 'react' | |||
|
|
|||
| const BlockLoader = ({ props }) => { | |||
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.
typed code is missing. its javascript
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.
Done
| const [error, setError] = useState() | ||
| const [loading, setLoading] = useState(false) | ||
|
|
||
| useEffect(async () => { |
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.
typed code is missing. its javascript
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.
Done
| function useOnlineStatus() { | ||
| const [online, setOnline] = useState(window.navigator.onLine) | ||
|
|
||
| useEffect(() => { |
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.
typed code is missing. its javascript
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.
Done
| const [error, setError] = useState() | ||
| const [loading, setLoading] = useState(false) | ||
|
|
||
| const postData = async (payload) => { |
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.
typed code is missing. its javascript
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.
Done
| // Utils. | ||
| import { RoutePaths } from '@/utils' | ||
|
|
||
| const NotFound = () => { |
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.
typed code is missing. its javascript
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.
Done
recipes/_ts/basic/config.js
Outdated
| "webpackLoaders", | ||
| "babel", | ||
| "basicTypescriptDev" | ||
|
|
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 empty spaces
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.
Done
| Sidebar: sidebarBlock, | ||
| TopBar: topBarBlock, | ||
| } | ||
|
|
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.
keep 1 space
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.
Done
| if (isTypeScriptProjectType) { | ||
| const tsConfigFileName = `tsconfig.json`; | ||
| createFile(tsConfigFileName, getFileContent(tsConfigFileName)); | ||
| } |
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.
this changes not required and its already exist in 226
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.
Done
| let projectTypeName; | ||
| if (is_BasicTypeScriptProjectType) { | ||
| projectTypeName = 'basic'; | ||
| } else if (isSlimTypeScriptProject(projectType)) { | ||
| projectTypeName = 'slim'; | ||
| } else { | ||
| projectTypeName = projectType; | ||
| } |
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.
can is_BasicTypeScriptProjectType rename to isBasicTypeScriptProjectType
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.
Done
| const browserHistory: History = createBrowserHistory() | ||
| const App: React.FC = () => { |
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.
try this below.
interface AppProps extends WithTranslation {}
const App: React.FC<AppProps> = (props) => {
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.
Done
| interface DashboardProps { | ||
| title?: 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.
this need to be separate file in types/dashboard.ts
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.
Already this file after installation it will add inside module folder
Basic TypeScript App on React Chef.