Skip to content

Commit 3d318db

Browse files
committed
Add Fork on GitHub button and related dependencies
1 parent 8ac4b9e commit 3d318db

7 files changed

Lines changed: 96 additions & 0 deletions

File tree

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@fontsource-variable/geist": "^5.2.6",
1616
"@fontsource/geist": "^5.2.6",
1717
"@geist-ui/core": "^2.3.8",
18+
"@geist-ui/icons": "^1.0.2",
1819
"@react-three/drei": "^9.81.2",
1920
"@react-three/fiber": "^8.15.20",
2021
"chart.js": "^4.5.0",

client/pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import React from 'react';
2+
import { Github } from '@geist-ui/icons';
3+
4+
/**
5+
* A reusable "Fork on GitHub" button rendered as a fixed-position anchor.
6+
*
7+
* Props:
8+
* position: object — CSS position properties (e.g., { top: '20px', right: '20px' }).
9+
* style: object — Additional style overrides.
10+
*/
11+
export default function ButtonForkOnGithub({ position = { bottom: '20px', right: '20px' }, style = {} }) {
12+
const baseStyle = {
13+
position: 'fixed',
14+
backgroundColor: 'rgba(17, 17, 17, 0.8)',
15+
color: '#fff',
16+
padding: '10px 16px',
17+
borderRadius: '6px',
18+
fontWeight: 500,
19+
textDecoration: 'none',
20+
backdropFilter: 'blur(8px)',
21+
zIndex: 1000,
22+
display: 'flex',
23+
alignItems: 'center',
24+
gap: '6px',
25+
border: '1px solid #fff',
26+
...position,
27+
...style,
28+
};
29+
30+
return (
31+
<a
32+
href="https://github.com/lukehollis/three-mlagents"
33+
target="_blank"
34+
rel="noopener noreferrer"
35+
style={baseStyle}
36+
>
37+
<Github size={12} style={{ border: '1px solid #fff' }} />
38+
Fork on GitHub
39+
</a>
40+
);
41+
}

client/src/examples/Ball3D.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import config from '../config.js';
77
import 'katex/dist/katex.min.css';
88
import { BlockMath } from 'react-katex';
99
import { Text, Button } from '@geist-ui/core';
10+
import ButtonForkOnGithub from '../components/ButtonForkOnGithub.jsx';
1011

1112
const ROWS = 3;
1213
const COLS = 4;
@@ -241,6 +242,9 @@ export default function Ball3DExample() {
241242
</div>
242243

243244
<DebugConsole logs={logs} />
245+
246+
{/* Fork link (top-right) */}
247+
<ButtonForkOnGithub position={{ top: '20px', right: '20px' }} />
244248
</div>
245249
);
246250
}

client/src/examples/Basic.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import config from '../config.js';
1414
import 'katex/dist/katex.min.css';
1515
import { BlockMath } from 'react-katex';
1616
import { Text, Button } from '@geist-ui/core';
17+
import ButtonForkOnGithub from '../components/ButtonForkOnGithub.jsx';
1718

1819
ChartJS.register(LineElement, PointElement, LinearScale, CategoryScale);
1920

@@ -419,6 +420,9 @@ export default function BasicExample() {
419420
</div>
420421
</div>
421422

423+
{/* Fork link (top-right) */}
424+
<ButtonForkOnGithub position={{ top: '20px', right: '20px' }} />
425+
422426
</div>
423427
);
424428
}

client/src/examples/GridWorld.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'katex/dist/katex.min.css';
77
import { BlockMath } from 'react-katex';
88
import DebugConsole from '../components/DebugConsole.jsx';
99
import ChartPanel from '../components/ChartPanel.jsx';
10+
import ButtonForkOnGithub from '../components/ButtonForkOnGithub.jsx';
1011

1112
const WS_URL = `${config.WS_BASE_URL}/ws/gridworld`;
1213
const CELL_SIZE = 1;
@@ -202,6 +203,9 @@ export default function GridWorldExample() {
202203
</div>
203204

204205
<DebugConsole logs={logs} />
206+
207+
{/* Fork link (top-right) */}
208+
<ButtonForkOnGithub position={{ top: '20px', right: '20px' }} />
205209
</div>
206210
);
207211
}

client/src/examples/Index.jsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { Link } from 'react-router-dom';
33
import { Page, Grid, Card, Text, Spacer, Button } from '@geist-ui/core';
44
import { Play } from 'geist-icons';
5+
import { Github } from '@geist-ui/icons';
56
import TronBackground from '../components/TronBackground.jsx';
67

78
export default function ExamplesIndex() {
@@ -165,6 +166,33 @@ export default function ExamplesIndex() {
165166

166167
</Page.Content>
167168
</Page>
169+
170+
{/* Fixed "Fork on GitHub" link */}
171+
<a
172+
href="https://github.com/lukehollis/three-mlagents"
173+
target="_blank"
174+
rel="noopener noreferrer"
175+
style={{
176+
position: 'fixed',
177+
right: '20px',
178+
bottom: '20px',
179+
backgroundColor: 'rgba(17, 17, 17, 0.8)',
180+
color: '#fff',
181+
padding: '10px 16px',
182+
borderRadius: '6px',
183+
fontWeight: 500,
184+
textDecoration: 'none',
185+
backdropFilter: 'blur(8px)',
186+
zIndex: 1000,
187+
display: 'flex',
188+
alignItems: 'center',
189+
gap: '6px',
190+
border: '1px solid #fff',
191+
}}
192+
>
193+
<Github size={12} style={{ border: '1px solid #fff' }} />
194+
Fork on GitHub
195+
</a>
168196
</>
169197
);
170198
}

0 commit comments

Comments
 (0)