Skip to content

Commit

Permalink
Merge branch 'main' into bot
Browse files Browse the repository at this point in the history
  • Loading branch information
giladAlboher committed Feb 14, 2024
2 parents 5183c4b + 1839f0e commit 50a569a
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 42 deletions.
2 changes: 1 addition & 1 deletion configs/intergratorportal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: integratorportal
image: giladalboher/integratorportal:v1.0.7784977091
image: giladalboher/integratorportal:v1.0.7886455464
ports:
- containerPort: 3000
resources:
Expand Down
7 changes: 4 additions & 3 deletions my-app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Login } from './Components/Login/Login';
import { SignUp } from './Components/SignUp/SignUp';
import { ProjectSelect } from './Views/ProjectSelect/ProjectSelect';
import { TasksPage } from './Views/TasksPage/TasksPage';
import { XrWs } from './Views/Workstations/XrWs/XrWs';

import { XrMain } from './Views/ProjectViews/XR/XrMain';
import { XrLabs } from './Views/ProjectViews/XR/XrLabs';
const App = () => {

const [showModal, setShowModal] = useState(false);
Expand Down Expand Up @@ -69,7 +69,8 @@ const App = () => {
<Route path="/tasks" element={<TasksPage />} />
<Route path="*" element={<NotFound />} />
{ /* Workstations Links */ }
<Route path="/xr-workstations" element={<XrWs />} />
<Route path="/xr-main" element={<XrMain/>} />
<Route path="/xr-labs" element={<XrLabs/>} />
</Routes>
{showModal && (
<Modal showModal={showModal} setShowModal={setShowModal} >
Expand Down
Binary file added my-app/src/Assets/labs-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
131 changes: 131 additions & 0 deletions my-app/src/Components/LabSelect/LabSelect.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
// Styles for the LabSelect component are in the StationSelect.css file
import React, { useState } from "react";
import { v4 as uuidv4 } from 'uuid';
import LabLogo from "../../Assets/labs-icon.png";
import { Msg } from "../Msg/Msg";
import { BackIconSmall } from "../../Assets/BackIconSmall";


export const LabSelect = (props) => {
const { items, setItems, setName } = props; // Make the items and setItems props available
const [editMode, setEditMode] = useState(null);
const [stationName, setStationName] = useState("Your Station Name");
const [newItem, setNewItem] = useState({
name: "New Lab",
});
const [msg, setMsg] = useState("");
const [isError, setIsError] = useState(false);

const handleNameClick = (id) => {
setEditMode(id);
// Find the item with the clicked ID and set its name as the current stationName
const selectedItem = items.find((item) => item.id === id);
if (selectedItem) {
setStationName(selectedItem.name);
}
};

const handleNameChange = (event) => {
if (event.target.value.length > 15) {
setIsError(true);
setMsg("Name is too long");
setTimeout(() => {
setMsg("");
}, 3000);
return;
}
if (event.target.value.length < 1) {
setIsError(true);
setMsg("Name is too short");
setTimeout(() => {
setMsg("");
}, 3000);
}
setStationName(event.target.value);
};

const handleNameBlur = () => {
setEditMode(null);
console.log("Save the new name: ", stationName);
// Update the item's name in the state
setItems((prevItems) =>
prevItems.map((item) =>
item.id === editMode ? { ...item, name: stationName } : item
)
);
};

const handleSaveNewItem = () => {
setItems((prevItems) => [
...prevItems,
{
id: uuidv4(),
name: newItem.name,
}
]);
console.log(items);
setNewItem({ name: "New Lab" }); // Clear the newItem after saving
};

const handleDeleteItem = (id) => {
const isConfirmed = window.confirm("Are you sure you want to delete?");
if (!isConfirmed) return;
setItems((prevItems) => prevItems.filter((item) => item.id !== id));
};

const handleSelectedItem = (item) => {
setName(item);
};
return (
<>
<div className="station-select-container">
<div className="popup-msg-labs">
{msg&&<Msg msg={msg} isError={isError}/>}
</div>
<button className="add-new-button" onClick={handleSaveNewItem}>
Add New
</button>
<div className="station-box">
{items.map((item) => (
<li key={item.id} className="">
<span
className="delete-icon"
onClick={() => handleDeleteItem(item.id)}
>
&#x2716; {/* "X" character */}
</span>
{/* <Link to={{ pathname: `${item.name}` }}> */}
<img
className="ws-logo"
src={LabLogo}
alt="StationLogo"
onClick={() => handleSelectedItem(item.name)}
title=""
onContextMenu={(e) => e.preventDefault()}
/>
{/* </Link> */}

{editMode === item.id ? (
<input
className="station-name-input"
type="text"
value={stationName}
onChange={handleNameChange}
onBlur={handleNameBlur}
/>
) : (
<div
className="station-name"
onClick={() => handleNameClick(item.id)}
>
{item.name}
</div>
)}
</li>
))}
</div>

</div>
</>
);
};
20 changes: 10 additions & 10 deletions my-app/src/Components/StationInfo/StationInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "./StationInfo.css";
import StationInfoLogo from "../../Assets/StationInfoLogo.png";

export const StationInfo = (props) => {
const { items2, setItems2, setWsName } = props; // Make the items and setItems2 props available
const { items, setItems, setName } = props;
const [editMode, setEditMode] = useState(null);
const [stationName, setStationName] = useState("Your Station Name");
const [newItem, setNewItem] = useState({
Expand All @@ -30,7 +30,7 @@ export const StationInfo = (props) => {
const handleNameClick = (id) => {
setEditMode(id);
// Find the item with the clicked ID and set its name as the current stationName
const selectedItem = items2.find((item) => item.id === id);
const selectedItem = items.find((item) => item.id === id);
if (selectedItem) {
setStationName(selectedItem.name);
}
Expand All @@ -44,29 +44,29 @@ export const StationInfo = (props) => {
setEditMode(null);

// Update the item's name in the state
setItems2((prevItems) =>
setItems((prevItems) =>
prevItems.map((item) =>
item.id === editMode ? { ...item, name: stationName } : item
)
);
};

const handleSaveNewItem = () => {
setItems2((prevItems) => [
setItems((prevItems) => [
...prevItems,
{
id: uuidv4(),
name: newItem.name,
}
]);
console.log(items2);
console.log(items);
setNewItem({ name: "New PC" }); // Clear the newItem after saving
};

const handleDeleteItem = (id) => {
const isConfirmed = window.confirm("Are you sure you want to delete?");
if (!isConfirmed) return;
setItems2((prevItems) => prevItems.filter((item) => item.id !== id));
setItems((prevItems) => prevItems.filter((item) => item.id !== id));
};

const handleShowInfo = (id) => {
Expand Down Expand Up @@ -100,11 +100,11 @@ export const StationInfo = (props) => {
<button className="add-new-button" onClick={handleSaveNewItem}>
Add New
</button>
<button className="back-btn" onClick={() => setWsName('')}>
<BackIconSmall/>
<button className="back-btn" onClick={() => setName('')}>
<BackIconSmall/>
</button>
<div className="station-box">
{items2.map((item) => (
{items.map((item) => (
<li key={item.id} className="">
<span
className="delete-icon"
Expand All @@ -119,7 +119,7 @@ export const StationInfo = (props) => {
alt="StationLogo"
onClick={() => handleShowInfo(item.name)}
title="" // This is the text that appears when you hover over the image
oncontextmenu="return false;" // This prevents the right-click img menu from appearing
onContextMenu={(e) => e.preventDefault()} // This prevents the right-click img menu from appearing
/>
{/* </Link> */}

Expand Down
16 changes: 15 additions & 1 deletion my-app/src/Components/StationSelect/StationSelect.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
margin: 0 auto;
transition: ease-in-out 0.1s;
cursor: pointer;
border-radius: 20px;
}
.station-name-input{
display: flex;
Expand Down Expand Up @@ -76,4 +77,17 @@
}
.delete-icon:hover{
transform: scale(1.8);
}
}
.popup-msg-labs{
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
margin: 0 auto;
z-index: 100;
}
.popup-msg-labs:hover{
background-color: #00438b;
transition: ease-in-out 0.1s;
}
10 changes: 7 additions & 3 deletions my-app/src/Components/StationSelect/StationSelect.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import { v4 as uuidv4 } from 'uuid';
import { BackIconSmall } from "../../Assets/BackIconSmall";
import "./StationSelect.css";
import WorkstationLogo from "../../Assets/WorkstationLogo.png";


export const StationSelect = (props) => {
const { items, setItems, setWsName } = props; // Make the items and setItems props available
const { items, setItems, setName, labNameRemove } = props; // Make the items and setItems props available
const [editMode, setEditMode] = useState(null);
const [stationName, setStationName] = useState("Your Station Name");
const [newItem, setNewItem] = useState({
Expand Down Expand Up @@ -56,14 +57,17 @@ export const StationSelect = (props) => {
};

const dostuff = (item) => {
setWsName(item);
setName(item);
};
return (
<>
<div className="station-select-container">
<button className="add-new-button" onClick={handleSaveNewItem}>
Add New
</button>
<button className="back-btn" onClick={() => labNameRemove('')}>
<BackIconSmall/>
</button>
<div className="station-box">
{items.map((item) => (
<li key={item.id} className="">
Expand All @@ -80,7 +84,7 @@ export const StationSelect = (props) => {
alt="StationLogo"
onClick={() => dostuff(item.name)}
title=""
oncontextmenu="return false;"
onContextMenu={(e) => e.preventDefault()}
/>
{/* </Link> */}

Expand Down
2 changes: 1 addition & 1 deletion my-app/src/Views/HomePage/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const HomePage = () => {

const menuItems = [
{ label: "ציוד וחומרה", link: "/inventory-list" },
{ label: "מעקב עמדות", link: "/project-select" },
{ label: "פרויקטים", link: "/project-select" },
{ label: "משימות", link: "/tasks" },
];

Expand Down
8 changes: 4 additions & 4 deletions my-app/src/Views/ProjectSelect/ProjectSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ export const ProjectSelect = (props) => {

const backBtn = true;
const menuItems = [
{ label: "Reccelite XR", link: "/xr-workstations" },
{ label: "Litening", link: "/litening-workstations" },
{ label: "Blue Bird", link: "/bb-workstations" },
{ label: "Hydra", link: "/hydra-workstations" },
{ label: "XR", link: "/xr-main" },
{ label: "LITE", link: "/lite-labs" },
{ label: "BB", link: "/bb-labs" },
{ label: "Hydration", link: "/hyd-labs" },
];

return (
Expand Down
14 changes: 14 additions & 0 deletions my-app/src/Views/ProjectViews/XR/XrDocs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { React } from 'react';
import { useState } from 'react';


export const XrDocs= () => {

return (
<>
<div>
<button className='general-btn'>DOCS</button>
</div>
</>
);
}
29 changes: 29 additions & 0 deletions my-app/src/Views/ProjectViews/XR/XrLabs.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { React } from 'react';
import { useState } from 'react';
import { StationSelect } from '../../../Components/StationSelect/StationSelect';
import {StationInfo } from '../../../Components/StationInfo/StationInfo';
import { LabSelect } from '../../../Components/LabSelect/LabSelect';

export const XrLabs= () => {
const [labItems, setLabItems] = useState([{ id: 1, name: 'Lab-102' }]);// Send the information to the LabSelect component
const [items, setItems] = useState([{ id: 1, name: 'New Station' }]);// Send the information to the StationSelect component
const [items2, setItems2] = useState([{ id: 1, name: 'New PC' }]);// Send the information to the StationInfo component

const [labName, setLabName] = useState('');
const [stationTitleName, setStationTitleName] = useState('');


return (
<>
<div className='page-content'>
<h1 style={{ textAlign: "center" }}>XR LABS</h1>
{labName && <h2 style={{ textAlign: 'center' }}>Lab Selected: {labName}</h2>}
{stationTitleName && <h2 style={{ textAlign: 'center' }}>Station Selected: {stationTitleName}</h2>}
{/* pages content based on states of labName and stationTitleName */ }
{!labName && <LabSelect items={labItems} setItems={setLabItems} setName={setLabName}/>}
{ labName && !stationTitleName && <StationSelect items = {items} setItems = {setItems} setName={setStationTitleName} labNameRemove = {setLabName}/>}
{ stationTitleName && <StationInfo items={items2} setItems={setItems2} setName = {setStationTitleName}/>}
</div>
</>
);
}
16 changes: 16 additions & 0 deletions my-app/src/Views/ProjectViews/XR/XrMain.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { React } from "react";
import { CircleMenu } from "../../../Components/CircleMenu/CircleMenu";

export const XrMain = () => {
const backBtn = true;
const menuItems = [
{ label: "LABS", link: "/xr-labs" },
{ label: "DOCS", link: "/xr-docs" },
];

return (
<>
<CircleMenu items={menuItems} backBtn={backBtn} />
</>
);
};
Loading

0 comments on commit 50a569a

Please sign in to comment.