Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Commit

Permalink
Merge pull request #116 from sanyamjain04/improved-code-quality
Browse files Browse the repository at this point in the history
improve code quality
  • Loading branch information
paraswaykole authored Apr 17, 2023
2 parents 17234fb + ae3e364 commit 8537d19
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import styles from './cheatsheet.module.scss'
import React, { useRef, useState } from 'react'
import { DBConnType } from '../../../data/defaults'
import CheatsheetCommand from './command'
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/components/dbfragments/query.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import styles from './query.module.scss'
import React, { useContext, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import { DBConnection, DBQuery, DBQueryData, DBQueryResult, Tab } from '../../data/models'
import { DBConnection, DBQueryData, DBQueryResult, Tab } from '../../data/models'
import QueryEditor from './queryeditor/queryeditor'
import { selectDBConnection } from '../../redux/dbConnectionSlice'
import { useAppDispatch, useAppSelector } from '../../redux/hooks'
Expand All @@ -14,10 +14,7 @@ import { closeTab, updateActiveTab } from '../../redux/tabsSlice'
import TabContext from '../layouts/tabcontext'


type DBQueryPropType = {
}

const DBQueryFragment = (_: DBQueryPropType) => {
const DBQueryFragment = () => {

const dispatch = useAppDispatch()

Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/dbfragments/showmodel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import { useAppSelector } from '../../redux/hooks'
import TabContext from '../layouts/tabcontext'
import DataModel from './datamodel/datamodel'

type DBShowModelPropType = {

}

const DBShowModelFragment = (_: DBShowModelPropType) => {
const DBShowModelFragment = () => {

const dbConnection: DBConnection | undefined = useAppSelector(selectDBConnection)
const currentTab: Tab = useContext(TabContext)!
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/dbfragments/table/addmodal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styles from './table.module.scss'
import React, { useContext, useState } from 'react'
import { ApiResult, AddDataResponse, DBConnection, DBQueryData, Tab } from '../../../data/models'
import toast from 'react-hot-toast'
import { useAppDispatch, useAppSelector } from '../../../redux/hooks'
import { useAppDispatch } from '../../../redux/hooks'
import { addDBData, setQueryData } from '../../../redux/dataModelSlice'
import { DBConnType } from '../../../data/defaults'
import TabContext from '../../layouts/tabcontext'
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/components/layouts/applayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { FunctionComponent, useEffect } from 'react'
import React, { FunctionComponent } from 'react'
import Header from './header'
import Footer from './footer'
import Sidebar from './sidebar'
Expand All @@ -7,11 +7,7 @@ import { useAppSelector } from '../../redux/hooks';
import { selectIsShowingSidebar } from '../../redux/configSlice';
import TabsBar from './tabsbar';

type PageLayoutPropType = {

}

const AppLayout: FunctionComponent<PageLayoutPropType> = () => {
const AppLayout: FunctionComponent = () => {

const location = useLocation()

Expand Down
5 changes: 1 addition & 4 deletions frontend/src/components/layouts/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ import Constants from '../../constants'
import { useEffect } from 'react'
import { checkConnection, selectDBConnection, selectIsDBConnected, getDBDataModels, resetDBDataModels } from '../../redux/dbConnectionSlice'


type FooterPropType = {}

const Footer = (_: FooterPropType) => {
const Footer = () => {

const navigate = useNavigate()
const location = useLocation()
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/layouts/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ import { selectProjects } from '../../redux/projectsSlice'
import { selectDBConnection } from '../../redux/dbConnectionSlice'
import utils from '../../lib/utils'

declare var window: any;

type HeaderPropType = {}

const Header = (_: HeaderPropType) => {
const Header = () => {

let location = useLocation()
const navigate = useNavigate()
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ConstantsType {
}

declare global {
var CONFIG: {
const CONFIG: {
API_HOST: string;
}
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/redux/allDBConnectionsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const getAllDBConnections = createAsyncThunk(

export const addNewDBConn = createAsyncThunk(
'allDBConnections/addNewDBConn',
async (payload: AddDBConnPayload, { rejectWithValue, getState }: any) => {
async (payload: AddDBConnPayload, { rejectWithValue }: any) => {
const response = await eventService.addNewDBConn(payload)
if (response.success) {
const dbConn = response.success ? response.data : null
Expand All @@ -60,7 +60,7 @@ export const allDBConnectionSlice = createSlice({
name: 'allDBConnections',
initialState,
reducers: {
reset: (state) => initialState
reset: () => initialState
},
extraReducers: (builder) => {
builder
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/redux/projectsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const projectsSlice = createSlice({
name: 'projects',
initialState,
reducers: {
reset: (state) => initialState
reset: () => initialState
},
extraReducers: (builder) => {
builder
Expand Down

0 comments on commit 8537d19

Please sign in to comment.