Skip to content

Commit

Permalink
Merge pull request #539 from Chia-Network/develop
Browse files Browse the repository at this point in the history
Hydrate main with develop
  • Loading branch information
MichaelTaylor3D authored Mar 11, 2022
2 parents eb1639d + ef403ce commit 8210d05
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 55 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "climate-warehouse",
"version": "0.1.13",
"version": "0.1.14",
"private": true,
"author": "Chia Network Inc. <hello@chia.net>",
"homepage": "./",
Expand Down
35 changes: 11 additions & 24 deletions src/components/blocks/LeftNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const StyledTitleContainer = styled('div')`
`;

const LeftNav = withTheme(({ children }) => {
const [location, setLocation] = useState(false);
const [confirmCreateOrgIsVisible, setConfirmCreateOrgIsVisible] =
useState(false);
const [createOrgIsVisible, setCreateOrgIsVisible] = useState(false);
Expand All @@ -95,9 +94,9 @@ const LeftNav = withTheme(({ children }) => {
return () => clearTimeout(intervalId);
}, [myOrgIsNotCreated, myOrgIsCreatedButNotSubscribed, createOrgIsVisible]);

useEffect(() => {
setLocation(window.location.pathname.split(/_(.+)/)[1]);
}, [window.location]);
const isUnitsPage = window.location.pathname.includes('/units');
const isProjectsPage = window.location.pathname.includes('/projects');
const isMyRegistryPage = window.location.search.includes('myRegistry=true');

return (
<Container>
Expand All @@ -109,23 +108,17 @@ const LeftNav = withTheme(({ children }) => {
</ButtonText>
</StyledTitleContainer>
<MenuItem
selected={location === 'projects'}
selected={isProjectsPage && !isMyRegistryPage}
to="/projects"
onClick={() => {
dispatch(resetRefreshPrompt);
setLocation('projects');
}}
onClick={() => dispatch(resetRefreshPrompt)}
>
<FormattedMessage id="projects-list" />
</MenuItem>
<div></div>
<MenuItem
selected={location === 'units'}
selected={isUnitsPage && !isMyRegistryPage}
to="/units"
onClick={() => {
dispatch(resetRefreshPrompt);
setLocation('units');
}}
onClick={() => dispatch(resetRefreshPrompt)}
>
<FormattedMessage id="units-list" />
</MenuItem>
Expand All @@ -140,23 +133,17 @@ const LeftNav = withTheme(({ children }) => {
{!myOrgIsNotCreated && !myOrgIsCreatedButNotSubscribed && (
<>
<MenuItem
selected={location === 'my-projects'}
selected={isProjectsPage && isMyRegistryPage}
to={`/projects?orgUid=${myOrgUid}&myRegistry=true`}
onClick={() => {
dispatch(resetRefreshPrompt);
setLocation('my-projects');
}}
onClick={() => dispatch(resetRefreshPrompt)}
>
<FormattedMessage id="my-projects" />
</MenuItem>
<div></div>
<MenuItem
selected={location === 'my-units'}
selected={isUnitsPage && isMyRegistryPage}
to={`/units?orgUid=${myOrgUid}&myRegistry=true`}
onClick={() => {
dispatch(resetRefreshPrompt);
setLocation('my-units');
}}
onClick={() => dispatch(resetRefreshPrompt)}
>
<FormattedMessage id="my-units" />
</MenuItem>
Expand Down
21 changes: 0 additions & 21 deletions src/components/layout/UpdateRefreshContainer.js

This file was deleted.

1 change: 0 additions & 1 deletion src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ export * from './TabPanel';
export * from './Tabs';
export * from './FormContainers';
export * from './SocketStatusContainer';
export * from './UpdateRefreshContainer';
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './index.css';

import App from './App';
import store from './store';
import { saveCurrentUrlToStorage } from './navigation';

// Allows the app to reload in a platform agnostic way (either in browser or electron)
const RefreshWrapper = () => {
Expand All @@ -20,6 +21,7 @@ const RefreshWrapper = () => {
}, [appStore.refresh]);

if (appStore.refresh) {
saveCurrentUrlToStorage();
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions src/navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { Route, Redirect } from 'react-router-dom';
import { IndeterminateProgressOverlay, Dashboard } from '../components/';
import { NotificationContainer } from 'react-notifications';

import { history, reloadCurrentUrlFromStorage } from './';
import { signOut } from '../store/actions/app';

import { history } from './';
import * as Pages from '../pages';

import { createNotification } from '../utils/notificationUtils';
Expand All @@ -21,6 +20,7 @@ import {
} from '../components';
import { setPendingError, setNotificationMessage } from '../store/actions/app';
import { getOrganizationData } from '../store/actions/climateWarehouseActions';
import { reloadCurrentUrlFromStorage } from './history';

const AppNavigator = () => {
const intl = useIntl();
Expand Down
8 changes: 2 additions & 6 deletions src/store/actions/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import socketIO from 'socket.io-client';
import { messageTypes } from '../../utils/message-types';
import { keyMirror } from '../store-functions';
import { getStagingData } from './climateWarehouseActions';
import { saveCurrentUrlToStorage } from '../../navigation/history';
import { refreshApp } from './app';
import { NotificationManager } from 'react-notifications';
import constants from '../../constants';
Expand All @@ -28,12 +27,9 @@ let interval;
const notifyRefresh = _.debounce(dispatch => {
NotificationManager.info(
'Click Here To Refresh.',
'The data that is viewed may be out of date, and a refresh is reccomended',
'The data that is viewed may be out of date, and a refresh is recommended',
20000,
() => {
saveCurrentUrlToStorage();
dispatch(refreshApp());
},
() => dispatch(refreshApp(true)),
true,
);
}, 5000);
Expand Down

0 comments on commit 8210d05

Please sign in to comment.