From aea42344ded1708361e7e1d577e9c6aa370ad64e Mon Sep 17 00:00:00 2001 From: ludovicm67 Date: Fri, 31 Jan 2020 12:18:19 +0100 Subject: webui: transform index and App to TypeScript --- webui/src/App.js | 63 ---------------------------------------- webui/src/App.tsx | 68 ++++++++++++++++++++++++++++++++++++++++++++ webui/src/index.js | 38 ------------------------- webui/src/index.tsx | 38 +++++++++++++++++++++++++ webui/src/react-app-env.d.ts | 1 + 5 files changed, 107 insertions(+), 101 deletions(-) delete mode 100644 webui/src/App.js create mode 100644 webui/src/App.tsx delete mode 100644 webui/src/index.js create mode 100644 webui/src/index.tsx create mode 100644 webui/src/react-app-env.d.ts (limited to 'webui/src') diff --git a/webui/src/App.js b/webui/src/App.js deleted file mode 100644 index b9c57327..00000000 --- a/webui/src/App.js +++ /dev/null @@ -1,63 +0,0 @@ -import AppBar from '@material-ui/core/AppBar'; -import CssBaseline from '@material-ui/core/CssBaseline'; -import { createMuiTheme, ThemeProvider } from '@material-ui/core/styles'; -import { makeStyles } from '@material-ui/styles'; -import Toolbar from '@material-ui/core/Toolbar'; -import React from 'react'; -import { Route, Switch } from 'react-router'; -import { Link } from 'react-router-dom'; - -import BugQuery from './bug/BugQuery'; -import ListQuery from './list/ListQuery'; -import CurrentIdentity from './CurrentIdentity'; - -const theme = createMuiTheme({ - palette: { - primary: { - main: '#263238', - }, - }, -}); - -const useStyles = makeStyles(theme => ({ - offset: theme.mixins.toolbar, - filler: { - flexGrow: 1, - }, - appTitle: { - ...theme.typography.h6, - color: 'white', - textDecoration: 'none', - display: 'flex', - alignItems: 'center', - }, - logo: { - height: '42px', - marginRight: theme.spacing(2), - }, -})); - -export default function App() { - const classes = useStyles(); - - return ( - - - - - - git-bug - git-bug - -
- -
-
-
- - - - - - ); -} diff --git a/webui/src/App.tsx b/webui/src/App.tsx new file mode 100644 index 00000000..d996eed6 --- /dev/null +++ b/webui/src/App.tsx @@ -0,0 +1,68 @@ +import AppBar from '@material-ui/core/AppBar'; +import CssBaseline from '@material-ui/core/CssBaseline'; +import { + createMuiTheme, + ThemeProvider, + makeStyles, +} from '@material-ui/core/styles'; +import Toolbar from '@material-ui/core/Toolbar'; +import React from 'react'; +import { Route, Switch } from 'react-router'; +import { Link } from 'react-router-dom'; + +import BugQuery from './bug/BugQuery'; +import ListQuery from './list/ListQuery'; +import CurrentIdentity from './CurrentIdentity'; + +const theme = createMuiTheme({ + palette: { + primary: { + main: '#263238', + }, + }, +}); + +const useStyles = makeStyles(theme => ({ + offset: { + ...theme.mixins.toolbar, + }, + filler: { + flexGrow: 1, + }, + appTitle: { + ...theme.typography.h6, + color: 'white', + textDecoration: 'none', + display: 'flex', + alignItems: 'center', + }, + logo: { + height: '42px', + marginRight: theme.spacing(2), + }, +})); + +export default function App() { + const classes = useStyles(); + + return ( + + + + + + git-bug + git-bug + +
+ +
+
+
+ + + + + + ); +} diff --git a/webui/src/index.js b/webui/src/index.js deleted file mode 100644 index 6f838c69..00000000 --- a/webui/src/index.js +++ /dev/null @@ -1,38 +0,0 @@ -import ThemeProvider from '@material-ui/styles/ThemeProvider'; -import { createMuiTheme } from '@material-ui/core/styles'; -import ApolloClient from 'apollo-boost'; -import { - IntrospectionFragmentMatcher, - InMemoryCache, -} from 'apollo-cache-inmemory'; -import React from 'react'; -import { ApolloProvider } from 'react-apollo'; -import ReactDOM from 'react-dom'; -import { BrowserRouter } from 'react-router-dom'; - -import introspectionQueryResultData from './fragmentTypes'; -import App from './App'; - -const theme = createMuiTheme(); - -const client = new ApolloClient({ - uri: '/graphql', - cache: new InMemoryCache({ - fragmentMatcher: new IntrospectionFragmentMatcher({ - introspectionQueryResultData, - }), - }), -}); - -ReactDOM.render( - - - - - - - - - , - document.getElementById('root') -); diff --git a/webui/src/index.tsx b/webui/src/index.tsx new file mode 100644 index 00000000..6f838c69 --- /dev/null +++ b/webui/src/index.tsx @@ -0,0 +1,38 @@ +import ThemeProvider from '@material-ui/styles/ThemeProvider'; +import { createMuiTheme } from '@material-ui/core/styles'; +import ApolloClient from 'apollo-boost'; +import { + IntrospectionFragmentMatcher, + InMemoryCache, +} from 'apollo-cache-inmemory'; +import React from 'react'; +import { ApolloProvider } from 'react-apollo'; +import ReactDOM from 'react-dom'; +import { BrowserRouter } from 'react-router-dom'; + +import introspectionQueryResultData from './fragmentTypes'; +import App from './App'; + +const theme = createMuiTheme(); + +const client = new ApolloClient({ + uri: '/graphql', + cache: new InMemoryCache({ + fragmentMatcher: new IntrospectionFragmentMatcher({ + introspectionQueryResultData, + }), + }), +}); + +ReactDOM.render( + + + + + + + + + , + document.getElementById('root') +); diff --git a/webui/src/react-app-env.d.ts b/webui/src/react-app-env.d.ts new file mode 100644 index 00000000..6431bc5f --- /dev/null +++ b/webui/src/react-app-env.d.ts @@ -0,0 +1 @@ +/// -- cgit