From 39ebbbd88ead24b9ae8df061bd8c40c33c14790b Mon Sep 17 00:00:00 2001 From: Hoang Pham Date: Wed, 22 Dec 2021 11:40:01 -0600 Subject: [PATCH] UI - formatted tsx files with prettier (single quote) --- lattice/src/App.tsx | 20 ++++------ lattice/src/App/AuthFlow/SignInButton.tsx | 6 +-- lattice/src/App/AuthFlow/SignOutButton.tsx | 6 +-- lattice/src/App/AuthFlow/Signin.tsx | 4 +- lattice/src/Main.tsx | 46 +++++++++++----------- lattice/src/index.tsx | 2 +- lattice/src/services/eventServices.tsx | 26 ++++++------ lattice/src/services/useAuth.tsx | 4 +- 8 files changed, 53 insertions(+), 61 deletions(-) diff --git a/lattice/src/App.tsx b/lattice/src/App.tsx index 9ee4804e1..4a93cd6ff 100644 --- a/lattice/src/App.tsx +++ b/lattice/src/App.tsx @@ -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 - } - /> + } /> ) : ( diff --git a/lattice/src/App/AuthFlow/SignInButton.tsx b/lattice/src/App/AuthFlow/SignInButton.tsx index 2b43b1121..7ebd9b8b7 100644 --- a/lattice/src/App/AuthFlow/SignInButton.tsx +++ b/lattice/src/App/AuthFlow/SignInButton.tsx @@ -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 = ({ children }) => { const signinOnClick = (e) => { - window.location.href = "/login"; + window.location.href = '/login'; }; return ( diff --git a/lattice/src/App/AuthFlow/SignOutButton.tsx b/lattice/src/App/AuthFlow/SignOutButton.tsx index b38c2cf33..3e76c22db 100644 --- a/lattice/src/App/AuthFlow/SignOutButton.tsx +++ b/lattice/src/App/AuthFlow/SignOutButton.tsx @@ -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 = ({ children }) => { const signoutOnClick = (e) => { - window.location.href = "/logout"; + window.location.href = '/logout'; }; return ( diff --git a/lattice/src/App/AuthFlow/Signin.tsx b/lattice/src/App/AuthFlow/Signin.tsx index d6ef3c457..4a5bb8ce2 100644 --- a/lattice/src/App/AuthFlow/Signin.tsx +++ b/lattice/src/App/AuthFlow/Signin.tsx @@ -9,9 +9,7 @@ import SignInButton from './SignInButton'; function Signin(props) { const renderLoginForm = () => ( - + diff --git a/lattice/src/Main.tsx b/lattice/src/Main.tsx index 44b80179f..b29410889 100644 --- a/lattice/src/Main.tsx +++ b/lattice/src/Main.tsx @@ -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( - localStorage.getItem("theme") || "light" - ); + const [theme, setTheme] = useState(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 (
- +
@@ -44,9 +42,9 @@ const Main = () => {
- + - +
diff --git a/lattice/src/index.tsx b/lattice/src/index.tsx index cc5626a9f..dccfe3cab 100644 --- a/lattice/src/index.tsx +++ b/lattice/src/index.tsx @@ -12,7 +12,7 @@ ReactDOM.render( , - document.getElementById("root") + document.getElementById('root') ); // If you want your app to work offline and load faster, you can change diff --git a/lattice/src/services/eventServices.tsx b/lattice/src/services/eventServices.tsx index 2fdca224d..b2adcfd33 100644 --- a/lattice/src/services/eventServices.tsx +++ b/lattice/src/services/eventServices.tsx @@ -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: { diff --git a/lattice/src/services/useAuth.tsx b/lattice/src/services/useAuth.tsx index fd0f4ece1..0c94cb733 100644 --- a/lattice/src/services/useAuth.tsx +++ b/lattice/src/services/useAuth.tsx @@ -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);