mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-23 04:46:07 +00:00
perf: bot card css
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
|
grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
|
||||||
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
||||||
gap: 15px;
|
gap: 2rem;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
@@ -4,30 +4,38 @@ import styles from './botCard.module.css';
|
|||||||
export default function BotCard({ botCardVO }: { botCardVO: BotCardVO }) {
|
export default function BotCard({ botCardVO }: { botCardVO: BotCardVO }) {
|
||||||
return (
|
return (
|
||||||
<div className={`${styles.cardContainer}`}>
|
<div className={`${styles.cardContainer}`}>
|
||||||
{/* icon和基本信息 */}
|
|
||||||
<div className={`${styles.iconBasicInfoContainer}`}>
|
<div className={`${styles.iconBasicInfoContainer}`}>
|
||||||
{/* icon */}
|
<img className={`${styles.iconImage}`} src={botCardVO.iconURL} alt="icon" />
|
||||||
<div className={`${styles.icon}`}>ICO</div>
|
|
||||||
{/* bot基本信息 */}
|
|
||||||
<div className={`${styles.basicInfoContainer}`}>
|
<div className={`${styles.basicInfoContainer}`}>
|
||||||
<div className={`${styles.basicInfoText} ${styles.bigText}`}>
|
|
||||||
{botCardVO.name}
|
<div className={`${styles.basicInfoNameContainer}`}>
|
||||||
|
<div className={`${styles.basicInfoName}`}>
|
||||||
|
{botCardVO.name}
|
||||||
|
</div>
|
||||||
|
<div className={`${styles.basicInfoDescription}`}>
|
||||||
|
{botCardVO.description}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={`${styles.basicInfoText}`}>
|
|
||||||
平台:{botCardVO.adapter}
|
<div className={`${styles.basicInfoAdapterContainer}`}>
|
||||||
|
<svg className={`${styles.basicInfoAdapterIcon}`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 8.99374C2 5.68349 4.67654 3 8.00066 3H15.9993C19.3134 3 22 5.69478 22 8.99374V21H8.00066C4.68659 21 2 18.3052 2 15.0063V8.99374ZM20 19V8.99374C20 6.79539 18.2049 5 15.9993 5H8.00066C5.78458 5 4 6.78458 4 8.99374V15.0063C4 17.2046 5.79512 19 8.00066 19H20ZM14 11H16V13H14V11ZM8 11H10V13H8V11Z"></path></svg>
|
||||||
|
<span className={`${styles.basicInfoAdapterLabel}`}>
|
||||||
|
{botCardVO.adapterLabel}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={`${styles.basicInfoText}`}>
|
|
||||||
绑定流水线:{botCardVO.pipelineName}
|
<div className={`${styles.basicInfoPipelineContainer}`}>
|
||||||
|
<svg className={`${styles.basicInfoPipelineIcon}`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M6 21.5C4.067 21.5 2.5 19.933 2.5 18C2.5 16.067 4.067 14.5 6 14.5C7.5852 14.5 8.92427 15.5539 9.35481 16.9992L15 16.9994V15L17 14.9994V9.24339L14.757 6.99938H9V9.00003H3V3.00003H9V4.99939H14.757L18 1.75739L22.2426 6.00003L19 9.24139V14.9994L21 15V21H15V18.9994L9.35499 19.0003C8.92464 20.4459 7.58543 21.5 6 21.5ZM6 16.5C5.17157 16.5 4.5 17.1716 4.5 18C4.5 18.8285 5.17157 19.5 6 19.5C6.82843 19.5 7.5 18.8285 7.5 18C7.5 17.1716 6.82843 16.5 6 16.5ZM19 17H17V19H19V17ZM18 4.58581L16.5858 6.00003L18 7.41424L19.4142 6.00003L18 4.58581ZM7 5.00003H5V7.00003H7V5.00003Z"></path></svg>
|
||||||
|
<span className={`${styles.basicInfoPipelineLabel}`}>
|
||||||
|
{botCardVO.usePipelineName}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* 描述和创建时间 */}
|
|
||||||
<div className={`${styles.urlAndUpdateText}`}>
|
|
||||||
描述:{botCardVO.description}
|
|
||||||
</div>
|
|
||||||
{/* <div className={`${styles.urlAndUpdateText}`}>
|
|
||||||
更新时间:{botCardVO.updateTime}
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
export interface IBotCardVO {
|
export interface IBotCardVO {
|
||||||
id: string;
|
id: string;
|
||||||
|
iconURL: string;
|
||||||
name: string;
|
name: string;
|
||||||
adapter: string;
|
|
||||||
description: string;
|
description: string;
|
||||||
updateTime: string;
|
adapterLabel: string;
|
||||||
pipelineName: string;
|
usePipelineName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class BotCardVO implements IBotCardVO {
|
export class BotCardVO implements IBotCardVO {
|
||||||
id: string;
|
id: string;
|
||||||
adapter: string;
|
iconURL: string;
|
||||||
description: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
updateTime: string;
|
description: string;
|
||||||
pipelineName: string;
|
adapterLabel: string;
|
||||||
|
usePipelineName: string;
|
||||||
|
|
||||||
constructor(props: IBotCardVO) {
|
constructor(props: IBotCardVO) {
|
||||||
this.id = props.id;
|
this.id = props.id;
|
||||||
|
this.iconURL = props.iconURL;
|
||||||
this.name = props.name;
|
this.name = props.name;
|
||||||
this.adapter = props.adapter;
|
|
||||||
this.description = props.description;
|
this.description = props.description;
|
||||||
this.updateTime = props.updateTime;
|
this.adapterLabel = props.adapterLabel;
|
||||||
this.pipelineName = props.pipelineName;
|
this.usePipelineName = props.usePipelineName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,86 @@
|
|||||||
.iconBasicInfoContainer {
|
|
||||||
width: 300px;
|
|
||||||
height: 100px;
|
|
||||||
margin-left: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cardContainer {
|
.cardContainer {
|
||||||
width: 360px;
|
width: 24rem;
|
||||||
height: 200px;
|
height: 10rem;
|
||||||
background-color: #FFF;
|
background-color: #fff;
|
||||||
border-radius: 9px;
|
border-radius: 10px;
|
||||||
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 1px -1px;
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
|
||||||
display: flex;
|
padding: 1.2rem;
|
||||||
flex-direction: column;
|
cursor: pointer;
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.iconBasicInfoContainer {
|
.iconBasicInfoContainer {
|
||||||
width: 300px;
|
width: 100%;
|
||||||
height: 100px;
|
height: 100%;
|
||||||
margin-left: 20px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
gap: 0.8rem;
|
||||||
|
user-select: none;
|
||||||
|
/* background-color: aqua; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon {
|
.iconImage {
|
||||||
width: 90px;
|
width: 4rem;
|
||||||
height: 90px;
|
height: 4rem;
|
||||||
border-radius: 5px;
|
margin: 0.2rem;
|
||||||
font-size: 40px;
|
/* border-radius: 50%; */
|
||||||
line-height: 90px;
|
|
||||||
text-align: center;
|
|
||||||
color: #ffffff;
|
|
||||||
background: rgba(96, 149, 209, 0.31);
|
|
||||||
border: 1px solid rgba(96, 149, 209, 0.31);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.basicInfoContainer {
|
.basicInfoContainer {
|
||||||
width: 200px;
|
|
||||||
height: 90px;
|
|
||||||
padding-left: 20px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
gap: 0.6rem;
|
||||||
justify-content: space-between;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.basicInfoText {
|
.basicInfoNameContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bigText {
|
.basicInfoName {
|
||||||
font-size: 20px;
|
font-size: 1.4rem;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.urlAndUpdateText {
|
.basicInfoDescription {
|
||||||
margin-left: 20px;
|
font-size: 1.2rem;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #b1b1b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createCardContainer {
|
.basicInfoAdapterContainer {
|
||||||
font-size: 90px;
|
display: flex;
|
||||||
background: #6062E7;
|
flex-direction: row;
|
||||||
color: white;
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoAdapterIcon {
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
color: #626262;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoAdapterLabel {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #626262;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoPipelineContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoPipelineIcon {
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
|
color: #626262;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoPipelineLabel {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #626262;
|
||||||
}
|
}
|
||||||
@@ -47,12 +47,12 @@ export default function BotConfigPage() {
|
|||||||
.then((resp) => {
|
.then((resp) => {
|
||||||
const botList: BotCardVO[] = resp.bots.map((bot: Bot) => {
|
const botList: BotCardVO[] = resp.bots.map((bot: Bot) => {
|
||||||
return new BotCardVO({
|
return new BotCardVO({
|
||||||
adapter: bot.adapter,
|
|
||||||
description: bot.description,
|
|
||||||
id: bot.uuid || '',
|
id: bot.uuid || '',
|
||||||
|
iconURL: httpClient.getAdapterIconURL(bot.adapter),
|
||||||
name: bot.name,
|
name: bot.name,
|
||||||
updateTime: bot.updated_at || '',
|
description: bot.description,
|
||||||
pipelineName: bot.use_pipeline_name || '',
|
adapterLabel: bot.adapter,
|
||||||
|
usePipelineName: bot.use_pipeline_name || '',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if (botList.length === 0) {
|
if (botList.length === 0) {
|
||||||
@@ -138,6 +138,12 @@ export default function BotConfigPage() {
|
|||||||
{/* 注意:其余的返回内容需要保持在Spin组件外部 */}
|
{/* 注意:其余的返回内容需要保持在Spin组件外部 */}
|
||||||
{pageShowRule === BotConfigPageShowRule.HAVE_BOT && (
|
{pageShowRule === BotConfigPageShowRule.HAVE_BOT && (
|
||||||
<div className={`${styles.botListContainer}`}>
|
<div className={`${styles.botListContainer}`}>
|
||||||
|
|
||||||
|
<CreateCardComponent
|
||||||
|
height={'10rem'}
|
||||||
|
plusSize={'4rem'}
|
||||||
|
onClick={handleCreateBotClick}
|
||||||
|
/>
|
||||||
{botList.map((cardVO) => {
|
{botList.map((cardVO) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -150,11 +156,6 @@ export default function BotConfigPage() {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
<CreateCardComponent
|
|
||||||
height={'200px'}
|
|
||||||
plusSize={'90px'}
|
|
||||||
onClick={handleCreateBotClick}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.langbotIconContainer {
|
.langbotIconContainer {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
.providerIcon {
|
.providerIcon {
|
||||||
width: 1.2rem;
|
width: 1.2rem;
|
||||||
height: 1.2rem;
|
height: 1.2rem;
|
||||||
|
margin-top: 0.2rem;
|
||||||
color: #626262;
|
color: #626262;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user