Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 新增空间分析 #36

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
42 changes: 42 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime'
],
overrides: [
{
env: {
node: true
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script'
}
},
{
files: ['**/*.tsx'],
rules: {
'react/prop-types': 'off'
}
}
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['@typescript-eslint', 'react'],
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'never']
}
}
11 changes: 5 additions & 6 deletions .github/ISSUE_TEMPLATE/oscp.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'AntV OSCP 计划'
description: AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP)
description: AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP)
body:
- type: checkboxes
id: AntV_OSCP_program
Expand All @@ -8,7 +8,7 @@ body:
description: |
AntV 开源共建计划(AntV Open Source Contribution Plan,简称 AntV OSCP) 期望可以基于 AntV 的开源 Roadmap 开放具体开发任务到社区,以社区共建任务的形式推动“AntV” 的开源发展,也期望有更多社区伙伴各各种形式参与到 AntV 的开源共建中,共同参与数据可视化开源生态的持续建设。
若有感兴趣想要认领的任务,可直接回复认领,如果你是首次认领可先完成[新手任务](https://www.yuque.com/antv/cyggvg/cwc9kacfvd9aivsp)

options:
- label: 我同意将这个 Issue 参与 OSCP 计划
validations:
Expand All @@ -28,16 +28,15 @@ body:
id: oscp_task_description
attributes:
label: 任务介绍
description: |
description: |
简单描述任务背景信息,为了解决哪些问题
validations:
required: false
- type: textarea
id: oscp_task_info_description_2
attributes:
label: 参考说明
description: |
提供一些可参考的demo,相关教程辅助用户解决问题
description: |
提供一些可参考的demo,相关教程辅助用户解决问题
validations:
required: false

6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/site_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
description: |
输入站点名称
placeholder: |
https://l7editor.antv.antgroup.com/
https://l7editor.antv.antgroup.com/
validations:
required: true
- type: input
Expand All @@ -18,7 +18,7 @@ body:
description: |
输入站点 URL
placeholder: |
https://l7editor.antv.antgroup.com/
https://l7editor.antv.antgroup.com/
validations:
required: true
- type: textarea
Expand Down Expand Up @@ -52,7 +52,7 @@ body:
- type: textarea
id: logo
attributes:
label: 图标
label: 图标
description: 站点 logo 或 icon 图标, URL 地址或者复制图片
placeholder: |
可以将你的图片拖拽到此处↓
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
node_modules
public
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false
}
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@ Inspired by [larkmap](https://larkmap.com/)

[点击提交站点信息](https://github.com/DipperMap/dippermap/issues/new?assignees=&labels=&projects=&template=site_report.yml)

#### 方式二 提交 PR
#### 方式二 提交 PR

直接修改站点配置文件,通过 PR 的方式,合并代码,代码合并后站点生效

[点击修改配置文件](https://github.com/DipperMap/dippermap/edit/main/src/data/config.ts)

## 本地开发

### clone 代码

```bash
git clone https://github.com/DipperMap/dippermap.git
````
```

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

### `npm commit`

Submit your code this way.

## 👬 Contributors

![https://github.com/DipperMap/dippermap/graphs/contributors](https://contrib.rocks/image?repo=DipperMap/dippermap)
3 changes: 3 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
}
31 changes: 29 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"prettier": "prettier --write .",
"lint": "lint-staged",
"commit": "cz"
},
"lint-staged": {
"src/*.{js,ts,jsx,tsx,vue}": [
"node_modules/.bin/prettier --write .",
"node_modules/.bin/eslint --fix .",
"git add ."
],
"src/*.{css,scss,less,json,html,md}": [
"node_modules/.bin/prettier --write .",
"git add ."
]
},
"eslintConfig": {
"extends": [
Expand All @@ -43,6 +57,19 @@
]
},
"devDependencies": {
"antd": "^5.11.5"
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"antd": "^5.11.5",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.54.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"prettier": "^3.1.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
14 changes: 7 additions & 7 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';
import React from 'react'
import { render, screen } from '@testing-library/react'
import App from './App'

test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
render(<App />)
const linkElement = screen.getByText(/learn react/i)
expect(linkElement).toBeInTheDocument()
})
50 changes: 25 additions & 25 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import { Layout } from "antd";
import "./App.css";
import { AppCard } from "./components/app-content";
import { AppSider } from "./components/app-sider";
import { useState, useEffect } from "react";
import classNames from "classnames";
import { AppHeader } from "./components/app-header";
import { AppSearch } from "./components/app-search";
import { Layout } from 'antd'
import './App.css'
import { AppCard } from './components/app-content'
import { AppSider } from './components/app-sider'
import { useState, useEffect } from 'react'
import classNames from 'classnames'
import { AppHeader } from './components/app-header'
import { AppSearch } from './components/app-search'

const { Header, Footer, Sider, Content } = Layout;
const { Header, Footer, Sider, Content } = Layout
function App() {
const [collapsed, setCollapsed] = useState(false);
const [screenWidth, setScreenWidth] = useState(window.innerWidth);
const [collapsed, setCollapsed] = useState(false)
const [screenWidth, setScreenWidth] = useState(window.innerWidth)
useEffect(() => {
if (window.innerWidth <= 767) {
setCollapsed(true);
setCollapsed(true)
}
const handleResize = () => {
setScreenWidth(window.innerWidth);
};
setScreenWidth(window.innerWidth)
}

window.addEventListener("resize", handleResize);
window.addEventListener('resize', handleResize)

return () => {
window.removeEventListener("resize", handleResize);
};
}, []);
window.removeEventListener('resize', handleResize)
}
}, [])
return (
<Layout className="App">
<Sider
className={classNames([
"App-sider",
'App-sider',
collapsed
? window.innerWidth <= 767
? "retractSiderHeight"
: "retractSiderWidth"
: "siderWidth",
? 'retractSiderHeight'
: 'retractSiderWidth'
: 'siderWidth'
])}
>
<AppSider
Expand All @@ -46,7 +46,7 @@ function App() {
<Layout
style={{
marginLeft: collapsed ? 0 : screenWidth <= 767 ? 0 : 270,
marginTop: screenWidth <= 767 ? 64 : 0,
marginTop: screenWidth <= 767 ? 64 : 0
}}
>
<Header className="App-header">
Expand All @@ -63,7 +63,7 @@ function App() {
<Footer className="App-footer">DipperMap</Footer>
</Layout>
</Layout>
);
)
}

export default App;
export default App
36 changes: 18 additions & 18 deletions src/components/app-content/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { SitesConfig } from "../../data/sites";
import { Avatar, Row, Card, Col, Tooltip, FloatButton } from "antd";
import { FileTextOutlined } from "@ant-design/icons";
import "./index.css";
import { IGroup } from "../../data/types";
import { IconFont } from "../../constants";
import { SitesConfig } from '../../data/sites'
import { Avatar, Row, Card, Col, Tooltip, FloatButton } from 'antd'
import { FileTextOutlined } from '@ant-design/icons'
import './index.css'
import { IGroup } from '../../data/types'
import { IconFont } from '../../constants'

export const AppCard = () => {
const siteConfig = SitesConfig["main"];
const siteConfig = SitesConfig['main']
return (
<div
style={{ display: "flex", alignItems: "center", flexDirection: "column" }}
style={{ display: 'flex', alignItems: 'center', flexDirection: 'column' }}
>
{siteConfig.groups.map((group: IGroup) => {
const { name, children, icon } = group;
const { name, children, icon } = group
return (
<Card
title={
<div style={{ display: "flex", alignItems: "center" }}>
<div style={{ display: 'flex', alignItems: 'center' }}>
{icon && (
<div className="titleIcon">
<IconFont type={icon} />
Expand All @@ -39,7 +39,7 @@ export const AppCard = () => {
xxl={4}
className="card-col"
onClick={() => {
window.open(val.site_url);
window.open(val.site_url)
}}
key={val.site_url}
>
Expand All @@ -62,21 +62,21 @@ export const AppCard = () => {
</div>
</div>
</Col>
);
)
})}
</Row>
</Card>
);
)
})}
<FloatButton
tooltip={<div>新站点提报</div>}
icon={<FileTextOutlined style={{ color: "#1677ff" }} />}
icon={<FileTextOutlined style={{ color: '#1677ff' }} />}
onClick={() => {
window.open(
"https://www.yuque.com/forms/share/0df1d286-b6c9-4412-9605-504af8cfb21f"
);
'https://www.yuque.com/forms/share/0df1d286-b6c9-4412-9605-504af8cfb21f'
)
}}
/>
</div>
);
};
)
}
Loading