mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-20 19:36:08 +00:00
perf: styles of pipelines
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
align-self: flex-start;
|
align-self: flex-start;
|
||||||
justify-self: flex-start;
|
justify-self: flex-start;
|
||||||
width: calc(100% - 60px);
|
width: calc(100% - 60px);
|
||||||
margin: auto;
|
margin: auto;
|
||||||
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));
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.basicInfoDescription {
|
.basicInfoDescription {
|
||||||
font-size: 1.2rem;
|
font-size: 1rem;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
color: #b1b1b1;
|
color: #b1b1b1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,8 +150,9 @@ export default function BotConfigPage() {
|
|||||||
<div className={`${styles.botListContainer}`}>
|
<div className={`${styles.botListContainer}`}>
|
||||||
|
|
||||||
<CreateCardComponent
|
<CreateCardComponent
|
||||||
|
width={'24rem'}
|
||||||
height={'10rem'}
|
height={'10rem'}
|
||||||
plusSize={'4rem'}
|
plusSize={'90px'}
|
||||||
onClick={handleCreateBotClick}
|
onClick={handleCreateBotClick}
|
||||||
/>
|
/>
|
||||||
{botList.map((cardVO) => {
|
{botList.map((cardVO) => {
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import styles from './pipelineCard.module.css';
|
||||||
|
import { PipelineCardVO } from '@/app/home/pipelines/components/pipeline-card/PipelineCardVO';
|
||||||
|
|
||||||
|
export default function PipelineCard({
|
||||||
|
cardVO,
|
||||||
|
}: {
|
||||||
|
cardVO: PipelineCardVO;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className={`${styles.cardContainer}`}>
|
||||||
|
|
||||||
|
<div className={`${styles.basicInfoContainer}`}>
|
||||||
|
|
||||||
|
<div className={`${styles.basicInfoNameContainer}`}>
|
||||||
|
<div className={`${styles.basicInfoNameText} ${styles.bigText}`}>
|
||||||
|
{cardVO.name}
|
||||||
|
</div>
|
||||||
|
<div className={`${styles.basicInfoDescriptionText}`}>
|
||||||
|
{cardVO.description}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={`${styles.basicInfoLastUpdatedTimeContainer}`}>
|
||||||
|
<svg className={`${styles.basicInfoUpdateTimeIcon}`} 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 20ZM13 12H17V14H11V7H13V12Z"></path></svg>
|
||||||
|
<div className={`${styles.basicInfoUpdateTimeText}`}>
|
||||||
|
更新于{cardVO.lastUpdatedTimeAgo}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.operationContainer}>
|
||||||
|
|
||||||
|
{cardVO.isDefault && (
|
||||||
|
|
||||||
|
<div className={styles.operationDefaultBadge}>
|
||||||
|
<svg className={styles.operationDefaultBadgeIcon} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M12.0006 18.26L4.94715 22.2082L6.52248 14.2799L0.587891 8.7918L8.61493 7.84006L12.0006 0.5L15.3862 7.84006L23.4132 8.7918L17.4787 14.2799L19.054 22.2082L12.0006 18.26Z"></path></svg>
|
||||||
|
<div className={styles.operationDefaultBadgeText}>
|
||||||
|
默认
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import styles from './pipelineCard.module.css';
|
|
||||||
import { PipelineCardVO } from '@/app/home/pipelines/components/pipeline-card/PipelineCardVO';
|
|
||||||
|
|
||||||
export default function PipelineCardComponent({
|
|
||||||
cardVO,
|
|
||||||
}: {
|
|
||||||
cardVO: PipelineCardVO;
|
|
||||||
}) {
|
|
||||||
return (
|
|
||||||
<div className={`${styles.cardContainer}`}>
|
|
||||||
{/* icon和基本信息 */}
|
|
||||||
<div className={`${styles.iconBasicInfoContainer}`}>
|
|
||||||
{/* icon */}
|
|
||||||
<div className={`${styles.icon}`}>ICO</div>
|
|
||||||
{/* 基本信息 */}
|
|
||||||
<div className={`${styles.basicInfoContainer}`}>
|
|
||||||
<div className={`${styles.basicInfoText} ${styles.bigText}`}>
|
|
||||||
{cardVO.name}
|
|
||||||
</div>
|
|
||||||
<div className={`${styles.basicInfoText}`}>
|
|
||||||
描述:{cardVO.description}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/* URL和创建时间 */}
|
|
||||||
<div className={`${styles.urlAndUpdateText}`}>版本:{cardVO.version}</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -2,22 +2,22 @@ export interface IPipelineCardVO {
|
|||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
createTime: string;
|
lastUpdatedTimeAgo: string;
|
||||||
version: string;
|
isDefault: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PipelineCardVO implements IPipelineCardVO {
|
export class PipelineCardVO implements IPipelineCardVO {
|
||||||
createTime: string;
|
|
||||||
description: string;
|
|
||||||
id: string;
|
id: string;
|
||||||
|
description: string;
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
lastUpdatedTimeAgo: string;
|
||||||
|
isDefault: boolean;
|
||||||
|
|
||||||
constructor(props: IPipelineCardVO) {
|
constructor(props: IPipelineCardVO) {
|
||||||
this.id = props.id;
|
this.id = props.id;
|
||||||
this.name = props.name;
|
this.name = props.name;
|
||||||
this.description = props.description;
|
this.description = props.description;
|
||||||
this.createTime = props.createTime;
|
this.lastUpdatedTimeAgo = props.lastUpdatedTimeAgo;
|
||||||
this.version = props.version;
|
this.isDefault = props.isDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +1,86 @@
|
|||||||
.iconBasicInfoContainer {
|
.cardContainer {
|
||||||
width: 300px;
|
width: 24rem;
|
||||||
height: 100px;
|
height: 10rem;
|
||||||
margin-left: 20px;
|
background-color: #fff;
|
||||||
|
border-radius: 10px;
|
||||||
|
box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
justify-content: space-between;
|
||||||
|
gap:0.5rem;
|
||||||
.cardContainer {
|
|
||||||
width: 360px;
|
|
||||||
height: 200px;
|
|
||||||
background-color: #FFF;
|
|
||||||
border-radius: 9px;
|
|
||||||
box-shadow: rgba(0, 0, 0, 0.4) 0 1px 1px -1px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-evenly;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
width: 90px;
|
|
||||||
height: 90px;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 40px;
|
|
||||||
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;
|
width: 100%;
|
||||||
height: 90px;
|
height: 100%;
|
||||||
padding-left: 20px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
gap: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.basicInfoText {
|
.basicInfoNameContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bigText {
|
.basicInfoNameText {
|
||||||
font-size: 20px;
|
font-size: 1.4rem;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.urlAndUpdateText {
|
.basicInfoDescriptionText {
|
||||||
margin-left: 20px;
|
font-size: 0.9rem;
|
||||||
|
font-weight: 400;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 3;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: #b1b1b1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.createCardContainer {
|
.basicInfoLastUpdatedTimeContainer {
|
||||||
font-size: 90px;
|
display: flex;
|
||||||
background: #6062E7;
|
flex-direction: row;
|
||||||
color: white;
|
align-items: center;
|
||||||
}
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoUpdateTimeIcon {
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.basicInfoUpdateTimeText {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operationContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 0.5rem;
|
||||||
|
width: 5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operationDefaultBadge {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operationDefaultBadgeIcon {
|
||||||
|
width: 1.2rem;
|
||||||
|
height: 1.2rem;
|
||||||
|
color: #ffcd27;
|
||||||
|
}
|
||||||
|
|
||||||
|
.operationDefaultBadgeText {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ffcd27;
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import CreateCardComponent from '@/app/infra/basic-component/create-card-compone
|
|||||||
import PipelineFormComponent from './components/pipeline-form/PipelineFormComponent';
|
import PipelineFormComponent from './components/pipeline-form/PipelineFormComponent';
|
||||||
import { httpClient } from '@/app/infra/http/HttpClient';
|
import { httpClient } from '@/app/infra/http/HttpClient';
|
||||||
import { PipelineCardVO } from '@/app/home/pipelines/components/pipeline-card/PipelineCardVO';
|
import { PipelineCardVO } from '@/app/home/pipelines/components/pipeline-card/PipelineCardVO';
|
||||||
import PipelineCardComponent from '@/app/home/pipelines/components/pipeline-card/PipelineCardComponent';
|
import PipelineCard from '@/app/home/pipelines/components/pipeline-card/PipelineCard';
|
||||||
import { PipelineFormEntity } from '@/app/home/pipelines/components/pipeline-form/PipelineFormEntity';
|
import { PipelineFormEntity } from '@/app/home/pipelines/components/pipeline-form/PipelineFormEntity';
|
||||||
|
import styles from './pipelineConfig.module.css';
|
||||||
|
|
||||||
export default function PluginConfigPage() {
|
export default function PluginConfigPage() {
|
||||||
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
const [modalOpen, setModalOpen] = useState<boolean>(false);
|
||||||
@@ -31,13 +32,18 @@ export default function PluginConfigPage() {
|
|||||||
httpClient
|
httpClient
|
||||||
.getPipelines()
|
.getPipelines()
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
|
let currentTime = new Date();
|
||||||
const pipelineList = value.pipelines.map((pipeline) => {
|
const pipelineList = value.pipelines.map((pipeline) => {
|
||||||
|
let lastUpdatedTimeAgo = Math.floor((currentTime.getTime() - new Date(pipeline.updated_at).getTime()) / 1000 / 60 / 60 / 24);
|
||||||
|
|
||||||
|
let lastUpdatedTimeAgoText = lastUpdatedTimeAgo > 0 ? ` ${lastUpdatedTimeAgo} 天前` : '今天';
|
||||||
|
|
||||||
return new PipelineCardVO({
|
return new PipelineCardVO({
|
||||||
createTime: pipeline.created_at,
|
lastUpdatedTimeAgo: lastUpdatedTimeAgoText,
|
||||||
description: pipeline.description,
|
description: pipeline.description,
|
||||||
id: pipeline.uuid,
|
id: pipeline.uuid,
|
||||||
name: pipeline.name,
|
name: pipeline.name,
|
||||||
version: pipeline.for_version,
|
isDefault: pipeline.is_default,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setPipelineList(pipelineList);
|
setPipelineList(pipelineList);
|
||||||
@@ -65,7 +71,7 @@ export default function PluginConfigPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={``}>
|
<div className={styles.configPageContainer}>
|
||||||
<Modal
|
<Modal
|
||||||
title={isEditForm ? '编辑流水线' : '创建流水线'}
|
title={isEditForm ? '编辑流水线' : '创建流水线'}
|
||||||
centered
|
centered
|
||||||
@@ -89,7 +95,16 @@ export default function PluginConfigPage() {
|
|||||||
</Modal>
|
</Modal>
|
||||||
|
|
||||||
{pipelineList.length > 0 && (
|
{pipelineList.length > 0 && (
|
||||||
<div className={``}>
|
<div className={styles.pipelineListContainer}>
|
||||||
|
<CreateCardComponent
|
||||||
|
width={'24rem'}
|
||||||
|
height={'10rem'}
|
||||||
|
plusSize={'90px'}
|
||||||
|
onClick={() => {
|
||||||
|
setModalOpen(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
{pipelineList.map((pipeline) => {
|
{pipelineList.map((pipeline) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -102,19 +117,12 @@ export default function PluginConfigPage() {
|
|||||||
getSelectedPipelineForm(pipeline.id);
|
getSelectedPipelineForm(pipeline.id);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<PipelineCardComponent cardVO={pipeline} />
|
<PipelineCard cardVO={pipeline} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<CreateCardComponent
|
|
||||||
height={'200px'}
|
|
||||||
plusSize={'90px'}
|
|
||||||
onClick={() => {
|
|
||||||
setModalOpen(true);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,3 +2,22 @@
|
|||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.configPageContainer {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.pipelineListContainer {
|
||||||
|
align-self: flex-start;
|
||||||
|
justify-self: flex-start;
|
||||||
|
width: calc(100% - 60px);
|
||||||
|
margin: auto;
|
||||||
|
display: grid;
|
||||||
|
grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
|
||||||
|
gap: 2rem;
|
||||||
|
justify-items: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export interface Pipeline {
|
|||||||
for_version: string;
|
for_version: string;
|
||||||
config: object;
|
config: object;
|
||||||
stages: string[];
|
stages: string[];
|
||||||
|
is_default: boolean;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user