Skip to content

Commit 23f2dc8

Browse files
authored
Add tooltips to icons and buttons. (#46)
1 parent 9d7c526 commit 23f2dc8

File tree

9 files changed

+82
-72
lines changed

9 files changed

+82
-72
lines changed

.editorconfig

-9
This file was deleted.

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"editor.formatOnSave": true,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll": true
4+
"source.fixAll": "explicit"
55
}
66
}

app/chat/page.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use client'
2-
2+
import { Suspense } from 'react'
33
import { Flex } from '@radix-ui/themes'
44
import { Chat, ChatContext, ChatSideBar, PersonaPanel, useChatHook } from '@/components'
55
import PersonaModal from './PersonaModal'
66

7-
const ChatPage = () => {
7+
const ChatProvider = () => {
88
const provider = useChatHook()
99

1010
return (
@@ -21,4 +21,12 @@ const ChatPage = () => {
2121
)
2222
}
2323

24+
const ChatPage = () => {
25+
return (
26+
<Suspense>
27+
<ChatProvider />
28+
</Suspense>
29+
)
30+
}
31+
2432
export default ChatPage

components/Chat/Chat.tsx

+37-32
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
useRef,
1010
useState
1111
} from 'react'
12-
import { Flex, Heading, IconButton, ScrollArea } from '@radix-ui/themes'
12+
import { Flex, Heading, IconButton, ScrollArea, Tooltip } from '@radix-ui/themes'
1313
import clipboard from 'clipboard'
1414
import ContentEditable from 'react-contenteditable'
1515
import toast from 'react-hot-toast'
@@ -267,37 +267,42 @@ const Chat = (props: ChatProps, ref: any) => {
267267
<AiOutlineLoading3Quarters className="animate-spin h-4 w-4" />
268268
</Flex>
269269
)}
270-
<IconButton
271-
variant="soft"
272-
disabled={isLoading}
273-
color="gray"
274-
size="2"
275-
className="rounded-xl"
276-
onClick={sendMessage}
277-
>
278-
<FiSend className="h-4 w-4" />
279-
</IconButton>
280-
<IconButton
281-
variant="soft"
282-
color="gray"
283-
size="2"
284-
className="rounded-xl"
285-
disabled={isLoading}
286-
onClick={clearMessages}
287-
>
288-
<AiOutlineClear className="h-4 w-4" />
289-
</IconButton>
290-
291-
<IconButton
292-
variant="soft"
293-
color="gray"
294-
size="2"
295-
className="rounded-xl md:hidden"
296-
disabled={isLoading}
297-
onClick={onToggleSidebar}
298-
>
299-
<AiOutlineUnorderedList className="h-4 w-4" />
300-
</IconButton>
270+
<Tooltip content={'Send Message'}>
271+
<IconButton
272+
variant="soft"
273+
disabled={isLoading}
274+
color="gray"
275+
size="2"
276+
className="rounded-xl cursor-pointer"
277+
onClick={sendMessage}
278+
>
279+
<FiSend className="h-4 w-4" />
280+
</IconButton>
281+
</Tooltip>
282+
<Tooltip content={'Clear Message'}>
283+
<IconButton
284+
variant="soft"
285+
color="gray"
286+
size="2"
287+
className="rounded-xl cursor-pointer"
288+
disabled={isLoading}
289+
onClick={clearMessages}
290+
>
291+
<AiOutlineClear className="h-4 w-4" />
292+
</IconButton>
293+
</Tooltip>
294+
<Tooltip content={'Toggle Sidebar'}>
295+
<IconButton
296+
variant="soft"
297+
color="gray"
298+
size="2"
299+
className="rounded-xl md:hidden cursor-pointer"
300+
disabled={isLoading}
301+
onClick={onToggleSidebar}
302+
>
303+
<AiOutlineUnorderedList className="h-4 w-4" />
304+
</IconButton>
305+
</Tooltip>
301306
</Flex>
302307
</Flex>
303308
</div>

components/Chat/ChatSideBar.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ChatSideBar = () => {
2929
<Box
3030
width="auto"
3131
onClick={() => onCreateChat?.(DefaultPersonas[0])}
32-
className="bg-token-surface-primary active:scale-95 "
32+
className="bg-token-surface-primary active:scale-95 cursor-pointer"
3333
>
3434
<FiPlus className="h-4 w-4" />
3535
<Text>New Chat</Text>
@@ -40,7 +40,7 @@ export const ChatSideBar = () => {
4040
<Box
4141
key={chat.id}
4242
width="auto"
43-
className={cs('bg-token-surface active:scale-95 truncate', {
43+
className={cs('bg-token-surface active:scale-95 truncate cursor-pointer', {
4444
active: currentChatRef?.current?.id === chat.id
4545
})}
4646
onClick={() => onChangeChat?.(chat)}
@@ -53,6 +53,7 @@ export const ChatSideBar = () => {
5353
</Flex>
5454
<IconButton
5555
size="2"
56+
className="cursor-pointer"
5657
variant="ghost"
5758
color="gray"
5859
radius="full"
@@ -70,7 +71,7 @@ export const ChatSideBar = () => {
7071
<Box
7172
width="auto"
7273
onClick={() => onOpenPersonaPanel?.('chat')}
73-
className="bg-token-surface-primary active:scale-95 "
74+
className="bg-token-surface-primary active:scale-95 cursor-pointer"
7475
>
7576
<RiRobot2Line className="h-4 w-4" />
7677
<Text>Persona Store</Text>

components/Markdown.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface MarkdownProps {
2020
export const Markdown = ({ className, children }: MarkdownProps) => {
2121
return (
2222
<ReactMarkdown
23-
className="prose dark:prose-invert max-w-none"
23+
className={cs('prose dark:prose-invert max-w-none', className)}
2424
remarkPlugins={[remarkParse, remarkMath, remarkRehype, remarkGfm]}
2525
rehypePlugins={[rehypeRaw, rehypeKatex, rehypeStringify]}
2626
components={{
@@ -30,7 +30,7 @@ export const Markdown = ({ className, children }: MarkdownProps) => {
3030
return match ? (
3131
<>
3232
<IconButton
33-
className="absolute right-4 top-4 copy-btn"
33+
className="absolute right-4 top-4 copy-btn cursor-pointer"
3434
variant="solid"
3535
data-clipboard-text={children}
3636
>

components/Themes/useTheme.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { useContext } from 'react'
22
import { UseThemeProps } from './interface'
33
import { ThemeContext } from './ThemeContext'
44

5-
const defaultContext: UseThemeProps = { setTheme: (_) => {}, themes: [] }
5+
const defaultContext: UseThemeProps = { setTheme: () => {}, themes: [] }
66

77
export const useTheme = () => useContext(ThemeContext) ?? defaultContext

next.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const nextConfig = {
1515
permanent: true
1616
}
1717
]
18+
},
19+
logging: {
20+
fetches: {
21+
fullUrl: true
22+
}
1823
}
1924
}
2025

package-lock.json

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)