Skip to content
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

Waitp 1197 tupaia web initial setup #4603

Merged
merged 12 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,69 @@
"prefer-destructuring": "warn",
"prettier/prettier": "warn"
}
},
{
"files": [
"packages/tupaia-web/**"
],
"extends": [
"eslint:recommended",
"plugin:react-hooks/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react-refresh"
],
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
},
"rules": {
"camelcase": "warn",
"import/no-named-as-default": "off",
"no-debugger": "warn",
"import/no-cycle": "warn",
"import/extensions": "off",
"jsx-a11y/click-events-have-key-events": "warn",
"jsx-a11y/no-noninteractive-element-interactions": "warn",
"jsx-a11y/no-static-element-interactions": "warn",
"no-dupe-keys": "warn",
"no-param-reassign": "warn",
"no-restricted-properties": "warn",
"no-shadow": "warn",
"no-unsafe-finally": "warn",
"no-useless-catch": "warn",
"no-unused-vars": "warn",
"react/default-props-match-prop-types": "warn",
"react/no-unused-prop-types": "warn",
"react/no-array-index-key": "warn",
"react/forbid-prop-types": "warn",
"react/prop-types": "warn",
"react/prefer-stateless-function": "warn",
"react/require-default-props": "warn",
"react/state-in-constructor": "warn",
"react/static-property-placement": "warn",
"prefer-destructuring": "warn",
"prettier/prettier": "warn",
"react-refresh/only-export-components": "warn",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-no-target-blank": "off",
"react/button-has-type": "off"
}
}
]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ While each package type has their own structure, there are a few common standard
### Platform interfaces

- [Tupaia](https://github.com/beyondessential/tupaia/blob/dev/packages/web-frontend/README.md) (for legacy reasons referred to as web-frontend)
- [Tupaia Web](https://github.com/beyondessential/tupaia/blob/dev/packages/tupaia-web/README.md) (New version of web-frontend)
- [Admin Panel](https://github.com/beyondessential/tupaia/blob/dev/packages/admin-panel/README.md)
- [LESMIS](https://github.com/beyondessential/tupaia/blob/dev/packages/lesmis/README.md)
- [PSSS](https://github.com/beyondessential/tupaia/blob/dev/packages/psss/README.md)
Expand Down
2 changes: 2 additions & 0 deletions codeship-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
command: './packages/devops/scripts/ci/testInternalDependencies.sh'
- name: Test web-frontend
command: './packages/devops/scripts/ci/testFrontend.sh web-frontend'
- name: Test tupaia-web
command: './packages/devops/scripts/ci/testFrontend.sh tupaia-web'
- type: parallel
name: Test batch 3
steps:
Expand Down
2 changes: 2 additions & 0 deletions packages/devops/ci/tupaia-ci-cd.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ RUN mkdir -p ./packages/report-server
COPY packages/report-server/package.json ./packages/report-server
RUN mkdir -p ./packages/server-boilerplate
COPY packages/server-boilerplate/package.json ./packages/server-boilerplate
RUN mkdir -p ./packages/tupaia-web
COPY packages/tupaia-web/package.json ./packages/tupaia-web
RUN mkdir -p ./packages/tsutils
COPY packages/tsutils/package.json ./packages/tsutils
RUN mkdir -p ./packages/types
Expand Down
1 change: 1 addition & 0 deletions packages/tupaia-web/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_CONFIG_SERVER_BASE_URL=
24 changes: 24 additions & 0 deletions packages/tupaia-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions packages/tupaia-web/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts-prepend-node-path=true
20 changes: 20 additions & 0 deletions packages/tupaia-web/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
core: {
builder: '@storybook/builder-vite',
},
};
export default config;
19 changes: 19 additions & 0 deletions packages/tupaia-web/.storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700&display=swap"
/>

<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.1.0/leaflet.css"
/>

<style>
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: Roboto, sans-serif;
}
</style>
34 changes: 34 additions & 0 deletions packages/tupaia-web/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import type { Preview } from '@storybook/react';
import { AppStyleProviders } from '../src/AppStyleProviders';
import { DARK_BLUE, WHITE } from '../src/theme';

const preview: Preview = {
parameters: {
backgrounds: {
default: 'Dark',
values: [
{ name: 'Dark', value: DARK_BLUE },
{ name: 'Light', value: WHITE },
],
},
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
decorators: [
Story => {
return (
<AppStyleProviders>
<Story />
</AppStyleProviders>
);
},
],
};

export default preview;
46 changes: 46 additions & 0 deletions packages/tupaia-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# @tupaia/tupaia-web

Main [Tupaia](https://tupaia.org/) application.

# Development

### Supported Browsers

Targeted browsers are:

- Chrome
- Firefox
- IE11 and newer

### Tools

- Visual Studio Code: Our preferred text/code editor. Good extensions as follows
- - Yarn: Basically does the job of 'npm' in terminal but faster and smarter
- - Reactjs code snippets
- - React-Native/React/Redux snippets for es6/es7
- - JavaScript (ES6) code snippets
- Github Desktop (or how ever you like to manage your git)

### Backend

For any charts/measures to load any data, basically anything to work, you need need a config server providing the API for web-frontend. There are 2 options

#### Point at a remote server

Create a .env file in the root directory of the project if you haven't already. Add the following line if you want to connect to the dev server:

```
REACT_APP_CONFIG_SERVER_BASE_URL = https://dev-config.tupaia.org/api/v1/
```

or add the following line if you want to connect to the live server:

```
REACT_APP_CONFIG_SERVER_BASE_URL = https://config.tupaia.org/api/v1/
```

The default is http://localhost:8080/api/v1/.

#### Host the backend locally

[Instructions are here](https://github.com/beyondessential/tupaia/blob/dev/packages/web-config-server/README.md) for running config server and a docker instance of the DHIS2 aggregation server. You shouldn't need to change LOCAL_URL as above, as the existing localhost address and port should be the default local/dev address for web-config-server.
Loading