From 345ab8ea9e9c2c718bdc6db3c97f09566852c5e4 Mon Sep 17 00:00:00 2001 From: sccalabr <4111230+sccalabr@users.noreply.github.com> Date: Sat, 5 Oct 2024 11:27:37 -0700 Subject: [PATCH 1/6] Addressing comments and using dropdown instead of button --- frontend/src/Navigation.tsx | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 052a9643..77999753 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -12,6 +12,7 @@ import Expand from './assets/expand.svg'; import Github from './assets/github.svg'; import Hamburger from './assets/hamburger.svg'; import Info from './assets/info.svg'; +import InfoDark from './assets/info-dark.svg'; import SettingGear from './assets/settingGear.svg'; import Twitter from './assets/TwitterX.svg'; import UploadIcon from './assets/upload.svg'; @@ -41,6 +42,7 @@ import { setSourceDocs, } from './preferences/preferenceSlice'; import Upload from './upload/Upload'; +import Dropdown from './components/Dropdown'; interface NavigationProps { navOpen: boolean; @@ -360,27 +362,24 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
- { - if (isMobile) { - setNavOpen(!navOpen); - } - resetConversation(); - }} - to="/about" - className={({ isActive }) => - `my-auto mx-4 flex h-9 cursor-pointer gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-[#28292E] ${ - isActive ? 'bg-gray-3000 dark:bg-[#28292E]' : '' - }` - } - > +
icon -

{t('about')}

- + src={InfoDark} + > + { + if (selectedOption.value === "documentation") { + window.open(" https://docs.docsgpt.cloud/", "_blank"); + } else if (selectedOption.value === "email"){ + window.location.href = `mailto:contact@arc53.com`; + } + }} + /> +
Date: Sat, 5 Oct 2024 11:38:23 -0700 Subject: [PATCH 2/6] Changing dropdown to support not going off screen. --- frontend/src/Navigation.tsx | 3 +- frontend/src/components/Dropdown.tsx | 105 ++++++++++----------------- 2 files changed, 42 insertions(+), 66 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 77999753..92347ab6 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -369,9 +369,10 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { > { + onSelect={(selectedOption: { label: string; value: string }) => { if (selectedOption.value === "documentation") { window.open(" https://docs.docsgpt.cloud/", "_blank"); } else if (selectedOption.value === "email"){ diff --git a/frontend/src/components/Dropdown.tsx b/frontend/src/components/Dropdown.tsx index 07f33650..b272fd8b 100644 --- a/frontend/src/components/Dropdown.tsx +++ b/frontend/src/components/Dropdown.tsx @@ -47,14 +47,13 @@ function Dropdown({ }) { const dropdownRef = React.useRef(null); const [isOpen, setIsOpen] = React.useState(false); + const [dropdownPosition, setDropdownPosition] = React.useState({ top: 0}); + const borderRadius = rounded === 'xl' ? 'rounded-xl' : 'rounded-3xl'; const borderTopRadius = rounded === 'xl' ? 'rounded-t-xl' : 'rounded-t-3xl'; const handleClickOutside = (event: MouseEvent) => { - if ( - dropdownRef.current && - !dropdownRef.current.contains(event.target as Node) - ) { + if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { setIsOpen(false); } }; @@ -65,56 +64,50 @@ function Dropdown({ document.removeEventListener('mousedown', handleClickOutside); }; }, []); + + const handleToggleDropdown = () => { + setIsOpen(prev => !prev); + if (!isOpen) { + adjustDropdownPosition(); + } + }; + + const adjustDropdownPosition = () => { + if (dropdownRef.current) { + const rect = dropdownRef.current.getBoundingClientRect(); + const dropdownMenuHeight = Math.min(200, options.length * 40); // Adjust height based on options + const viewportHeight = window.innerHeight; + + // Check if dropdown overflows the bottom of the viewport + const newPosition = { + top: rect.bottom + dropdownMenuHeight > viewportHeight ? -dropdownMenuHeight : 0, + left: 0, + }; + + setDropdownPosition(newPosition); + } + }; + return (
{isOpen && (
{options.map((option: any, index) => (
- {typeof option === 'string' - ? option - : option.name - ? option.name - : option.label - ? option.label - : `${ - option.value < 1e9 - ? option.value + ` (${option.description})` - : option.description - }`} + {typeof option === 'string' ? option : option.name || option.label || option.description} {showEdit && onEdit && ( Edit { - onEdit({ - id: option.id, - name: option.name, - type: option.type, - }); + onEdit(option); setIsOpen(false); }} /> @@ -163,11 +142,7 @@ function Dropdown({ Delete )} From e1a8184c2ea78909fad40c9542eb20f76c8065c8 Mon Sep 17 00:00:00 2001 From: sccalabr <4111230+sccalabr@users.noreply.github.com> Date: Sat, 5 Oct 2024 15:24:59 -0700 Subject: [PATCH 3/6] Fixing build issues --- frontend/src/Navigation.tsx | 30 +++++++++++---------- frontend/src/components/Dropdown.tsx | 39 +++++++++++++++++++++------- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 92347ab6..621ae96b 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -11,7 +11,6 @@ import Discord from './assets/discord.svg'; import Expand from './assets/expand.svg'; import Github from './assets/github.svg'; import Hamburger from './assets/hamburger.svg'; -import Info from './assets/info.svg'; import InfoDark from './assets/info-dark.svg'; import SettingGear from './assets/settingGear.svg'; import Twitter from './assets/TwitterX.svg'; @@ -362,24 +361,27 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
- +
+ { - if (selectedOption.value === "documentation") { - window.open(" https://docs.docsgpt.cloud/", "_blank"); - } else if (selectedOption.value === "email"){ + contentSize="50" + options={[ + { label: 'Docs', value: 'documentation' }, + { label: 'Email Us', value: 'email' }, + ]} + onSelect={(selectedOption: { + label: string; + value: string; + }) => { + if (selectedOption.value === 'documentation') { + window.open(' https://docs.docsgpt.cloud/', '_blank'); + } else if (selectedOption.value === 'email') { window.location.href = `mailto:contact@arc53.com`; } }} - /> + />
(null); const [isOpen, setIsOpen] = React.useState(false); - const [dropdownPosition, setDropdownPosition] = React.useState({ top: 0}); - + const [dropdownPosition, setDropdownPosition] = React.useState({ top: 0 }); + const borderRadius = rounded === 'xl' ? 'rounded-xl' : 'rounded-3xl'; const borderTopRadius = rounded === 'xl' ? 'rounded-t-xl' : 'rounded-t-3xl'; const handleClickOutside = (event: MouseEvent) => { - if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) { + if ( + dropdownRef.current && + !dropdownRef.current.contains(event.target as Node) + ) { setIsOpen(false); } }; @@ -66,7 +69,7 @@ function Dropdown({ }, []); const handleToggleDropdown = () => { - setIsOpen(prev => !prev); + setIsOpen((prev) => !prev); if (!isOpen) { adjustDropdownPosition(); } @@ -80,7 +83,10 @@ function Dropdown({ // Check if dropdown overflows the bottom of the viewport const newPosition = { - top: rect.bottom + dropdownMenuHeight > viewportHeight ? -dropdownMenuHeight : 0, + top: + rect.bottom + dropdownMenuHeight > viewportHeight + ? -dropdownMenuHeight + : 0, left: 0, }; @@ -90,7 +96,12 @@ function Dropdown({ return (
{isOpen && (
- {typeof option === 'string' ? option : option.name || option.label || option.description} + {typeof option === 'string' + ? option + : option.name || option.label || option.description} {showEdit && onEdit && ( Date: Sat, 5 Oct 2024 18:16:09 -0700 Subject: [PATCH 4/6] Addressing comments --- frontend/src/App.tsx | 6 +- frontend/src/Navigation.tsx | 33 ++------ frontend/src/assets/documentation-dark.svg | 5 +- frontend/src/assets/documentation.svg | 5 +- frontend/src/assets/envelope-dark.svg | 3 + frontend/src/assets/envelope.svg | 3 + frontend/src/components/Dropdown.tsx | 94 +++++++++++---------- frontend/src/components/Help.tsx | 97 ++++++++++++++++++++++ frontend/src/components/SourceDropdown.tsx | 9 +- frontend/src/locale/i18n.ts | 2 +- 10 files changed, 174 insertions(+), 83 deletions(-) create mode 100644 frontend/src/assets/envelope-dark.svg create mode 100644 frontend/src/assets/envelope.svg create mode 100644 frontend/src/components/Help.tsx diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 1455f495..176ae518 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -32,9 +32,9 @@ function MainLayout() { } export default function App() { - const [,,componentMounted] = useDarkTheme(); - if(!componentMounted) { - return
+ const [, , componentMounted] = useDarkTheme(); + if (!componentMounted) { + return
; } return (
diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 621ae96b..09245d9d 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -11,7 +11,6 @@ import Discord from './assets/discord.svg'; import Expand from './assets/expand.svg'; import Github from './assets/github.svg'; import Hamburger from './assets/hamburger.svg'; -import InfoDark from './assets/info-dark.svg'; import SettingGear from './assets/settingGear.svg'; import Twitter from './assets/TwitterX.svg'; import UploadIcon from './assets/upload.svg'; @@ -41,7 +40,7 @@ import { setSourceDocs, } from './preferences/preferenceSlice'; import Upload from './upload/Upload'; -import Dropdown from './components/Dropdown'; +import Help from './components/Help'; interface NavigationProps { navOpen: boolean; @@ -305,7 +304,6 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) { <> )}
-
@@ -360,30 +358,11 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {

-
-
- - { - if (selectedOption.value === 'documentation') { - window.open(' https://docs.docsgpt.cloud/', '_blank'); - } else if (selectedOption.value === 'email') { - window.location.href = `mailto:contact@arc53.com`; - } - }} - /> -
-
+
+
+
+ +
- + + + diff --git a/frontend/src/assets/documentation.svg b/frontend/src/assets/documentation.svg index f9f7c596..955d392f 100644 --- a/frontend/src/assets/documentation.svg +++ b/frontend/src/assets/documentation.svg @@ -1,3 +1,4 @@ - - + + + diff --git a/frontend/src/assets/envelope-dark.svg b/frontend/src/assets/envelope-dark.svg new file mode 100644 index 00000000..a61bec4f --- /dev/null +++ b/frontend/src/assets/envelope-dark.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/assets/envelope.svg b/frontend/src/assets/envelope.svg new file mode 100644 index 00000000..a4c25032 --- /dev/null +++ b/frontend/src/assets/envelope.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/components/Dropdown.tsx b/frontend/src/components/Dropdown.tsx index 97c074a7..07f33650 100644 --- a/frontend/src/components/Dropdown.tsx +++ b/frontend/src/components/Dropdown.tsx @@ -47,8 +47,6 @@ function Dropdown({ }) { const dropdownRef = React.useRef(null); const [isOpen, setIsOpen] = React.useState(false); - const [dropdownPosition, setDropdownPosition] = React.useState({ top: 0 }); - const borderRadius = rounded === 'xl' ? 'rounded-xl' : 'rounded-3xl'; const borderTopRadius = rounded === 'xl' ? 'rounded-t-xl' : 'rounded-t-3xl'; @@ -67,33 +65,6 @@ function Dropdown({ document.removeEventListener('mousedown', handleClickOutside); }; }, []); - - const handleToggleDropdown = () => { - setIsOpen((prev) => !prev); - if (!isOpen) { - adjustDropdownPosition(); - } - }; - - const adjustDropdownPosition = () => { - if (dropdownRef.current) { - const rect = dropdownRef.current.getBoundingClientRect(); - const dropdownMenuHeight = Math.min(200, options.length * 40); // Adjust height based on options - const viewportHeight = window.innerHeight; - - // Check if dropdown overflows the bottom of the viewport - const newPosition = { - top: - rect.bottom + dropdownMenuHeight > viewportHeight - ? -dropdownMenuHeight - : 0, - left: 0, - }; - - setDropdownPosition(newPosition); - } - }; - return (
{isOpen && (
{options.map((option: any, index) => (
{typeof option === 'string' ? option - : option.name || option.label || option.description} + : option.name + ? option.name + : option.label + ? option.label + : `${ + option.value < 1e9 + ? option.value + ` (${option.description})` + : option.description + }`} {showEdit && onEdit && ( Edit { - onEdit(option); + onEdit({ + id: option.id, + name: option.name, + type: option.type, + }); setIsOpen(false); }} /> @@ -163,7 +163,11 @@ function Dropdown({ Delete )} diff --git a/frontend/src/components/Help.tsx b/frontend/src/components/Help.tsx new file mode 100644 index 00000000..b61f9c52 --- /dev/null +++ b/frontend/src/components/Help.tsx @@ -0,0 +1,97 @@ +import React, { useState, useRef, useEffect } from 'react'; +import InfoDark from '../assets/info-dark.svg'; +import PageIcon from '../assets/documentation.svg'; // Ensure this path is correct +import EmailIcon from '../assets/envelope.svg'; // Replace with your actual email icon path + +const Help = () => { + const [isOpen, setIsOpen] = useState(false); + const dropdownRef = useRef(null); + const buttonRef = useRef(null); + + const toggleDropdown = () => { + setIsOpen((prev) => !prev); + }; + + const handleClickOutside = (event: MouseEvent) => { + if ( + dropdownRef.current && + !dropdownRef.current.contains(event.target as Node) && + buttonRef.current && + !buttonRef.current.contains(event.target as Node) + ) { + setIsOpen(false); + } + }; + + useEffect(() => { + document.addEventListener('mousedown', handleClickOutside); + return () => { + document.removeEventListener('mousedown', handleClickOutside); + }; + }, []); + + const dropdownPosition = () => { + if (!buttonRef.current) return { top: '100%', left: '0' }; + + const rect = buttonRef.current.getBoundingClientRect(); + const dropdownHeight = 80; // Adjust based on the content height + const spaceBelow = window.innerHeight - rect.bottom; + + const dropdownWidth = 192; // Adjust to fit your design + const spaceRight = window.innerWidth - rect.right; + + let leftPosition = 0; // Default to align with the button + + if (spaceRight < dropdownWidth) { + leftPosition = dropdownWidth - rect.width; + } + + if (spaceBelow >= dropdownHeight) { + return { top: '100%', left: `${leftPosition}px` }; // Open downward + } else { + return { top: `${-dropdownHeight}px`, left: `${leftPosition}px` }; // Open upward + } + }; + + return ( +
+ + {isOpen && ( + + )} +
+ ); +}; + +export default Help; diff --git a/frontend/src/components/SourceDropdown.tsx b/frontend/src/components/SourceDropdown.tsx index 6a348161..f92173a0 100644 --- a/frontend/src/components/SourceDropdown.tsx +++ b/frontend/src/components/SourceDropdown.tsx @@ -121,9 +121,12 @@ function SourceDropdown({ className="flex cursor-pointer items-center justify-between hover:bg-gray-100 dark:text-bright-gray dark:hover:bg-purple-taupe" onClick={handleEmptyDocumentSelect} > - { - handlePostDocumentSelect(null); - }}> + { + handlePostDocumentSelect(null); + }} + > {t('none')}
diff --git a/frontend/src/locale/i18n.ts b/frontend/src/locale/i18n.ts index 674a3467..72f9ec28 100644 --- a/frontend/src/locale/i18n.ts +++ b/frontend/src/locale/i18n.ts @@ -25,7 +25,7 @@ i18n zh: { translation: zh, }, - "zh-TW": { + 'zh-TW': { translation: zhTW, }, }, From 5f62c0d57ae09e5cbec4552b12c5565a8688b2c3 Mon Sep 17 00:00:00 2001 From: sccalabr <4111230+sccalabr@users.noreply.github.com> Date: Sun, 13 Oct 2024 09:33:45 -0700 Subject: [PATCH 5/6] fixing look --- frontend/signal-desktop-keyring.gpg | Bin 0 -> 2223 bytes frontend/src/Navigation.tsx | 90 +++++++++++++++------------- frontend/src/components/Help.tsx | 2 +- 3 files changed, 48 insertions(+), 44 deletions(-) create mode 100644 frontend/signal-desktop-keyring.gpg diff --git a/frontend/signal-desktop-keyring.gpg b/frontend/signal-desktop-keyring.gpg new file mode 100644 index 0000000000000000000000000000000000000000..b5e68a0406c738a31fff4c4de4352399168f47e8 GIT binary patch literal 2223 zcmV;g2vGN#0u2OM(o>8@%6k}|}?l=%0SOu3ZEv`h(5}P#jS~+r;ni_t? zNrY}n3T$7un?2=;`~jag0jB9PBsd%;D!g%b>g1aPJsnB_zNv@#Fe&JRHV?d@SSo$G zE|9Kz$n@BA*o^WS6BXQjFQP&vrbcKpABq|fn`as*3957C<)#ZtY!dXhm}|^BLOzmj z3D<7a)N-*mDtrKvN{26^rZjd|%{;?=k4_68$XqC4Vy5EVBg(M^TBR_A2?3-B{hbyu-z z`(BqDmG2_lBBYy=;9s2YN29S#xq(t@O@O2#%Mkibv-h|F=KDkXd&>zz&^r!XSu75R zxhTF#4VE>_vMjyO{!&EJpix;;bnH^$rUT7izb)%h{& zpqVsRbL8kTCMb1Ld2on&XX>a=?Hijoo_GjW{u2zd4OL2yaWWyDMR?!zBgV8@m3sM) z>C?dM47Un`rvtRDHObYOKTANPRJLcbY=b7b(Qete|J9O)!>SXe6G6j12p8WmDPFcp zxXIB0%=!ihx|aYE0RRECF;8%1ZXj1^X>)L8av)QAb97~Gb09o(b#QQRa&$mSkmbwQ$LenA^WjruSBy1}5gDmquCEazRgY!GTe2D=Ks| zLHj`OCoX_e4j$$H{Uw0bPxP~Py%Q{{ojr50Yf~GGeiV7O2<>5et8Jd_3Sp%0$!vE6 z_};Q&(|Q&~0GOL38c85yI}H494iT_XORzqA4gNLM5f&1f>^|or>z`aRlQBgkQlnTb zFRHzjPbRgeE7oins}Imc8BOs9l3@)~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S4ZQScdXRetue3^J#dnWuHwm literal 0 HcmV?d00001 diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 09245d9d..6e3b6818 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -358,50 +358,54 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {

-
-
-
- +
+
+
+
+ +
+
+
+ + discord + + + x + + + github +
- - discord - - - x - - - github -
diff --git a/frontend/src/components/Help.tsx b/frontend/src/components/Help.tsx index b61f9c52..38e4468f 100644 --- a/frontend/src/components/Help.tsx +++ b/frontend/src/components/Help.tsx @@ -63,7 +63,7 @@ const Help = () => { icon Help From 56e3a1c3b2b03d7fe6867befb9605b47f173df7f Mon Sep 17 00:00:00 2001 From: Digvijay Shelar <82649533+shelar1423@users.noreply.github.com> Date: Mon, 14 Oct 2024 17:08:47 +0530 Subject: [PATCH 6/6] DocsGPT DEMO UPDATED --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f1942dc1..ee9a1af6 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,8 @@ We're eager to provide personalized assistance when deploying your DocsGPT to a [Send Email :email:](mailto:contact@arc53.com?subject=DocsGPT%20support%2Fsolutions) -![video-example-of-docs-gpt](https://d3dg1063dc54p9.cloudfront.net/videos/demov3.gif) + +video-example-of-docs-gpt ## Roadmap