This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/answer-plugins.git


The following commit(s) were added to refs/heads/main by this push:
     new 4495038  fix: quick-links update
4495038 is described below

commit 44950385c5114b4f95a0c374e8c50c1791130e8f
Author: shuai <[email protected]>
AuthorDate: Thu Dec 25 16:56:18 2025 +0800

    fix: quick-links update
---
 quick-links/Component.tsx | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/quick-links/Component.tsx b/quick-links/Component.tsx
index f14dd19..0343eac 100644
--- a/quick-links/Component.tsx
+++ b/quick-links/Component.tsx
@@ -17,10 +17,31 @@
  * under the License.
  */
 
+import React from 'react';
 import { useTranslation } from 'react-i18next';
 import useSWR from 'swr'
 
-const Component = ({ navigate, request, hasDivider }) => {
+interface Tag {
+  slug_name: string;
+  display_name: string;
+}
+
+interface SidebarConfigData {
+  tags?: Tag[];
+  links_text?: string;
+}
+
+interface ComponentProps {
+  navigate: (url: string) => void;
+  request: {
+    instance: {
+      get: (url: string) => Promise<SidebarConfigData>;
+    };
+  };
+  hasDivider?: boolean;
+}
+
+const Component = ({ navigate, request, hasDivider }: ComponentProps) => {
 
   const { t } = useTranslation('plugin', {
     keyPrefix: 'quick_links.frontend',
@@ -33,7 +54,7 @@ const Component = ({ navigate, request, hasDivider }) => {
   const tags = data?.tags || [];
   const links = data?.links_text?.split('\n') || [];
 
-  const handleNavigate = (e) => {
+  const handleNavigate = (e: React.MouseEvent<HTMLAnchorElement>) => {
     e.preventDefault();
     e.stopPropagation();
     const url = e.currentTarget.getAttribute('href');
@@ -56,7 +77,7 @@ const Component = ({ navigate, request, hasDivider }) => {
     <div>
       {hasDivider && <div className="border-top mt-3" />}
       <div className="py-2 px-3 mt-3 small fw-bold 
quick-link">{t('quick_links')}</div>
-      {tags?.map((tag) => {
+      {tags?.map((tag: Tag) => {
         const href = `/tags/${encodeURIComponent(tag.slug_name)}`
         return (
           <a
@@ -69,7 +90,7 @@ const Component = ({ navigate, request, hasDivider }) => {
         )
       })}
 
-      {links?.map((link) => {
+      {links?.map((link: string) => {
         const name = link.split(',')[0]
         const url = link.split(',')[1]?.trim()
         if (!url || !name) {

Reply via email to