Skip to content

Commit 35e98c9

Browse files
feat: add user feedback button (#5831)
* feat: add userpilot feedback button in new script editor * chore: add feature flag around the feedback button
1 parent 941618f commit 35e98c9

File tree

2 files changed

+58
-32
lines changed

2 files changed

+58
-32
lines changed

src/dataExplorer/components/FluxQueryBuilder.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
padding: $cf-space-xs 0;
2929
border-top: 2px solid $cf-grey-15;
3030
border-bottom: 2px solid $cf-grey-15;
31+
32+
.userpilot-feedback {
33+
color: $c-pool;
34+
cursor: pointer;
35+
}
3136
}
3237

3338
.flux-query-builder__action-button {

src/dataExplorer/components/FluxQueryBuilder.tsx

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ const FluxQueryBuilder: FC = () => {
8181
}
8282
}
8383

84+
const handleUserpilot = () => {
85+
if (window.userpilot) {
86+
window.userpilot.trigger('1663269889fDfn2554')
87+
}
88+
}
89+
8490
return (
8591
<EditorProvider>
8692
<SidebarProvider>
@@ -124,38 +130,53 @@ const FluxQueryBuilder: FC = () => {
124130
className="flux-query-builder--menu"
125131
data-testid="flux-query-builder--menu"
126132
>
127-
<Button
128-
onClick={handleNewScript}
129-
text={isFlagEnabled('saveAsScript') ? 'New Script' : 'Clear'}
130-
icon={IconFont.Plus_New}
131-
status={
132-
query.length === 0
133-
? ComponentStatus.Disabled
134-
: ComponentStatus.Default
135-
}
136-
testID="flux-query-builder--new-script"
137-
/>
138-
{isFlagEnabled('saveAsScript') && (
139-
<Button
140-
className="flux-query-builder__action-button"
141-
onClick={() => setOverlayType(OverlayType.OPEN)}
142-
text="Open"
143-
icon={IconFont.Export_New}
144-
/>
145-
)}
146-
{isFlagEnabled('saveAsScript') && (
147-
<Button
148-
className="flux-query-builder__action-button"
149-
onClick={() => setOverlayType(OverlayType.SAVE)}
150-
status={
151-
hasChanged
152-
? ComponentStatus.Default
153-
: ComponentStatus.Disabled
154-
}
155-
text="Save"
156-
icon={IconFont.Save}
157-
/>
158-
)}
133+
<FlexBox
134+
direction={FlexDirection.Row}
135+
justifyContent={JustifyContent.SpaceBetween}
136+
>
137+
<div>
138+
<Button
139+
onClick={handleNewScript}
140+
text={isFlagEnabled('saveAsScript') ? 'New Script' : 'Clear'}
141+
icon={IconFont.Plus_New}
142+
status={
143+
query.length === 0
144+
? ComponentStatus.Disabled
145+
: ComponentStatus.Default
146+
}
147+
testID="flux-query-builder--new-script"
148+
/>
149+
{isFlagEnabled('saveAsScript') && (
150+
<Button
151+
className="flux-query-builder__action-button"
152+
onClick={() => setOverlayType(OverlayType.OPEN)}
153+
text="Open"
154+
icon={IconFont.Export_New}
155+
/>
156+
)}
157+
{isFlagEnabled('saveAsScript') && (
158+
<Button
159+
className="flux-query-builder__action-button"
160+
onClick={() => setOverlayType(OverlayType.SAVE)}
161+
status={
162+
hasChanged
163+
? ComponentStatus.Default
164+
: ComponentStatus.Disabled
165+
}
166+
text="Save"
167+
icon={IconFont.Save}
168+
/>
169+
)}
170+
</div>
171+
{isFlagEnabled('userFeedback') && (
172+
<button
173+
className="userpilot-feedback"
174+
onClick={handleUserpilot}
175+
>
176+
Provide Feedback
177+
</button>
178+
)}
179+
</FlexBox>
159180
</div>
160181
<DraggableResizer
161182
handleOrientation={Orientation.Vertical}

0 commit comments

Comments
 (0)