From 64909d74f9c88e87aafb2133084150f1eb45d58c Mon Sep 17 00:00:00 2001 From: pablodanswer Date: Mon, 7 Oct 2024 10:33:08 -0700 Subject: [PATCH] UX Cleanup (#2701) * start * shared iconlogo class * clean out of place components * nit --- .../app/admin/assistants/AssistantEditor.tsx | 2 +- web/src/app/admin/assistants/PersonaTable.tsx | 2 +- .../prompt-library/modals/EditPromptModal.tsx | 2 +- .../admin/prompt-library/promptLibrary.tsx | 41 +- web/src/app/admin/tools/ToolEditor.tsx | 9 +- .../ee/admin/api-key/DanswerApiKeyForm.tsx | 13 +- .../ee/admin/groups/UserGroupCreationForm.tsx | 15 +- web/src/components/icons/icons.tsx | 541 ++++-------------- .../components/resizable/ResizableSection.tsx | 2 +- web/src/components/search/SearchBar.tsx | 4 +- .../search/SearchResultsDisplay.tsx | 2 +- web/src/components/search/SearchSection.tsx | 5 +- .../search/filtering/FilterDropdown.tsx | 3 +- 13 files changed, 160 insertions(+), 481 deletions(-) diff --git a/web/src/app/admin/assistants/AssistantEditor.tsx b/web/src/app/admin/assistants/AssistantEditor.tsx index 1f961614d..d4287e4c9 100644 --- a/web/src/app/admin/assistants/AssistantEditor.tsx +++ b/web/src/app/admin/assistants/AssistantEditor.tsx @@ -165,7 +165,7 @@ export function AssistantEditor({ existingPersona.num_chunks === 0 ); } - }, []); + }, [isUpdate, existingPrompt]); const defaultProvider = llmProviders.find( (llmProvider) => llmProvider.is_default_provider diff --git a/web/src/app/admin/assistants/PersonaTable.tsx b/web/src/app/admin/assistants/PersonaTable.tsx index dac260a18..7a72d6e2e 100644 --- a/web/src/app/admin/assistants/PersonaTable.tsx +++ b/web/src/app/admin/assistants/PersonaTable.tsx @@ -176,7 +176,7 @@ export function PersonasTable({ ,
-
+
{!persona.is_default_persona && isEditable ? (
{({ isSubmitting, values }) => ( -
+

{ @@ -138,35 +140,16 @@ export const PromptLibraryTable = ({ return (
{confirmDeletionId != null && ( - setConfirmDeletionId(null)} - className="max-w-sm" - > - <> -

- Are you sure you want to delete this prompt? You will not be able - to recover this prompt -

-
- - -
- -
+ setConfirmDeletionId(null)} + onSubmit={() => handleDelete(confirmDeletionId)} + entityType="prompt" + entityName={ + paginatedPromptLibrary.find( + (prompt) => prompt.id === confirmDeletionId + )?.prompt ?? "" + } + /> )}
diff --git a/web/src/app/admin/tools/ToolEditor.tsx b/web/src/app/admin/tools/ToolEditor.tsx index b4df98f86..0ffb8750e 100644 --- a/web/src/app/admin/tools/ToolEditor.tsx +++ b/web/src/app/admin/tools/ToolEditor.tsx @@ -318,10 +318,11 @@ export function ToolEditor({ tool }: { tool?: ToolSnapshot }) { ({ - key: header.key, - value: header.value, - })) ?? [{ key: "test", value: "value" }], + customHeaders: + tool?.custom_headers?.map((header) => ({ + key: header.key, + value: header.value, + })) ?? [], }} validationSchema={ToolSchema} onSubmit={async (values: ToolFormValues) => { diff --git a/web/src/app/ee/admin/api-key/DanswerApiKeyForm.tsx b/web/src/app/ee/admin/api-key/DanswerApiKeyForm.tsx index 6b1c8a860..4232929c8 100644 --- a/web/src/app/ee/admin/api-key/DanswerApiKeyForm.tsx +++ b/web/src/app/ee/admin/api-key/DanswerApiKeyForm.tsx @@ -28,18 +28,9 @@ export const DanswerApiKeyForm = ({ return ( -
+ <>

{isUpdate ? "Update API Key" : "Create a new API Key"} -
- -

@@ -126,7 +117,7 @@ export const DanswerApiKeyForm = ({ )} -
+
); }; diff --git a/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx b/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx index ec1ac52e6..2963eb20b 100644 --- a/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx +++ b/web/src/app/ee/admin/groups/UserGroupCreationForm.tsx @@ -35,18 +35,9 @@ export const UserGroupCreationForm = ({ return ( -
+ <>

{isUpdate ? "Update a User Group" : "Create a new User Group"} -
- -

@@ -89,7 +80,7 @@ export const UserGroupCreationForm = ({ > {({ isSubmitting, values, setFieldValue }) => (
-
+
)} -
+ ); }; diff --git a/web/src/components/icons/icons.tsx b/web/src/components/icons/icons.tsx index 186e4473c..9295a08c0 100644 --- a/web/src/components/icons/icons.tsx +++ b/web/src/components/icons/icons.tsx @@ -43,7 +43,7 @@ import { FiSlack, } from "react-icons/fi"; import { SiBookstack } from "react-icons/si"; -import Image from "next/image"; +import Image, { StaticImageData } from "next/image"; import jiraSVG from "../../../public/Jira.svg"; import confluenceSVG from "../../../public/Confluence.svg"; import openAISVG from "../../../public/Openai.svg"; @@ -94,6 +94,23 @@ export interface IconProps { className?: string; } +export interface LogoIconProps extends IconProps { + src: string | StaticImageData; +} + +export const LogoIcon = ({ + size = 16, + className = defaultTailwindCSS, + src, +}: LogoIconProps) => ( +
+ Logo +
+); + export const AssistantsIconSkeleton = ({ size, className = defaultTailwindCSS, @@ -172,36 +189,6 @@ export const AssistantsIcon = ({ ); }; -// export const AssistantsIcon = ({ -// size, -// className = defaultTailwindCSS, -// }: IconProps) => { -// return ( -// -// -// -// -// -// -// -// - -// ); -// }; - { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const NewIconTest = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( - - - - - - - ); -}; +}: IconProps) => ( + +); export const GitlabIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); + export const GithubIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GmailIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GoogleDriveIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const BookstackIcon = ({ size = 16, @@ -1107,440 +1044,240 @@ export const BookstackIcon = ({ export const ConfluenceIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const OCIStorageIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const JiraIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - // Jira Icon has a bit more surrounding whitespace than other icons, which is why we need to adjust it here - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const ZulipIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ; export const OpenAIIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ; export const VoyageIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GoogleIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const CohereIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GoogleStorageIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const ProductboardIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const AWSIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ; export const AzureIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ; export const LinearIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const SlabIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const NotionIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GuruIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); +}: IconProps) => ; export const RequestTrackerIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const SalesforceIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const R2Icon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); +}: IconProps) => ; export const S3Icon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); +}: IconProps) => ; export const SharepointIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const TeamsIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); +}: IconProps) => ; export const GongIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); +}: IconProps) => ; export const HubSpotIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const Document360Icon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const GoogleSitesIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const ZendeskIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const DropboxIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const DiscourseIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const AxeroIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const ClickupIcon = ({ size = 16, className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; +}: IconProps) => ( + +); export const MediaWikiIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); export const WikipediaIcon = ({ size = 16, className = defaultTailwindCSS, }: IconProps) => ( -
- Logo -
+ ); +export const XenforoIcon = ({ + size = 16, + className = defaultTailwindCSS, +}: IconProps) => ( + +); + +export const AsanaIcon = ({ + size = 16, + className = defaultTailwindCSS, +}: IconProps) => ; + /* EE Icons */ @@ -2836,29 +2573,3 @@ export const WindowsIcon = ({ ); }; - -export const XenforoIcon = ({ - size = 16, - className = defaultTailwindCSS, -}: IconProps) => { - return ( -
- Logo -
- ); -}; - -export const AsanaIcon = ({ - size = 16, - className = defaultTailwindCSS, -}: IconProps) => ( -
- Logo -
-); diff --git a/web/src/components/resizable/ResizableSection.tsx b/web/src/components/resizable/ResizableSection.tsx index 98a877792..0591555d8 100644 --- a/web/src/components/resizable/ResizableSection.tsx +++ b/web/src/components/resizable/ResizableSection.tsx @@ -41,7 +41,7 @@ export function ResizableSection({ Cookies.set(DOCUMENT_SIDEBAR_WIDTH_COOKIE_NAME, newWidth.toString(), { path: "/", }); - }, [minWidth, maxWidth]); + }, [minWidth, maxWidth, width]); const startResizing = (mouseDownEvent: React.MouseEvent) => { setIsResizing(true); diff --git a/web/src/components/search/SearchBar.tsx b/web/src/components/search/SearchBar.tsx index d268367bd..df6f45eac 100644 --- a/web/src/components/search/SearchBar.tsx +++ b/web/src/components/search/SearchBar.tsx @@ -178,10 +178,10 @@ export const FullSearchBar = ({ suppressContentEditableWarning={true} />
{(ccPairs.length > 0 || documentSets.length > 0) && ( { window.removeEventListener("keydown", handleKeyDown); }; - }, []); + }, [performSweep, agenticResults]); if (!searchResponse) { return null; diff --git a/web/src/components/search/SearchSection.tsx b/web/src/components/search/SearchSection.tsx index 4e8ea0abd..a9641511a 100644 --- a/web/src/components/search/SearchSection.tsx +++ b/web/src/components/search/SearchSection.tsx @@ -140,7 +140,8 @@ export const SearchSection = ({ return () => { window.removeEventListener("keydown", handleKeyDown); }; - }, []); + }, [toggleAgentic]); + const [isFetching, setIsFetching] = useState(false); // Search Type @@ -522,7 +523,7 @@ export const SearchSection = ({ return () => { window.removeEventListener("keydown", handleKeyDown); }; - }, [router]); + }, [router, toggleSidebar]); useEffect(() => { if (settings?.isMobile) { diff --git a/web/src/components/search/filtering/FilterDropdown.tsx b/web/src/components/search/filtering/FilterDropdown.tsx index 71fcf84b3..444382fc7 100644 --- a/web/src/components/search/filtering/FilterDropdown.tsx +++ b/web/src/components/search/filtering/FilterDropdown.tsx @@ -41,7 +41,8 @@ export function FilterDropdown({ flex-col ${dropdownWidth || width} max-h-96 - overflow-y-scroll + overflow-y-scroll + overscroll-contain `} > {options.map((option, ind) => {