Skip to content

Commit

Permalink
feat(frontend): add opendatalab links
Browse files Browse the repository at this point in the history
  • Loading branch information
gary-Shen committed Aug 12, 2024
1 parent dc0f9a7 commit 1fe2604
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 14 deletions.
18 changes: 9 additions & 9 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"private": true,
"dependencies": {
"@ant-design/icons": "^4.6.2",
"@labelu/audio-annotator-react": "1.5.0-alpha.5",
"@labelu/components-react": "1.4.2-alpha.2",
"@labelu/image": "1.1.0",
"@labelu/formatter": "1.0.2",
"@labelu/image-annotator-react": "2.1.0-alpha.4",
"@labelu/interface": "1.3.1",
"@labelu/video-annotator-react": "1.3.4-alpha.8",
"@labelu/video-react": "1.3.2-alpha.2",
"@labelu/audio-annotator-react": "workspace:*",
"@labelu/components-react": "workspace:*",
"@labelu/image": "workspace:*",
"@labelu/formatter": "workspace:*",
"@labelu/image-annotator-react": "workspace:*",
"@labelu/interface": "workspace:*",
"@labelu/video-annotator-react": "workspace:*",
"@labelu/video-react": "workspace:*",
"@tanstack/react-query": "^5.0.0",
"antd": "5.10.1",
"axios": "^1.3.4",
Expand Down Expand Up @@ -111,4 +111,4 @@
"vite-plugin-svgr": "^2.4.0",
"vite-plugin-ts-mono-alias": "^1.1.8"
}
}
}
11 changes: 11 additions & 0 deletions apps/frontend/src/assets/svg/labelllm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions apps/frontend/src/assets/svg/mineru.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions apps/frontend/src/assets/svg/opendatalab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/frontend/src/assets/svg/toolbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions apps/frontend/src/components/AppPanel/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.panel {
display: flex;
flex-wrap: wrap;
width: 40rem;
min-height: 10rem;
}

.title {
font-size: 20px;
font-weight: 600;
margin: 0.5rem 0 0.5rem 1rem;
}

.appWrapper {
flex-basis: 50%;
border-radius: 0.25rem;
transition: all 0.2s ease-in-out;
overflow: hidden;

&:hover {
background-color: rgba(244, 245, 249, 1);

.links {
opacity: 1;
}

.appContainer {
animation: wrapperSlideIn 0.2s ease-in-out forwards;
}
}

&:not(:hover) {
.links {
opacity: 0;
}

.appContainer {
animation: wrapperSlideOut 0.2s ease-in-out forwards;
}
}
}

.appContainer {
display: flex;
padding: 0 1rem 1rem;
flex-direction: column;
align-items: start;
justify-content: center;
}

.avatar {
flex-shrink: 0;
}

.header {
display: flex;
align-items: center;
gap: 0.5rem;
cursor: pointer;
}

.description {
color: var(--color-text-tertiary);
font-size: 0.75rem;
}

.links {
display: flex;
gap: 1rem;
padding: 0.5rem 0;
align-items: center;
opacity: 0;
transition: all 0.2s ease-in-out;
}

.link {
display: flex;
justify-items: center;
gap: 0.25rem;
color: var(--color-text);

&:hover {
color: var(--color-primary);

.arrow {
transform: translateX(0.25rem);
}
}
}

.arrow {
transition: transform 0.2s ease-in-out;
}

@keyframes wrapperSlideIn {
from {
transform: translateY(28px);
}
to {
transform: translateY(12px);
}
}

@keyframes wrapperSlideOut {
from {
transform: translateY(12px);
}
to {
transform: translateY(28px);
}
}
88 changes: 88 additions & 0 deletions apps/frontend/src/components/AppPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { ArrowRightOutlined } from '@ant-design/icons';
import { Avatar } from 'antd';
import _ from 'lodash';

import { ReactComponent as LabelLLM } from '@/assets/svg/labelllm.svg';
import { ReactComponent as MinerU } from '@/assets/svg/mineru.svg';
import { ReactComponent as OpenDataLab } from '@/assets/svg/opendatalab.svg';

import styles from './index.module.css';

interface AppLink {
name: string;
title: string;
links: {
name: string;
link: string;
}[];
icon: JSX.Element;
description: string;
}

const apps = [
{
name: 'OpenDataLab',
links: [{ name: '立即前往', link: 'https://opendatalab.com' }],
icon: <OpenDataLab />,
description: '一个引领 AI 大模型时代的开放数据平台,提供了海量的、多模态的优质数据集,助力 AI 开发落地',
},
{
name: 'LabelLLM',
links: [
{
name: 'Github',
link: 'https://github.com/opendatalab/LabelLLM?tab=readme-ov-file#labelllm-the-open-source-data-annotation-platform',
},
],
icon: <LabelLLM />,
description: '专业致力于 LLM 对话标注,通过灵活的工具配置与多种数据模态的广泛兼容,为大模型打造高质量数据',
},
{
name: 'MinerU',
links: [
{ name: 'Github', link: 'https://github.com/opendatalab/MinerU' },
{ name: '在线体验', link: 'https://opendatalab.com/OpenSourceTools/Extractor/PDF' },
],
icon: <MinerU />,
description: '一站式开源高质量数据提取工具,支持多格式(PDF/网页/电子书),智能萃取,生成高质量语料',
},
];

export default function AppPanel() {
const handleGoApp = (app: AppLink) => {
window.open(app.links[0].link, '_blank');
};

return (
<div>
<div className={styles.title}>欢迎使用 OpenDataLab 开源工具 🎉</div>
<div className={styles.panel}>
{_.map(apps, (app) => {
return (
<div key={app.name} className={styles.appWrapper}>
<div className={styles.appContainer}>
<div className={styles.header} onClick={() => handleGoApp(app)}>
<Avatar shape="square" className={styles.avatar} src={app.icon} />
<div className={styles.appInfo}>
{app.name}
<div className={styles.description}>{app.description}</div>
</div>
</div>
<div className={styles.links}>
{_.map(app.links, (link) => {
return (
<a href={link.link} key={link.name} target="_blank" rel="noreferrer" className={styles.link}>
{link.name}
<ArrowRightOutlined className={styles.arrow} />
</a>
);
})}
</div>
</div>
</div>
);
})}
</div>
</div>
);
}
19 changes: 15 additions & 4 deletions apps/frontend/src/components/Navigate/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { Button, Divider, Dropdown, Tag } from 'antd';
import { Link, useMatch, useNavigate } from 'react-router-dom';
import Icon, { BellOutlined, PoweroffOutlined } from '@ant-design/icons';
import { FlexLayout } from '@labelu/components-react';
import { Button, Divider, Dropdown, Popover, Tag } from 'antd';
import { Link, useMatch, useNavigate } from 'react-router-dom';

import { ReactComponent as ProfileIcon } from '@/assets/svg/personal.svg';
import { ReactComponent as LocalDeploy } from '@/assets/svg/local-deploy.svg';
import { ReactComponent as ProfileIcon } from '@/assets/svg/personal.svg';
import { ReactComponent as ToolboxSvg } from '@/assets/svg/toolbox.svg';
import { goLogin } from '@/utils/sso';

import TaskTip from './TaskTip';
import AppPanel from '../AppPanel';
import Breadcrumb from '../Breadcrumb';
import { LabeluLogo, NavigationWrapper } from './style';
import TaskTip from './TaskTip';

const Homepage = () => {
const username = localStorage.getItem('username');
Expand Down Expand Up @@ -50,6 +52,15 @@ const Homepage = () => {
</FlexLayout.Item>
<FlexLayout.Item flex gap="1rem">
<TaskTip visible={Boolean(isSampleDetail)} />
<Popover title={null} content={<AppPanel />}>
<Button
type="link"
icon={<ToolboxSvg />}
style={{ color: 'rgba(0, 0, 0, 0.85)', display: 'flex', alignItems: 'center' }}
>
开源工具箱
</Button>
</Popover>
{window.IS_ONLINE && (
<a data-wiz="local-deploy-top-right" href="https://opendatalab.github.io/labelU/#/guide/install">
<Button type="link" style={{ color: 'rgba(0, 0, 0, 0.85)' }} icon={<Icon component={LocalDeploy} />}>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineConfig({
host: '0.0.0.0',
proxy: {
'/api': {
target: isOnline ? 'https://labelu.shlab.tech' : 'http://127.0.0.1:8000',
target: 'https://labelu.shlab.tech',
changeOrigin: true,
},
},
Expand Down

0 comments on commit 1fe2604

Please sign in to comment.