Completed /calculators and /calculate routes development

This commit is contained in:
2026-04-02 17:59:10 +05:30
parent 5ee01cb014
commit 530ad05cb1
9 changed files with 375 additions and 83 deletions

View File

@@ -26,15 +26,13 @@ export default function Calculators(){
<GetQuote/>
{pastUsedObj.length !== 0 ? <div className="card card-border bg-white text-black w-full mt-5">
<div className="card-body">
<h2 className="card-title justify-center">Past Results:</h2>
<h2 className="card-title justify-center">Past Results: ({pastUsedObj.length})</h2>
<div className="flex flex-col justify-center mt-2">
<Result id={pastUsedObj[index].calcInfo.id}
section={pastUsedObj[index].calcInfo.section}
interpretation={pastUsedObj[index].interpretation}
calculated_value={pastUsedObj[index].value}
unit={pastUsedObj[index].unit}/>
<h1>Empty</h1>
</div>
<div className="card-actions justify-center">
<div className="join mt-2 self-center">
@@ -52,17 +50,17 @@ export default function Calculators(){
</div>
</div>
</div>
</div> : <h2>No past results were found</h2>}
</div> : null}
<div className="card border-4 border-[#ed1b24] bg-white text-black w-full mt-5">
<div className="card-body">
<h2 className="card-title">Bookmarks:</h2>
<h2 className="card-title">Bookmarks: ({bookmarks?.length})</h2>
<div className="grid grid-cols-2 gap-4">
{bookmarks?.length !== 0 ? bookmarks?.map(e => {
console.log(e.id);
const calc = CalculatorRegistry[e.section].calculators.find(c => c.id === e.id)
return <Bookmark section={e.section} name={calc?.name || "Not Loaded"} desc={calc?.desc || "Not Loaded"} id={e.id}/>
}) : <h2>empty</h2>}
}) : <h2>Add bookmarks to get started!</h2>}
</div>
</div>
</div>

View File

@@ -3,6 +3,7 @@ import { useState } from "react";
import Sidemenu from "../utils/Sidemenu";
import Navbar from "../utils/Navbar";
import { Roboto } from "next/font/google";
import Footer from "../utils/Footer";
const font = Roboto({});
export default function LayoutClient({children} : {children:React.ReactNode}){
const [navbar, setNavbar] = useState<boolean>(false);
@@ -11,11 +12,11 @@ export default function LayoutClient({children} : {children:React.ReactNode}){
<Navbar navbarToggle={setNavbar}/>
<Sidemenu isNavOpen={navbar}/>
<div className="content w-full flex justify-center px-4 pb-6">
<div className="w-full max-w-2xl">
<div className="max-w-2xl overflow-x-hidden">
{children}
</div>
</div>
<div className="footer"></div>
<div className="footer-area w-full"><Footer/></div>
</div>
);
}

View File

@@ -2,14 +2,33 @@
@plugin "daisyui";
.calculators-container{
display: grid;
grid-template-areas:"navbar navbar" "sidebar content" "footer footer";
grid-template-areas:
"navbar"
"content"
"footer";
height: 100vh;
width: 100%;
grid-template-columns: 1fr;
grid-template-rows: 60px 1fr 40px;
overflow-x: hidden;
}
@media (min-width: 768px) {
.calculators-container {
grid-template-areas:
"navbar navbar"
"sidebar content"
"footer footer";
grid-template-columns: 300px 1fr;
}
}
.navbar{
grid-area: navbar;
background: #ed1b24;
color: #FFFFFF;
position:sticky;
position: sticky;
top: 0;
z-index: 50;
}
#logo{
transform: translateY(1px);
@@ -24,9 +43,10 @@
background: #F9FAFB; /* soft white */
color: black;
}
.footer{
.footer-area{
grid-area: footer;
background: #cccccc;
background: #ed1b24;
}
.website-name {
font-size: 18px;

59
src/app/utils/Footer.tsx Normal file
View File

@@ -0,0 +1,59 @@
import LogoSVG from "./LogoSVG"
export default function Footer(){
return(
<footer className="footer sm:footer-horizontal bg-neutral text-neutral-content items-center p-4">
<aside className="grid-flow-col items-center min-w-0">
<LogoSVG/>
<p>Made with by Saksham Vitwekar</p>
</aside>
<nav className="flex justify-center gap-4 md:justify-self-center">
<a href="https://github.com/SomeTroller77/" target="_blank" rel="noopener noreferrer">
<svg fill="#ccc" className="h-6 w-6" viewBox="0 -0.5 25 25" xmlns="http://www.w3.org/2000/svg"><path d="m12.301 0h.093c2.242 0 4.34.613 6.137 1.68l-.055-.031c1.871 1.094 3.386 2.609 4.449 4.422l.031.058c1.04 1.769 1.654 3.896 1.654 6.166 0 5.406-3.483 10-8.327 11.658l-.087.026c-.063.02-.135.031-.209.031-.162 0-.312-.054-.433-.144l.002.001c-.128-.115-.208-.281-.208-.466 0-.005 0-.01 0-.014v.001q0-.048.008-1.226t.008-2.154c.007-.075.011-.161.011-.249 0-.792-.323-1.508-.844-2.025.618-.061 1.176-.163 1.718-.305l-.076.017c.573-.16 1.073-.373 1.537-.642l-.031.017c.508-.28.938-.636 1.292-1.058l.006-.007c.372-.476.663-1.036.84-1.645l.009-.035c.209-.683.329-1.468.329-2.281 0-.045 0-.091-.001-.136v.007c0-.022.001-.047.001-.072 0-1.248-.482-2.383-1.269-3.23l.003.003c.168-.44.265-.948.265-1.479 0-.649-.145-1.263-.404-1.814l.011.026c-.115-.022-.246-.035-.381-.035-.334 0-.649.078-.929.216l.012-.005c-.568.21-1.054.448-1.512.726l.038-.022-.609.384c-.922-.264-1.981-.416-3.075-.416s-2.153.152-3.157.436l.081-.02q-.256-.176-.681-.433c-.373-.214-.814-.421-1.272-.595l-.066-.022c-.293-.154-.64-.244-1.009-.244-.124 0-.246.01-.364.03l.013-.002c-.248.524-.393 1.139-.393 1.788 0 .531.097 1.04.275 1.509l-.01-.029c-.785.844-1.266 1.979-1.266 3.227 0 .025 0 .051.001.076v-.004c-.001.039-.001.084-.001.13 0 .809.12 1.591.344 2.327l-.015-.057c.189.643.476 1.202.85 1.693l-.009-.013c.354.435.782.793 1.267 1.062l.022.011c.432.252.933.465 1.46.614l.046.011c.466.125 1.024.227 1.595.284l.046.004c-.431.428-.718 1-.784 1.638l-.001.012c-.207.101-.448.183-.699.236l-.021.004c-.256.051-.549.08-.85.08-.022 0-.044 0-.066 0h.003c-.394-.008-.756-.136-1.055-.348l.006.004c-.371-.259-.671-.595-.881-.986l-.007-.015c-.198-.336-.459-.614-.768-.827l-.009-.006c-.225-.169-.49-.301-.776-.38l-.016-.004-.32-.048c-.023-.002-.05-.003-.077-.003-.14 0-.273.028-.394.077l.007-.003q-.128.072-.08.184c.039.086.087.16.145.225l-.001-.001c.061.072.13.135.205.19l.003.002.112.08c.283.148.516.354.693.603l.004.006c.191.237.359.505.494.792l.01.024.16.368c.135.402.38.738.7.981l.005.004c.3.234.662.402 1.057.478l.016.002c.33.064.714.104 1.106.112h.007c.045.002.097.002.15.002.261 0 .517-.021.767-.062l-.027.004.368-.064q0 .609.008 1.418t.008.873v.014c0 .185-.08.351-.208.466h-.001c-.119.089-.268.143-.431.143-.075 0-.147-.011-.214-.032l.005.001c-4.929-1.689-8.409-6.283-8.409-11.69 0-2.268.612-4.393 1.681-6.219l-.032.058c1.094-1.871 2.609-3.386 4.422-4.449l.058-.031c1.739-1.034 3.835-1.645 6.073-1.645h.098-.005zm-7.64 17.666q.048-.112-.112-.192-.16-.048-.208.032-.048.112.112.192.144.096.208-.032zm.497.545q.112-.08-.032-.256-.16-.144-.256-.048-.112.08.032.256.159.157.256.047zm.48.72q.144-.112 0-.304-.128-.208-.272-.096-.144.08 0 .288t.272.112zm.672.673q.128-.128-.064-.304-.192-.192-.32-.048-.144.128.064.304.192.192.32.044zm.913.4q.048-.176-.208-.256-.24-.064-.304.112t.208.24q.24.097.304-.096zm1.009.08q0-.208-.272-.176-.256 0-.256.176 0 .208.272.176.256.001.256-.175zm.929-.16q-.032-.176-.288-.144-.256.048-.224.24t.288.128.225-.224z"/></svg>
</a>
<a href="https://www.linkedin.com/in/saksham-vitwekar-92a141343/">
<svg fill="#ccc" className="h-6 w-6" version="1.1" xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 504.4 504.4">
<g>
<g>
<path d="M377.6,0.2H126.4C56.8,0.2,0,57,0,126.6v251.6c0,69.2,56.8,126,126.4,126H378c69.6,0,126.4-56.8,126.4-126.4V126.6
C504,57,447.2,0.2,377.6,0.2z M168,408.2H96v-208h72V408.2z M131.6,168.2c-20.4,0-36.8-16.4-36.8-36.8c0-20.4,16.4-36.8,36.8-36.8
c20.4,0,36.8,16.4,36.8,36.8C168,151.8,151.6,168.2,131.6,168.2z M408.4,408.2H408h-60V307.4c0-24.4-3.2-55.6-36.4-55.6
c-34,0-39.6,26.4-39.6,54v102.4h-60v-208h56v28h1.6c8.8-16,29.2-28.4,61.2-28.4c66,0,77.6,38,77.6,94.4V408.2z"/>
</g>
</g>
</svg>
</a>
<a href="https://www.reddit.com/user/_SomeTroller69/">
<svg fill="#ccc" className="h-7 w-7" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
viewBox="-268 289.4 262.6 222.6">
<g>
<path d="M-5.6,392.5c-4.4-23.6-30.2-34.8-50.3-21.8c-1.4,0.9-2.3,0.8-3.6,0c-15.1-8.8-31.4-14.2-48.5-17.1
c-5.8-1-11.6-1.6-17.6-2.3c4.8-13.6,9.5-27.1,14.3-40.7c11.1,2.6,22,5.4,32.9,7.7c2.9,0.6,4,1.8,4.7,4.8
c2.9,13.6,16,22.4,30.2,20.7c13-1.5,23.4-13.3,23.5-26.6c0.1-12.3-7.8-23.1-19.5-26.6c-11.8-3.5-24.1,1.1-30.8,11.5
c-1,1.5-1.8,1.7-3.5,1.3c-9.1-2.3-18.2-4.4-27.4-6.6c-6.7-1.6-13.4-3.2-20.2-4.8c-0.4,1-0.7,1.8-1,2.6
c-6.4,18.2-12.8,36.4-19.2,54.6c-0.5,1.5-1.2,2.2-2.9,2.2c-3.2,0.1-6.3,0.3-9.5,0.6c-21,2.1-41.1,7.7-59.5,18.3
c-1.6,0.9-2.7,1-4.3-0.1c-15.4-9.9-36.1-5.1-45.3,10.7c-2.3,4-3.3,8.7-4.9,13.1c0,2.6,0,5.1,0,7.7c0.8,2.8,1.5,5.8,2.5,8.5
c1.9,5.1,5.2,9.2,9.3,12.7c0.7,0.6,1.4,1.7,1.3,2.4c-1.6,15.7,2.9,29.5,12.2,42c10.5,14.3,24.6,24,40.6,31.2
c23.9,10.7,49.1,14.6,75.2,13.1c22.7-1.3,44.3-6.6,64.4-17.6c14.7-8.1,27.2-18.5,35.8-33.2c6.3-10.8,9-22.4,7.9-34.9
c-0.1-0.7,0.1-1.8,0.6-2.2c6.9-5.5,11.1-12.6,12.5-21.4c0-0.2,0.2-0.5,0.3-0.7c0-2.7,0-5.5,0-8.2C-5.3,393.3-5.5,392.9-5.6,392.5z
M-47.2,305.3c6.4,0,11.5,5.1,11.5,11.6c0,6.4-5.1,11.6-11.5,11.7c-6.4,0-11.8-5.3-11.7-11.7C-58.9,310.4-53.6,305.2-47.2,305.3z
M-249.2,406.9c-4-6-3.5-14.2,1.1-19.7c4.6-5.5,12.2-7.7,18.4-5.1C-237.8,389.1-244.5,397.2-249.2,406.9z M-44.6,460.3
c-9.3,11.8-21.6,19.5-35.2,25.3c-18.2,7.7-37.3,10.9-59.6,10.9c-21.2-0.2-44-4.7-65.1-16.2c-9.9-5.4-18.7-12.3-25.4-21.6
c-12.9-17.8-12.4-38.5,1.3-55.6c9.4-11.7,21.6-19.5,35.3-25.2c22-9.1,44.9-12.1,68.5-10.4c19.9,1.4,38.9,6.2,56.4,16
c9.7,5.4,18.4,12.2,25,21.3C-30.5,422.5-30.9,442.9-44.6,460.3z M-23.5,406.9c-2.9-4.4-5.6-9-8.9-13.1c-3.2-4.1-7-7.8-10.7-11.8
c6.3-2.6,14.1-0.3,18.7,5.6C-19.9,393.2-19.6,401.4-23.5,406.9z"/>
<path d="M-102.5,458c-3.5,2.4-7.1,4.8-11,6.4c-11.8,4.6-24.1,5.1-36.6,2.8c-7-1.3-13.7-3.6-19.2-8.5c-3.8-3.4-8.6-3.5-11.6-0.1
c-3.1,3.4-2.9,8.3,1,11.6c3.3,2.7,6.8,5.2,10.6,7.1c10.2,5.2,21.2,6.8,32.6,7.4c6.7-0.9,13.4-1.5,20-2.9
c9.2-1.9,17.7-5.6,24.8-12.1c3.3-3.1,3.5-7.8,0.6-11C-94.3,455.5-98.9,455.5-102.5,458z"/>
<path d="M-96.7,396.7c-12.2-0.3-22,9.1-22.2,21.1c-0.2,11.5,9.3,21.3,20.7,21.5c12.1,0.2,21.7-9,22-21
C-76,406.8-85.3,397-96.7,396.7z"/>
<path d="M-151.8,418.4c0.1-11.7-9.3-21.5-20.8-21.6c-12-0.2-21.6,9.1-21.8,21.1c-0.2,11.6,9.1,21.3,20.6,21.5
C-161.8,439.6-151.9,430.2-151.8,418.4z"/>
</g>
</svg>
</a>
</nav>
</footer>
);
}

245
src/app/utils/LogoSVG.tsx Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,12 @@
"use client"
import Link from "next/link";
type Props = {
"use client"
import Link from "next/link";
type Props = {
navbarToggle: React.Dispatch<React.SetStateAction<boolean>>;
};
};
export default function Navbar({navbarToggle}: Props){
export default function Navbar({navbarToggle}: Props){
return(
<div className="navbar h-14 bg-base-100 shadow-sm z-50 sticky top-0">
<div className="navbar h-14 bg-base-100 shadow-sm z-50 sticky top-0 md:col-span-2">
<div className="navbar-start sticky">
<div className="dropdown">
<button onClick={
@@ -29,43 +29,7 @@ export default function Navbar({navbarToggle}: Props){
</span>
</Link>
</div>
<div className="navbar-end">
<button className="btn btn-ghost btn-circle">
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /> </svg>
</button>
<button>
</button>
<label className="flex cursor-pointer gap-2 mt-0.5">
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round">
<circle cx="12" cy="12" r="5" />
<path
d="M12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4" />
</svg>
<input type="checkbox" value="synthwave" className="toggle theme-controller" />
<svg
xmlns="http://www.w3.org/2000/svg"
width="20"
height="20"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path>
</svg>
</label>
</div>
<div className="navbar-end"/>
</div>
);
}
}

View File

@@ -29,7 +29,7 @@ export default function Result({interpretation, calculated_value, unit, id, sect
viewBox="0 0 24 24" fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path d="M8.37032 11.0726L5.41421 14.0287C4.63317 14.8097 4.63316 16.076 5.41421 16.8571L6.95611 18.399C7.73715 19.18 9.00348 19.18 9.78453 18.399L12.7406 15.4429M11.0726 8.37032L14.0287 5.41421C14.8097 4.63317 16.076 4.63316 16.8571 5.41421L18.399 6.95611C19.18 7.73715 19.18 9.00348 18.399 9.78453L15.4429 12.7406M6.64883 6.64883L4.88296 4.88296M19.0992 19.0992L17.3333 17.3333M9.35119 5.87299V4M14.6488 20V18.127M5.87299 9.35119H4M20 14.6488H18.127" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M8.37032 11.0726L5.41421 14.0287C4.63317 14.8097 4.63316 16.076 5.41421 16.8571L6.95611 18.399C7.73715 19.18 9.00348 19.18 9.78453 18.399L12.7406 15.4429M11.0726 8.37032L14.0287 5.41421C14.8097 4.63317 16.076 4.63316 16.8571 5.41421L18.399 6.95611C19.18 7.73715 19.18 9.00348 18.399 9.78453L15.4429 12.7406M6.64883 6.64883L4.88296 4.88296M19.0992 19.0992L17.3333 17.3333M9.35119 5.87299V4M14.6488 20V18.127M5.87299 9.35119H4M20 14.6488H18.127" stroke="#000000" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round"/>
</svg>
<h6 className="leading-none">{calc.name}</h6></Link> : null}
<h2 className="card-title self-center">Calculated Score/Value: {calculated_value} {unit}</h2>

View File

@@ -13,7 +13,6 @@ export default function Sidemenu({isNavOpen}: Props){
<ul className={`menu bg-base-200 rounded-box
w-[300px] h-full
fixed top-[60px] left-0 z-40
transform-gpu will-change-transform
transition-all duration-500 ease-[cubic-bezier(0.22,1,0.36,1)] ${isNavOpen
? "translate-x-0 opacity-100 visible"

View File

@@ -1,5 +1,7 @@
"use client"
import { useEffect, useState } from "react";
export default function GetQuote(){
const quotes = [
{
@@ -107,7 +109,11 @@ export default function GetQuote(){
author: "Steve Goodier"
}
];
const quote = quotes[Math.floor(Math.random() * quotes.length)];
const [quote, setQuote] = useState<{quote:string, author:string}>({quote:"", author:""});
useEffect(() => {
setQuote(quotes[Math.floor(Math.random() * quotes.length)]);
}, [])
return(
<div className="mt-5">
<div className="chat chat-start">