Skip to content

Commit

Permalink
Merge branch 'main' into fix-graphy-readme
Browse files Browse the repository at this point in the history
longbinlai committed Nov 13, 2024
2 parents 8b34387 + cfe0187 commit 2b0fe47
Showing 65 changed files with 1,128 additions and 405 deletions.
2 changes: 1 addition & 1 deletion docs/interactive/package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build:site": "next build",
"type-check": "tsc",
"deploy": "gh-pages -d out -t true"
},
3 changes: 3 additions & 0 deletions docs/portal/.gitignore
Original file line number Diff line number Diff line change
@@ -35,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts


/public/portal.html
34 changes: 34 additions & 0 deletions docs/portal/components/Tools/graphy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import dynamic from 'next/dynamic';
import { GlobalSpin } from '@graphscope/studio-components';

const Apps = dynamic(
() =>
import('@graphscope/graphy-website').then(module => {
return {
/** 这种写法和 react lazy 就统一了 */
default: () => {
return (
<div
style={{
position: 'absolute',
top: '0px',
left: '0px',
bottom: '0px',
right: '0px',
zIndex: 999,
background: '#fff',
}}
>
<module.default />
</div>
);
},
};
}),
{
loading: () => <GlobalSpin />,
ssr: false,
},
);

export default Apps;
6 changes: 3 additions & 3 deletions docs/portal/components/Tools/index.tsx
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const tools = [
features: ['Supports importing CSV/JSON data for instant graph visual analysis'],
module: '@graphscope/studio-graph',
link: '/tools/visualizer',
img: '/query/recommand.png',
img: '/tools/visualizer.png',
},
{
name: 'Graphy',
@@ -23,7 +23,7 @@ const tools = [
note: 'Follow the GitHub documentation to start the Graphy server',
module: '@graphscope/graphy',
link: '/tools/graphy',
img: '/query/recommand.png',
img: '/tools/graphy.png',
},
{
name: 'Draw-pattern',
@@ -77,7 +77,7 @@ const Tools: React.FunctionComponent<IToolsProps> = props => {
{tools.map((tool, index) => (
<Col span={8} key={index}>
{/** @ts-ignore */}
<Link href={tool.link}>
<Link href={tool.link} target="_blank">
<Card style={{ padding: '1px' }} hoverable cover={<img alt={tool.name} src={tool.img} />}>
<Meta title={tool.description} description={tool.features[0]} />
</Card>
52 changes: 52 additions & 0 deletions docs/portal/components/Tools/portal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// import dynamic from 'next/dynamic';
// import { GlobalSpin } from '@graphscope/studio-components';

// const Apps = dynamic(
// () =>
// import('@graphscope/studio-site').then(module => {
// return {
// /** 这种写法和 react lazy 就统一了 */
// default: () => {
// return (
// <div
// style={{
// position: 'absolute',
// top: '0px',
// left: '0px',
// bottom: '0px',
// right: '0px',
// zIndex: 999,
// background: '#fff',
// }}
// >
// <module.default />
// </div>
// );
// },
// };
// }),
// {
// loading: () => <GlobalSpin />,
// ssr: false,
// },
// );

// export default Apps;

export default () => {
return (
<iframe
style={{
position: 'absolute',
height: '100%',
width: '100%',
top: '0px',
left: '0px',
bottom: '0px',
right: '0px',
zIndex: 999,
}}
src="/portal.html"
></iframe>
);
};
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dynamic from 'next/dynamic';
import { GlobalSpin } from '@graphscope/studio-components';

const Apps = dynamic(
const Visualizer = dynamic(
() =>
import('@graphscope/graph-apps').then(module => {
return {
@@ -17,4 +17,4 @@ const Apps = dynamic(
},
);

export default Apps;
export default Visualizer;
23 changes: 23 additions & 0 deletions docs/portal/next.config.js
Original file line number Diff line number Diff line change
@@ -21,6 +21,27 @@ const nextConfig = {
esmExternals: 'loose',
optimizePackageImports: ['node:os'],
},
async headers() {
return [
{
source: '/(.*)', // 匹配所有路径
headers: [
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
{
key: 'Cross-Origin-Embedder-Policy',
value: 'require-corp',
},
{
key: 'Cross-Origin-Opener-Policy',
value: 'same-origin',
},
],
},
];
},
};

const { webpack: nextraWebpack, ...othersConfig } = withNextra();
@@ -32,7 +53,9 @@ const webpack = (config, options) => {
_config.externals.push({
'node:os': 'os',
fsevents: 'fsevents',
// 'monaco-editor': 'monaco',
});

return _config;
};

5 changes: 4 additions & 1 deletion docs/portal/package.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"build:site": "cd ../../packages/studio-website && npm run build:site:single && cd ../../docs/portal && next build",
"type-check": "tsc",
"deploy": "gh-pages -d out -t true"
},
@@ -13,6 +13,9 @@
"@graphscope/studio-components": "workspace:*",
"@graphscope/studio-graph": "workspace:*",
"@graphscope/graph-apps": "workspace:*",
"@graphscope/graphy-website": "workspace:*",
"@graphscope/studio-importor": "workspace:*",
"@graphscope/studio-site": "workspace:*",
"next": "15.0.2",
"next-seo": "^6.6.0",
"nextra": "^2.13.2",
18 changes: 18 additions & 0 deletions docs/portal/pages/tools/_meta.json
Original file line number Diff line number Diff line change
@@ -13,5 +13,23 @@
"footer": false,
"layout": "full"
}
},
"graphy": {
"type": "page",
"title": "Graphy",
"theme": {
"footer": false,
"layout": "full",
"header": false
}
},
"portal": {
"type": "page",
"title": "Portal",
"theme": {
"footer": false,
"layout": "full",
"header": false
}
}
}
5 changes: 5 additions & 0 deletions docs/portal/pages/tools/graphy.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import { Bleed } from 'nextra-theme-docs';
import Graphy from '../../components/Tools/graphy';

<Graphy />
5 changes: 5 additions & 0 deletions docs/portal/pages/tools/portal.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import React from 'react';
import { Bleed } from 'nextra-theme-docs';
import Portal from '../../components/Tools/portal';

<Portal />
4 changes: 2 additions & 2 deletions docs/portal/pages/tools/visualizer.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import VisualTools from '../../components/VisualTool';
import Visualizer from '../../components/Tools/visualizer';

<VisualTools></VisualTools>
<Visualizer />
Binary file added docs/portal/public/tools/graphy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/portal/public/tools/visualizer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/graphy/.fatherrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
esm: { output: 'es' },
cjs: { output: 'lib' },
};
2 changes: 1 addition & 1 deletion examples/graphy/index.html
Original file line number Diff line number Diff line change
@@ -13,6 +13,6 @@
</head>
<body>
<div id="root" style="height: 100vh"></div>
<script type="module" src="./src/index.tsx"></script>
<script type="module" src="./src/app.tsx"></script>
</body>
</html>
23 changes: 13 additions & 10 deletions examples/graphy/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "graphy-wesite",
"name": "@graphscope/graphy-website",
"version": "0.1.1",
"description": "",
"main": "lib/index.js",
@@ -15,8 +15,10 @@
"dist"
],
"scripts": {
"start": "vite dev",
"build": "vite build"
"start": "father dev",
"build": "father build",
"start:site": "vite dev",
"build:site": "vite build"
},
"pnpm": {
"overrides": {
@@ -28,13 +30,13 @@
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@antv/g2": "^5.2.7",
"@graphscope/graph-apps": "latest",
"@graphscope/studio-components": "latest",
"@graphscope/studio-driver": "latest",
"@graphscope/studio-graph": "latest",
"@graphscope/studio-importor": "latest",
"@graphscope/studio-query": "latest",
"@kuzu/kuzu-wasm": "^1.0.4",
"@graphscope/graph-apps": "workspace:*",
"@graphscope/studio-components": "workspace:*",
"@graphscope/studio-driver": "workspace:*",
"@graphscope/studio-graph": "workspace:*",
"@graphscope/studio-importor": "workspace:*",
"@graphscope/studio-query": "workspace:*",
"@kuzu/kuzu-wasm": "0.6.2-dev",
"antd": "^5.21.0",
"d3-force": "latest",
"html-to-image": "^1.11.11",
@@ -51,6 +53,7 @@
"devDependencies": {
"@vitejs/plugin-react": "^4.2.1",
"jszip": "^3.10.1",
"tslib": "^2.8.1",
"vite": "^5.4.9",
"vite-plugin-top-level-await": "^1.4.4",
"vite-plugin-wasm": "^3.3.0"
6 changes: 6 additions & 0 deletions examples/graphy/src/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './pages';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);
8 changes: 2 additions & 6 deletions examples/graphy/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './pages';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);
import GraphyApp from './pages';
export default GraphyApp;
Loading

0 comments on commit 2b0fe47

Please sign in to comment.