Skip to content

Commit

Permalink
feat: add export icon
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh990918 committed May 22, 2023
1 parent 00b160b commit 100b6bd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/components/header/ConversationMessageShareButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { useStore } from '@nanostores/solid'
import { currentConversationId } from '@/stores/conversation'

export default () => {
const $currentConversationId = useStore(currentConversationId)

const handleClearMessage = () => {
}

return (
<>
{$currentConversationId() && (
<div
class="fcc p-2 rounded-md text-xl hv-foreground"
onClick={handleClearMessage}
>
<div i-carbon-export />
</div>
)}
</>
)
}
2 changes: 2 additions & 0 deletions src/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { scrollController, showConversationSidebar, showSettingsSidebar } from '
import { useLargeScreen } from '@/hooks'
import ConversationHeaderInfo from './ConversationHeaderInfo'
import ConversationMessageClearButton from './ConversationMessageClearButton'
import ConversationMessageShareButton from './ConversationMessageShareButton'

export default () => {
onMount(() => {
Expand All @@ -25,6 +26,7 @@ export default () => {
</div>
<div class="fi gap-1 overflow-hidden">
<ConversationMessageClearButton />
<ConversationMessageShareButton />
<div
class="fcc p-2 rounded-md text-xl hv-foreground lg:hidden"
onClick={() => showSettingsSidebar.set(true)}
Expand Down
3 changes: 1 addition & 2 deletions src/components/main/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ export default (props: Props) => {
const [menuList, setMenuList] = createSignal<MenuItem[]>([
{ id: 'retry', label: 'Retry send', icon: 'i-carbon:restart', role: 'all', action: handleRetryMessageItem },
{ id: 'raw', label: 'Show raw code', icon: 'i-carbon-code', role: 'system', action: () => setShowRawCode(!showRawCode()) },
// TODO: Share message
// { id: 'share', label: 'Share message', icon: 'i-carbon:share' },
{ id: 'edit', label: 'Edit message', icon: 'i-carbon:edit', role: 'user', action: handleEditMessageItem },
{ id: 'copy', label: 'Copy message', icon: 'i-carbon-copy', role: 'all', action: handleCopyMessageItem },
{ id: 'delete', label: 'Delete message', icon: 'i-carbon-trash-can', role: 'all', action: handleDeleteMessageItem },
{ id: 'share', label: 'Share message', icon: 'i-carbon:export', role: 'all' },
])

if (props.message.role === 'user')
Expand Down

0 comments on commit 100b6bd

Please sign in to comment.