UI - formatted tsx files with prettier (single quote)

This commit is contained in:
Hoang Pham 2021-12-22 11:40:01 -06:00
parent 9612096682
commit 39ebbbd88e
8 changed files with 53 additions and 61 deletions

View file

@ -1,11 +1,11 @@
import { BrowserRouter, Route, Switch } from "react-router-dom";
import { MuiThemeProvider } from "@material-ui/core/styles";
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { MuiThemeProvider } from '@material-ui/core/styles';
import { useAuth } from "services/useAuth";
import PrivateRoute from "shared/PrivateRoute/PrivateRoute";
import { lightTheme } from "theme/";
import Main from "Main";
import Signin from "App/AuthFlow/Signin";
import { useAuth } from 'services/useAuth';
import PrivateRoute from 'shared/PrivateRoute/PrivateRoute';
import { lightTheme } from 'theme/';
import Main from 'Main';
import Signin from 'App/AuthFlow/Signin';
const App = () => {
const auth = useAuth();
@ -21,11 +21,7 @@ const App = () => {
{auth.isAuthOn ? (
// Auth is on, hide the routes with PrivateRoute
<Switch>
<Route
exact
path="/signin"
render={(props) => <Signin {...props}></Signin>}
/>
<Route exact path="/signin" render={(props) => <Signin {...props}></Signin>} />
<PrivateRoute path="/" component={Main} />
</Switch>
) : (

View file

@ -1,5 +1,5 @@
import React from "react";
import { Button } from "@material-ui/core";
import React from 'react';
import { Button } from '@material-ui/core';
interface Props {
children?: React.ReactNode;
@ -7,7 +7,7 @@ interface Props {
const SignInButton: React.FC<Props> = ({ children }) => {
const signinOnClick = (e) => {
window.location.href = "/login";
window.location.href = '/login';
};
return (

View file

@ -1,5 +1,5 @@
import React from "react";
import { Button } from "@material-ui/core";
import React from 'react';
import { Button } from '@material-ui/core';
interface Props {
children?: React.ReactNode;
@ -7,7 +7,7 @@ interface Props {
const SignOutButton: React.FC<Props> = ({ children }) => {
const signoutOnClick = (e) => {
window.location.href = "/logout";
window.location.href = '/logout';
};
return (

View file

@ -9,9 +9,7 @@ import SignInButton from './SignInButton';
function Signin(props) {
const renderLoginForm = () => (
<Card>
<CardHeader
subheader={"Sign in to continue"}
/>
<CardHeader subheader={'Sign in to continue'} />
<CardContent>
<SignInButton />
</CardContent>

View file

@ -1,41 +1,39 @@
import { useEffect, useState } from "react";
import { Route, Switch } from "react-router-dom";
import CssBaseline from "@material-ui/core/CssBaseline";
import { MuiThemeProvider } from "@material-ui/core/styles";
import { useEffect, useState } from 'react';
import { Route, Switch } from 'react-router-dom';
import CssBaseline from '@material-ui/core/CssBaseline';
import { MuiThemeProvider } from '@material-ui/core/styles';
import { Header } from "shared/Header";
import { Nav } from "shared/Nav";
import { darkTheme, lightTheme } from "theme/";
import { Home } from "App/Home";
import { MoleculaTablesContainer } from "App/MoleculaTables";
import { NotFound } from "App/NotFound";
import { QueryContainer } from "App/Query";
import { QueryBuilderContainer } from "App/QueryBuilder";
import { Header } from 'shared/Header';
import { Nav } from 'shared/Nav';
import { darkTheme, lightTheme } from 'theme/';
import { Home } from 'App/Home';
import { MoleculaTablesContainer } from 'App/MoleculaTables';
import { NotFound } from 'App/NotFound';
import { QueryContainer } from 'App/Query';
import { QueryBuilderContainer } from 'App/QueryBuilder';
import css from "./App.module.scss";
import css from './App.module.scss';
const Main = () => {
const [theme, setTheme] = useState<string>(
localStorage.getItem("theme") || "light"
);
const [theme, setTheme] = useState<string>(localStorage.getItem('theme') || 'light');
useEffect(() => {
if (theme === "dark") {
document.documentElement.setAttribute("data-theme", "dark");
if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark');
} else {
document.documentElement.removeAttribute("data-theme");
document.documentElement.removeAttribute('data-theme');
}
}, [theme]);
const onToggleTheme = () => {
const newTheme = theme === "dark" ? "light" : "dark";
const newTheme = theme === 'dark' ? 'light' : 'dark';
setTheme(newTheme);
localStorage.setItem("theme", newTheme);
localStorage.setItem('theme', newTheme);
};
return (
<div>
<MuiThemeProvider theme={theme === "light" ? lightTheme : darkTheme}>
<MuiThemeProvider theme={theme === 'light' ? lightTheme : darkTheme}>
<CssBaseline />
<Header onToggleTheme={onToggleTheme} />
<div className={css.container}>
@ -44,9 +42,9 @@ const Main = () => {
<div className={css.mainContent}>
<Switch>
<Route exact path="/" component={Home} />
<Route path="/tables/:id?" component={MoleculaTablesContainer}/>
<Route path="/tables/:id?" component={MoleculaTablesContainer} />
<Route exact path="/query" component={QueryContainer} />
<Route exact path="/querybuilder" component={QueryBuilderContainer}/>
<Route exact path="/querybuilder" component={QueryBuilderContainer} />
<Route component={NotFound} />
</Switch>
</div>

View file

@ -12,7 +12,7 @@ ReactDOM.render(
<App />
</ProvideAuth>
</React.StrictMode>,
document.getElementById("root")
document.getElementById('root')
);
// If you want your app to work offline and load faster, you can change

View file

@ -5,48 +5,48 @@ import { baseURL } from './baseURL';
const api = axios.create({
baseURL,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json",
'Content-Type': 'application/x-www-form-urlencoded',
Accept: 'application/json',
},
});
export const pilosa = {
get: {
status() {
return api.get("/status");
return api.get('/status');
},
auth() {
return api.get("/auth");
return api.get('/auth');
},
userinfo() {
return api.get("/userinfo");
return api.get('/userinfo');
},
info() {
return api.get("/info");
return api.get('/info');
},
version() {
return api.get("/version");
return api.get('/version');
},
transactions() {
return api.get("/ui/transaction");
return api.get('/ui/transaction');
},
transaction(id) {
return api.get(`/transaction/${id}`);
},
schema() {
return api.get("/schema");
return api.get('/schema');
},
schemaDetails() {
return api.get("/schema/details");
return api.get('/schema/details');
},
metrics() {
return api.get("/metrics.json");
return api.get('/metrics.json');
},
usage() {
return api.get("/ui/usage");
return api.get('/ui/usage');
},
queryHistory() {
return api.get("/query-history");
return api.get('/query-history');
},
},
post: {

View file

@ -51,10 +51,10 @@ function useProvideAuth() {
// Authentication is off
setIsAuthOn(false);
} else {
// Turn on Authentication
// Turn on Authentication
setIsAuthOn(true);
if (res.data === "OK") {
if (res.data === 'OK') {
// User is authenticated
setIsAuthenticated(true);