diff --git a/src/client/Layout.tsx b/src/client/Layout.tsx
index 6c995d1..9a13fb1 100644
--- a/src/client/Layout.tsx
+++ b/src/client/Layout.tsx
@@ -1,14 +1,15 @@
-import { Box, CssBaseline, Link, Sheet, Typography } from "@mui/joy";
-import React from "react";
+import { Box, Button, CssBaseline, Link, Sheet, Typography } from "@mui/joy";
import { Toaster } from "sonner";
import { GitHub } from "@mui/icons-material"
import hyLogo from "./assets/hy_logo.svg"
import toskaLogo from "./assets/toska13.png"
import { Link as RouterLink, Outlet } from "react-router-dom";
import { useTranslation } from "react-i18next";
+import { FeedbackProvider, useFeedback } from "./feedback/FeedbackProvider";
const Header = () => {
const { t } = useTranslation()
+ const { mode, setMode } = useFeedback()
return (
{
{t("navbar.description")}
+
+
+
)
}
+
const Footer = () => (
(
const Layout = () => (
-
-
-
-
-
+
+
+
+
+
+
+
)
diff --git a/src/client/components/Calculator.tsx b/src/client/components/Calculator.tsx
index 3b53951..39442fe 100644
--- a/src/client/components/Calculator.tsx
+++ b/src/client/components/Calculator.tsx
@@ -4,6 +4,7 @@ import useContractStore, { useTotalHours, useWorkHourCalculatorFields } from '..
import { Option } from '../types'
import { courseTypeOptions, creditOptions, preparationHoursTableData, studentCountOptions } from '../calculatorConfig'
import { SectionDivider } from './common'
+import FeedbackTargetContainer from '../feedback/FeedbackTargetContainer'
const HoursChip = ({ hours }: { hours: number }) => (
{`${hours} tuntia`}
@@ -16,7 +17,7 @@ const SalaryChip = ({ salary, unit='€/h' }: { salary: number, unit?: string })
const InputContainer = ({ children, resultName, resultChip, infoBox, sx }: { children: React.ReactNode, resultName?: string, resultChip?: React.ReactNode, infoBox?: React.ReactNode, sx?: SxProps }) => (
-
+
-
+
)
diff --git a/src/client/feedback/FeedbackForm.tsx b/src/client/feedback/FeedbackForm.tsx
new file mode 100644
index 0000000..280b59d
--- /dev/null
+++ b/src/client/feedback/FeedbackForm.tsx
@@ -0,0 +1,23 @@
+import { Box, Button, FormControl, FormLabel, Input, Sheet, Textarea, Typography } from "@mui/joy"
+import React from "react"
+
+const FeedbackForm = () => {
+ const [feedbackText, setFeedbackText] = React.useState("")
+
+ return (
+
+
+
+
+
+ )
+}
+
+export default FeedbackForm
\ No newline at end of file
diff --git a/src/client/feedback/FeedbackProvider.tsx b/src/client/feedback/FeedbackProvider.tsx
new file mode 100644
index 0000000..a85a560
--- /dev/null
+++ b/src/client/feedback/FeedbackProvider.tsx
@@ -0,0 +1,26 @@
+import React from "react";
+
+type Mode = "disabled"|"edit"|"view"
+
+const FeedbackContext = React.createContext<{
+ mode: Mode,
+ setMode: (newMode: Mode) => void
+}>({
+ mode: "disabled",
+ setMode: (mode: Mode) => {}
+})
+
+export const useFeedback = () => React.useContext(FeedbackContext)
+
+export const FeedbackProvider = ({ children }: { children: React.ReactNode }) => {
+ const [mode, setMode] = React.useState("edit")
+
+ return (
+
+ {children}
+
+ )
+}
\ No newline at end of file
diff --git a/src/client/feedback/FeedbackTargetContainer.tsx b/src/client/feedback/FeedbackTargetContainer.tsx
new file mode 100644
index 0000000..f5e894e
--- /dev/null
+++ b/src/client/feedback/FeedbackTargetContainer.tsx
@@ -0,0 +1,64 @@
+import React from "react";
+import { useFeedback } from "./FeedbackProvider";
+import { Box, Tooltip } from "@mui/joy";
+import { SxProps } from "@mui/joy/styles/types";
+import FeedbackForm from "./FeedbackForm";
+
+type FeedbackTargetContainerProps = {
+ feedbackId: string
+} & React.ComponentProps
+
+const ActiveFeedbackTargetContainer = (props: FeedbackTargetContainerProps) => {
+ const [open, setOpen] = React.useState(false)
+ const [opened, setOpened] = React.useState(false)
+
+ const activeSx: SxProps = {
+ outlineStyle: "solid",
+ outlineColor: "lightblue",
+ outlineWidth: "2px",
+ outlineOffset: "2px",
+ borderRadius: "2px",
+ cursor: "pointer",
+ "&:hover": {
+ outlineColor: "blue",
+ },
+ }
+
+ const handleClick = () => {
+ const newOpen = !open
+ setOpen(newOpen)
+ if (newOpen) setOpened(true)
+ console.log(`Feedback ${newOpen ? "opened" : "closed"} for `, props.feedbackId)
+ }
+
+ return (
+ } open={open} keepMounted={opened}>
+
+ {props.children}
+
+
+ )
+}
+
+const FeedbackTargetContainer = (props: FeedbackTargetContainerProps) => {
+ const { mode } = useFeedback()
+
+ if (mode === "disabled") {
+ return (
+
+ {props.children}
+
+ )
+ }
+
+ return (
+
+ {props.children}
+
+ )
+}
+
+export default FeedbackTargetContainer
\ No newline at end of file