Skip to content

Commit

Permalink
feat: add doc page (vesoft-inc#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
hetao92 committed Mar 31, 2022
1 parent 60bca00 commit 297fd65
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 7 deletions.
18 changes: 16 additions & 2 deletions app/config/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@
"statistics": "Statistics",
"download": "Download"
},
"doc": {
"welcome": "Welcome to",
"functionIntro": "Functions introduction",
"schemaIntro": "You can use the Schema page to operate graph spaces in Nebula Graph",
"importIntro": "You can use the Import page to batch import vertex and edge data into Nebula Graph for graph exploration and data analysis.",
"consoleIntro": "When data is imported, you can use the Console page to query graph data.",
"learningDoc": "Learning Docs",
"getStarted": "Getting started with Nebula Studio",
"getStartedTip": "What's Nebula Studio",
"useGuide": "Documents of Nebula Studio",
"useGuideTip": "Learn how to use Nebula Studio",
"ngqlIntro": "Nebula Graph Query Language (nGQL)",
"ngqlIntroTip": "nGQL is a declarative graph query language for Nebula Graph. It allows expressive and efficient graph patterns. ",
"start": "Get Started"
},
"NGQLOutput": {
"success": "Execution successful!"
},
Expand Down Expand Up @@ -398,7 +413,6 @@
"link": {
"nGQLHref": "https://docs.nebula-graph.io/3.0.0/3.ngql-guide/1.nGQL-overview/1.overview/",
"mannualHref": "https://docs.nebula-graph.io/3.0.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/",
"versionLogHref": "https://docs.nebula-graph.io/3.0.0/nebula-studio/about-studio/st-ug-release-note/",
"forumLink": "https://discuss.nebula-graph.io/"
"startStudioHref": "https://docs.nebula-graph.io/3.0.0/nebula-studio/quick-start/st-ug-plan-schema/"
}
}
18 changes: 16 additions & 2 deletions app/config/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@
"statistics": "统计",
"download": "下载"
},
"doc": {
"welcome": "欢迎使用",
"functionIntro": "功能介绍",
"schemaIntro": "您可以在 schema 模块对 Nebula Graph 图空间进行管理。",
"importIntro": "您可以使用导入模块将数据批量导入 Nebula Graph。",
"consoleIntro": "您可以使用控制台模块对 Nebula Graph 内的数据进行查询操作。",
"learningDoc": "学习文档",
"getStarted": "认识 Nebula Studio",
"getStartedTip": "什么是 Nebula Studio。",
"useGuide": "Nebula Studio 使用手册",
"useGuideTip": "学习如何使用 Nebula Studio。",
"ngqlIntro": "Nebula Graph 查询语言 (nGQL)",
"ngqlIntroTip": "nGQL 是 Nebula Graph 使用的的声明式图查询语言,是为开发和运维人员设计的类 SQL 查询语言,易于学习。",
"start": "快速开始"
},
"warning": {
"configServer": "请先配置服务器",
"connectError": "数据库连接有误,请重新配置"
Expand Down Expand Up @@ -394,7 +409,6 @@
"link": {
"nGQLHref": "https://docs.nebula-graph.com.cn/3.0.0/3.ngql-guide/1.nGQL-overview/1.overview/",
"mannualHref": "https://docs.nebula-graph.com.cn/3.0.0/nebula-studio/about-studio/st-ug-what-is-graph-studio/",
"versionLogHref": "https://docs.nebula-graph.com.cn/3.0.0/nebula-studio/about-studio/st-ug-release-note/",
"forumLink": "https://discuss.nebula-graph.com.cn/"
"startStudioHref": "https://docs.nebula-graph.com.cn/3.0.0/nebula-studio/quick-start/st-ug-plan-schema/"
}
}
105 changes: 105 additions & 0 deletions app/pages/Doc/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
.studio-doc {
margin-top: 50px;
display: flex;
flex-direction: column;
align-items: center;
.welcome-label {
font-family: Roboto-Light, sans-serif;
font-weight: 300;
font-size: 64px;

color: #000000;
> span {
font-family: Roboto-Bold, sans-serif;
}
}
.doc-box {
width: 100%;
margin-bottom: 36px;
.header {
font-family: Roboto-Regular, sans-serif;
font-size: 18px;
padding-bottom: 12px;
border-bottom: 1px solid #D5DDEB;
}
.module-intro {
padding: 14px;
display: flex;
.module-item {
padding: 27px 30px;
display: inline-flex;
flex-direction: column;
align-items: flex-start;
font-family: Roboto-Regular, sans-serif;
.anticon > svg {
width: 50px;
height: 50px;
fill: #0091FF;
}
.title {
color: #0091FF;
font-weight: 500;
font-size: 24px;
margin: 20px 0 15px;
}
.tip {
font-weight: 300;
font-size: 14px;
color: #4F4F4F;
padding-right: 5px;
}
}
}
.doc-carousel {
width: 100%;
padding: 20px;
.doc-group {
display: flex !important;
}
.doc-item {
height: 295px;
background: #FFFFFF;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
padding: 30px 20px 15px 20px;
display: flex;
flex-direction: column;
justify-content: space-between;
font-family: Roboto-Regular, sans-serif;
.doc-title {
font-weight: 500;
font-size: 24px;
height: 72px;
}
.doc-tip {
font-weight: 300;
font-size: 14px;
color: #4F4F4F;
}
.ant-btn {
width: 100%;
}
}
}
}

.ant-carousel .slick-dots-bottom {
bottom: -30px;
margin: 0;

li {
width: 24px;
}

li button {
width: 10px;
height: 10px;
border-radius: 10px;
background-color: #E0E0E0;
}

li.slick-active button {
width: 10px;
background-color: #0091FF;
}
}
}
95 changes: 95 additions & 0 deletions app/pages/Doc/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { Button, Carousel, Col, Row } from 'antd';
import React, { useEffect } from 'react';
import intl from 'react-intl-universal';
import { observer } from 'mobx-react-lite';
import { trackPageView } from '@app/utils/stat';
import Icon from '@app/components/Icon';
import { chunk } from 'lodash';

import './index.less';

const MODULES = [
{
icon: 'icon-studio-nav-schema',
title: 'common.schema',
tip: 'doc.schemaIntro'
},
{
icon: 'icon-studio-nav-import',
title: 'import.importData',
tip: 'doc.importIntro'
},
{
icon: 'icon-studio-nav-console',
title: 'common.console',
tip: 'doc.consoleIntro'
},
];

const DOCS = [
{
title: 'doc.getStarted',
tip: 'doc.getStartedTip',
link: 'link.mannualHref'
},
{
title: 'doc.useGuide',
tip: 'doc.useGuideTip',
link: 'link.startStudioHref'
},
{
title: 'doc.ngqlIntro',
tip: 'doc.ngqlIntroTip',
link: 'link.nGQLHref'
},
];

const DocPage = () => {
const docGroup = chunk(DOCS, 3);
useEffect(() => {
trackPageView('/doc');
}, []);

return (
<div className="studio-doc center-layout">
<h1 className="welcome-label">{intl.get('doc.welcome')} <span>Nebula Studio</span></h1>
<div className="doc-box">
<div className="header">{intl.get('doc.functionIntro')}</div>
<div className="module-intro">
{MODULES.map(module => <Col span={8} key={module.title}>
<div className="module-item">
<Icon type={module.icon} />
<span className="title">{intl.get(module.title)}</span>
<span className="tip">{intl.get(module.tip)}</span>
</div>
</Col>)}
</div>
</div>
<div className="doc-box">
<div className="header">{intl.get('doc.learningDoc')}</div>
<div className="doc-carousel">
<Carousel dotPosition="bottom" lazyLoad="progressive" dots={{ className: 'btn-carousel' }}>
{docGroup.map((group, index) => (
<Row className="doc-group" gutter={26} key={index}>
{group.map(doc => <Col span={8} key={doc.title}>
<div className="doc-item">
<div className="doc-desc">
<p className="doc-title">{intl.get(doc.title)}</p>
<p className="doc-tip">{intl.get(doc.tip)}</p>
</div>
<Button type="primary">
<a href={intl.get(doc.link)} target="_blank" rel="noreferrer">
{intl.get('doc.start')}
</a>
</Button>
</div>
</Col>)}
</Row>
))}
</Carousel>
</div>
</div>
</div>
);
};
export default observer(DocPage);
1 change: 1 addition & 0 deletions app/pages/MainPage/Header/HelpMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const HelpMenu = () => {
className="help-menu"
mode="horizontal"
theme="dark"
selectedKeys={[]}
>
<Menu.Item key="star">
<a
Expand Down
5 changes: 2 additions & 3 deletions app/pages/MainPage/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@ const PageHeader = (props: IProps) => {
const { menus } = props;
const [activeKey, setActiveKey] = useState<string>('');
const { global: { username, host } } = useStore();
const location = useLocation();
const { pathname } = useLocation();
const handleMenuClick = async({ key }) => {
setActiveKey(key);
};


useEffect(() => {
const { pathname } = location;
const activeKey = pathname.split('/')[1];
setActiveKey(activeKey);
}, []);
}, [pathname]);

return <Header className="studio-header">
<div className="nebula-logo">
Expand Down
6 changes: 6 additions & 0 deletions app/pages/MainPage/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const SpaceCreate = lazy(() => import('@app/pages/Schema/SpaceCreate'));
const SchemaConfig = lazy(() => import('@app/pages/Schema/SchemaConfig'));
const Import = lazy(() => import('@app/pages/Import'));
const TaskCreate = lazy(() => import('@app/pages/Import/TaskCreate'));
const Doc = lazy(() => import('@app/pages/Doc'));


export const RoutesList = [
Expand Down Expand Up @@ -37,6 +38,11 @@ export const RoutesList = [
path: '/import/:type',
component: Import,
},
{
path: '/doc',
component: Doc,
exact: true,
},
];

export const MENU_LIST = [
Expand Down

0 comments on commit 297fd65

Please sign in to comment.