Skip to content

Commit

Permalink
Change TitleBar storage namespace, replace callout with a full screen…
Browse files Browse the repository at this point in the history
… prompt (#19)
  • Loading branch information
MakotoE authored Apr 16, 2019
1 parent 7b1b9a0 commit 36a7d7b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/components/StoredComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class StoredComponent<P = {}, S extends StringKey = {}> extends React.Com
this.saveState(this.state);
} else {
localStorage.clear();
localStorage.setItem('app-firstVisit', 'false'); // TODO refactor (if necessary)
localStorage.setItem('app1-firstVisit', 'false'); // TODO refactor (if necessary)
}
}

Expand Down
38 changes: 25 additions & 13 deletions src/components/TitleBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {StoredComponent} from './StoredComponent';
import {TranslateFunction} from './BaseProps';
import {withTranslation} from 'react-i18next';
import {Callout, IconButton, Text} from 'office-ui-fabric-react';
import {IconButton, PrimaryButton, Text} from 'office-ui-fabric-react';
import * as React from 'react';
import * as style from './style.css';

Expand All @@ -24,10 +24,9 @@ interface State {
// use the add-in, or directing the user to help / configuration information.
export class TitleBarComponent extends StoredComponent<Props, State> {
public constructor(props: Props) {
super(props, 'app', {firstVisit: true, visible: false}, ['firstVisit']);
super(props, 'app1', {firstVisit: true, visible: false}, ['firstVisit']);
this._save = true;
this.state = {...this.state, ...StoredComponent.loadState('app', ['firstVisit'])};
this._icon = React.createRef();
this.state = {...this.state, ...StoredComponent.loadState('app1', ['firstVisit'])};
}

public render(): React.ReactNode {
Expand All @@ -42,7 +41,7 @@ export class TitleBarComponent extends StoredComponent<Props, State> {
}}
>
<Text variant='xLarge'><strong>{this.props.text}</strong></Text>
<div ref={this._icon} className={style.smallIcon}>
<div className={style.smallIcon}>
{/* TODO this icon is getting covered up by the add-in info button on Mac*/}
<IconButton
style={{marginRight: '4px'}}
Expand All @@ -55,14 +54,29 @@ export class TitleBarComponent extends StoredComponent<Props, State> {
/>
</div>
</div>
<Callout
target={this._icon.current}
<div
style={{
position: 'absolute',
zIndex: 1,
width: '100%',
height: '100%',
backgroundColor: '#FFFFFF',
}}
hidden={!this.state.visible}
onDismiss={() => this.setState({visible: false})}
>
{t('CSV Import+Export makes it easy to add CSV data to Excel. For help, click'
+ ' on the question mark to open the help page.')}
</Callout>
<div className={style.pageMargin}>
<Text variant='mediumPlus'>
{t('CSV Import+Export makes it easy to add CSV data to Excel. If you'
+ ' need any help, the "?" icon in the top right corner will take'
+ ' you to the help page.')}
</Text>
<br /><br />
<PrimaryButton
text={t('Continue')}
onClick={() => this.setState({visible: false})}
/>
</div>
</div>
</>
);
}
Expand All @@ -71,8 +85,6 @@ export class TitleBarComponent extends StoredComponent<Props, State> {
this.setState(state => ({visible: state.firstVisit}));
this.setState({firstVisit: false});
}

private readonly _icon: React.RefObject<HTMLDivElement>;
}

// @ts-ignore
Expand Down
3 changes: 2 additions & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"importExport": {
"CSV Import+Export makes it easy to add CSV data to Excel. For help, click on the question mark to open the help page.": "CSV Import+Export makes it easy to add CSV data to Excel. For help, click on the question mark to open the help page.",
"CSV Import+Export makes it easy to add CSV data to Excel. If you need any help, the \"?\" icon in the top right corner will take you to the help page.": "CSV Import+Export makes it easy to add CSV data to Excel. If you need any help, the \"?\" icon in the top right corner will take you to the help page.",
"Continue": "Continue",
"Help page": "Help page",
"Auto-detect": "Auto-detect",
"Other": "Other",
Expand Down

0 comments on commit 36a7d7b

Please sign in to comment.