Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ft modify feedback #59

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,506 changes: 0 additions & 4,506 deletions package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@emotion/react": "^11.9.3",
"@emotion/styled": "^11.9.3",
"@mui/material": "^5.8.4",
"@reduxjs/toolkit": "^1.8.2",
"@reduxjs/toolkit": "^1.9.5",
"axios": "^0.27.2",
"bootstrap": "^5.1.3",
"classnames": "^2.3.1",
Expand Down
84 changes: 53 additions & 31 deletions pages/feedback.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
/* eslint-disable react-hooks/rules-of-hooks */
import styles from '../styles/feedback.module.css'
import EmojiSlider from '../components/EmojiSlider'
import { useState } from 'react'
import { useState,useRef } from 'react'
import axios from 'axios'
import Image from "next/image";
import Link from "next/link";
import log from "../public/assets/logo.png";
import log from "../public/assets/logoLight.png";
import { toast } from "react-toastify";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import Stepper from 'react-stepper-horizontal';
import { useDispatch, useSelector } from 'react-redux';
import { next, prev } from '../state/slices/pageSlice';

const feedback = () => {
const [ fullName,setFullName ] = useState(null);
const [ phone , setPhone ] = useState(null);
const [ message , setMessage ] = useState(null);
const [ concept ,setConcept ] = useState({});
const [ management ,setManagement ] = useState({});
const [ loader ,setLoader ] = useState();
const count = useSelector((state)=>state.pages.value);
const type = useSelector((state)=> state.pages.type );
const dispatch = useDispatch();
const formRef = useRef(null);
const msgRef = useRef(null);



Expand Down Expand Up @@ -43,15 +52,19 @@ const feedback = () => {
const feedbackData = {
fullName,
emailOrPhone:phone,
message,
'concept': concept,
'projectManagement': management,
}

const response = await axios.post(`https://mozaik-portal-api-wgwap.ondigitalocean.app/api/feedback/new`, feedbackData );
console.log(response);
formRef.current.reset();
setConcept({});
setManagement({});
setFullName(null);
setPhone(null);
setMessage('');
setLoader(false);
return toast.success(response.data.message, {
autoClose: 2000,
Expand All @@ -71,51 +84,52 @@ const feedback = () => {
}
};
return (
<div className={styles.mainContainer}>
<div className={`${styles.mainContainer}`}>
<ToastContainer />
<div style={{ cursor: "pointer" }}>
<Link href='/'>
<Image src={log} width='120px' height='100px' alt='logg' />
</Link>
</div>
<div className={styles.container}>
<div>
<h1 className={styles.maintitle}>{`We'd love to hear from you`}</h1>
<h1 className={styles.maintitle}>{`Concept`}</h1>
<div className={`${styles.container} border-[1px] border-amber-500 rounded`}>
{type === 'management' && <Stepper steps={ [{title: ''}, {title: ``}] } activeStep={ count } className='w-full p-0'
/>}
{count === 0 && <div>
<h1 className={`${styles.maintitle} mt-[20px]`}>{`Concept`}</h1>

<div>
<h1 className={styles.title}>{`1.Timeliness of clarity of communication regarding project updates and changes`}</h1>
<h1 className={styles.title}>{`1.Timely and clear project updates and changes.`}</h1>
<EmojiSlider questionIndex={'Timeliness of clarity of communication regarding project updates and changes'} onEmojiSelect={(emojiIndex) => handleEmojiSelect('Timeliness of clarity of communication regarding project updates and changes', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`2.Ability to understand and address your design preferences and requirements`}</h1>
<h1 className={styles.title}>{`2.Understanding and meeting your design needs.`}</h1>
<EmojiSlider questionIndex='Ability to understand and address your design preferences and requirements' onEmojiSelect={(emojiIndex) => handleEmojiSelect('Ability to understand and address your design preferences and requirements', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`3.Professionalism and courtesy of our staff`}</h1>
<h1 className={styles.title}>{`3.Professionalism and courtesy of our staff.`}</h1>
<EmojiSlider questionIndex={'Professionalism and courtesy of our staff'} onEmojiSelect={(emojiIndex) => handleEmojiSelect('Professionalism and courtesy of our staff', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`4.Responsiveness to your feedback and requests`}</h1>
<EmojiSlider questionIndex={'Responsiveness to your feedback and requests'} onEmojiSelect={(emojiIndex) => handleEmojiSelect('Responsiveness to your feedback and requests', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`5.Overall satisfaction with the interior design service provided.`}</h1>
<h1 className={styles.title}>{`5.Satisfaction with interior design service.`}</h1>
<EmojiSlider questionIndex={'Overall satisfaction with the interior design service provided'} onEmojiSelect={(emojiIndex) => handleEmojiSelect('Overall satisfaction with the interior design service provided', emojiIndex)}/>
</div>
</div>
<div style={{marginTop:'50px'}}>
</div>}
{count === 1 && <div style={{marginTop:'50px'}}>
<h1 className={styles.maintitle}>{`Project management`}</h1>
<div>
<h1 className={styles.title}>{`1. Adherence to project timelines and deadlines.`}</h1>
<EmojiSlider questionIndex={'Adherence to project timelines and deadlines'} onEmojiSelect={(emojiIndex) => handleEmojiManagementSelect('Adherence to project timelines and deadlines', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`2. Handling of unexpected challenges or changes during the project`}</h1>
<h1 className={styles.title}>{`2. Handling of unexpected challenges or changes during the project.`}</h1>
<EmojiSlider questionIndex={'Handling of unexpected challenges or changes during the project'} onEmojiSelect={(emojiIndex) => handleEmojiManagementSelect('Handling of unexpected challenges or changes during the project', emojiIndex)}/>
</div>
<div>
<h1 className={styles.title}>{`3.Professionalism and courtesy of our staff`}</h1>
<h1 className={styles.title}>{`3.Professionalism and courtesy of our staff.`}</h1>
<EmojiSlider questionIndex={'Professionalism and courtesy of our staff'} onEmojiSelect={(emojiIndex) => handleEmojiManagementSelect('Professionalism and courtesy of our staff', emojiIndex)}/>
</div>
<div>
Expand All @@ -126,23 +140,31 @@ const feedback = () => {
<h1 className={styles.title}>{`5.Quality of materials and furnishings used.`}</h1>
<EmojiSlider questionIndex={'Quality of materials and furnishings used'} onEmojiSelect={(emojiIndex) => handleEmojiManagementSelect('Quality of materials and furnishings used', emojiIndex)}/>
</div>
</div>}
{type === 'concept' || count === 1 ? <form className={styles.form} ref={formRef} onSubmit={handleSubmitFeedback}>
<div className='flex justify-between xs:flex-col'>
<input type="text" value={fullName} className="px-2 mr-5 xs:mb-5" placeholder="Enter your names" onChange={(e)=>setFullName(e.target.value)} required/>
<input type="text" value={phone} className="px-2" placeholder="Enter email or phone number" onChange={(e)=>setPhone(e.target.value)} required/>
</div>
<textarea name="" id="" cols="30" rows="10" value={message} placeholder='Leave us a message...' onChange={(e)=>setMessage(e.target.value)}></textarea>

<div className='flex '>
{type === 'management' && count === 1 ? <button className={`${styles.popp} bg-[#233044] text-[#cdcfd0] my-7 rounded w-[150px] h-[40px] mr-5`} onClick={()=>dispatch(prev())}>Previous</button> : ''}
{count === 1 || type === 'concept' ? <button type='submit' className={!loader ? 'flex justify-center cursor-pointer items-center bg-[#233044] text-[#cdcfd0] my-7 rounded w-[150px] h-[40px]' : 'flex justify-center items-center text-white my-7 rounded w-[150px] h-[40px] bg-gray-700 cursor-not-allowed'}>
{!loader ? <h1 className={`${styles.popp} text-[#cdcfd0]`}>Submit</h1>
:
<div role="status" className='flex'>
<h1 className={`${styles.popp} text-[#cdcfd0] mr-3`}>Processing...</h1>
<svg aria-hidden="true" className="w-5 h-5 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span className="sr-only">Loading...</span>
</div>}
</button>:''}
</div>
<form className={styles.form}>
<input type="text" value={fullName} className="" placeholder="Enter your names" onChange={(e)=>setFullName(e.target.value)} required/>
<input type="text" value={phone} className="" placeholder="Enter email or phone number" onChange={(e)=>setPhone(e.target.value)} required/>
</form>
<div onClick={handleSubmitFeedback} className={!loader ? 'flex justify-center cursor-pointer items-center bg-black text-white my-7 rounded w-[150px] h-[40px]' : 'flex justify-center items-center text-white my-7 rounded w-[150px] h-[40px] bg-gray-700 cursor-not-allowed'}>
{!loader ? <h1 className='text-white font-semibold'>Submit</h1>
:
<div role="status" className='flex'>
<h1 className='text-white font-semibold mr-3'>Please wait</h1>
<svg aria-hidden="true" className="w-5 h-5 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
<span className="sr-only">Loading...</span>
</div>}
</div>
</form>:''}
{type === 'management' && count === 0 ? <button className='bg-[#233044] text-[#cdcfd0] my-7 rounded w-[150px] h-[40px]' onClick={()=>dispatch(next())}>Next</button> : ''}
</div>
</div>
)
Expand Down
33 changes: 33 additions & 0 deletions pages/feedback2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Image from "next/image";
import Link from "next/link";
import log from "../public/assets/logoLight.png";
import { useDispatch } from "react-redux";
import { setConcept, setManagement } from "../state/slices/pageSlice";

const feedback2 = () => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const dispatch = useDispatch();

return (
<div className='h-screen px-10 bg-[#131A25]'>
<div style={{ cursor: "pointer" }}>
<Link href='/'>
<Image src={log} width='120px' height='100px' alt='logg' />
</Link>
</div>
<div className='flex justify-center items-center'>
<div className=" w-[30%] border-[1px] border-amber-500 rounded py-3 2xl:w-[40%] larg:w-[60%] md:w-[80%] md:mt-32 sm:w-[90%] xtra:w-full">
<h1 className="text-[#cdcfd0] font-medium text-center text-2xl xs:text-xl">{`We'd love to hear from you`}</h1>
<h1 className="text-[#F5F8FA] text-center xs:text-sm">Choose one based on service you experienced</h1>
<div className="flex justify-between mx-auto w-[80%] mt-5 xs:text-sm xs:w-[90%]">
<button className="bg-yellow-700 text-white cursor-pointer px-3 py-2 rounded font-medium sm:text-sm xs:text-xs" onClick={()=> dispatch(setConcept())}><Link href='/feedback'>Concept</Link></button>
<button className="bg-yellow-700 text-white cursor-pointer px-3 py-2 rounded font-medium sm:text-sm xs:text-xs" onClick={()=> dispatch(setManagement())}><Link href='/feedback'>Project management</Link></button>
</div>
</div>
</div>
</div>

)
}

export default feedback2
4 changes: 3 additions & 1 deletion state/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import stepsSlice from "./slices/steps.slice";
import pageSlice from "./slices/pageSlice";
import { configureStore } from '@reduxjs/toolkit'
const Store = configureStore({
reducer: {
steps: stepsSlice
steps: stepsSlice,
pages: pageSlice
},
})
export default Store;
27 changes: 27 additions & 0 deletions state/slices/pageSlice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { createSlice } from '@reduxjs/toolkit';

const initialState = {
value: 0,
type: ''
}
const pageSlice = createSlice({
name: 'steps',
initialState: initialState,
reducers: {
next: (state) => {
state.value += 1;
},
prev: (state) => {
state.value -= 1;
},
setConcept: (state) => {
state.type = 'concept';
},
setManagement: (state) => {
state.type = 'management';
},
},
});

export const { next, prev, setConcept, setManagement } = pageSlice.actions;
export default pageSlice.reducer;
79 changes: 68 additions & 11 deletions styles/feedback.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@

.mainContainer{
padding: 20px 100px;
background: #131A25;
/* background: #fff; */

}

.container{
padding: 50px 100px;
}

.popp{
font-family: 'Poppins', sans-serif;
}

.maintitle{
color: #000;
color: #F5F8FA;
font-size: 20px;
font-family: 'Poppins', sans-serif;
font-weight: 500;
Expand All @@ -17,33 +25,47 @@
.title{
font-size: 18px;
font-weight: 400;
color: #000;
color: #cdcfd0;
font-family: 'Poppins', sans-serif;
/* text-align: center; */
}

.form{
width: 50%;
display: grid;
grid-template-columns: repeat(2,1fr);
grid-template-columns: repeat(1,1fr);
column-gap: 50px;
}

.container input{
background-color: #f9fafb;
border: 1px solid #d1d5db;
color: #111827;
background-color: #040404;
width: 100%;
color: #cdcfd0;
font-size: 15px;
height: 40px;
border-radius: 5px;
border-radius: 5px 10px;
}

.container button{

.container textarea{
background-color: #040404;
/* border: 1px solid #d1d5db; */
color: #cdcfd0;
font-size: 15px;
height: 100px;
border-radius: 5px;
margin-top: 10px;
padding: 5px;

}
/* .container button{
background: #000;
color: #fff;
margin: 20px 0px;
border-radius: 5px;
padding: 10px 20px;
}
height: 40px;
padding: 0px 20px;
} */
.label{
font-size: 7px;
text-align: center;
Expand All @@ -55,16 +77,51 @@
margin-left: -5px;
}

@media (max-width: 480px){
@media (max-width: 768px){
.mainContainer{
padding: 10px 50px;
}

.form{
width: 50%;
grid-template-columns: repeat(1,1fr);
row-gap: 20px;
}
}

@media (max-width: 600px){
.mainContainer{
padding: 10px 30px;
}

.container{
padding: 50px 30px;
}

.form{
width: 50%;
grid-template-columns: repeat(1,1fr);
row-gap: 20px;
}
}

@media (max-width: 480px){
.mainContainer{
padding: 10px 30px;
}
.container{
padding: 30px 20px;
}
.form{
width: 100%;
grid-template-columns: repeat(1,1fr);
row-gap: 20px;
}
.maintitle{
font-size: 18px;
}
.title{
font-size: 16px;
/* text-align: center; */
}
}
Loading