A local-first personal finance app
Update the server button in the corner to take the user to the “change server” page if none is configured
Jed Fox0b706c5eeee8
diff --git a/packages/desktop-client/src/components/LoggedInUser.js b/packages/desktop-client/src/components/LoggedInUser.jsindex 46d472fe19..6f01609738 100644--- a/packages/desktop-client/src/components/LoggedInUser.js+++ b/packages/desktop-client/src/components/LoggedInUser.js@@ -1,6 +1,6 @@import React, { useState, useEffect } from 'react';import { connect } from 'react-redux';-import { withRouter } from 'react-router';+import { useHistory, withRouter } from 'react-router';import * as actions from 'loot-core/src/client/actions';import {View,@@ -10,9 +10,9 @@ import {Menu} from 'loot-design/src/components/common';import { colors } from 'loot-design/src/style';+import useServerURL from '../hooks/useServerURL';function LoggedInUser({- history,files,budgetId,userData,@@ -26,6 +26,8 @@ function LoggedInUser({}) {let [loading, setLoading] = useState(true);let [menuOpen, setMenuOpen] = useState(false);+ const url = useServerURL();+ const history = useHistory();useEffect(() => {getUserData().then(() => setLoading(false));@@ -33,7 +35,7 @@ function LoggedInUser({async function onChangePassword() {await closeBudget();- window.__history.push('/change-password');+ history.push('/change-password');}function onMenuSelect(type) {@@ -51,7 +53,11 @@ function LoggedInUser({}function onClick() {- setMenuOpen(true);+ if (url) {+ setMenuOpen(true);+ } else {+ history.push('/config-server');+ }}if (loading) {@@ -68,7 +74,7 @@ function LoggedInUser({return (<View style={[{ flexDirection: 'row', alignItems: 'center' }, style]}><Button bare onClick={onClick} style={{ color }}>- Server+ {url ? 'Server' : 'No server'}</Button>{menuOpen && (@@ -82,7 +88,7 @@ function LoggedInUser({items={[{ name: 'change-password', text: 'Change password' },{ name: 'sign-out', text: 'Sign out' }- ].filter(x => x)}+ ]}/></Tooltip>)}