You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by sh...@apache.org on 2025/08/14 02:26:25 UTC
(answer) branch feat/1.7.0/quicklinks updated: feat: support quick-links plugin
This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch feat/1.7.0/quicklinks
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/feat/1.7.0/quicklinks by this push:
new c2c7ea84 feat: support quick-links plugin
c2c7ea84 is described below
commit c2c7ea84d58944a6a113bc0586d15cd7a03c8e99
Author: shuai <li...@sifou.com>
AuthorDate: Thu Aug 14 10:24:31 2025 +0800
feat: support quick-links plugin
---
ui/src/components/SideNav/index.tsx | 15 +++++++++++++--
ui/src/plugins/index.ts | 23 ++---------------------
ui/src/utils/pluginKit/interface.ts | 1 +
3 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/ui/src/components/SideNav/index.tsx b/ui/src/components/SideNav/index.tsx
index e3f04f8f..294389a0 100644
--- a/ui/src/components/SideNav/index.tsx
+++ b/ui/src/components/SideNav/index.tsx
@@ -19,11 +19,14 @@
import { FC } from 'react';
import { Nav } from 'react-bootstrap';
-import { NavLink, useLocation } from 'react-router-dom';
+import { NavLink, useLocation, useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { loggedUserInfoStore, sideNavStore } from '@/stores';
-import { Icon } from '@/components';
+import { Icon, PluginRender } from '@/components';
+import { PluginType } from '@/utils/pluginKit';
+import request from '@/utils/request';
+
import './index.scss';
const Index: FC = () => {
@@ -31,6 +34,7 @@ const Index: FC = () => {
const { pathname } = useLocation();
const { user: userInfo } = loggedUserInfoStore();
const { can_revision, revision } = sideNavStore();
+ const navigate = useNavigate();
return (
<Nav variant="pills" className="flex-column" id="sideNav">
@@ -62,6 +66,13 @@ const Index: FC = () => {
<span>{t('header.nav.badges')}</span>
</NavLink>
+ <PluginRender
+ slug_name="quick_links"
+ type={PluginType.Sidebar}
+ request={request}
+ navigate={navigate}
+ />
+
{can_revision || userInfo?.role_id === 2 ? (
<>
<div className="py-2 px-3 mt-3 small fw-bold">
diff --git a/ui/src/plugins/index.ts b/ui/src/plugins/index.ts
index 7cbc4cd9..eac762ef 100644
--- a/ui/src/plugins/index.ts
+++ b/ui/src/plugins/index.ts
@@ -1,22 +1,3 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-export default null;
-
-// export { default as Demo } from './Demo';
+const loadQuickLinks = () => import('quick-links').then(module => module.default);
+export const quick_links = loadQuickLinks
\ No newline at end of file
diff --git a/ui/src/utils/pluginKit/interface.ts b/ui/src/utils/pluginKit/interface.ts
index d946ed6e..a1b641d8 100644
--- a/ui/src/utils/pluginKit/interface.ts
+++ b/ui/src/utils/pluginKit/interface.ts
@@ -29,6 +29,7 @@ export enum PluginType {
Route = 'route',
Captcha = 'captcha',
Render = 'render',
+ Sidebar = 'sidebar',
}
export interface PluginInfo {