imwithye commited on
Commit
6fd9719
·
1 Parent(s): 5d86ca1

add controls ui

Browse files
src/app/page.tsx CHANGED
@@ -1,18 +1,10 @@
1
  import { Canvas } from '@/components/canvas';
 
2
 
3
  export default function Home() {
4
  return (
5
  <div className="w-full h-full">
6
- <div className="absolute inset-0 z-10 pointer-events-none">
7
- <div className="w-full h-full p-6">
8
- <div className="text-6xl font-bold">Rubik&apos;s Cube Solver</div>
9
- <div className="text-2xl text-gray-800">with Reinforcement Learning</div>
10
- <div className="text-gray-700">
11
- <a href="https://cross-entropy.ai">https://cross-entropy.ai</a>
12
- </div>
13
- </div>
14
- </div>
15
-
16
  <Canvas />
17
  </div>
18
  );
 
1
  import { Canvas } from '@/components/canvas';
2
+ import { UI } from '@/components/ui';
3
 
4
  export default function Home() {
5
  return (
6
  <div className="w-full h-full">
7
+ <UI />
 
 
 
 
 
 
 
 
 
8
  <Canvas />
9
  </div>
10
  );
src/app/providers.tsx CHANGED
@@ -3,5 +3,5 @@
3
  import { HeroUIProvider } from '@heroui/react';
4
 
5
  export const Providers = ({ children }: { children: React.ReactNode }) => {
6
- return <HeroUIProvider className='h-full w-full'>{children}</HeroUIProvider>;
7
  };
 
3
  import { HeroUIProvider } from '@heroui/react';
4
 
5
  export const Providers = ({ children }: { children: React.ReactNode }) => {
6
+ return <HeroUIProvider className="h-full w-full">{children}</HeroUIProvider>;
7
  };
src/components/ui-controls.tsx ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use client';
2
+
3
+ import { Button, ButtonGroup, Card, CardBody, Slider } from '@heroui/react';
4
+
5
+ export const UIControls = () => {
6
+ return (
7
+ <div className="z-10 pointer-events-none">
8
+ <Card className="max-w-sm bg-white/30 border border-white/80 backdrop-blur-xl pointer-events-auto">
9
+ <CardBody className="flex flex-col gap-6">
10
+ <div className="text-2xl font-bold">Controls</div>
11
+ <div className="flex flex-col gap-2">
12
+ <div className="flex items-center justify-between">
13
+ <div className="text-sm">Background</div>
14
+ <ButtonGroup size="sm">
15
+ <Button>Sunset</Button>
16
+ <Button>Dawn</Button>
17
+ <Button>Forest</Button>
18
+ </ButtonGroup>
19
+ </div>
20
+ <Slider size="sm" label="Cube Roughness" defaultValue={0.5} minValue={0} maxValue={1} step={0.1} />
21
+ <Slider size="sm" label="Cube Speed" defaultValue={2} minValue={1} maxValue={10} step={1} />
22
+ </div>
23
+ <div className="flex flex-col gap-2">
24
+ <div className="flex gap-2">
25
+ <Button>Scramble</Button>
26
+ <Button>Reset</Button>
27
+ <Button className="ms-auto" color="success">
28
+ Solve
29
+ </Button>
30
+ </div>
31
+ <div className="text-sm italic font-bold underline text-primary cursor-pointer">Train my own model!</div>
32
+ </div>
33
+ </CardBody>
34
+ </Card>
35
+ </div>
36
+ );
37
+ };
src/components/ui-title.tsx ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export const UITitle = () => {
2
+ return (
3
+ <div className="z-10 pointer-events-none">
4
+ <div className="text-6xl font-bold">Rubik&apos;s Cube Solver</div>
5
+ <div className="text-2xl text-gray-800">with Reinforcement Learning</div>
6
+ <div className="text-gray-700">
7
+ <a href="https://cross-entropy.ai">https://cross-entropy.ai</a>
8
+ </div>
9
+ </div>
10
+ );
11
+ };
src/components/ui.tsx ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { UIControls } from './ui-controls';
2
+ import { UITitle } from './ui-title';
3
+
4
+ export const UI = () => {
5
+ return (
6
+ <div className="absolute inset-0">
7
+ <div className="w-full h-full p-6 flex flex-col justify-between">
8
+ <UITitle />
9
+ <UIControls />
10
+ </div>
11
+ </div>
12
+ );
13
+ };