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

54 make dashboard for before aplication #61

Merged
merged 37 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5a9bbaf
feat: skeleton code for the dashboard
ArtemisAaroe Oct 29, 2024
bfebadf
feat: dashboard partialy done. including
ArtemisAaroe Oct 30, 2024
4045b83
Merge branch 'main' into 54-make-dashboard-for-before-aplication
ArtemisAaroe Oct 30, 2024
ace7e23
fix add local dev port to alaw orphand
ArtemisAaroe Oct 30, 2024
f08bc67
fix: lint warnings
ArtemisAaroe Oct 30, 2024
6dbcc30
style: making ul more intuitive
ArtemisAaroe Oct 31, 2024
41a757a
fix: wird merge ting
ArtemisAaroe Oct 31, 2024
c1a566c
Merge remote-tracking branch 'origin/main' into 54-make-dashboard-for…
ArtemisAaroe Nov 1, 2024
c7e44fa
usertest build
ArtemisAaroe Nov 1, 2024
cea4987
added ink to arkivgpt
ArtemisAaroe Nov 1, 2024
38d2482
added link to dashboard
ArtemisAaroe Nov 1, 2024
872d32b
feat: added text to make purpuse clarer
ArtemisAaroe Nov 6, 2024
d45c341
style: trying to make responsiv
ArtemisAaroe Nov 6, 2024
2d49ebd
refactor: removed files that should not be there
ArtemisAaroe Nov 6, 2024
957b372
feat: local storage atempth
ArtemisAaroe Nov 6, 2024
d3ef877
Fix: Fix build failures
magnusgiverin Nov 7, 2024
ec2414e
refactor: separated dashboard logic in to componant
ArtemisAaroe Nov 7, 2024
249efdc
fix: layout bug were the d3 house box was misbehaving
ArtemisAaroe Nov 7, 2024
399bac7
fix: made cadaid mock respons sem more naturale
ArtemisAaroe Nov 8, 2024
f3a1a4d
Update webapp/src/app/under-soknad/byggeideer/dashbord/arkivgpt/page.tsx
ArtemisAaroe Nov 8, 2024
c7b2543
Update webapp/src/app/for-soknad/byggeideer/dashbord/cadaid/page.tsx
ArtemisAaroe Nov 8, 2024
4c5933c
Update webapp/src/app/for-soknad/byggeideer/dashbord/arkivgpt/page.tsx
ArtemisAaroe Nov 8, 2024
26a6458
Update webapp/src/components/ArkivGPTWidget.tsx
ArtemisAaroe Nov 8, 2024
93ddfca
Update webapp/src/components/PickAddress.tsx
ArtemisAaroe Nov 8, 2024
d837146
Update webapp/src/components/PickAddress.tsx
ArtemisAaroe Nov 8, 2024
cac1374
Update webapp/src/components/PickAddress.tsx
ArtemisAaroe Nov 8, 2024
354a9b7
fix: pr response
ArtemisAaroe Nov 8, 2024
822b45b
fix: under-soknad/byggeideer/dashord/cadaid/page fix
ArtemisAaroe Nov 8, 2024
12cc301
Fix: Fix HTML and shortcut name
magnusgiverin Nov 8, 2024
b559e8b
som more e2e tests
ArtemisAaroe Nov 8, 2024
8790d0f
Merge branch 'main' of github.com:kartAI/ntnu-kpro-ai-assistant into …
ArtemisAaroe Nov 8, 2024
edb76fa
Merge branch 'main' into 54-make-dashboard-for-before-aplication
ArtemisAaroe Nov 8, 2024
0b36f6e
added planprat to dashbord
ArtemisAaroe Nov 8, 2024
9f7b5e7
more e2e tests
ArtemisAaroe Nov 8, 2024
702664e
all tests added
ArtemisAaroe Nov 11, 2024
3c7ffd5
fix: bracking ui on userDashboard
ArtemisAaroe Nov 11, 2024
cf2b51a
fix: all tests run
ArtemisAaroe Nov 11, 2024
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
2 changes: 1 addition & 1 deletion backend/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def plan_prat(question: PlanPratRequest) -> PlanPratResponse:
question (PlanPratRequest): The query to PlanPrat.
Returns:
PlanPratResponse: The PlanPrat response.

backend/src/main.py
"""

logger.info(f"Query: {question}")
Expand Down
20 changes: 20 additions & 0 deletions webapp/cypress/e2e/pages/for-soknad-dashbord.cy.ts
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe("for-soknad-dashbord e2e Tests", () => {
const ROUTE = "for-soknad/byggeideer/dashbord"

beforeEach(() => {
cy.visit(`/${ROUTE}`)
})

it("should render content", () => {
cy.get('[data-cy="title"').should("be.visible")
cy.get('[data-cy="pick-address"').should("be.visible")
cy.get('[data-cy="todo-list"').should("be.visible")
cy.get('[data-cy="planprat"').should("be.visible")
cy.get('[data-cy="cadaid-widget"').should("be.visible")
cy.get('[data-cy="digital-tiltaksdata-widget"').should("be.visible")
cy.get('[data-cy="3d-visning-widget"').should("be.visible")
cy.get('[data-cy="document-overview"').should("be.visible")
cy.get('[data-cy="arkiv-gpt"').should("be.visible")
cy.get('[data-cy="start-aplication-button"').should("be.visible")
})
})
Binary file added webapp/public/actionMap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion webapp/src/app/data/shortcuts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const shortcuts: ShortcutLink[] = [
{ label: 'Planchat', url: '/for-soknad/planprat', text: "Få oversikt over hva du har lov å gjøre med denne chatbotten" },
{ label: 'Tiltakskart', url: '/for-soknad/tiltakskart', text: "Se tiltakene rundt deg"},
{ label: '3D-situasjonsmodell', url: '/for-soknad/3d-situasjon', text: "Se ditt tiltak i 3D kart" },
{ label: 'Min byggeide', url: '/for-soknad/byggeideer/dashbord', text: "Organiser informasjonen rundt din byggesøknad" },
],
},
{
Expand Down Expand Up @@ -55,7 +56,7 @@ const shortcuts: ShortcutLink[] = [
{ label: 'Søknadsinformasjon', url: '/for-soknad/soknadsinfo', text: "Se detaljert analyse av, og informasjon rundt, din byggesøknad" },
{ label: 'Tiltakskart', url: '/under-soknad/tiltakskart', text: "Se tiltakene rundt deg" },
{ label: '3D-situasjonsmodell', url: '/under-soknad/3d-situasjon', text: "Se ditt tiltak i 3D kart" },
{ label: 'Saken oppsummert', url: '/under-soknad/oppsummering', text: "Få totaloversikt over søknaden din" },
{ label: 'Min byggeidee', url: '/under-soknad/byggeideer/dashbord', text: "Organiser informasjonen rundt din byggesøknad" },
],
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ArkivGPTPage from "~/components/ArkivGPT";

export default async function ArkivGPT() {
return (
<div>
<ArkivGPTPage></ArkivGPTPage>
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
}
11 changes: 11 additions & 0 deletions webapp/src/app/for-soknad/byggeideer/dashbord/cadaid/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import CadaidPage from "~/components/CADAiD";

export default async function PlantegningsAnalyse() {
return (
<div>
<CadaidPage></CadaidPage>
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
}


9 changes: 9 additions & 0 deletions webapp/src/app/for-soknad/byggeideer/dashbord/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client";
import UserDashboard from "~/components/UserDashboard";

export default function Dashboard() {
return(
<UserDashboard/>
);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import ArkivGPTPage from "~/components/ArkivGPT";

export default async function ArkivGPT() {
return (
<div>
<ArkivGPTPage></ArkivGPTPage>
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client";
import UserDashboard from "~/components/UserDashboard";

export default function Dashboard() {
return(
<UserDashboard/>
);

}
9 changes: 9 additions & 0 deletions webapp/src/app/under-soknad/byggeideer/dashbord/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client";
import UserDashboard from "~/components/UserDashboard";

export default function Dashboard() {
return(
<UserDashboard/>
);

}
41 changes: 41 additions & 0 deletions webapp/src/components/ArkivGPTWidget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"use client";
import React from "react";
import Image from "next/image";
import { useRouter } from 'next/navigation';
interface ArkivGPTWidgetProps {
hasInputPickAddress: boolean;
}

export function ArkivGPTWidget({hasInputPickAddress}: ArkivGPTWidgetProps) {
const router = useRouter();

const handleNavigation = () => {
router.push('//localhost:3000/for-soknad/byggeideer/dashbord/arkivgpt');
ArtemisAaroe marked this conversation as resolved.
Show resolved Hide resolved
};


return(
<section data-cy="arkiv-gpt"
className="border rounded-md p-4 shadow-md hover:shadow-lg transition-all cursor-pointer lg:col-span-2"
onClick={handleNavigation}>
<div className="flex justify-between items-center">
<h1 className="font-bold text-xlwebapp/src/app/for-soknad/byggeideer/dashbord/page.tsx">Tomtens arkiv historikk</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hva gjør webapp/src/app/for-soknad/byggeideer/dashbord/page.tsx her?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h1 className="font-bold text-xlwebapp/src/app/for-soknad/byggeideer/dashbord/page.tsx">Tomtens arkiv historikk</h1>
<h1 className="font-bold text-xl">Tomtens arkiv historikk</h1>

<Image src={hasInputPickAddress? "/Ikoner/Dark/SVG/Check, Success.svg" : "/Ikoner/Dark/SVG/Warning.svg"}
alt={hasInputPickAddress? "hake" : "varselsymbol"}
className="bg-kartAI-blue rounded-sm p-1"
width={30}
height={30}/>

</div>
{hasInputPickAddress?
<div>
<p className="underline">KLIKK HER:</p>
<p>Les tidligere saker relatert til tomten</p>
</div>
:
<p>Ingen arkiv funnet</p>}

</section>

)
}
87 changes: 87 additions & 0 deletions webapp/src/components/CadaidWidget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
"use client";
import React, { use, useEffect, useState } from "react";
import Image from "next/image";
import { useRouter } from 'next/navigation';
interface CadaidWidgetProps {
setHasInputCadaidWidget: (value: boolean) => void;
hasInputCadaidWidget: boolean;
reportUrl: string;
}
interface response {
message: string;
type: string;
}

export function CadaidWidget({setHasInputCadaidWidget, hasInputCadaidWidget, reportUrl }: CadaidWidgetProps) {
const [cadaidRespons, setCadaidRespons] = useState<response[]>([])
const router = useRouter();

const handleNavigation = () => {
router.push(reportUrl);
};

const hardcodedRespons = [{message: "Du har fasade", type: "CONFIRMED"},
{message: "Du mangler snit", type: "MISSING"},
{message: "Du mangler situasjons kart", type: "MISSING" }]

const handleClick = () => {
handleNavigation();
if (!hasInputCadaidWidget) {
setHasInputCadaidWidget(true);
localStorage.setItem("CadaidRespons", JSON.stringify(cadaidRespons)) ;

}
}
useEffect(() => {
if (cadaidRespons.length > 0) {
localStorage.setItem("CadaidRespons", JSON.stringify(cadaidRespons)) ;
}
}, [cadaidRespons] )

useEffect(() => {
const storedCadaidRespons = localStorage.getItem("CadaidRespons")

if (storedCadaidRespons) {
try {
const parsedRespons: response[] = JSON.parse(storedCadaidRespons) as response[];
setCadaidRespons(parsedRespons);

if (parsedRespons.length > 0) {
setHasInputCadaidWidget(true);
}

} catch {
console.error("respons could not be parsed")
}
}
}, [setHasInputCadaidWidget])

return(
<section data-cy="cadaid-widget"
className="border rounded-md p-4 shadow-md hover:shadow-lg transition-all cursor-pointer lg:col-span-2"
onClick={handleClick}>
<div className="flex justify-between items-center">
<h1 className="font-bold text-xlwebapp/src/app/for-soknad/byggeideer/dashbord/page.tsx">Få oversikt over plantegninger</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<h1 className="font-bold text-xlwebapp/src/app/for-soknad/byggeideer/dashbord/page.tsx">Få oversikt over plantegninger</h1>
<h1 className="font-bold text-xl">Få oversikt over plantegninger</h1>

<Image src={hasInputCadaidWidget? "/Ikoner/Dark/SVG/Check, Success.svg" : "/Ikoner/Dark/SVG/Warning.svg"}
alt={hasInputCadaidWidget? "hake" : "varselsymbol"}
className="bg-kartAI-blue rounded-sm p-1"
width={30}
height={30}/>

</div>
{hasInputCadaidWidget?
<ul>
{cadaidRespons.map((response , index) => (
<li className={`${response.type === "MISSING" ? "text-red-600" : "text-black"}`}
key={index}>{response.message}</li>
))}
</ul>
:
<div>
<p className="underline">KLIKK HER: </p>
<p>Laste opp plantegning for å få se hva som må legges til før du skriver søknad</p>
</div>}

</section>
)
}
101 changes: 101 additions & 0 deletions webapp/src/components/DigitalTilraksdataWidget.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"use client";

import React, { useEffect, useState } from "react";
import Image from "next/image";
import { Button } from "./ui/button";

interface DigitalTiltaksdataWidgetProps {
hasInputDigitalTiltaksdataWidget: boolean;
setHasInputDigitalTiltaksdataWidget: (value: boolean) => void;
}

export function DigitalTiltaksdataWidget({hasInputDigitalTiltaksdataWidget, setHasInputDigitalTiltaksdataWidget}:DigitalTiltaksdataWidgetProps) {
const [isOverlayOpen, setIsOverlayOpen] = useState(false);

useEffect(() => {
if (hasInputDigitalTiltaksdataWidget) {
localStorage.setItem("hasInputDigitalTiltaksdataWidget", JSON.stringify(hasInputDigitalTiltaksdataWidget));
}
})

useEffect(() => {
const storedHasInputDigitalTiltaksdataWidget = localStorage.getItem("hasInputDigitalTiltaksdataWidget")

if (storedHasInputDigitalTiltaksdataWidget) {
try {
const parsedHasInputDigitalTiltaksdataWidget: boolean = JSON.parse(storedHasInputDigitalTiltaksdataWidget) as boolean;
setHasInputDigitalTiltaksdataWidget(parsedHasInputDigitalTiltaksdataWidget);
} catch {
console.error("respons could not be parsed");

}
}
})
const applyInput= () => {
setHasInputDigitalTiltaksdataWidget(true);
setIsOverlayOpen(false);
};




const toggleOverlay = () => setIsOverlayOpen(!isOverlayOpen);
return(
<section data-cy="digital-tiltaksdata-widget"
className="Border rounded-md p-4 shadow-md hover:shadow-lg transition-all cursor-pointer lg:col-span-2"
onClick={toggleOverlay}>

{hasInputDigitalTiltaksdataWidget?
<div>
<div className="flex justify-between items-center">
<h1 className="font-bold text-xl">Analyser bygg området</h1>
<Image src={hasInputDigitalTiltaksdataWidget? "/Ikoner/Dark/SVG/Check, Success.svg" : "/Ikoner/Dark/SVG/Warning.svg"}
alt={hasInputDigitalTiltaksdataWidget? "hake" : "varselsymbol"}
className="bg-kartAI-blue rounded-sm p-1"
width={30}
height={30}/>

</div>
<ul className="text-red-600">
<li>Høy konsentrasjon av radon</li>
<li>Nær fuldyrket jord</li>
<li>Nær maringrense</li>
<li>Skadefare</li>
</ul>
</div>
:
<div>
<div className="flex justify-between items-center">
<h1 className="font-bold">Analyser bygg området</h1>
<Image src={hasInputDigitalTiltaksdataWidget? "/Ikoner/Dark/SVG/Check, Success.svg" : "/Ikoner/Dark/SVG/Warning.svg"}
alt={hasInputDigitalTiltaksdataWidget? "hake" : "varselsymbol"}
className="bg-kartAI-blue rounded-sm p-1"
width={30}
height={30}/>

</div>
<p className="underline">KLIKK HER: </p>
<p>Tegn opp området du tenker å bygge på for å se om det er noen hindringer for å bygge der</p>
</div>
}


{isOverlayOpen && (
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center">
<div className="bg-white p-6 rounded-lg shadow-lg max-w-md w-full">
<h1><strong>Trykk på kartet for å merkere hvor du vil bygge</strong></h1>
<Image src="/actionMap.png" alt="kart" height={500} width={500} onClick={applyInput}></Image>
<div className="flex justify-end gap-4">
<Button
onClick={toggleOverlay}
className="bg-kartAI-blue hover:bg-red-600 mt-2"
>
Lukk
</Button>
</div>
</div>
</div>
)}
</section>
)
}
Loading
Loading