Skip to content

Commit

Permalink
feat: migrate more baseapp features from carbon retirement repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael.Taylor committed Nov 12, 2021
1 parent 92b2b72 commit 804701a
Show file tree
Hide file tree
Showing 73 changed files with 3,451 additions and 189 deletions.
27 changes: 0 additions & 27 deletions .eslintrc

This file was deleted.

46 changes: 16 additions & 30 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,27 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true
"amd": true,
"node": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
}
},
"extends": [
"eslint:recommended",
"plugin:jest/recommended",
"plugin:react/recommended"
],
"rules": {
"no-const-assign": "warn",
"no-this-before-super": "warn",
"no-undef": "warn",
"no-continue": "off",
"no-unreachable": "warn",
"no-unused-vars": "warn",
"constructor-super": "warn",
"valid-typeof": "warn",
"quotes": [2, "single"],
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"operator-linebreak": "off",
"linebreak-style": "off",
"import/prefer-default-export": "off",
"object-curly-spacing": "off",
"react/prop-types": "off",
"arrow-parens": "off",
"no-param-reassign": "off",
"vars-on-top": "off",
"no-bitwise": "off",
"import/order": "off",
"react/jsx-one-expression-per-line": "off",
"implicit-arrow-linebreak": "off"
"react/prop-types": "off"
},
"parser": "babel-eslint",
"extends": "airbnb",
"plugins": ["react", "jsx-a11y", "import"]
"plugins": ["react"],
"settings": {
"react": {
"version": "detect"
}
}
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
15.0.1
8 changes: 8 additions & 0 deletions check_node_version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const semver = require('semver');
const { engines } = require('./package');
const version = engines.node;
if (!semver.satisfies(process.version, version)) {
throw new Error(
`The current node version${process.version} does not satisfy the required version ${version} .`,
);
}
34 changes: 34 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"private": true,
"homepage": "./",
"main": "src/start.js",
"engineStrict": true,
"engines": {
"node": ">=15.0.1"
},
"dependencies": {
"@emotion/react": "^11.5.0",
"@emotion/styled": "^11.3.0",
Expand All @@ -13,10 +17,12 @@
"@testing-library/user-event": "^12.1.10",
"electron": "^15.3.0",
"lodash": "^4.17.21",
"minisearch": "^3.1.0",
"react": "^17.0.2",
"react-content-loader": "^6.0.3",
"react-dom": "^17.0.2",
"react-intl": "^5.21.0",
"react-paginate": "^8.0.0",
"react-redux": "^7.2.6",
"react-router-dom": "^5.3.0",
"react-scripts": "4.0.3",
Expand All @@ -36,7 +42,8 @@
"react-start": "react-scripts start",
"pack": "build --dir",
"dist": "npm run build && build",
"postinstall": "install-app-deps"
"requirements-check": "node check_node_version.js",
"postinstall": "npm run requirements-check && install-app-deps"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -73,7 +80,7 @@
"standard-version": "^9.3.2"
},
"build": {
"appId": "com.electron.electron-with-create-react-app",
"appId": "com.chia.climate-warehouse",
"win": {
"iconUrl": "https://cdn2.iconfinder.com/data/icons/designer-skills/128/react-256.png"
},
Expand Down
6 changes: 3 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" style="width: 100%; height: 100%; min-width: 565px">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
Expand All @@ -26,9 +26,9 @@
-->
<title>React App</title>
</head>
<body>
<body style="width: 100%; height: 100%">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="root" style="width: 100%; height: 100%"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
55 changes: 34 additions & 21 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,51 @@
import React, { useEffect, useState } from 'react';
import { Provider } from 'react-redux';
import { ThemeProvider } from 'styled-components';
import { IntlProvider } from 'react-intl';

import { loadLocaleData } from './translations';
import store from './store';
import { AppNavigator } from './navigation';
import React, {useEffect, useState} from 'react';
import {ThemeProvider} from 'styled-components';
import {IntlProvider} from 'react-intl';
import {useDispatch, useSelector} from 'react-redux';

import {setLocale, setThemeFromLocalStorage} from './store/actions/app';
import {loadLocaleData} from './translations';

import {AppNavigator} from './navigation';
import theme from './theme';

import { IndeterminateProgressOverlay } from './components';
import {IndeterminateProgressOverlay} from './components';

const App = () => {
const dispatch = useDispatch();
const appStore = useSelector(state => state.app);
const [translationTokens, setTranslationTokens] = useState();

useEffect(
() => dispatch(setThemeFromLocalStorage),
[setThemeFromLocalStorage],
);

useEffect(() => {
const processTranslationTokens = async () => {
setTranslationTokens(await loadLocaleData());
};
if (appStore.locale) {
const processTranslationTokens = async () => {
setTranslationTokens(await loadLocaleData(appStore.locale));
};

processTranslationTokens();
}, []);
processTranslationTokens();
} else {
dispatch(setLocale(navigator.language));
}
}, [appStore.locale]);

if (!translationTokens) {
return <IndeterminateProgressOverlay />;
}

return (
<Provider store={store}>
<ThemeProvider theme={theme}>
<IntlProvider defaultLocale="en" messages={translationTokens.default}>
<AppNavigator />
</IntlProvider>
</ThemeProvider>
</Provider>
<ThemeProvider theme={theme}>
<IntlProvider
locale="en"
defaultLocale="en"
messages={translationTokens.default}>
<AppNavigator />
</IntlProvider>
</ThemeProvider>
);
};

Expand Down
Binary file added src/assets/fonts/Roboto-Light.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Medium.ttf
Binary file not shown.
Binary file added src/assets/fonts/Roboto-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/ionicons.eot
Binary file not shown.
Loading

0 comments on commit 804701a

Please sign in to comment.