From 7ccd74b02233669c60ffe3c227413eb4061e7c2e Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Tue, 15 Oct 2024 02:05:25 +0530 Subject: [PATCH 1/2] fix(help): ui --- frontend/src/Navigation.tsx | 4 +-- frontend/src/components/Help.tsx | 62 ++++++++++++-------------------- 2 files changed, 23 insertions(+), 43 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 6e3b68189..4b49ddbc0 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -361,9 +361,7 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
- -
+
{ const [isOpen, setIsOpen] = useState(false); @@ -30,62 +30,44 @@ const Help = () => { }; }, []); - 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 && ( From 085542c861487fc3f01ad31b9247c72589b17780 Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Tue, 15 Oct 2024 02:33:20 +0530 Subject: [PATCH 2/2] feat(help): sync locales --- frontend/src/Navigation.tsx | 5 ++--- frontend/src/components/Help.tsx | 11 ++++++----- frontend/src/locale/en.json | 3 +++ frontend/src/locale/es.json | 3 +++ frontend/src/locale/jp.json | 3 +++ frontend/src/locale/zh-TW.json | 3 +++ frontend/src/locale/zh.json | 3 +++ 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/frontend/src/Navigation.tsx b/frontend/src/Navigation.tsx index 4b49ddbc0..ced91fca5 100644 --- a/frontend/src/Navigation.tsx +++ b/frontend/src/Navigation.tsx @@ -360,9 +360,8 @@ export default function Navigation({ navOpen, setNavOpen }: NavigationProps) {
-
- -
+ +
{ const [isOpen, setIsOpen] = useState(false); const dropdownRef = useRef(null); const buttonRef = useRef(null); + const { t } = useTranslation(); const toggleDropdown = () => { setIsOpen((prev) => !prev); @@ -38,11 +39,11 @@ const Help = () => { className="my-auto mx-4 w-full flex items-center h-9 gap-4 rounded-3xl hover:bg-gray-100 dark:hover:bg-[#28292E]" > info - Help + {t('help')} {isOpen && ( )} diff --git a/frontend/src/locale/en.json b/frontend/src/locale/en.json index 76bdea566..335d1e6c8 100644 --- a/frontend/src/locale/en.json +++ b/frontend/src/locale/en.json @@ -10,6 +10,9 @@ "sourceDocs": "Source", "none": "None", "cancel": "Cancel", + "help":"Help", + "emailUs":"Email us", + "documentation":"documentation", "demo": [ { "header": "Learn about DocsGPT", diff --git a/frontend/src/locale/es.json b/frontend/src/locale/es.json index 793efcb97..9358aafa3 100644 --- a/frontend/src/locale/es.json +++ b/frontend/src/locale/es.json @@ -10,6 +10,9 @@ "sourceDocs": "Fuente", "none": "Nada", "cancel": "Cancelar", + "help":"Asistencia", + "emailUs": "Envíanos un correo", + "documentation": "documentación", "demo": [ { "header": "Aprende sobre DocsGPT", diff --git a/frontend/src/locale/jp.json b/frontend/src/locale/jp.json index 725bfeb48..2adc4947d 100644 --- a/frontend/src/locale/jp.json +++ b/frontend/src/locale/jp.json @@ -10,6 +10,9 @@ "sourceDocs": "ソース", "none": "なし", "cancel": "キャンセル", + "help":"ヘルプ", + "emailUs": "メールを送る", + "documentation": "ドキュメント", "demo": [ { "header": "DocsGPTについて学ぶ", diff --git a/frontend/src/locale/zh-TW.json b/frontend/src/locale/zh-TW.json index e91005b51..a826baed1 100644 --- a/frontend/src/locale/zh-TW.json +++ b/frontend/src/locale/zh-TW.json @@ -10,6 +10,9 @@ "sourceDocs": "原始文件", "none": "無", "cancel": "取消", + "help":"聯繫支援", + "emailUs": "寄送電子郵件給我們", + "documentation": "文件", "demo": [ { "header": "了解 DocsGPT", diff --git a/frontend/src/locale/zh.json b/frontend/src/locale/zh.json index 79cf63412..427bddc4c 100644 --- a/frontend/src/locale/zh.json +++ b/frontend/src/locale/zh.json @@ -10,6 +10,9 @@ "sourceDocs": "源", "none": "无", "cancel": "取消", + "help":"联系支持", + "emailUs": "给我们发邮件", + "documentation": "文档", "demo": [ { "header": "了解 DocsGPT",