Skip to content

Commit

Permalink
fix: fix site error (#181)
Browse files Browse the repository at this point in the history
* fix: fix g6 links

* fix: fix SEO ref

* refactor: remove useless notification logic

* fix: remove PropTypes

* docs: update readme

* chore: add typing.d.ts, update tsconfig

* chore: remove mirror action

* chore: add ci action

* chore: fix package.json error
  • Loading branch information
Aarebecca authored Jan 8, 2025
1 parent 8c5c97a commit f7a143c
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 136 deletions.
21 changes: 12 additions & 9 deletions .dumi/pages/case/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import React from 'react';
import { SEO } from '@antv/dumi-theme-antv/dist/slots/SEO';
import SEO from '@antv/dumi-theme-antv/dist/common/SEO';
import ShowCase from 'site/components/ShowCase/ShowCase';
import { useIntl, useLocale } from 'dumi'
import { Header } from '@antv/dumi-theme-antv/dist/slots/Header'
import { Footer } from '@antv/dumi-theme-antv/dist/slots/Footer'
import { useIntl, useLocale } from 'dumi';
import { Header } from '@antv/dumi-theme-antv/dist/slots/Header';
import { Footer } from '@antv/dumi-theme-antv/dist/slots/Footer';

const CaseIndex: React.FC = () => {
const locale = useLocale()
const intl = useIntl()
const locale = useLocale();
const intl = useIntl();
return (
<>
<Header />
<SEO title={intl.formatMessage({
id: '场景案例'
}) } lang={locale.id} />
<SEO
title={intl.formatMessage({
id: '场景案例',
})}
lang={locale.id}
/>
<div className="home-container" style={{ marginTop: '-24px' }}>
<ShowCase />
</div>
Expand Down
24 changes: 13 additions & 11 deletions .dumi/pages/quick/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React from 'react';
import { SEO } from '@antv/dumi-theme-antv/dist/slots/SEO';
import { useIntl, useLocale } from 'dumi'
import { Header } from '@antv/dumi-theme-antv/dist/slots/Header'
import { Footer } from '@antv/dumi-theme-antv/dist/slots/Footer'
import SEO from '@antv/dumi-theme-antv/dist/common/SEO';
import { useIntl, useLocale } from 'dumi';
import { Header } from '@antv/dumi-theme-antv/dist/slots/Header';
import { Footer } from '@antv/dumi-theme-antv/dist/slots/Footer';
import QuickIssue from 'site/components/quickIssue/QuickIssue';


const QuickIssueIndex: React.FC = () => {
const locale = useLocale()
const intl = useIntl()
const locale = useLocale();
const intl = useIntl();
return (
<>
<Header />
<SEO title={intl.formatMessage({
id: 'quickIssue'
}) } lang={locale.id} />
<SEO
title={intl.formatMessage({
id: 'quickIssue',
})}
lang={locale.id}
/>
<div className="home-container">
<QuickIssue/>
<QuickIssue />
</div>
<Footer />
</>
Expand Down
57 changes: 21 additions & 36 deletions .dumi/theme/slots/Detail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { debounce } from 'lodash';
import SEO from '@antv/dumi-theme-antv/dist/common/SEO';
import { useIntl, useLocale } from 'dumi';
import { debounce } from 'lodash';
import React, { useEffect, useRef } from 'react';
import Banner from 'site/components/Banner/Banner';
import { ComplexCharts } from 'site/components/ComplexCharts';
import { FamousPersons } from 'site/components/FamousPersons';
import { LinkCharts } from 'site/components/LinkCharts';
import { ThemeCharts } from 'site/components/ThemeCharts';
import { ProjectCard } from 'site/components/ProjectCard';
import { SEO } from '@antv/dumi-theme-antv/dist/slots/SEO';
import React, { useEffect, useState, useRef } from 'react';
import { FamousPersons } from 'site/components/FamousPersons';
import { ComplexCharts } from 'site/components/ComplexCharts';
interface NotificationProps {
index?: number;
type: string;
title: string;
date: string;
link: string;
}
import { ThemeCharts } from 'site/components/ThemeCharts';

export const Detail: React.FC = () => {
const locale = useLocale();
Expand All @@ -23,19 +16,9 @@ export const Detail: React.FC = () => {

const useT = (transformedMessage: string) => {
return intl.formatMessage({
id: transformedMessage
})
}
const notificationsUrl = `https://my-json-server.typicode.com/antvis/antvis-sites-data/notifications?lang=${locale.id}`;
const [remoteNews, setRemoteNews] = useState<NotificationProps[]>([]);
useEffect(() => {
fetch(notificationsUrl)
.then((res) => res.json())
.then((data) => {
// 根据设计,目前只取最新的两条
setRemoteNews(data.slice(0, 2));
});
}, [notificationsUrl]);
id: transformedMessage,
});
};

useEffect(() => {
const onResize = debounce(() => {
Expand All @@ -49,11 +32,17 @@ export const Detail: React.FC = () => {

return () => {
window.removeEventListener('resize', onResize);
}
};
}, []);

return (
<div className="home-container" style={{ backgroundImage: 'linear-gradient(180deg, #F0E5FF 0%, #FFFFFF 13%, #FFFFFF 92%, #F7F8FD 100%)' }} >
<div
className="home-container"
style={{
backgroundImage:
'linear-gradient(180deg, #F0E5FF 0%, #FFFFFF 13%, #FFFFFF 92%, #F7F8FD 100%)',
}}
>
<SEO
title={useT('AntV')}
titleSuffix={useT('蚂蚁数据可视化')}
Expand All @@ -62,12 +51,9 @@ export const Detail: React.FC = () => {
)}
lang={locale.id}
/>
<div
style={{ overflowX: 'auto' }}
ref={ref}
>
<div style={{ overflowX: 'auto' }} ref={ref}>
<div style={{ minWidth: '1280px', scrollSnapAlign: 'center' }}>
<Banner remoteNews={remoteNews} />
<Banner />
<ThemeCharts />
<ComplexCharts />
<LinkCharts />
Expand All @@ -76,6 +62,5 @@ export const Detail: React.FC = () => {
</div>
</div>
</div>
)
}

);
};
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: build

on:
push:

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Type Check
run: npm run type-check

- name: Build
run: npm run build
30 changes: 0 additions & 30 deletions .github/workflows/mirror.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AntV New Site 📈

New AntV site built on [@antv/gatsby-theme-antv](https://github.com/antvis/gatsby-theme-antv).
New AntV site built on [@antv/dumi-theme-antv](https://github.com/antvis/dumi-theme-antv).

![CI status](https://github.com/antvis/antvis.github.io/workflows/Node%20CI/badge.svg) [![Dependency Status](https://david-dm.org/antvis/antvis.github.io.svg?style=flat-square)](https://david-dm.org/antvis/antvis.github.io) [![devDependencies Status](https://david-dm.org/antvis/antvis.github.io/dev-status.svg)](https://david-dm.org/antvis/antvis.github.io?type=dev) ![prettier code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)
![prettier code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)

## Install & Preview

Expand Down
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
"url": "https://github.com/antvis/antvis.github.io/issues"
},
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@ant-design/icons": "^4.8.3",
"@antv/dumi-theme-antv": "^0.5.2",
"@antv/g2plot": "^2.3.1",
"@antv/g6": "3.3.7",
"@antv/knowledge": "^0.1.3-alpha.17",
"@antv/matrix-util": "2.0.7",
"@antv/util": "^3.3.1",
"antd": "5.10.2",
"chroma-js": "^2.1.0",
Expand All @@ -36,21 +34,18 @@
"new-github-issue-url": "^1.0.0",
"prettier": "^2.0.0",
"pretty-quick": "^3.1.3",
"react": "^18.2.0",
"react-github-btn": "^1.4.0",
"react-use": "^17.4.0"
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-github-btn": "^1.4.0"
},
"devDependencies": {
"@types/classnames": "^2.2.9",
"@types/d3": "^7.4.2",
"@types/lodash": "^4.14.189",
"@types/parse-github-url": "^1.0.0",
"@types/react": "^16.9.5",
"@types/react-dom": "^16.9.1",
"@types/react-github-button": "^0.1.0",
"@types/react-helmet": "^6.0.0",
"i": "^0.3.7",
"npm": "^9.1.2"
"@types/react-helmet": "^6.0.0"
},
"license": "MIT",
"scripts": {
Expand All @@ -63,7 +58,8 @@
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md,less}\"",
"pretty-quick": "pretty-quick",
"tsc": "tsc",
"serve": "dumi preview"
"serve": "dumi preview",
"type-check": "tsc --noEmit"
},
"husky": {
"hooks": {
Expand Down
Loading

0 comments on commit f7a143c

Please sign in to comment.