mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 01:18:34 +00:00
show username
This commit is contained in:
1 parent
ec66d5b002
commit
b6710d9bc0
3 files changed
+18
-6
No files matched your search
+2
-2
@@ -134,8 +134,8 @@ class App extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.startupQueryServiceSettings();
|
||||
this.querySession();
|
||||
this.startupQueryServiceSettings();
|
||||
setInterval(() => this.querySession, 10000);
|
||||
//this.state.videoJobPoller.start();
|
||||
//this.state.videoQueuePoller.start();
|
||||
@@ -428,7 +428,7 @@ class App extends React.Component<Props, State> {
|
||||
<div id="viewable">
|
||||
<TopNav
|
||||
enableAlpha={this.state.enableAlpha}
|
||||
loggedIn={this.state.loggedIn}
|
||||
sessionState={this.state.sessionState}
|
||||
mode={this.state.mode}
|
||||
historyBadgeCount={this.state.utterances.length}
|
||||
isHistoryCountBadgeVisible={this.state.isHistoryCountBadgeVisible}
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface SessionStateResponse {
|
||||
logged_in: boolean,
|
||||
|
||||
// Extended user details (only if logged in)
|
||||
user_info?: UserInfo,
|
||||
user?: UserInfo,
|
||||
}
|
||||
|
||||
export interface UserInfo {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import React from 'react';
|
||||
import { Mode } from '../AppMode'
|
||||
import { SessionStateResponse } from '../api/SessionState';
|
||||
|
||||
interface Props {
|
||||
enableAlpha: boolean,
|
||||
loggedIn: boolean,
|
||||
sessionState?: SessionStateResponse,
|
||||
mode: Mode,
|
||||
historyBadgeCount: number,
|
||||
isHistoryCountBadgeVisible: boolean,
|
||||
@@ -24,15 +25,26 @@ function TopNav(props: Props) {
|
||||
badge = <span className={className}>{props.historyBadgeCount}</span>;
|
||||
}
|
||||
|
||||
let loggedIn = false;
|
||||
let displayName = "My Account";
|
||||
|
||||
if (props.sessionState !== undefined) {
|
||||
console.log('sessionstate', props.sessionState);
|
||||
loggedIn = props.sessionState.logged_in;
|
||||
if (props.sessionState.user !== undefined) {
|
||||
displayName = props.sessionState.user.display_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Vo.codes 2.0
|
||||
let loginManagement = <span />;
|
||||
let extendedFeatures = <span />;
|
||||
|
||||
if (props.enableAlpha) {
|
||||
if (props.loggedIn) {
|
||||
if (loggedIn) {
|
||||
loginManagement = (
|
||||
<span>
|
||||
<a href="#profile" onClick={() => props.switchModeCallback(Mode.PROFILE_MODE)}>username</a>
|
||||
<a href="#profile" onClick={() => props.switchModeCallback(Mode.PROFILE_MODE)}>{displayName}</a>
|
||||
<a href="#logout" onClick={() => props.logoutHandler()}>Log Out</a>
|
||||
</span>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user