-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathsuccessPanel.tsx
More file actions
52 lines (44 loc) · 2.28 KB
/
successPanel.tsx
File metadata and controls
52 lines (44 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import {Constants} from "../../constants";
import {UrlUtils} from "../../urlUtils";
import {ExtensionUtils} from "../../extensions/extensionUtils";
import {Localization} from "../../localization/localization";
import * as Log from "../../logging/log";
import {ClipperStateProp} from "../clipperState";
import {ComponentBase} from "../componentBase";
import {Clipper} from "../frontEndGlobals";
import {SpriteAnimation} from "../components/spriteAnimation";
class SuccessPanelClass extends ComponentBase<{ }, ClipperStateProp> {
public onLaunchOneNoteButton() {
Clipper.logger.logUserFunnel(Log.Funnel.Label.ViewInWac);
let data = this.props.clipperState.oneNoteApiResult.data as OneNoteApi.Page;
if (data && data.links && data.links.oneNoteWebUrl && data.links.oneNoteWebUrl.href) {
let urlWithFromClipperParam = UrlUtils.addUrlQueryValue(data.links.oneNoteWebUrl.href, Constants.Urls.QueryParams.wdFromClipper, "1");
window.open(urlWithFromClipperParam, "_blank");
} else {
Clipper.logger.logFailure(Log.Failure.Label.OnLaunchOneNoteButton, Log.Failure.Type.Unexpected,
{ error: "Page created and returned by API is either missing entirely, or missing its links, oneNoteWebUrl, or oneNoteWebUrl.href. Page: " + data });
}
}
render() {
return (
<div id={Constants.Ids.clipperSuccessContainer}>
<div className="messageLabelContainer successPagePadding">
<SpriteAnimation spriteUrl={ExtensionUtils.getImageResourceUrl("checkmark.png")} imageHeight={28} totalFrameCount={30} loop={false} tabIndex={-1} />
<span className="actionLabelFont messageLabel" role="alert"
style={Localization.getFontFamilyAsStyle(Localization.FontFamily.Light)}>
{Localization.getLocalizedString("WebClipper.Label.ClipSuccessful")}
</span>
</div>
<div className="wideButtonContainer">
<a id={Constants.Ids.launchOneNoteButton} className="wideButtonFont wideActionButton buttonTextInHighContrast" role="button"
{...this.enableInvoke({callback: this.onLaunchOneNoteButton, tabIndex: 70})}
style={Localization.getFontFamilyAsStyle(Localization.FontFamily.Regular)}>
{Localization.getLocalizedString("WebClipper.Action.ViewInOneNote")}
</a>
</div>
</div>
);
}
}
let component = SuccessPanelClass.componentize();
export {component as SuccessPanel};