add animations
Change-Id: I55d77e10e680d9d72f7fefd4a3e4e2b193fad11d
diff --git a/client/src/App.js b/client/src/App.js
index 6d2284c..3687dcc 100644
--- a/client/src/App.js
+++ b/client/src/App.js
@@ -10,7 +10,7 @@
import './App.scss'
import SignInPage from "./pages/loginDialog.jsx"
-import JamiMessenger from "./pages/messenger.jsx"
+import JamiMessenger from "./pages/JamiMessenger.jsx"
import AccountSettings from "./pages/accountSettings.jsx"
import AccountSelection from "./pages/accountSelection.jsx"
import ServerSetup from "./pages/serverSetup.jsx"
@@ -18,6 +18,7 @@
import NotFoundPage from "./pages/404.jsx"
import LoadingPage from './components/loading'
import JamiAccountDialog from './pages/jamiAccountCreation.jsx'
+import { AnimatePresence } from 'framer-motion'
import WelcomeAnimation from './components/welcome'
const App = (props) => {
@@ -29,7 +30,7 @@
useEffect(() => {
authManager.init(auth => {
- setState({ loaded: true, auth })
+ setState({ loaded: false, auth })
})
return () => authManager.deinit()
}, []);
@@ -44,18 +45,24 @@
</Switch>
}
return <React.Fragment>
- <Switch>
- <Route exact path="/"><Redirect to="/account" /></Route>
- <Route path="/account/:accountId/settings" component={AccountSettings} />
- <Route path="/account/:accountId/addContact/:contactId" component={JamiMessenger} />
- <Route path="/account/:accountId/conversation/:conversationId" component={JamiMessenger} />
- <Route path="/account/:accountId" component={JamiMessenger} />
- <Route path="/account" component={AccountSelection} />
- <Route path="/newAccount/jami" component={JamiAccountDialog} />
- <Route path="/newAccount" component={AccountCreationDialog} />
- <Route component={NotFoundPage} />
- </Switch>
- {!state.auth.authenticated && <SignInPage open={!state.auth.authenticated}/>}
+ <Route
+ render={({ location }) => {
+ console.log("App render location")
+
+ return <AnimatePresence exitBeforeEnter initial={false}>
+ <Switch location={location} key={location.pathname}>
+ <Route exact path="/"><Redirect to="/account" /></Route>
+ <Route path="/account/:accountId/settings" component={AccountSettings} />
+ <Route path="/account/:accountId" component={JamiMessenger} />
+ <Route path="/account" component={AccountSelection} />
+ <Route path="/newAccount/jami" component={JamiAccountDialog} />
+ <Route path="/newAccount" component={AccountCreationDialog} />
+ <Route path="/setup"><Redirect to="/account" /></Route>
+ <Route component={NotFoundPage} />
+ </Switch>
+ {!state.auth.authenticated && <SignInPage open={!state.auth.authenticated}/>}
+ </AnimatePresence>}}
+ />
</React.Fragment>
}