Skip to content

Commit 81c44ae

Browse files
committed
Vincent-Hackathon: Frontend: CreateButton: Add tutorial tooltip for create button
1 parent a447fa1 commit 81c44ae

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

frontend/src/components/common/Resource/CreateButton.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { useTranslation } from 'react-i18next';
2626
import { useSelectedClusters } from '../../../lib/k8s';
2727
import { Activity } from '../../activity/Activity';
2828
import ActionButton from '../ActionButton';
29+
import { TutorialToolTip } from '../Tutorial/TutorialToolTip';
2930
import EditorDialog from './EditorDialog';
3031

3132
interface CreateButtonProps {
@@ -53,6 +54,25 @@ export default function CreateButton(props: CreateButtonProps) {
5354
}
5455
}, [clusters]);
5556

57+
// Hackathon WIP for tutorial mode
58+
console.log('current tutorial mode', localStorage.getItem('tutorialMode'));
59+
const isTutorialMode = localStorage.getItem('tutorialMode') === 'true';
60+
61+
const [createButtonDescription, setCreateButtonDescription] = React.useState<
62+
string | React.ReactNode
63+
>('loading..');
64+
65+
React.useEffect(() => {
66+
if (isTutorialMode) {
67+
setCreateButtonDescription(
68+
<TutorialToolTip context="CreateButton" labelText={t('translation|Create ')} />
69+
);
70+
} else {
71+
setCreateButtonDescription(t('translation|Create '));
72+
}
73+
}, [isTutorialMode, createButtonDescription, t]);
74+
// need to clean later
75+
5676
const openActivity = () => {
5777
const id = 'create-button';
5878
Activity.launch({
@@ -128,7 +148,7 @@ export default function CreateButton(props: CreateButtonProps) {
128148
},
129149
})}
130150
>
131-
{t('translation|Create')}
151+
{createButtonDescription}
132152
</Button>
133153
)}
134154
</React.Fragment>

0 commit comments

Comments
 (0)