Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add search filters (#276) #286

Merged
merged 155 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
52bfa85
remove "@vitest/ui"
IlyaBondar Nov 16, 2023
9035571
unit-test refactoring
IlyaBondar Nov 16, 2023
ca62064
fix: eslint issues
IlyaBondar Nov 16, 2023
8c42857
Merge branch 'development' into feat/131_share_conversation
IlyaBondar Nov 17, 2023
b912bfd
fixed tooltip border
IlyaBondar Nov 17, 2023
df2125a
Update .eslintrc.json
IlyaBondar Nov 17, 2023
94763ce
Merge branch 'development' into feat/131_share_conversation
IlyaBondar Nov 17, 2023
7ab1d96
trim name on rename for all entities
IlyaBondar Nov 17, 2023
3a2d3c8
feat: add sharing option in context menu for conversation and for prompt
IlyaBondar Nov 17, 2023
5164c91
lint fixes
IlyaBondar Nov 17, 2023
90fa4bb
feat: added Shared icon for conversations and promts
IlyaBondar Nov 17, 2023
42e4dc1
feat: updated copy/check icons and added tooltips
IlyaBondar Nov 17, 2023
2c6e74a
Merge branch 'development' into feat/131_share_conversation
IlyaBondar Nov 17, 2023
6ade1a0
Update .eslintrc.json
IlyaBondar Nov 17, 2023
a277d21
Merge branch 'feat/131_share_conversation' of https://github.com/epam…
IlyaBondar Nov 17, 2023
445c2b4
fixed e2e tests
IlyaBondar Nov 20, 2023
f52530f
chore: save isShared and hide share icon during renaming/deleting
IlyaBondar Nov 20, 2023
d9973ee
feat: two separate feature-flags for sharing
IlyaBondar Nov 20, 2023
77597ed
feat: store several share infomations (id, date)
IlyaBondar Nov 20, 2023
0c7906f
lint fixes
IlyaBondar Nov 20, 2023
f0010d3
fixed color
IlyaBondar Nov 20, 2023
23f829f
handle onCopy event
IlyaBondar Nov 20, 2023
a17d08b
code review fixes
IlyaBondar Nov 20, 2023
6257efd
using context
IlyaBondar Nov 20, 2023
b876d86
code review fixes
IlyaBondar Nov 21, 2023
f9db0b6
Update ShareModal.tsx
IlyaBondar Nov 21, 2023
ee3067b
div -> input
IlyaBondar Nov 21, 2023
60b959f
fix: lint issues
IlyaBondar Nov 21, 2023
80518f9
search in folders
IlyaBondar Nov 21, 2023
d588f0d
collapsed folder section
IlyaBondar Nov 21, 2023
008253e
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 21, 2023
42f7444
collapsed folders
IlyaBondar Nov 21, 2023
b075fd6
icons
IlyaBondar Nov 22, 2023
e224565
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 23, 2023
059f394
search refactoring
IlyaBondar Nov 23, 2023
62efea3
Update ChatFolders.tsx
IlyaBondar Nov 23, 2023
06810e1
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 24, 2023
d7847f7
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 24, 2023
5973f18
folders
IlyaBondar Nov 24, 2023
dfb9666
lint fixes
IlyaBondar Nov 24, 2023
b23e81d
chatbar
IlyaBondar Nov 24, 2023
da35a08
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 24, 2023
52c446f
lint fixes
IlyaBondar Nov 24, 2023
4988931
lint fixes
IlyaBondar Nov 24, 2023
7d6c413
feature: redesign sidebar menu
IlyaBondar Nov 25, 2023
76d3859
refactoring
IlyaBondar Nov 25, 2023
b11d8ef
redesign FolderContextMenu
IlyaBondar Nov 25, 2023
54d40b1
Update FileItemContextMenu.tsx
IlyaBondar Nov 25, 2023
b6b7ce7
Update FileItemContextMenu.tsx
IlyaBondar Nov 25, 2023
5914e03
refactroing
IlyaBondar Nov 25, 2023
70f9d47
contextMenu
IlyaBondar Nov 25, 2023
44f8184
Update BaseContextMenu.tsx
IlyaBondar Nov 26, 2023
fb929f8
Update SidebarMenu.tsx
IlyaBondar Nov 26, 2023
fd993e4
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 26, 2023
065d113
AttachButton context menu
IlyaBondar Nov 26, 2023
630ca65
added Tooltips for menu
IlyaBondar Nov 26, 2023
942812f
Update menu.ts
IlyaBondar Nov 26, 2023
749702b
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 26, 2023
0acb7d3
fixed name
IlyaBondar Nov 26, 2023
e24922c
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 26, 2023
96fd7f1
share by me
IlyaBondar Nov 27, 2023
e312e42
fix context menu
IlyaBondar Nov 27, 2023
e2d8fb9
fixed build
IlyaBondar Nov 27, 2023
e66ec3d
fixed context menu style and size
IlyaBondar Nov 27, 2023
980472e
lint fixes
IlyaBondar Nov 27, 2023
5c969c5
fixed scrolling
IlyaBondar Nov 27, 2023
4f98efd
Merge branch 'development' into feat/redesign_sidebar_menu
IlyaBondar Nov 27, 2023
b626b17
merge with "onContextMenu" changes
IlyaBondar Nov 27, 2023
266b0b9
Update menu.ts
IlyaBondar Nov 27, 2023
07f15c4
fix: fix displaying of context menu
IlyaBondar Nov 27, 2023
e92b545
fixed "key={index}"
IlyaBondar Nov 27, 2023
4d64c5f
fix: fixed displaying menu
IlyaBondar Nov 27, 2023
91ca974
Merge branch 'development' into feat/redesign_sidebar_menu
IlyaBondar Nov 27, 2023
76627ff
fixed AttachButton
IlyaBondar Nov 27, 2023
8e80dae
rename ContextMenu -> SettingsContextMenu
IlyaBondar Nov 27, 2023
f42e2aa
rename BaseContextMenu -> ContextMenu
IlyaBondar Nov 27, 2023
654cfac
refactoring Translation
IlyaBondar Nov 27, 2023
e080592
code review refactoring
IlyaBondar Nov 27, 2023
05a1931
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 28, 2023
34f0446
lint fixes
IlyaBondar Nov 28, 2023
9554e73
Merge branch 'development' into feat/redesign_sidebar_menu
IlyaBondar Nov 28, 2023
459f95e
feat: redesign tooltips
IlyaBondar Nov 28, 2023
d6d68fd
lint fixes
IlyaBondar Nov 28, 2023
12a1901
feat: redesign tooltips
IlyaBondar Nov 28, 2023
b1e773c
lint fixes
IlyaBondar Nov 28, 2023
94e6b11
Merge branch 'development' into feat/redesign_sidebar_menu
IlyaBondar Nov 28, 2023
9de276a
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
5619791
Update conversations.selectors.ts
IlyaBondar Nov 29, 2023
eeade1a
eslint
IlyaBondar Nov 29, 2023
d7b0c7a
clean up
IlyaBondar Nov 29, 2023
fad7cb2
clean up
IlyaBondar Nov 29, 2023
7f06d0a
Update ChatFolders.tsx
IlyaBondar Nov 29, 2023
b70c65b
Merge branch 'feat/redesign_tooltip' of https://github.com/epam/ai-di…
IlyaBondar Nov 29, 2023
08d1470
increase eslint rule level
IlyaBondar Nov 29, 2023
62b001b
code review comments resolving
IlyaBondar Nov 29, 2023
0e999be
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
27f163a
Merge branch 'feat/redesign_tooltip' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
0740272
Update package-lock.json
IlyaBondar Nov 29, 2023
1dca47e
renaming: menuItems -> childMenuItems
IlyaBondar Nov 29, 2023
6dee914
fixed typing
IlyaBondar Nov 29, 2023
88e34b5
Merge branch 'feat/redesign_sidebar_menu' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
e7df8a2
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
9e52c55
refactoring
IlyaBondar Nov 29, 2023
e396c92
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 29, 2023
b52b849
share icons redesign
IlyaBondar Nov 30, 2023
e793a04
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Nov 30, 2023
d24f98e
lint fixes
IlyaBondar Nov 30, 2023
33e7a70
Update search.ts
IlyaBondar Nov 30, 2023
6df72fb
fix console errors
IlyaBondar Nov 30, 2023
6cfb080
fixed console error
IlyaBondar Dec 1, 2023
bbf1cab
share with me section
IlyaBondar Dec 1, 2023
0cb3780
tooltips
IlyaBondar Dec 1, 2023
2f8838e
rename fixes
IlyaBondar Dec 1, 2023
96e39f6
Share with me section for prompts
IlyaBondar Dec 1, 2023
d05b007
CaretIconComponent
IlyaBondar Dec 1, 2023
6cc9d69
transalation
IlyaBondar Dec 1, 2023
43a9410
added CollapsedSection component
IlyaBondar Dec 1, 2023
6d7bd3e
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Dec 1, 2023
00cb95c
lint fixes
IlyaBondar Dec 1, 2023
849a56c
remove ShareByMe dialog/option
IlyaBondar Dec 1, 2023
b27f102
lint fixes
IlyaBondar Dec 1, 2023
42a423b
clean up: using folder selectors
IlyaBondar Dec 1, 2023
22089ce
using interface abstraction
IlyaBondar Dec 1, 2023
2ebcaf5
apply CollapsedSection for PromptFolders
IlyaBondar Dec 1, 2023
359eea4
apply CollapsedSection for ConversationsRenderer
IlyaBondar Dec 1, 2023
58b22c4
use Tabler-icons
IlyaBondar Dec 4, 2023
a2c3837
Merge branch 'development' into feat/169_share_with_me
IlyaBondar Dec 4, 2023
e0a1e57
lint fixes
IlyaBondar Dec 4, 2023
1032a7c
clean up
IlyaBondar Dec 4, 2023
86ea2a7
lint fix
IlyaBondar Dec 4, 2023
fc02068
fixed promps
IlyaBondar Dec 4, 2023
18401ca
lint fixes
IlyaBondar Dec 4, 2023
2f17943
code review fixes
IlyaBondar Dec 4, 2023
2306a03
search filters UI
IlyaBondar Dec 4, 2023
c192bdb
applying search filters
IlyaBondar Dec 4, 2023
31072f9
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 4, 2023
b26c59b
feat: search filters: applying, refactoring, enabled by enabledFeatures
IlyaBondar Dec 5, 2023
a8b6968
lint fixes
IlyaBondar Dec 5, 2023
23c9f3a
share-icon in compare dropdown
IlyaBondar Dec 5, 2023
51dde04
Update ChatCompareSelect.tsx
IlyaBondar Dec 5, 2023
84b193a
revert: from Tabler-icons to svg
IlyaBondar Dec 5, 2023
16abd0f
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 5, 2023
468406b
clean up
IlyaBondar Dec 5, 2023
cca9091
"no results found" instead of "no data"
IlyaBondar Dec 5, 2023
77a1810
fixed code review comments
IlyaBondar Dec 5, 2023
713524c
hide -> hidden
IlyaBondar Dec 5, 2023
1044ce7
code review resolving
IlyaBondar Dec 5, 2023
ddcd3e7
fix double divider
IlyaBondar Dec 5, 2023
d29b2d9
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 6, 2023
7a881f5
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 7, 2023
cddc60c
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 7, 2023
7d95131
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 7, 2023
056b3e9
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 11, 2023
01bb39d
code review resolving
IlyaBondar Dec 11, 2023
01e8b05
Merge branch 'development' into feat/276_search_filter
IlyaBondar Dec 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions public/images/icons/arrow-up-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions public/images/icons/search.svg

This file was deleted.

3 changes: 3 additions & 0 deletions public/images/icons/world.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 16 additions & 7 deletions src/components/Chat/ChatCompareSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useTranslation } from 'next-i18next';
import { isMobile } from '@/src/utils/app/mobile';

import { Conversation, Role } from '@/src/types/chat';
import { FeatureType, HighlightColor } from '@/src/types/common';
import { Translation } from '@/src/types/translation';

import { useAppSelector } from '@/src/store/hooks';
Expand All @@ -15,6 +16,7 @@ import { UISelectors } from '@/src/store/ui/ui.reducers';
import { ModelIcon } from '../Chatbar/components/ModelIcon';

import { Combobox } from '../Common/Combobox';
import ShareIcon from '../Common/ShareIcon';

interface OptionProps {
item: Conversation;
Expand All @@ -37,13 +39,20 @@ const Option = ({ item }: OptionProps) => {
}

return (
<div className="flex items-center gap-3 pl-1">
<ModelIcon
entity={model}
entityId={model.id}
size={24}
inverted={theme === 'dark'}
/>
<div className="group flex items-center gap-3 pl-1">
<ShareIcon
{...item}
isHighlited={false}
highlightColor={HighlightColor.Blue}
featureType={FeatureType.Chat}
>
<ModelIcon
entity={model}
entityId={model.id}
size={24}
inverted={theme === 'dark'}
/>
</ShareIcon>
<span>{item.name}</span>
</div>
);
Expand Down
30 changes: 15 additions & 15 deletions src/components/Chatbar/Chatbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { Conversation } from '@/src/types/chat';
import { FeatureType } from '@/src/types/common';
import { SearchFilters } from '@/src/types/search';
import { Translation } from '@/src/types/translation';

import {
Expand Down Expand Up @@ -39,7 +40,7 @@
names: [DEFAULT_CONVERSATION_NAME],
}),
);
dispatch(ConversationsActions.setSearchTerm({ searchTerm: '' }));
dispatch(ConversationsActions.resetSearch());
}}
disabled={!!messageIsStreaming}
data-qa="new-chat"
Expand All @@ -56,24 +57,21 @@

const showChatbar = useAppSelector(UISelectors.selectShowChatbar);
const searchTerm = useAppSelector(ConversationsSelectors.selectSearchTerm);
const folders = useAppSelector((state) =>
ConversationsSelectors.selectFilteredFolders(
const searchFilters = useAppSelector(
ConversationsSelectors.selectSearchFilters,
);
const itemFilter = useAppSelector(ConversationsSelectors.selectItemFilter);

const filteredConversations = useAppSelector((state) =>
ConversationsSelectors.selectFilteredConversations(
state,
undefined,
itemFilter,
searchTerm,
true,
),
);
const conversations = useAppSelector(
ConversationsSelectors.selectConversations,
);

const filteredConversations = useAppSelector(
ConversationsSelectors.selectSearchedConversations,
);

const handleDrop = useCallback(
(e: any) => {

Check warning on line 74 in src/components/Chatbar/Chatbar.tsx

View workflow job for this annotation

GitHub Actions / run_tests / style_checks

Unexpected any. Specify a different type
if (e.dataTransfer) {
const conversation = JSON.parse(e.dataTransfer.getData('conversation'));
dispatch(
Expand All @@ -82,7 +80,7 @@
values: { folderId: undefined },
}),
);
dispatch(ConversationsActions.setSearchTerm({ searchTerm: '' }));
dispatch(ConversationsActions.resetSearch());
}
},
[dispatch],
Expand All @@ -96,13 +94,15 @@
isOpen={showChatbar}
itemComponent={<Conversations conversations={filteredConversations} />}
folderComponent={<ChatFolders />}
folders={folders}
items={conversations}
filteredItems={filteredConversations}
searchTerm={searchTerm}
searchFilters={searchFilters}
handleSearchTerm={(searchTerm: string) =>
dispatch(ConversationsActions.setSearchTerm({ searchTerm }))
}
handleSearchFilters={(searchFilters: SearchFilters) =>
dispatch(ConversationsActions.setSearchFilters({ searchFilters }))
}
handleDrop={handleDrop}
footerComponent={<ChatbarSettings />}
/>
Expand Down
63 changes: 44 additions & 19 deletions src/components/Chatbar/components/ChatFolders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import { useTranslation } from 'next-i18next';

import { PinnedItemsFilter, SharedWithMeFilter } from '@/src/utils/app/search';
import { SharedWithMeFilter } from '@/src/utils/app/search';

import { Conversation } from '@/src/types/chat';
import { EntityFilter, HighlightColor } from '@/src/types/common';
import { Feature } from '@/src/types/features';
import { FolderInterface, FolderSectionProps } from '@/src/types/folder';
import { Translation } from '@/src/types/translation';

Expand All @@ -14,6 +15,7 @@
ConversationsSelectors,
} from '@/src/store/conversations/conversations.reducers';
import { useAppDispatch, useAppSelector } from '@/src/store/hooks';
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';
import { UIActions, UISelectors } from '@/src/store/ui/ui.reducers';

import Folder from '@/src/components/Folder';
Expand Down Expand Up @@ -63,7 +65,7 @@
const openedFoldersIds = useAppSelector(UISelectors.selectOpenedFoldersIds);

const handleDrop = useCallback(
(e: any, folder: FolderInterface) => {

Check warning on line 68 in src/components/Chatbar/components/ChatFolders.tsx

View workflow job for this annotation

GitHub Actions / run_tests / style_checks

Unexpected any. Specify a different type
if (e.dataTransfer) {
const conversationData = e.dataTransfer.getData('conversation');
const folderData = e.dataTransfer.getData('folder');
Expand Down Expand Up @@ -234,7 +236,13 @@
rootConversations,
]);

if (hideIfEmpty && !conversations.length && !folders.length) return null;
if (
hideIfEmpty &&
(!displayRootFiles || !conversations.length) &&
!folders.length
) {
return null;
IlyaBondar marked this conversation as resolved.
Show resolved Hide resolved
}

return (
<CollapsableSection
Expand Down Expand Up @@ -267,26 +275,43 @@
);
};

const folderItems: FolderSectionProps<Conversation>[] = [
{
name: 'Share With Me',
itemFilter: SharedWithMeFilter,
displayRootFiles: true,
dataQa: 'share-with-me',
},
{
name: 'Pinned Chats',
itemFilter: PinnedItemsFilter,
showEmptyFolders: true,
openByDefault: true,
dataQa: 'pinned-chats',
},
];

export function ChatFolders() {
const { t } = useTranslation(Translation.SideBar);
const isFilterEmpty = useAppSelector(
ConversationsSelectors.selectIsEmptySearchFilter,
);
const commonItemFilter = useAppSelector(
ConversationsSelectors.selectItemFilter,
);

const isSharingEnabled = useAppSelector((state) =>
SettingsSelectors.isFeatureEnabled(state, Feature.ConversationsSharing),
);

const folderItems: FolderSectionProps<Conversation>[] = useMemo(
() =>
[
{
hidden: !isSharingEnabled || !isFilterEmpty,
name: t('Shared with me'),
itemFilter: SharedWithMeFilter,
displayRootFiles: true,
dataQa: 'share-with-me',
},
{
name: t('Pinned chats'),
itemFilter: commonItemFilter,
showEmptyFolders: isFilterEmpty,
openByDefault: true,
dataQa: 'pinned-chats',
},
].filter(({ hidden }) => !hidden),
[commonItemFilter, isFilterEmpty, isSharingEnabled, t],
);

return (
<div
className="flex w-full flex-col gap-0.5 divide-y divide-gray-200 dark:divide-gray-800"
className="flex w-full flex-col gap-0.5 divide-y divide-gray-200 empty:hidden dark:divide-gray-800"
mikitabut marked this conversation as resolved.
Show resolved Hide resolved
data-qa="chat-folders"
>
{folderItems.map((itemProps) => (
Expand Down
2 changes: 2 additions & 0 deletions src/components/Chatbar/components/Conversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function ConversationView({ conversation, isHighlited }: ViewProps) {
{...conversation}
isHighlited={!!isHighlited}
highlightColor={HighlightColor.Green}
featureType={FeatureType.Chat}
>
{conversation.replay.replayAsIs && (
<span className="flex shrink-0">
Expand Down Expand Up @@ -333,6 +334,7 @@ export const ConversationComponent = ({ item: conversation, level }: Props) => {
{...conversation}
isHighlited={isHighlited}
highlightColor={HighlightColor.Green}
featureType={FeatureType.Chat}
>
{conversation.replay.replayAsIs && (
<span className="flex shrink-0">
Expand Down
32 changes: 25 additions & 7 deletions src/components/Common/ShareIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,58 @@
import { IconArrowUpRight, IconWorldLongitude } from '@tabler/icons-react';
import { ReactNode } from 'react';

import classNames from 'classnames';

import { getByHighlightColor } from '@/src/utils/app/folders';

import { HighlightColor } from '@/src/types/common';
import { FeatureType, HighlightColor } from '@/src/types/common';
import { ShareInterface } from '@/src/types/share';

import { useAppSelector } from '@/src/store/hooks';
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';

import ArrowUpRight from '@/public/images/icons/arrow-up-right.svg';
import World from '@/public/images/icons/world.svg';

interface ShareIsonProps extends ShareInterface {
isHighlited: boolean;
highlightColor: HighlightColor;
size?: number;
children: ReactNode | ReactNode[];
featureType: FeatureType;
}

export default function ShareIcon({
isShared,
isPublished,
isHighlited,
highlightColor,
size = !isPublished ? 12 : 8,
size = 12,
children,
featureType,
}: ShareIsonProps) {
if (!isPublished && !isShared) {
const isSharingEnabled = useAppSelector((state) =>
SettingsSelectors.isSharingEnabled(state, featureType),
);
const isPublishingEnabled = useAppSelector((state) =>
SettingsSelectors.isPublishingEnabled(state, featureType),
);

if (
(!isSharingEnabled || !isShared) &&
(!isPublishingEnabled || !isPublished)
) {
return <>{children}</>;
}

const AdditionalIcon = isPublished ? IconWorldLongitude : IconArrowUpRight;
const AdditionalIcon =
isPublished && isPublishingEnabled ? World : ArrowUpRight;

return (
<div className="relative">
{children}
<div
className={classNames(
'absolute bottom-0 left-0 h-[8px] w-[8px] overflow-hidden bg-gray-100 align-text-top dark:bg-gray-700',
'absolute -bottom-1 -left-1 bg-gray-100 dark:bg-gray-700',
isPublished ? 'rounded-md' : 'rounded-sm',
)}
>
Expand All @@ -49,7 +67,7 @@ export default function ShareIcon({
'text-violet group-hover:bg-violet/15',
'text-blue-500 group-hover:bg-blue-500/20',
),
!isPublished && 'm-[-2px]',
'stroke-1 p-[1px]',
isHighlited &&
getByHighlightColor(
highlightColor,
Expand Down
23 changes: 13 additions & 10 deletions src/components/Promptbar/Promptbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useTranslation } from 'next-i18next';

import { FeatureType } from '@/src/types/common';
import { Prompt } from '@/src/types/prompt';
import { SearchFilters } from '@/src/types/search';
import { Translation } from '@/src/types/translation';

import { useAppDispatch, useAppSelector } from '@/src/store/hooks';
Expand All @@ -30,7 +31,7 @@ const PromptActionsBlock = () => {
className="flex shrink-0 grow cursor-pointer select-none items-center gap-3 rounded px-3 py-2 transition-colors duration-200 hover:bg-violet/15 disabled:cursor-not-allowed"
onClick={() => {
dispatch(PromptsActions.createNewPrompt());
dispatch(PromptsActions.setSearchTerm({ searchTerm: '' }));
dispatch(PromptsActions.resetSearch());
dispatch(PromptsActions.setIsEditModalOpen({ isOpen: true }));
}}
data-qa="new-prompt"
Expand All @@ -45,14 +46,14 @@ const PromptActionsBlock = () => {
const Promptbar = () => {
const dispatch = useAppDispatch();
const showPromptbar = useAppSelector(UISelectors.selectShowPromptbar);
const filteredPrompts = useAppSelector(
PromptsSelectors.selectSearchedPrompts,
);
const searchTerm = useAppSelector(PromptsSelectors.selectSearchTerm);
const folders = useAppSelector((state) =>
PromptsSelectors.selectFilteredFolders(state, undefined, searchTerm, true),
const itemFilter = useAppSelector(PromptsSelectors.selectItemFilter);

const filteredPrompts = useAppSelector((state) =>
PromptsSelectors.selectFilteredPrompts(state, itemFilter, searchTerm),
);
const prompts = useAppSelector(PromptsSelectors.selectPrompts);

const searchFilters = useAppSelector(PromptsSelectors.selectSearchFilters);

const handleDrop = useCallback(
(e: any) => {
Expand Down Expand Up @@ -80,15 +81,17 @@ const Promptbar = () => {
itemComponent={<Prompts prompts={filteredPrompts} />}
actionButtons={<PromptActionsBlock />}
folderComponent={<PromptFolders />}
folders={folders}
items={prompts}
filteredItems={filteredPrompts}
searchTerm={searchTerm}
searchFilters={searchFilters}
handleSearchTerm={(searchTerm: string) =>
dispatch(PromptsActions.setSearchTerm({ searchTerm }))
}
handleSearchFilters={(searchFilters: SearchFilters) =>
dispatch(PromptsActions.setSearchFilters({ searchFilters }))
}
handleDrop={handleDrop}
footerComponent={<PromptbarSettings allPrompts={prompts} />}
footerComponent={<PromptbarSettings />}
/>
);
};
Expand Down
Loading
Loading