From ff167f49d7d95e8f668812ccf92d4cebe31b8924 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Mon, 18 Dec 2023 17:22:21 +0300 Subject: [PATCH] [MIRROR] Fixes interview panel [NO GBP] [MDB IGNORE] (#25689) (#1178) * Fixes interview panel [NO GBP] (#80395) ## About The Pull Request This was a problematic UI based on how React handles onChange compared to Inferno, our previous. It was extra laggy after the switch, sending data on every key. When I had changed it to not send on keystroke, it wasn't super obvious that you must press "enter". I've tried to make this more obvious, and it now also safeguards against incomplete forms. This should resolve the issue, but not a screen I can test locally 100%.
Pictures ![image](https://github.com/tgstation/tgstation/assets/42397676/3f06e0ab-3a58-4d03-b3c4-fdd809937bfc)
## Why It's Good For The Game Bug fix fixes #80378 ## Changelog :cl: fix: Interview UI should now be more obvious how it works: You must press "enter" or save the answer. /:cl: * Fixes interview panel [NO GBP] --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com> --- tgui/packages/tgui/interfaces/Interview.tsx | 146 +++++++++++++------- 1 file changed, 97 insertions(+), 49 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Interview.tsx b/tgui/packages/tgui/interfaces/Interview.tsx index 4c996ac3651..78f8266f476 100644 --- a/tgui/packages/tgui/interfaces/Interview.tsx +++ b/tgui/packages/tgui/interfaces/Interview.tsx @@ -4,10 +4,11 @@ import { Section, BlockQuote, NoticeBox, + Box, } from '../components'; import { Window } from '../layouts'; import { useBackend } from '../backend'; -import { ReactNode } from 'react'; +import { ReactNode, useState } from 'react'; type Data = { connected: boolean; @@ -22,7 +23,7 @@ type Data = { type Question = { qidx: number; question: string; - response: string; + response: string | null; }; enum STATUS { @@ -56,13 +57,16 @@ export const Interview = (props) => { const { connected, is_admin, - questions = [], // TODO: Remove default + questions = [], queue_pos, read_only, status, welcome_message = '', } = data; + const allAnswered = questions.every((q) => q.response); + const numAnswered = questions.filter((q) => q.response)?.length; + return ( { buttons={ {!!is_admin && status === 'interview_pending' && ( - + + )} } > {!read_only && ( -

- Please answer the following questions, and press submit when you - are satisfied with your answers. -
-
- You will not be able to edit your answers after submitting. -

+ <> + + Please answer the following questions. + + + + You will not be able to edit your answers after submitting. + + )} - {questions.map(({ qidx, question, response }) => ( -
-

{linkifyText(question)}

- {((read_only || is_admin) && ( -
{response || 'No response.'}
- )) || ( -