Skip to content

Commit 0cf03cb

Browse files
committed
Smaller fixes
Signed-off-by: Heiko W. Rupp <[email protected]>
1 parent 19e144e commit 0cf03cb

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

src/app/playground/chat/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const ChatPage: React.FC = () => {
3636
variant="link"
3737
isInline
3838
onClick={(e) => {
39-
window.analytics.trackSingleItem('Chat Cleared', {});
4039
e.preventDefault();
4140
router.push('/playground/endpoints');
4241
}}

src/components/AppLayout.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type Route = {
4848
const AppLayout: React.FunctionComponent<IAppLayout> = ({ children, className }) => {
4949
const { data: session, status } = useSession();
5050
const [isExperimentalEnabled, setExperimental] = useState(false);
51+
const [analyticsInitialised, setAnalyticsInitialised] = useState(false);
5152

5253
const router = useRouter();
5354
const pathname = usePathname();
@@ -63,9 +64,9 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children, className })
6364
}, []);
6465

6566
React.useEffect(() => {
66-
console.log("Get analytics effect " + window.analytics);
6767
if (!window.analytics) {
6868
initAnalytics();
69+
setAnalyticsInitialised(true);
6970
}
7071
}, []);
7172

@@ -74,15 +75,16 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children, className })
7475
window.analytics.trackPageView(pathname);
7576
}
7677

77-
}, [pathname]);
78+
}, [pathname, analyticsInitialised]);
7879

7980
React.useEffect(() => {
80-
console.log(("Identify effect " + session?.user) )
8181
if (window.analytics) {
8282
// TODO we may potentially want to hash this. Also different code per target install?
83-
window.analytics.identify(session?.user?.name ? session.user.name : '-unknown-user-name ');
83+
// TODO pass other parameters as properties
84+
window.analytics.identify(session?.user?.name ? session.user.name : '-unknown-user-name ', {}
85+
);
8486
}
85-
},[session?.user?.name,session?.user]);
87+
},[analyticsInitialised, session?.user?.name,session?.user]);
8688

8789
React.useEffect(() => {
8890
if (status === 'loading') return; // Do nothing while loading

src/components/Chat/ChatBotComponent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ const ChatBotComponent: React.FunctionComponent<ChatbotComponentProps> = ({
214214

215215
const handleCleanup = () => {
216216
setMessages([]);
217+
window.analytics.trackSingleItem('Chat Cleared', {});
217218
};
218219

219220
return (

src/components/Contribute/ContributionWizard/ContributionWizard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ export const ContributionWizard: React.FunctionComponent<Props> = ({
189189
style={{ maxHeight: '100%' }}
190190
startIndex={1}
191191
onClose={handleCancel}
192-
onStepChange={(_ev, currentStep) => setActiveStepIndex(stepIds.indexOf(String(currentStep.id)))}
192+
onStepChange={(_ev, currentStep) => {
193+
setActiveStepIndex(stepIds.indexOf(String(currentStep.id)));
194+
window.analytics.trackSingleItem('Wizard Step Changed', { isSkillContribution, step: currentStep.id });}
195+
}
193196
footer={
194197
<ContributionWizardFooter
195198
onCancel={handleCancel}

src/components/Contribute/Skill/SkillWizard/SkillWizard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export const SkillWizard: React.FunctionComponent<Props> = ({ skillEditFormData,
176176
};
177177

178178
const handleSubmit = async (githubUsername: string): Promise<boolean> => {
179-
window.analytics.trackSingleItem("Knowledge Contribution Submitted", {}); // TODO better place, add data
179+
window.analytics.trackSingleItem("Skill Contribution Submitted", {}); // TODO better place, add data
180180
if (skillEditFormData) {
181181
const result = isGithubMode
182182
? await updateGithubSkillData(session, skillFormData, skillEditFormData, updateActionGroupAlertContent)

0 commit comments

Comments
 (0)