From c8c69e7e4b1b50ae70498cdff418d691e8e5dd53 Mon Sep 17 00:00:00 2001 From: Edmond Chui <1967998+EdmondChuiHW@users.noreply.github.com> Date: Mon, 25 Mar 2024 16:22:13 +0000 Subject: [PATCH] add feedback link support --- .../entrypoints/rn_inspector/rn_inspector.ts | 1 + front_end/global_typings/react_native.d.ts | 1 + front_end/panels/rn_welcome/RNWelcome.ts | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/front_end/entrypoints/rn_inspector/rn_inspector.ts b/front_end/entrypoints/rn_inspector/rn_inspector.ts index 68d897d722a..c8011fbd5ae 100644 --- a/front_end/entrypoints/rn_inspector/rn_inspector.ts +++ b/front_end/entrypoints/rn_inspector/rn_inspector.ts @@ -38,6 +38,7 @@ Root.Runtime.experiments.register( 'Show React Native-specific UI', /* unstable */ false, /* docLink */ globalThis.reactNativeDocLink ?? 'https://reactnative.dev/docs/debugging', + /* feedbackLink */ globalThis.reactNativeFeedbackLink, ); Root.Runtime.experiments.register( diff --git a/front_end/global_typings/react_native.d.ts b/front_end/global_typings/react_native.d.ts index 7e55da40bc5..07d575ce965 100644 --- a/front_end/global_typings/react_native.d.ts +++ b/front_end/global_typings/react_native.d.ts @@ -10,5 +10,6 @@ declare global { var enableReactNativePerfMetrics: boolean|undefined; var enableReactNativePerfMetricsGlobalPostMessage: boolean|undefined; var reactNativeDocLink: string|undefined; + var reactNativeFeedbackLink: string|undefined; } } diff --git a/front_end/panels/rn_welcome/RNWelcome.ts b/front_end/panels/rn_welcome/RNWelcome.ts index b3ceca6e297..c55efe0b790 100644 --- a/front_end/panels/rn_welcome/RNWelcome.ts +++ b/front_end/panels/rn_welcome/RNWelcome.ts @@ -20,7 +20,9 @@ const UIStrings = { /** @description "Debugging docs" link */ docsLabel: 'Debugging docs', /** @description "What's new" link */ - whatsNewLabel: "What's new", + whatsNewLabel: 'What\'s new', + /** @description "Send feedback" link */ + feedbackLabel: 'Send feedback', }; const {render, html} = LitHtml; @@ -51,6 +53,8 @@ export class RNWelcomeImpl extends UI.Widget.VBox { render(): void { const welcomeIconUrl = new URL('../../Images/react_native/welcomeIcon.png', import.meta.url).toString(); + const feedbackLink = this.getFeedbackLink(); + render( html`
@@ -73,6 +77,11 @@ export class RNWelcomeImpl extends UI.Widget.VBox { ${i18nString(UIStrings.whatsNewLabel)} + ${!feedbackLink ? LitHtml.nothing : html` + + ${i18nString(UIStrings.feedbackLabel)} + + `}
`, @@ -86,4 +95,10 @@ export class RNWelcomeImpl extends UI.Widget.VBox { return experimentDocLink ?? 'https://reactnative.dev/docs/debugging'; } + + private getFeedbackLink(): string|undefined { + return Root.Runtime.experiments.enabledExperiments() + .find(e => e.name === Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI) + ?.feedbackLink; + } }