Skip to content

Commit

Permalink
Merge pull request #275 from LL08-MathematicalModelling-dowell/fronte…
Browse files Browse the repository at this point in the history
…nd-Norah

Fixes on the nps scale page and shop number page
  • Loading branch information
norahwinda authored Jun 10, 2024
2 parents f90659a + 3d233c3 commit 94716b7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ console.log(screenWidth, "YYYYYYYYYYYYYYYYYYYYYYYYYYYYy")
</div>

{popuOption &&
<div className='popup' style={{width: '550px', height: '240px', display: 'flex', left: '53%', top: '25%', WebkitTransform:'translate(-50%, -50%)', MozTransformStyle: 'translate(-50%, -50%)', transform: 'translate(-50%, -50%)', position: 'fixed', backgroundColor:'white', borderRadius: '8px'}}>
<div className='popup' style={{width: '550px', height: '240px', display: 'flex', left: '51%', top: '53%', WebkitTransform:'translate(-50%, -50%)', MozTransformStyle: 'translate(-50%, -50%)', transform: 'translate(-50%, -50%)', position: 'fixed', backgroundColor:'white', borderRadius: '8px'}}>
<button
onClick={() => setPopupOption(false)}
className="absolute px-2 text-black bg-white rounded-full right-2 top-2"
Expand Down
5 changes: 3 additions & 2 deletions src/pages/SideBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import ScaleMainScreen from './scales/ui-scales-helper/ScaleMainScreen';

const SideBar = () => {

const { rSize, setRSize, newScaleBtn, setNewScaleBtn, myScalesBtn, setMyScalesBtn, scaleIndex,
const { popuOption,
setPopupOption, rSize, setRSize, newScaleBtn, setNewScaleBtn, myScalesBtn, setMyScalesBtn, scaleIndex,
setScaleIndex, } = useFetchUserContext();

const [searchParams] = useSearchParams();
Expand Down Expand Up @@ -124,7 +125,7 @@ const handleConfirm = () =>{
}, []);

return (
<div className='hidden lg:block lg:w-3/12 h-screen' style={{backgroundColor:'#54595F', width: reduceSize ? '50px' :'250px', marginRight: '50px', position: 'fixed', }}>
<div className='hidden lg:block lg:w-3/12 h-screen' style={{backgroundColor:'#54595F', width: reduceSize ? '50px' :'250px', marginRight: '50px', position: 'fixed', filter: popuOption ? 'blur(8px)' : '', pointerEvents: popuOption ? 'none' : '' }}>
<div style={{color: '#D3D3D3', fontSize:'15px', fontWeight:'400', display: 'flex', flexDirection: reduceSize ? 'column' : 'row', alignItems:'center', justifyContent: 'center', marginTop: '20px'}}>
<AiOutlineMenuUnfold onClick={handleSizeToggle} style={{fontSize: '25px', color:'#6D6E70', cursor: 'pointer', display: reduceSize ? 'block' : 'none'}}/>
<img src= {dowellLogo} alt='image' style={{height: reduceSize ? '25px' : '60px', borderRadius:'8px'}}/>
Expand Down
12 changes: 8 additions & 4 deletions src/pages/scales/report/Booth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ function degreesToRadians(degrees) {
const distance=calculateDistance(latitude,longitude,latitude,longitude)
console.log(distance)
if(distance<=3){
if(scaleType === 'nps_lite'){
window.location.href=`https://100035.pythonanywhere.com/nps-lite/api/v5/nps-lite-create-scale/?user=False&scale_type=${scaleType}&workspace_id=${workspaceId}&username=HeenaK&scale_id=${scaleId}&channel_name=${channelName}&instance_id=${boothInput}`
}else if(scaleType === 'nps'){
window.location.href=`https://100035.pythonanywhere.com/nps/api/v5/nps-create-scale/?user=False&scale_type=${scaleType}&workspace_id=${workspaceId}&username=HeenaK&scale_id=${scaleId}&channel_name=${channelName}&instance_id=${boothInput}`
}
}else{
setValid(-1)
setSubmitted(false)
Expand Down Expand Up @@ -126,18 +130,18 @@ console.log(response.data)
<div className='flex flex-col items-center justify-center w-full'>
<img className='mt-5 w-[150px] sm:w-[250px]' src={logo} alt='booth image'/>
<div className="flex flex-col gap-2 mt-[20px] sm:mt-[50px]">
<label htmlFor="boothNumber" className="text-[14px] sm:text-[16px] font-medium self-center">Please enter your booth number</label>
<input id="boothNumber" name="boothNumber" value={boothInput} type="number"
<label htmlFor="boothNumber" className="text-[14px] sm:text-[16px] font-medium self-center">Please enter your shop number</label>
<input id="boothNumber" name="boothNumber" value={boothInput}
placeholder="enter shop/stand number" onChange={(e) => {
setBoothInput(e.target.value);
setBoothInput(e.target.value);
setBoothErr(false)
setValid(0)
}
}
disabled={submitted==true}
className={`border rounded-full p-2 px-6 sm:text-base text-sm ${setSubmitted==true ? "bg-gray-300" : ""}`}/>
</div>
{boothErr && <p className="text-red-500 text-[12px] sm:text-[14px]">**Booth number is not valid**</p>}
{boothErr && <p className="text-red-500 text-[12px] sm:text-[14px]">**Shop number is not valid**</p>}
<div className="w-[300px] sm:w-[500px] h-[250px] m-5 sm:m-10">
{locationLoading==0 ? (
<>
Expand Down
16 changes: 15 additions & 1 deletion src/pages/scales/ui-scales-helper/ScaleMainScreen.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { useState, useEffect } from "react";
import { useNavigate } from 'react-router';

import { useFetchUserContext } from "../../../contexts/fetchUserContext";
import { FaArrowCircleLeft } from "react-icons/fa";


Expand All @@ -15,6 +15,20 @@ import PreviewScale from "./PreviewScale";

export default function ScaleMainScreen({textContent}){

const {
popuOption,
setPopupOption,
sName,
setSName,
BtnLink,
setBtnLink,
scaleIndex,
setScaleIndex,
rSize,
setRSize,
setMyScalesBtn,
setNewScaleBtn } = useFetchUserContext()

const[goBack,setGoBack]=useState(false)
const[step,setStep]=useState(1)

Expand Down

0 comments on commit 94716b7

Please sign in to comment.