mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-02 03:55:55 +00:00
perf: add helpLink for each page
This commit is contained in:
@@ -6,6 +6,7 @@ export interface ISidebarChildVO {
|
||||
name: string;
|
||||
route: string;
|
||||
description: string;
|
||||
helpLink: string;
|
||||
}
|
||||
|
||||
export class SidebarChildVO {
|
||||
@@ -14,6 +15,7 @@ export class SidebarChildVO {
|
||||
name: string;
|
||||
route: string;
|
||||
description: string;
|
||||
helpLink: string;
|
||||
|
||||
constructor(props: ISidebarChildVO) {
|
||||
this.id = props.id;
|
||||
@@ -21,6 +23,7 @@ export class SidebarChildVO {
|
||||
this.name = props.name;
|
||||
this.route = props.route;
|
||||
this.description = props.description;
|
||||
this.helpLink = props.helpLink;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export const sidebarConfigList = [
|
||||
),
|
||||
route: '/home/bots',
|
||||
description: '创建和管理机器人,这是 LangBot 与各个平台连接的入口',
|
||||
helpLink: 'https://docs.langbot.app/deploy/platforms/readme.html',
|
||||
}),
|
||||
new SidebarChildVO({
|
||||
id: 'models',
|
||||
@@ -33,6 +34,7 @@ export const sidebarConfigList = [
|
||||
),
|
||||
route: '/home/models',
|
||||
description: '配置和管理可在流水线中使用的模型',
|
||||
helpLink: 'https://docs.langbot.app/deploy/models/readme.html',
|
||||
}),
|
||||
new SidebarChildVO({
|
||||
id: 'pipelines',
|
||||
@@ -49,6 +51,7 @@ export const sidebarConfigList = [
|
||||
),
|
||||
route: '/home/pipelines',
|
||||
description: '流水线定义了对消息事件的处理流程,用于绑定到机器人',
|
||||
helpLink: 'https://docs.langbot.app/deploy/pipelines/readme.html',
|
||||
}),
|
||||
new SidebarChildVO({
|
||||
id: 'plugins',
|
||||
@@ -65,5 +68,6 @@ export const sidebarConfigList = [
|
||||
),
|
||||
route: '/home/plugins',
|
||||
description: '安装和配置用于扩展 LangBot 功能的插件',
|
||||
helpLink: 'https://docs.langbot.app/plugin/plugin-intro.html',
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -3,14 +3,30 @@ import styles from './HomeTittleBar.module.css';
|
||||
export default function HomeTitleBar({
|
||||
title,
|
||||
subtitle,
|
||||
helpLink,
|
||||
}: {
|
||||
title: string;
|
||||
subtitle: string;
|
||||
helpLink: string;
|
||||
}) {
|
||||
return (
|
||||
<div className={`${styles.titleBarContainer}`}>
|
||||
<div className={`${styles.titleText}`}>{title}</div>
|
||||
<div className={`${styles.subtitleText}`}>{subtitle}</div>
|
||||
<div className={`${styles.subtitleText}`}>
|
||||
{subtitle}
|
||||
<span className={`${styles.helpLink}`}>
|
||||
<a href={helpLink} target="_blank" rel="noopener noreferrer">
|
||||
<svg
|
||||
className="w-[1rem] h-[1rem]"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path d="M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM13 13.3551V14H11V12.5C11 11.9477 11.4477 11.5 12 11.5C12.8284 11.5 13.5 10.8284 13.5 10C13.5 9.17157 12.8284 8.5 12 8.5C11.2723 8.5 10.6656 9.01823 10.5288 9.70577L8.56731 9.31346C8.88637 7.70919 10.302 6.5 12 6.5C13.933 6.5 15.5 8.067 15.5 10C15.5 11.5855 14.4457 12.9248 13 13.3551Z"></path>
|
||||
</svg>
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.titleBarContainer {
|
||||
width: 100%;
|
||||
padding-top: 0.8rem;
|
||||
padding-top: 1rem;
|
||||
height: 4rem;
|
||||
opacity: 1;
|
||||
font-size: 20px;
|
||||
@@ -21,4 +21,12 @@
|
||||
margin-left: 3.2rem;
|
||||
font-size: 0.8rem;
|
||||
color: #808080;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.helpLink {
|
||||
margin-left: 0.2rem;
|
||||
font-size: 0.8rem;
|
||||
color: #8b8b8b;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,11 @@ export default function HomeLayout({
|
||||
}>) {
|
||||
const [title, setTitle] = useState<string>('');
|
||||
const [subtitle, setSubtitle] = useState<string>('');
|
||||
const [helpLink, setHelpLink] = useState<string>('');
|
||||
const onSelectedChangeAction = (child: SidebarChildVO) => {
|
||||
setTitle(child.name);
|
||||
setSubtitle(child.description);
|
||||
setHelpLink(child.helpLink);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -25,7 +27,7 @@ export default function HomeLayout({
|
||||
</aside>
|
||||
|
||||
<div className={styles.main}>
|
||||
<HomeTitleBar title={title} subtitle={subtitle} />
|
||||
<HomeTitleBar title={title} subtitle={subtitle} helpLink={helpLink} />
|
||||
|
||||
<main className={styles.mainContent}>{children}</main>
|
||||
</div>
|
||||
|
||||
@@ -77,7 +77,7 @@ const PluginInstalledComponent = forwardRef<PluginInstalledComponentRef>(
|
||||
>
|
||||
<path d="M7 5C7 2.79086 8.79086 1 11 1C13.2091 1 15 2.79086 15 5H20C20.5523 5 21 5.44772 21 6V10.1707C21 10.4953 20.8424 10.7997 20.5774 10.9872C20.3123 11.1746 19.9728 11.2217 19.6668 11.1135C19.4595 11.0403 19.2355 11 19 11C17.8954 11 17 11.8954 17 13C17 14.1046 17.8954 15 19 15C19.2355 15 19.4595 14.9597 19.6668 14.8865C19.9728 14.7783 20.3123 14.8254 20.5774 15.0128C20.8424 15.2003 21 15.5047 21 15.8293V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V6C3 5.44772 3.44772 5 4 5H7ZM11 3C9.89543 3 9 3.89543 9 5C9 5.23554 9.0403 5.45952 9.11355 5.66675C9.22172 5.97282 9.17461 6.31235 8.98718 6.57739C8.79974 6.84243 8.49532 7 8.17071 7H5V19H19V17C16.7909 17 15 15.2091 15 13C15 10.7909 16.7909 9 19 9V7H13.8293C13.5047 7 13.2003 6.84243 13.0128 6.57739C12.8254 6.31235 12.7783 5.97282 12.8865 5.66675C12.9597 5.45952 13 5.23555 13 5C13 3.89543 12.1046 3 11 3Z"></path>
|
||||
</svg>
|
||||
<div className="text-lg mb-2">暂无已安装的插件</div>
|
||||
<div className="text-lg mb-2">暂未安装任何插件</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className={`${styles.pluginListContainer}`}>
|
||||
|
||||
Reference in New Issue
Block a user