You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Please push the changes to a remote branch on GitHub, but do NOT create a pull request. Please use the exact SAME branch name as the one you are currently on.",
35
+
eventName: "push_to_branch_button_clicked",
36
+
};
37
+
38
+
constPUSH_AND_CREATE_PR: ButtonConfig={
39
+
label: "Push & Create PR",
40
+
value:
41
+
"Please push the changes to GitHub and open a pull request. Please create a meaningful branch name that describes the changes.",
42
+
eventName: "create_pr_button_clicked",
43
+
callback: ()=>setHasPullRequest(true),
44
+
};
45
+
46
+
constPUSH_TO_PR: ButtonConfig={
47
+
label: "Push changes to PR",
48
+
value: "Please push the latest changes to the existing pull request.",
49
+
eventName: "push_to_pr_button_clicked",
50
+
};
51
+
52
+
// Helper function to handle button clicks
53
+
consthandleButtonClick=(config: ButtonConfig)=>{
54
+
posthog.capture(config.eventName);
55
+
onSuggestionsClick(config.value);
56
+
if(config.callback){
57
+
config.callback();
58
+
}
59
+
};
60
+
22
61
return(
23
62
<divclassName="flex flex-col gap-2 mb-2">
24
63
{githubTokenIsSet&&selectedRepository&&(
@@ -27,48 +66,26 @@ export function ActionSuggestions({
27
66
<>
28
67
<SuggestionItem
29
68
suggestion={{
30
-
label: "Push to Branch",
31
-
value:
32
-
"Please push the changes to a remote branch on GitHub, but do NOT create a pull request. Please use the exact SAME branch name as the one you are currently on.",
33
-
}}
34
-
onClick={()=>{
35
-
posthog.capture("push_to_branch_button_clicked");
36
-
// Ensure we're sending the correct value for this button
37
-
onSuggestionsClick(
38
-
"Please push the changes to a remote branch on GitHub, but do NOT create a pull request. Please use the exact SAME branch name as the one you are currently on.",
39
-
);
69
+
label: PUSH_TO_BRANCH.label,
70
+
value: PUSH_TO_BRANCH.value,
40
71
}}
72
+
onClick={()=>handleButtonClick(PUSH_TO_BRANCH)}
41
73
/>
42
74
<SuggestionItem
43
75
suggestion={{
44
-
label: "Push & Create PR",
45
-
value:
46
-
"Please push the changes to GitHub and open a pull request. Please create a meaningful branch name that describes the changes.",
47
-
}}
48
-
onClick={()=>{
49
-
posthog.capture("create_pr_button_clicked");
50
-
// Ensure we're sending the correct value for this button
51
-
onSuggestionsClick(
52
-
"Please push the changes to GitHub and open a pull request. Please create a meaningful branch name that describes the changes.",
0 commit comments