Skip to content

Commit 40f64b8

Browse files
prakriti-solankeypraveshkumar1988
authored andcommitted
tooltip for setting
1 parent 6cfbf95 commit 40f64b8

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

frontend/src/components/ButtonWithToolTip.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const ButtonWithToolTip = ({
1010
disabled = false,
1111
className = '',
1212
label,
13+
loading,
1314
}: {
1415
text: string | React.ReactNode;
1516
children: React.ReactNode;
@@ -20,12 +21,20 @@ const ButtonWithToolTip = ({
2021
placement?: 'bottom' | 'top' | 'right' | 'left';
2122
disabled?: boolean;
2223
className?: string;
24+
loading?: boolean;
2325
label: string;
2426
}) => {
2527
return (
2628
<Tip allowedPlacements={[placement]}>
2729
<Tip.Trigger>
28-
<Button aria-label={label} size={size} onClick={onClick} disabled={disabled} className={className}>
30+
<Button
31+
aria-label={label}
32+
size={size}
33+
onClick={onClick}
34+
disabled={disabled}
35+
className={className}
36+
loading={loading}
37+
>
2938
{children}
3039
</Button>
3140
</Tip.Trigger>

frontend/src/components/Layout/PageLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function PageLayoutNew({
2222
openSettingsDialog: () => void;
2323
}) {
2424
const [isLeftExpanded, setIsLeftExpanded] = useState<boolean>(true);
25-
const [isRightExpanded, setIsRightExpanded] = useState<boolean>(false);
25+
const [isRightExpanded, setIsRightExpanded] = useState<boolean>(true);
2626
const [showChatBot, setShowChatBot] = useState<boolean>(false);
2727
const [showDrawerChatbot, setShowDrawerChatbot] = useState<boolean>(true);
2828
const [clearHistoryData, setClearHistoryData] = useState<boolean>(false);

frontend/src/components/SettingModal.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { Button, Dialog, Dropdown } from '@neo4j-ndl/react';
1+
import { Dialog, Dropdown } from '@neo4j-ndl/react';
22
import { OnChangeValue, ActionMeta } from 'react-select';
33
import { OptionType, OptionTypeForExamples, UserCredentials, schema } from '../types';
44
import { useFileContext } from '../context/UsersFiles';
55
import { getNodeLabelsAndRelTypes } from '../services/GetNodeLabelsRelTypes';
66
import { useCredentials } from '../context/UserCredentials';
77
import { MouseEventHandler, useCallback, useEffect, useState } from 'react';
88
import schemaExamples from '../assets/schemas.json';
9+
import ButtonWithToolTip from './ButtonWithToolTip';
10+
import { tooltips } from '../utils/Constants';
911

1012
export default function SettingsModal({
1113
open,
@@ -199,22 +201,31 @@ export default function SettingsModal({
199201
type='creatable'
200202
/>
201203
<Dialog.Actions className='!mt-4'>
202-
<Button
204+
<ButtonWithToolTip
203205
loading={loading}
204-
title={!nodeLabelOptions.length && !relationshipTypeOptions.length ? `No Labels Found in the Database` : ''}
206+
text={
207+
!nodeLabelOptions.length && !relationshipTypeOptions.length
208+
? `No Labels Found in the Database`
209+
: tooltips.useExistingSchema
210+
}
205211
disabled={!nodeLabelOptions.length && !relationshipTypeOptions.length}
206-
onClick={clickHandler}
212+
onClick={() => clickHandler}
213+
label='Use Existing Schema'
214+
placement='top'
207215
>
208216
Use Existing Schema
209-
</Button>
210-
<Button
217+
</ButtonWithToolTip>
218+
<ButtonWithToolTip
219+
text={tooltips.createSchema}
220+
placement='top'
211221
onClick={() => {
212222
onClose();
213223
opneTextSchema();
214224
}}
225+
label='Get Existing Schema From Text'
215226
>
216227
Get Existing Schema From Text
217-
</Button>
228+
</ButtonWithToolTip>
218229
</Dialog.Actions>
219230
</Dialog.Content>
220231
</Dialog>

frontend/src/utils/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,6 @@ export const tooltips = {
108108
copied: 'Copied',
109109
stopSpeaking: 'Stop Speaking',
110110
textTospeech: 'Text to Speech',
111+
createSchema: 'Create your own schema by passing text',
112+
useExistingSchema: 'Use the already existing schema from DB',
111113
};

0 commit comments

Comments
 (0)