chore: merged dev into show-connected-robots
ref: N25B-142
This commit is contained in:
17
.githooks/commit-msg
Executable file
17
.githooks/commit-msg
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
commit_msg_file=$1
|
||||
commit_msg=$(cat "$commit_msg_file")
|
||||
|
||||
if echo "$commit_msg" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert): .+"; then
|
||||
if echo "$commit_msg" | grep -Eq "^(ref|close):\sN25B-.+"; then
|
||||
echo "🎉 commit message is Valid"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ Commit message invalid! Must end with [ref/close]: N25B-000"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "❌ Commit message invalid! Must start with <type>: <description>"
|
||||
exit 1
|
||||
fi
|
||||
18
.githooks/pre-commit
Executable file
18
.githooks/pre-commit
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get current branch
|
||||
branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
if echo "$branch" | grep -Eq "(dev|main)"; then
|
||||
echo 0
|
||||
fi
|
||||
|
||||
# allowed pattern <type/>
|
||||
if echo "$branch" | grep -Eq "^(feat|fix|refactor|perf|style|test|docs|build|chore|revert)\/\w+(-\w+){0,5}$"; then
|
||||
echo "✅ Branch name valid: $branch"
|
||||
exit 0
|
||||
else
|
||||
echo "❌ Invalid branch name: $branch"
|
||||
echo "Branch must be named <type>/<description-of-branch> (must have one to six words separated by a dash)"
|
||||
exit 1
|
||||
fi
|
||||
9
.githooks/prepare-commit-msg
Executable file
9
.githooks/prepare-commit-msg
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "#<type>: <description>
|
||||
|
||||
#[optional body]
|
||||
|
||||
#[optional footer(s)]
|
||||
|
||||
#[ref/close]: <issue identifier>" > $1
|
||||
14
README.md
14
README.md
@@ -27,3 +27,17 @@ npm run dev
|
||||
```
|
||||
|
||||
It should automatically reload when you save changes.
|
||||
|
||||
## GitHooks
|
||||
|
||||
To activate automatic commits/branch name checks run:
|
||||
|
||||
```shell
|
||||
git config --local core.hooksPath .githooks
|
||||
```
|
||||
|
||||
If your commit fails its either:
|
||||
branch name != <type>/description-of-branch
|
||||
commit name != <type>: description of the commit.
|
||||
<ref>: N25B-Num's
|
||||
|
||||
|
||||
28
src/App.css
28
src/App.css
@@ -1,12 +1,3 @@
|
||||
#root {
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.logopepper {
|
||||
height: 8em;
|
||||
padding: 1.5em;
|
||||
@@ -92,7 +83,26 @@ button.movePage:hover{
|
||||
|
||||
|
||||
|
||||
header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
|
||||
padding: 1rem;
|
||||
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
backdrop-filter: blur(10px);
|
||||
z-index: 1; /* Otherwise any translated elements render above the blur?? */
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
display: flex;
|
||||
|
||||
28
src/App.tsx
28
src/App.tsx
@@ -3,10 +3,7 @@ import { useState } from 'react'
|
||||
import './App.css'
|
||||
import TemplatePage from './pages/TemplatePage/Template.tsx'
|
||||
import Home from './pages/Home/Home.tsx'
|
||||
import ServerComms from './pages/ServerComms/ServerComms.tsx'
|
||||
import ConnectedRobots from './pages/ConnectedRobots/ConnectedRobots.tsx'
|
||||
import Logging from './pages/Logging/Logging.tsx'
|
||||
import VisProg from "./pages/VisProgPage/VisProg.tsx";
|
||||
import Robot from './pages/Robot/Robot.tsx';
|
||||
|
||||
function App(){
|
||||
|
||||
@@ -22,25 +19,16 @@ function App(){
|
||||
|
||||
return (
|
||||
<div>
|
||||
{/* Should not use inline styles like this */}
|
||||
<Link style={{position: "fixed", top: "1rem", left: "50%", translate: "-50%"}} to={"/"}>Home</Link>
|
||||
<header>
|
||||
<Link to={"/"}>Home</Link>
|
||||
</header>
|
||||
<main className={"flex-col align-center"}>
|
||||
<Routes>
|
||||
<Route path="/" element={<Home />} />
|
||||
<Route path="/Template" element={<TemplatePage />} />
|
||||
<Route path="/ServerComms" element = {<ServerComms />} />
|
||||
<Route path="/visprog" element={<VisProg />} />
|
||||
<Route path="/logging" element = {<Logging />} />
|
||||
<Route
|
||||
path="/ConnectedRobots"
|
||||
// Pass the useState to the page to update from there
|
||||
element={
|
||||
<ConnectedRobots
|
||||
connectedRobots={connectedRobots}
|
||||
setConnectedRobots={setConnectedRobots}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<Route path="/template" element={<TemplatePage />} />
|
||||
<Route path="/robot" element={<Robot />} />
|
||||
</Routes>
|
||||
</main>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
// src/components/Counter.tsx
|
||||
import { useState } from 'react'
|
||||
//import style from './Counter.module.css' // optional, if you want a CSS module for reset button
|
||||
import '../App.css'
|
||||
|
||||
function Counter() {
|
||||
const [count, setCount] = useState(0)
|
||||
|
||||
return (
|
||||
<div className="card">
|
||||
<button onClick={() => setCount((count) => count + 3)}>
|
||||
<button onClick={() => setCount((count) => count + 1)}>
|
||||
count is {count}
|
||||
</button>
|
||||
<button className='reset' onClick={() => setCount(0)}>
|
||||
|
||||
@@ -13,6 +13,16 @@
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
height: 100dvh;
|
||||
width: 100dvw;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
@@ -22,14 +32,6 @@ a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
place-items: center;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3.2em;
|
||||
line-height: 1.1;
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
.read_the_docs {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.gap-xl {
|
||||
gap: 2rem;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -4,19 +4,17 @@ import styles from './Home.module.css'
|
||||
|
||||
function Home() {
|
||||
return (
|
||||
<>
|
||||
<div className={`flex-col ${styles.gapXl}`}>
|
||||
<div className="logoPepperScaling">
|
||||
<a href="https://git.science.uu.nl/ics/sp/2025/n25b" target="_blank">
|
||||
<img src={pepperLogo} className="logopepper" alt="Pepper logo" />
|
||||
</a>
|
||||
</div>
|
||||
<div className={styles.links}>
|
||||
<Link to={"/ServerComms"}>Robot interaction →</Link>
|
||||
<Link to={"/visprog"}>Node editor →</Link>
|
||||
<Link to={"/logging"}>Logs →</Link>
|
||||
<Link to={"/ConnectedRobots"}>Connected Robots →</Link>
|
||||
<Link to={"/robot"}>Robot Interaction →</Link>
|
||||
<Link to={"/template"}>Template →</Link>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState, useEffect, useRef } from 'react'
|
||||
|
||||
export default function ServerComms() {
|
||||
export default function Robot() {
|
||||
const [message, setMessage] = useState('');
|
||||
|
||||
const [listening, setListening] = useState(false);
|
||||
@@ -49,7 +49,7 @@ export default function ServerComms() {
|
||||
}, [conversation]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
<h1>Robot interaction</h1>
|
||||
<h2>Force robot speech</h2>
|
||||
<div className={"flex-row gap-md justify-center"}>
|
||||
@@ -62,12 +62,12 @@ export default function ServerComms() {
|
||||
/>
|
||||
<button onClick={sendMessage}>Speak</button>
|
||||
</div>
|
||||
<div className={"flex-col gap-lg"}>
|
||||
<div className={"flex-col gap-lg align-center"}>
|
||||
<h2>Conversation</h2>
|
||||
<p>Listening {listening ? "🟢" : "🔴"}</p>
|
||||
<div style={{ maxHeight: "200px", maxWidth: "600px", overflowY: "auto"}} ref={conversationRef}>
|
||||
{conversation.map((item) => (
|
||||
<p
|
||||
{conversation.map((item, i) => (
|
||||
<p key={i}
|
||||
style={{
|
||||
backgroundColor: item["role"] == "user"
|
||||
? "color-mix(in oklab, canvas, blue 20%)"
|
||||
@@ -89,6 +89,6 @@ export default function ServerComms() {
|
||||
}}>{conversationIndex == -1 ? "Start" : "Stop"}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
button.reset:hover {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
import { useState } from 'react'
|
||||
import { Link } from 'react-router'
|
||||
import Counter from '../../components/components.tsx'
|
||||
//import style from './Template.module.css'
|
||||
import '../../App.css'
|
||||
|
||||
//this is your css file where you can style your buttons and such
|
||||
//you can still use css parts from App.css, but also overwrite them
|
||||
|
||||
function TemplatePage() {
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Counter />
|
||||
<Link to = {"/"}> {/* here you link to the homepage, in App.tsx you can link new pages */}
|
||||
<button className= 'movePage left' onClick={() :void => {}}>
|
||||
Page {'<'}-- Go Home
|
||||
</button>
|
||||
</Link>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react'
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
css: {
|
||||
modules: {
|
||||
localsConvention: "camelCase",
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user