diff --git a/website/src/components/FlaggableElement.tsx b/website/src/components/FlaggableElement.tsx index cae24484..c8fc17ce 100644 --- a/website/src/components/FlaggableElement.tsx +++ b/website/src/components/FlaggableElement.tsx @@ -2,6 +2,7 @@ import { Button, Checkbox, Flex, + Grid, Popover, PopoverAnchor, PopoverArrow, @@ -15,6 +16,7 @@ import { SliderTrack, Spacer, useBoolean, + useId, } from "@chakra-ui/react"; import { FlagIcon, QuestionMarkCircleIcon } from "@heroicons/react/20/solid"; import { useState } from "react"; @@ -65,58 +67,47 @@ export const FlaggableElement = (props) => { isLazy lazyBehavior="keepMounted" > -
+ {props.children} - -
+ - -
- -
    - {TEXT_LABEL_FLAGS.map((option, i) => { - return ( - - ); - })} -
-
- -
-
+
+
+ + {TEXT_LABEL_FLAGS.map((option, i) => ( + + ))} + + + + ); }; -function FlagCheckboxLi(props: { +function FlagCheckbox(props: { option: textFlagLabels; idx: number; checkboxValues: boolean[]; @@ -136,37 +127,35 @@ function FlagCheckboxLi(props: { ); } + const id = useId(); + return ( -
  • - - { - props.checkboxHandler(e.target.checked, props.idx); - }} - /> - - - { - props.sliderHandler(val / 100, props.idx); - }} - > - - - - - - -
  • + + { + props.checkboxHandler(e.target.checked, props.idx); + }} + /> + + + { + props.sliderHandler(val / 100, props.idx); + }} + > + + + + + + ); } interface textFlagLabels { diff --git a/website/src/components/Messages.tsx b/website/src/components/Messages.tsx index cc94fcc0..5b77cd26 100644 --- a/website/src/components/Messages.tsx +++ b/website/src/components/Messages.tsx @@ -1,3 +1,4 @@ +import { Grid } from "@chakra-ui/react"; import { FlaggableElement } from "./FlaggableElement"; export interface Message { @@ -10,18 +11,13 @@ const getColor = (isAssistant: boolean) => (isAssistant ? "bg-slate-800" : "bg-s export const Messages = ({ messages, post_id }: { messages: Message[]; post_id: string }) => { const items = messages.map(({ text, is_assistant }: Message, i: number) => { return ( -
    - -
    - {text} -
    -
    -
    + +
    + {text} +
    +
    ); }); // Maybe also show a legend of the colors? - return <>{items}; + return {items}; }; diff --git a/website/src/pages/account/index.tsx b/website/src/pages/account/index.tsx index 51f7ed38..9f8dc4a3 100644 --- a/website/src/pages/account/index.tsx +++ b/website/src/pages/account/index.tsx @@ -2,24 +2,10 @@ import { Button } from "@chakra-ui/react"; import Head from "next/head"; import Link from "next/link"; import { useSession } from "next-auth/react"; -import React, { useState } from "react"; +import React from "react"; export default function Account() { const { data: session } = useSession(); - const [username, setUsername] = useState("null"); - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const handleUpdate = async () => { - const response = await fetch("../api/update", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ username }), - }); - const { name } = await response.json(); - setUsername(name); - }; if (!session) { return; @@ -34,7 +20,7 @@ export default function Account() { />
    -

    {username}

    +

    {session.user.name || "No username"}

    diff --git a/website/src/pages/api/new_task/[task_type].ts b/website/src/pages/api/new_task/[task_type].ts index 69548b5f..2a2a0215 100644 --- a/website/src/pages/api/new_task/[task_type].ts +++ b/website/src/pages/api/new_task/[task_type].ts @@ -63,7 +63,6 @@ const handler = async (req, res) => { message_id: registeredTask.id, }), }); - await ackRes.json(); // Send the results to the client. res.status(200).json(registeredTask);