web/components/NavBar/NavBAr.jsx

208 lines
14 KiB
JavaScript

"use client";
import Link from "next/link";
import React, { useContext } from "react";
import { usePathname } from "next/navigation";
import Image from "next/image";
import logo from "@img/logo.png";
import AppContext from "@ctx/AppContext";
const NavBAr = (props) => {
const usePath = usePathname();
const CTX = useContext(AppContext);
console.log("vvvvv", CTX.state.BigPlusOpen);
const openBigPlus = () => {
setTimeout(() => {
CTX.setBigPlusRotateIcon(true);
}, 500);
CTX.setBigPlusOpen(true);
};
return (
<div className="fixed w-full z-10 bottom-0 ">
{/* <div className="w-[100px] text-left overflow-hidden">
<Image src={divide} alt="" className=" " />
</div> */}
<div className="bg-white shadow px-4 py-5 flex rounded-t-[30px] ">
<Link href={"/home"} className="w-full !no-underline mr-5">
<>
{usePath.includes("/home") ? (
<div className="flex justify-center w-full">
<svg
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M11 14L15 20H21L12 4L3 20H9L13 14"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="flex justify-center opacity-20 w-full">
<svg
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M11 14L15 20H21L12 4L3 20H9L13 14"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
)}
</>
</Link>
<Link href={"/shifts"} className="w-full !no-underline mr-10">
<>
{usePath.includes("/shifts") ? (
<div className="flex justify-center w-full">
<svg
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M20.984 12.53C21.0938 10.6693 20.6232 8.82034 19.6371 7.23856C18.6511 5.65678 17.1982 4.42018 15.4792 3.69954C13.7601 2.9789 11.8598 2.80978 10.0405 3.21554C8.22123 3.62129 6.57282 4.5819 5.32292 5.9647C4.07303 7.3475 3.28331 9.08426 3.06283 10.9351C2.84235 12.786 3.20198 14.6597 4.09207 16.2974C4.98216 17.9351 6.35878 19.2561 8.03183 20.0779C9.70487 20.8996 11.5918 21.1817 13.432 20.885"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M12 7V12L15 15M19 16L17 19H21L19 22"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
) : (
<div className="flex justify-center opacity-20 w-full">
<svg
width="32"
height="32"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M20.984 12.53C21.0938 10.6693 20.6232 8.82034 19.6371 7.23856C18.6511 5.65678 17.1982 4.42018 15.4792 3.69954C13.7601 2.9789 11.8598 2.80978 10.0405 3.21554C8.22123 3.62129 6.57282 4.5819 5.32292 5.9647C4.07303 7.3475 3.28331 9.08426 3.06283 10.9351C2.84235 12.786 3.20198 14.6597 4.09207 16.2974C4.98216 17.9351 6.35878 19.2561 8.03183 20.0779C9.70487 20.8996 11.5918 21.1817 13.432 20.885"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
<path
d="M12 7V12L15 15M19 16L17 19H21L19 22"
stroke="black"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</div>
)}
</>
</Link>
<div
className="flex justify-center "
onClick={() => {
openBigPlus();
}}
>
<div className="bg-primary-200 w-[60px] h-[60px] rounded-full absolute top-[-25px] ">
<svg
width="25"
height="25"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className="mx-auto mt-4"
>
<path
d="M14 6H10V2C10 1.46957 9.78929 0.960859 9.41421 0.585786C9.03914 0.210714 8.53043 0 8 0C7.46957 0 6.96086 0.210714 6.58579 0.585786C6.21071 0.960859 6 1.46957 6 2L6.071 6H2C1.46957 6 0.960859 6.21071 0.585786 6.58579C0.210714 6.96086 0 7.46957 0 8C0 8.53043 0.210714 9.03914 0.585786 9.41421C0.960859 9.78929 1.46957 10 2 10L6.071 9.929L6 14C6 14.5304 6.21071 15.0391 6.58579 15.4142C6.96086 15.7893 7.46957 16 8 16C8.53043 16 9.03914 15.7893 9.41421 15.4142C9.78929 15.0391 10 14.5304 10 14V9.929L14 10C14.5304 10 15.0391 9.78929 15.4142 9.41421C15.7893 9.03914 16 8.53043 16 8C16 7.46957 15.7893 6.96086 15.4142 6.58579C15.0391 6.21071 14.5304 6 14 6Z"
fill="white"
/>
</svg>
</div>
</div>
<Link href={"/employees"} className="w-full !no-underline ml-10">
<>
{usePath.includes("/employees") ? (
<div className="flex justify-center w-full">
<svg
width="30"
height="30"
viewBox="0 0 256 256"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M125.18 156.94C135.231 148.492 142.44 137.157 145.83 124.473C149.22 111.789 148.627 98.369 144.131 86.0333C139.635 73.6976 131.454 63.043 120.698 55.5146C109.941 47.9861 97.1294 43.9481 84 43.9481C70.8706 43.9481 58.0588 47.9861 47.3022 55.5146C36.5456 63.043 28.3647 73.6976 23.8689 86.0333C19.3732 98.369 18.7801 111.789 22.1702 124.473C25.5603 137.157 32.7694 148.492 42.82 156.94C27.1258 164.036 13.5251 175.057 3.32997 188.94C1.44694 191.506 0.660351 194.715 1.14326 197.861C1.62616 201.007 3.339 203.832 5.90497 205.715C8.47094 207.598 11.6799 208.385 14.8258 207.902C17.9717 207.419 20.7969 205.706 22.68 203.14C29.7374 193.501 38.9676 185.662 49.6217 180.258C60.2758 174.854 72.0538 172.038 84 172.038C95.9462 172.038 107.724 174.854 118.378 180.258C129.032 185.662 138.263 193.501 145.32 203.14C147.203 205.707 150.029 207.421 153.176 207.905C156.322 208.389 159.533 207.603 162.1 205.72C164.667 203.837 166.381 201.011 166.865 197.864C167.349 194.717 166.563 191.507 164.68 188.94C154.479 175.059 140.875 164.039 125.18 156.94ZM44 108C44 100.089 46.3459 92.3552 50.7412 85.7772C55.1364 79.1992 61.3836 74.0723 68.6926 71.0448C76.0017 68.0173 84.0443 67.2252 91.8036 68.7686C99.5628 70.312 106.69 74.1216 112.284 79.7157C117.878 85.3098 121.688 92.4372 123.231 100.196C124.775 107.956 123.983 115.998 120.955 123.307C117.928 130.616 112.801 136.864 106.223 141.259C99.6448 145.654 91.9112 148 84 148C73.3913 148 63.2172 143.786 55.7157 136.284C48.2142 128.783 44 118.609 44 108ZM250.1 205.67C248.83 206.604 247.388 207.278 245.857 207.654C244.326 208.03 242.736 208.1 241.177 207.862C239.619 207.623 238.123 207.08 236.775 206.263C235.427 205.446 234.253 204.371 233.32 203.1C226.245 193.48 217.011 185.654 206.361 180.253C195.711 174.851 183.942 172.024 172 172C168.817 172 165.765 170.736 163.515 168.485C161.264 166.235 160 163.183 160 160C160 156.817 161.264 153.765 163.515 151.515C165.765 149.264 168.817 148 172 148C177.89 147.993 183.705 146.686 189.031 144.171C194.357 141.657 199.062 137.997 202.809 133.454C206.557 128.91 209.255 123.596 210.712 117.889C212.168 112.182 212.345 106.224 211.232 100.44C210.119 94.657 207.743 89.1907 204.273 84.4319C200.802 79.6732 196.324 75.7395 191.158 72.9118C185.991 70.0841 180.264 68.4322 174.385 68.0741C168.507 67.7159 162.621 68.6604 157.15 70.84C155.684 71.4401 154.114 71.7442 152.531 71.7347C150.947 71.7251 149.381 71.4022 147.922 70.7845C146.464 70.1667 145.142 69.2664 144.034 68.1355C142.925 67.0045 142.051 65.6653 141.463 64.195C140.874 62.7247 140.582 61.1524 140.604 59.5688C140.626 57.9852 140.961 56.4216 141.59 54.9682C142.219 53.5147 143.13 52.2002 144.27 51.1003C145.409 50.0005 146.755 49.1371 148.23 48.56C162.353 42.9054 178.029 42.4667 192.446 47.3225C206.863 52.1783 219.079 62.0109 226.904 75.0575C234.729 88.1041 237.65 103.511 235.144 118.517C232.638 133.522 224.869 147.144 213.23 156.94C228.924 164.036 242.525 175.057 252.72 188.94C254.584 191.508 255.355 194.711 254.864 197.846C254.373 200.981 252.66 203.795 250.1 205.67Z"
fill="black"
/>
</svg>
</div>
) : (
<div className="flex justify-center opacity-20 w-full">
<svg
width="30"
height="30"
viewBox="0 0 256 256"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M125.18 156.94C135.231 148.492 142.44 137.157 145.83 124.473C149.22 111.789 148.627 98.369 144.131 86.0333C139.635 73.6976 131.454 63.043 120.698 55.5146C109.941 47.9861 97.1294 43.9481 84 43.9481C70.8706 43.9481 58.0588 47.9861 47.3022 55.5146C36.5456 63.043 28.3647 73.6976 23.8689 86.0333C19.3732 98.369 18.7801 111.789 22.1702 124.473C25.5603 137.157 32.7694 148.492 42.82 156.94C27.1258 164.036 13.5251 175.057 3.32997 188.94C1.44694 191.506 0.660351 194.715 1.14326 197.861C1.62616 201.007 3.339 203.832 5.90497 205.715C8.47094 207.598 11.6799 208.385 14.8258 207.902C17.9717 207.419 20.7969 205.706 22.68 203.14C29.7374 193.501 38.9676 185.662 49.6217 180.258C60.2758 174.854 72.0538 172.038 84 172.038C95.9462 172.038 107.724 174.854 118.378 180.258C129.032 185.662 138.263 193.501 145.32 203.14C147.203 205.707 150.029 207.421 153.176 207.905C156.322 208.389 159.533 207.603 162.1 205.72C164.667 203.837 166.381 201.011 166.865 197.864C167.349 194.717 166.563 191.507 164.68 188.94C154.479 175.059 140.875 164.039 125.18 156.94ZM44 108C44 100.089 46.3459 92.3552 50.7412 85.7772C55.1364 79.1992 61.3836 74.0723 68.6926 71.0448C76.0017 68.0173 84.0443 67.2252 91.8036 68.7686C99.5628 70.312 106.69 74.1216 112.284 79.7157C117.878 85.3098 121.688 92.4372 123.231 100.196C124.775 107.956 123.983 115.998 120.955 123.307C117.928 130.616 112.801 136.864 106.223 141.259C99.6448 145.654 91.9112 148 84 148C73.3913 148 63.2172 143.786 55.7157 136.284C48.2142 128.783 44 118.609 44 108ZM250.1 205.67C248.83 206.604 247.388 207.278 245.857 207.654C244.326 208.03 242.736 208.1 241.177 207.862C239.619 207.623 238.123 207.08 236.775 206.263C235.427 205.446 234.253 204.371 233.32 203.1C226.245 193.48 217.011 185.654 206.361 180.253C195.711 174.851 183.942 172.024 172 172C168.817 172 165.765 170.736 163.515 168.485C161.264 166.235 160 163.183 160 160C160 156.817 161.264 153.765 163.515 151.515C165.765 149.264 168.817 148 172 148C177.89 147.993 183.705 146.686 189.031 144.171C194.357 141.657 199.062 137.997 202.809 133.454C206.557 128.91 209.255 123.596 210.712 117.889C212.168 112.182 212.345 106.224 211.232 100.44C210.119 94.657 207.743 89.1907 204.273 84.4319C200.802 79.6732 196.324 75.7395 191.158 72.9118C185.991 70.0841 180.264 68.4322 174.385 68.0741C168.507 67.7159 162.621 68.6604 157.15 70.84C155.684 71.4401 154.114 71.7442 152.531 71.7347C150.947 71.7251 149.381 71.4022 147.922 70.7845C146.464 70.1667 145.142 69.2664 144.034 68.1355C142.925 67.0045 142.051 65.6653 141.463 64.195C140.874 62.7247 140.582 61.1524 140.604 59.5688C140.626 57.9852 140.961 56.4216 141.59 54.9682C142.219 53.5147 143.13 52.2002 144.27 51.1003C145.409 50.0005 146.755 49.1371 148.23 48.56C162.353 42.9054 178.029 42.4667 192.446 47.3225C206.863 52.1783 219.079 62.0109 226.904 75.0575C234.729 88.1041 237.65 103.511 235.144 118.517C232.638 133.522 224.869 147.144 213.23 156.94C228.924 164.036 242.525 175.057 252.72 188.94C254.584 191.508 255.355 194.711 254.864 197.846C254.373 200.981 252.66 203.795 250.1 205.67Z"
fill="black"
/>
</svg>
</div>
)}
</>
</Link>
<Link href={"/dashboard"} className="w-full !no-underline ml-5">
<>
{usePath.includes("/dashboard") ? (
<div className="flex justify-center w-full">
<div className="w-[32px] mt-2">
<Image src={logo} />
</div>
</div>
) : (
<div className="flex justify-center opacity-20 w-full">
<div className="w-[32px] mt-2">
<Image src={logo} />
</div>
</div>
)}
</>
</Link>
</div>
</div>
);
};
export default NavBAr;