From 5f404450a01abd83c89de0f15b946938cc9b03ba Mon Sep 17 00:00:00 2001 From: Thomas Jay Rush Date: Mon, 27 Jan 2020 16:59:18 -0500 Subject: [PATCH] Changing filenames to use PascalCase for component files --- frontend/src/Content.js | 6 +++--- .../dash-menu.css => DashMenu/DashMenu.css} | 0 .../dash-menu.jsx => DashMenu/DashMenu.jsx} | 2 +- frontend/src/components/DashMenu/index.js | 2 ++ .../chevron.jsx => MainMenu/Chevron.jsx} | 6 +++--- .../main-menu.css => MainMenu/MainMenu.css} | 0 .../main-menu.jsx => MainMenu/MainMenu.jsx} | 19 ++++++------------- .../main-menu => MainMenu}/MenuItem.jsx | 2 +- .../SubmenuItem.jsx} | 0 frontend/src/components/MainMenu/index.js | 2 ++ .../reducer.js => MainMenu/reducers.js} | 0 .../SidePanel.css} | 0 .../SidePanel.jsx} | 8 ++------ frontend/src/components/SidePanel/index.js | 2 ++ .../reducers.js} | 0 ...oll-observer.jsx => TopScrollObserver.jsx} | 10 ++++------ frontend/src/components/breadcrumb.jsx | 4 +--- .../{ => data-tables}/identicons.css | 0 .../{ => data-tables}/identicons.jsx | 0 .../components/data-tables/old-data-table.js | 2 +- frontend/src/components/index.js | 11 ++++++----- frontend/src/components/menus/index.js | 4 ---- .../src/components/menus/main-menu/index.js | 1 - frontend/src/components/page.jsx | 13 +++---------- frontend/src/components/panels/status.jsx | 2 +- frontend/src/pages/templates/blank-content.js | 9 ++++----- .../pages/templates/blank-root-reducers.js | 4 ++-- frontend/src/root-reducers.js | 4 ++-- 28 files changed, 46 insertions(+), 67 deletions(-) rename frontend/src/components/{menus/dash-menu.css => DashMenu/DashMenu.css} (100%) rename frontend/src/components/{menus/dash-menu.jsx => DashMenu/DashMenu.jsx} (99%) create mode 100644 frontend/src/components/DashMenu/index.js rename frontend/src/components/{menus/main-menu/chevron.jsx => MainMenu/Chevron.jsx} (70%) rename frontend/src/components/{menus/main-menu/main-menu.css => MainMenu/MainMenu.css} (100%) rename frontend/src/components/{menus/main-menu/main-menu.jsx => MainMenu/MainMenu.jsx} (83%) rename frontend/src/components/{menus/main-menu => MainMenu}/MenuItem.jsx (96%) rename frontend/src/components/{menus/main-menu/SubMenuItem.jsx => MainMenu/SubmenuItem.jsx} (100%) create mode 100644 frontend/src/components/MainMenu/index.js rename frontend/src/components/{menus/main-menu/reducer.js => MainMenu/reducers.js} (100%) rename frontend/src/components/{panels/side-panel.css => SidePanel/SidePanel.css} (100%) rename frontend/src/components/{panels/side-panel.jsx => SidePanel/SidePanel.jsx} (82%) create mode 100644 frontend/src/components/SidePanel/index.js rename frontend/src/components/{panels/side-panel-actions.js => SidePanel/reducers.js} (100%) rename frontend/src/components/{top-scroll-observer.jsx => TopScrollObserver.jsx} (56%) rename frontend/src/components/{ => data-tables}/identicons.css (100%) rename frontend/src/components/{ => data-tables}/identicons.jsx (100%) delete mode 100644 frontend/src/components/menus/index.js delete mode 100644 frontend/src/components/menus/main-menu/index.js diff --git a/frontend/src/Content.js b/frontend/src/Content.js index 0319a031..25aad5ca 100644 --- a/frontend/src/Content.js +++ b/frontend/src/Content.js @@ -13,8 +13,8 @@ import { other_menu } from './pages/other'; import { settings_menu } from './pages/settings'; import { support_menu } from './pages/support'; -import { STATUS_TOGGLE, HELP_TOGGLE } from './components/panels/side-panel-actions'; -import { MAIN_MENU_TOGGLE } from './components/menus/main-menu/reducer'; +import { STATUS_TOGGLE, HELP_TOGGLE } from './components/SidePanel/reducers'; +import { MAIN_MENU_TOGGLE } from './components/MainMenu/reducers'; import { MainMenu, StatusPanel, HelpPanel, PageHelp } from './components'; import Routes from './routes'; import './Content.css'; @@ -28,7 +28,7 @@ const mainMenu = [ caches_menu, other_menu, settings_menu, - support_menu, + support_menu ]; const toggleStatus = () => ({ type: STATUS_TOGGLE }); diff --git a/frontend/src/components/menus/dash-menu.css b/frontend/src/components/DashMenu/DashMenu.css similarity index 100% rename from frontend/src/components/menus/dash-menu.css rename to frontend/src/components/DashMenu/DashMenu.css diff --git a/frontend/src/components/menus/dash-menu.jsx b/frontend/src/components/DashMenu/DashMenu.jsx similarity index 99% rename from frontend/src/components/menus/dash-menu.jsx rename to frontend/src/components/DashMenu/DashMenu.jsx index a89114b2..aa838bf7 100644 --- a/frontend/src/components/menus/dash-menu.jsx +++ b/frontend/src/components/DashMenu/DashMenu.jsx @@ -1,6 +1,6 @@ /*-----------------------------------------------------------------------------*/ import React, { Fragment } from 'react'; -import './dash-menu.css'; +import './DashMenu.css'; import * as ad from '../../pages/addresses/dispatchers'; import * as ex from '../../pages/explore/dispatchers'; import * as ind from '../../pages/indicies/dispatchers'; diff --git a/frontend/src/components/DashMenu/index.js b/frontend/src/components/DashMenu/index.js new file mode 100644 index 00000000..3df0f5dc --- /dev/null +++ b/frontend/src/components/DashMenu/index.js @@ -0,0 +1,2 @@ +import { DashMenu } from './DashMenu'; +export { DashMenu }; diff --git a/frontend/src/components/menus/main-menu/chevron.jsx b/frontend/src/components/MainMenu/Chevron.jsx similarity index 70% rename from frontend/src/components/menus/main-menu/chevron.jsx rename to frontend/src/components/MainMenu/Chevron.jsx index 6c4caae0..346625f5 100644 --- a/frontend/src/components/menus/main-menu/chevron.jsx +++ b/frontend/src/components/MainMenu/Chevron.jsx @@ -1,11 +1,11 @@ import React from 'react'; -import { Icon } from '../../icon'; +import { Icon } from '../icon'; //------------------------------------------------------------ -export default function Chevron ({ active }) { +export default function Chevron({ active }) { return (
); -}; +} diff --git a/frontend/src/components/menus/main-menu/main-menu.css b/frontend/src/components/MainMenu/MainMenu.css similarity index 100% rename from frontend/src/components/menus/main-menu/main-menu.css rename to frontend/src/components/MainMenu/MainMenu.css diff --git a/frontend/src/components/menus/main-menu/main-menu.jsx b/frontend/src/components/MainMenu/MainMenu.jsx similarity index 83% rename from frontend/src/components/menus/main-menu/main-menu.jsx rename to frontend/src/components/MainMenu/MainMenu.jsx index 90b71232..925ebe85 100644 --- a/frontend/src/components/menus/main-menu/main-menu.jsx +++ b/frontend/src/components/MainMenu/MainMenu.jsx @@ -1,8 +1,8 @@ import React from 'react'; import { connect } from 'react-redux'; -import { ExpandShrinkIcon } from '../../'; +import { ExpandShrinkIcon } from '../'; import MenuItem from './MenuItem'; -import './main-menu.css'; +import './MainMenu.css'; /** * Check which main menu matches loaded page and returns its index @@ -17,7 +17,7 @@ function getInitialActiveMenuIndex(pathname, menus) { return menus.findIndex((menu) => menu.page === pageToMatch); } -export class MainMenu extends React.Component { +class MainMenu extends React.Component { constructor(props) { super(props); this.state = { @@ -39,17 +39,12 @@ export class MainMenu extends React.Component { render = () => { const { isExpanded } = this.props; - const className = [ - 'left-body-container', - isExpanded ? 'expanded' : '' - ].join(' '); + const className = ['left-body-container', isExpanded ? 'expanded' : ''].join(' '); return (
{this.state.mainMenu.map((menu, index) => { return ( @@ -76,6 +71,4 @@ const mapStateToProps = ({ router, reducer_MainMenu }, ownProps) => ({ toggle: ownProps.toggle }); -export const ConnectedMainMenu = connect( - mapStateToProps -)(MainMenu); +export default connect(mapStateToProps)(MainMenu); diff --git a/frontend/src/components/menus/main-menu/MenuItem.jsx b/frontend/src/components/MainMenu/MenuItem.jsx similarity index 96% rename from frontend/src/components/menus/main-menu/MenuItem.jsx rename to frontend/src/components/MainMenu/MenuItem.jsx index 3462e109..575710be 100644 --- a/frontend/src/components/menus/main-menu/MenuItem.jsx +++ b/frontend/src/components/MainMenu/MenuItem.jsx @@ -1,7 +1,7 @@ import React, { Fragment } from 'react'; import { NavLink } from 'react-router-dom'; import SubmenuItem from './SubmenuItem'; -import Chevron from './chevron'; +import Chevron from './Chevron'; export default function MenuItem({ id, active: mainMenuActive, page, items, onClick }) { const hasSubMenu = items && items.length > 0; diff --git a/frontend/src/components/menus/main-menu/SubMenuItem.jsx b/frontend/src/components/MainMenu/SubmenuItem.jsx similarity index 100% rename from frontend/src/components/menus/main-menu/SubMenuItem.jsx rename to frontend/src/components/MainMenu/SubmenuItem.jsx diff --git a/frontend/src/components/MainMenu/index.js b/frontend/src/components/MainMenu/index.js new file mode 100644 index 00000000..095b22c3 --- /dev/null +++ b/frontend/src/components/MainMenu/index.js @@ -0,0 +1,2 @@ +import MainMenu from './MainMenu'; +export { MainMenu }; diff --git a/frontend/src/components/menus/main-menu/reducer.js b/frontend/src/components/MainMenu/reducers.js similarity index 100% rename from frontend/src/components/menus/main-menu/reducer.js rename to frontend/src/components/MainMenu/reducers.js diff --git a/frontend/src/components/panels/side-panel.css b/frontend/src/components/SidePanel/SidePanel.css similarity index 100% rename from frontend/src/components/panels/side-panel.css rename to frontend/src/components/SidePanel/SidePanel.css diff --git a/frontend/src/components/panels/side-panel.jsx b/frontend/src/components/SidePanel/SidePanel.jsx similarity index 82% rename from frontend/src/components/panels/side-panel.jsx rename to frontend/src/components/SidePanel/SidePanel.jsx index bc6eb836..bfac166d 100644 --- a/frontend/src/components/panels/side-panel.jsx +++ b/frontend/src/components/SidePanel/SidePanel.jsx @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { ExpandShrinkIcon } from '../'; -import './side-panel.css'; +import './SidePanel.css'; const getShrinkToClass = (shrinkTo) => `shrink-to-${shrinkTo}`; @@ -14,11 +14,7 @@ export const SidePanel = (props) => {
{props.title} - +
{isExpanded ? props.children : null}
diff --git a/frontend/src/components/SidePanel/index.js b/frontend/src/components/SidePanel/index.js new file mode 100644 index 00000000..133f86c9 --- /dev/null +++ b/frontend/src/components/SidePanel/index.js @@ -0,0 +1,2 @@ +import { SidePanel } from './SidePanel'; +export { SidePanel }; diff --git a/frontend/src/components/panels/side-panel-actions.js b/frontend/src/components/SidePanel/reducers.js similarity index 100% rename from frontend/src/components/panels/side-panel-actions.js rename to frontend/src/components/SidePanel/reducers.js diff --git a/frontend/src/components/top-scroll-observer.jsx b/frontend/src/components/TopScrollObserver.jsx similarity index 56% rename from frontend/src/components/top-scroll-observer.jsx rename to frontend/src/components/TopScrollObserver.jsx index 67d3781e..be1635ea 100644 --- a/frontend/src/components/top-scroll-observer.jsx +++ b/frontend/src/components/TopScrollObserver.jsx @@ -1,21 +1,19 @@ import React from 'react'; -export default class TopScrollObserver extends React.Component { +export class TopScrollObserver extends React.Component { constructor(props) { super(props); this.targetRef = React.createRef(); - this.observer = new IntersectionObserver(entries => { - const [ firstEntry ] = entries; + this.observer = new IntersectionObserver((entries) => { + const [firstEntry] = entries; props.onTopScroll(firstEntry.intersectionRatio < 1); }); } render() { - return ( -
- ); + return
; } componentDidMount() { diff --git a/frontend/src/components/breadcrumb.jsx b/frontend/src/components/breadcrumb.jsx index e7b0312d..f8ebbb20 100644 --- a/frontend/src/components/breadcrumb.jsx +++ b/frontend/src/components/breadcrumb.jsx @@ -1,8 +1,6 @@ import React from 'react'; -function BreadCrumb({ page, menu }) { +export function BreadCrumb({ page, menu }) { var text = menu ? page + ' : ' + menu.subpage.replace('_', ' ') : page; return
{text}
; } - -export default BreadCrumb; diff --git a/frontend/src/components/identicons.css b/frontend/src/components/data-tables/identicons.css similarity index 100% rename from frontend/src/components/identicons.css rename to frontend/src/components/data-tables/identicons.css diff --git a/frontend/src/components/identicons.jsx b/frontend/src/components/data-tables/identicons.jsx similarity index 100% rename from frontend/src/components/identicons.jsx rename to frontend/src/components/data-tables/identicons.jsx diff --git a/frontend/src/components/data-tables/old-data-table.js b/frontend/src/components/data-tables/old-data-table.js index 0c7499fe..0bf53397 100644 --- a/frontend/src/components/data-tables/old-data-table.js +++ b/frontend/src/components/data-tables/old-data-table.js @@ -1,7 +1,7 @@ //---------------------------------------------------------------------- import React, { Fragment } from 'react'; import './old-data-table.css'; -import Identicon from '../identicons'; +import Identicon from './identicons'; import { Icon } from '../icon'; var Utils = require('../../utils'); diff --git a/frontend/src/components/index.js b/frontend/src/components/index.js index ed824cb9..6a123a1a 100644 --- a/frontend/src/components/index.js +++ b/frontend/src/components/index.js @@ -1,16 +1,17 @@ -import { Page, PageHeader, PageFooter } from './page'; +import { Page, PageHeader, PageFooter } from './Page'; import { DataTable } from './data-tables'; import { OldDataTable } from './data-tables/old-data-table'; import { ObjectTable } from './data-tables/object-data-table'; import { Icon } from './icon'; import { Loading } from './loading'; import { isReady, isError, NotReady, isEmpty, EmptyQuery } from './not-ready'; -import BreadCrumb from './breadcrumb'; -import { MainMenu, DashMenu } from './menus'; -import { SidePanel } from './panels/side-panel'; +import { BreadCrumb } from './BreadCrumb'; +import { DashMenu } from './DashMenu'; +import { TopScrollObserver } from './TopScrollObserver'; +import { MainMenu } from './MainMenu'; +import { SidePanel } from './SidePanel'; import StatusPanel from './panels/status'; import HelpPanel from './panels/help'; -import TopScrollObserver from './top-scroll-observer'; import PageHelp from './PageHelp'; import ExpandShrinkIcon from './ExpandShrinkIcon'; diff --git a/frontend/src/components/menus/index.js b/frontend/src/components/menus/index.js deleted file mode 100644 index 765e51f1..00000000 --- a/frontend/src/components/menus/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import { ConnectedMainMenu as MainMenu } from './main-menu'; -import { DashMenu } from './dash-menu'; - -export { MainMenu, DashMenu }; diff --git a/frontend/src/components/menus/main-menu/index.js b/frontend/src/components/menus/main-menu/index.js deleted file mode 100644 index e1e18090..00000000 --- a/frontend/src/components/menus/main-menu/index.js +++ /dev/null @@ -1 +0,0 @@ -export { ConnectedMainMenu } from './main-menu'; diff --git a/frontend/src/components/page.jsx b/frontend/src/components/page.jsx index 4ccba713..e93f511e 100644 --- a/frontend/src/components/page.jsx +++ b/frontend/src/components/page.jsx @@ -8,16 +8,12 @@ import medium from '../img/medium.svg'; import twitter from '../img/twitter.svg'; // import facebook from '../img/facebook.svg'; // import linkedin from '../img/linkedin.svg'; -import './page.css'; +import './Page.css'; //---------------------------------------------------------------------- export class Page extends React.Component { render = () => { - return ( - - {this.props.inner} - - ); + return {this.props.inner}; }; static propTypes = { @@ -27,10 +23,7 @@ export class Page extends React.Component { //------------------------------------------------------------ export function PageHeader({ small }) { - const className = [ - 'header-item', - (small ? 'small' : '') - ].join(' '); + const className = ['header-item', small ? 'small' : ''].join(' '); return (
diff --git a/frontend/src/components/panels/status.jsx b/frontend/src/components/panels/status.jsx index e29a0a90..a776e2a0 100644 --- a/frontend/src/components/panels/status.jsx +++ b/frontend/src/components/panels/status.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { SidePanel } from './side-panel'; +import { SidePanel } from '../SidePanel'; import StatusInner from './status-inner'; import './status.css'; diff --git a/frontend/src/pages/templates/blank-content.js b/frontend/src/pages/templates/blank-content.js index 0ce1313b..2e8dae72 100644 --- a/frontend/src/pages/templates/blank-content.js +++ b/frontend/src/pages/templates/blank-content.js @@ -3,15 +3,14 @@ import { Route } from 'react-router-dom'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; -[{IMPORTS1}] -import { STATUS_TOGGLE, HELP_TOGGLE } from './components/panels/side-panel-actions'; -import { MAIN_MENU_TOGGLE } from './components/menus/main-menu/reducer'; +[{ IMPORTS1 }]; +import { STATUS_TOGGLE, HELP_TOGGLE } from './components/SidePanel/reducers'; +import { MAIN_MENU_TOGGLE } from './components/MainMenu/reducers'; import { MainMenu, StatusPanel, HelpPanel, PageHelp } from './components'; import Routes from './routes'; import './Content.css'; -const mainMenu = [ -[{NAVLINKS}]]; +const mainMenu = [[{ NAVLINKS }]]; const toggleStatus = () => ({ type: STATUS_TOGGLE }); const toggleHelp = () => ({ type: HELP_TOGGLE }); diff --git a/frontend/src/pages/templates/blank-root-reducers.js b/frontend/src/pages/templates/blank-root-reducers.js index d38b2ffb..366188f8 100644 --- a/frontend/src/pages/templates/blank-root-reducers.js +++ b/frontend/src/pages/templates/blank-root-reducers.js @@ -2,9 +2,9 @@ import { combineReducers } from 'redux'; //------------------------------------------------------------------------ import reducer_Status from './components/panels/status-actions'; -import reducer_SidePanels from './components/panels/side-panel-actions'; +import reducer_SidePanels from './components/SidePanel/reducers'; import reducer_LastLocation from './last-location-actions'; -import reducer_MainMenu from './components/menus/main-menu/reducer'; +import reducer_MainMenu from './components/MainMenu/reducers'; [{REDIMPORTS}] //------------------------------------------------------------------------ export default combineReducers({ diff --git a/frontend/src/root-reducers.js b/frontend/src/root-reducers.js index 6b99e84c..1ab03a50 100644 --- a/frontend/src/root-reducers.js +++ b/frontend/src/root-reducers.js @@ -2,9 +2,9 @@ import { combineReducers } from 'redux'; //------------------------------------------------------------------------ import reducer_Status from './components/panels/status-actions'; -import reducer_SidePanels from './components/panels/side-panel-actions'; +import reducer_SidePanels from './components/SidePanel/reducers'; import reducer_LastLocation from './last-location-actions'; -import reducer_MainMenu from './components/menus/main-menu/reducer'; +import reducer_MainMenu from './components/MainMenu/reducers'; import reducer_Dashboard from './pages/dashboard/reducers'; import reducer_Addresses from './pages/addresses/reducers'; import reducer_Explore from './pages/explore/reducers';