diff --git a/src/app/views/App.styles.ts b/src/app/views/App.styles.ts index 4f1947a1d..4e1139162 100644 --- a/src/app/views/App.styles.ts +++ b/src/app/views/App.styles.ts @@ -66,6 +66,15 @@ export const appStyles = (theme: ITheme) => { '&:hover': { borderRight: '3px solid silver' } + }, + feedbackButtonFullScreenDisplay: { + position: 'relative', + top: '5px' + }, + feedbackButtonMobileDisplay: { + position: 'absolute', + top: '-1px', + right: '15px' } }; }; diff --git a/src/app/views/App.tsx b/src/app/views/App.tsx index f68427f8b..76fe47b64 100644 --- a/src/app/views/App.tsx +++ b/src/app/views/App.tsx @@ -39,6 +39,7 @@ import { QueryRunner } from './query-runner'; import { parse } from './query-runner/util/iframe-message-parser'; import { Settings } from './settings'; import { Sidebar } from './sidebar/Sidebar'; +import { FeedbackButton } from './app-sections/FeedbackButton'; interface IAppProps { theme?: ITheme; @@ -294,9 +295,14 @@ class App extends Component { alignItems: minimised ? '' : 'center', marginLeft: minimised ? '' : '-0.9em' }}> -
+
+ {minimised && +
+ +
+ }
@@ -387,7 +393,7 @@ class App extends Component {
{graphExplorerMode === Mode.Complete && ( { + onResize={(e: any, direction: any, ref: any) => { if (ref?.style?.width) { this.resizeSideBar(ref.style.width); } diff --git a/src/app/views/app-sections/AppTitle.tsx b/src/app/views/app-sections/AppTitle.tsx index 303a883ce..2a96ed2f2 100644 --- a/src/app/views/app-sections/AppTitle.tsx +++ b/src/app/views/app-sections/AppTitle.tsx @@ -24,6 +24,7 @@ export function appTitleDisplayOnFullScreen( iconProps={{ iconName: 'GlobalNavButton' }} className={classes.sidebarToggle} ariaLabel={!minimised ? 'Minimize sidebar' : 'Maximize sidebar'} + styles={{root: { position:'relative', top: '3px'}}} onClick={() => toggleSidebar()} />
@@ -32,11 +33,11 @@ export function appTitleDisplayOnFullScreen( {displayGraphLabel(classes)} }
-
+
{!minimised && - <> +
- +
}
; @@ -59,7 +60,7 @@ export function appTitleDisplayOnMobileScreen(
{displayGraphLabel(classes)}
-
+
diff --git a/src/app/views/app-sections/FeedbackButton.tsx b/src/app/views/app-sections/FeedbackButton.tsx index a5cd164d8..cc8e0e183 100644 --- a/src/app/views/app-sections/FeedbackButton.tsx +++ b/src/app/views/app-sections/FeedbackButton.tsx @@ -7,18 +7,14 @@ import { IRootState } from '../../../types/root'; import { ACCOUNT_TYPE } from '../../services/graph-constants'; export const FeedbackButton = () => { - const [enableSurvey, setEnableShowSurvey] = useState(false); + const [enableSurvey, setEnableSurvey] = useState(false); const { profile } = useSelector( (state: IRootState) => state ); - const toggleFeedback = () => { - setEnableShowSurvey(prevState => !prevState); - } - const feedbackIcon : IIconProps = { iconName : 'Feedback' } const feedbackTitle = translateMessage('Feedback'); - const content_ =
{translateMessage('Feedback')}
+ const content =
{translateMessage('Feedback')}
const feedbackIconStyles = { root:{ @@ -30,22 +26,29 @@ export const FeedbackButton = () => { gapSpace: 0 }; const hostStyles = { root: { - display: 'inline-block', - padding: '15px' + display: 'inline-block' } }; + const toggleSurvey = () => { + setEnableSurvey(prevState => !prevState); + } + + const disableSurvey = () => { + setEnableSurvey(false); + } + return (
{profile?.profileType !== ACCOUNT_TYPE.AAD &&
- { disabled={enableSurvey} /> - + +
}
diff --git a/src/app/views/query-runner/request/Request.tsx b/src/app/views/query-runner/request/Request.tsx index 89d7c5e9d..eadd1e802 100644 --- a/src/app/views/query-runner/request/Request.tsx +++ b/src/app/views/query-runner/request/Request.tsx @@ -20,7 +20,6 @@ import { translateMessage } from '../../../utils/translate-messages'; import { convertPxToVh, convertVhToPx } from '../../common/dimensions/dimensions-adjustment'; import { Auth } from './auth'; import { RequestBody } from './body'; -import FeedbackForm from './feedback/FeedbackForm'; import { RequestHeaders } from './headers'; import { Permission } from './permissions'; import './request.scss'; @@ -209,9 +208,6 @@ export class Request extends Component {
-
- -
); } diff --git a/src/app/views/query-runner/request/feedback/FeedbackForm.tsx b/src/app/views/query-runner/request/feedback/FeedbackForm.tsx index 43ce164dd..459e9280f 100644 --- a/src/app/views/query-runner/request/feedback/FeedbackForm.tsx +++ b/src/app/views/query-runner/request/feedback/FeedbackForm.tsx @@ -2,7 +2,7 @@ import { makeFloodgate } from '@ms-ofb/officebrowserfeedbacknpm/Floodgate'; import { AuthenticationType } from '@ms-ofb/officebrowserfeedbacknpm/scripts/app/Configuration/IInitOptions'; import { OfficeBrowserFeedback } from '@ms-ofb/officebrowserfeedbacknpm/scripts/app/Window/Window'; import { getTheme, MessageBarType } from '@fluentui/react'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { geLocale } from '../../../../../appLocale'; @@ -15,7 +15,7 @@ import { getVersion } from '../../../../utils/version'; import CampaignDefinitions from './campaignDefinitions'; import { uiStringMap } from './uiStrings'; -export default function FeedbackForm({ activated, dismissSurvey }: any) { +export default function FeedbackForm({ activated, onDismissSurvey, onDisableSurvey }: any) { const dispatch = useDispatch(); const [officeBrowserFeedback, setOfficeBrowserFeedback] = useState(undefined); const currentTheme = getTheme(); @@ -33,7 +33,9 @@ export default function FeedbackForm({ activated, dismissSurvey }: any) { }); } - initializeFeedback(); + useEffect(() => { + initializeFeedback(); + }, []); const showCustomSurvey = () => { const customSurvey: OfficeBrowserFeedback.ICustomSurvey = { @@ -55,10 +57,13 @@ export default function FeedbackForm({ activated, dismissSurvey }: any) { surveyType: 2, title: translateMessage('title') } - - officeBrowserFeedback.floodgate.showCustomSurvey(customSurvey).catch( - (error: any) => { throw error; } - ); + if(officeBrowserFeedback){ + officeBrowserFeedback.floodgate.showCustomSurvey(customSurvey).catch( + (error: any) => { + onDisableSurvey(); + throw error; } + ); + } } if (activated) { @@ -107,7 +112,7 @@ export default function FeedbackForm({ activated, dismissSurvey }: any) { })); } - dismissSurvey(); + onDismissSurvey(); }, uIStringGetter: (str: string): any => { return uiStringMap[str]; } };