Add quality survey at the end of the call (#1084)

Signed-off-by: Timo K <toger5@hotmail.de>
Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
Timo 2023-06-07 16:22:44 +02:00 committed by GitHub
commit 2a6981c58d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 338 additions and 30 deletions

View file

@ -0,0 +1,23 @@
/*
Copyright 2023 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
.feedback textarea {
height: 75px;
border-radius: 8px;
}
.feedback {
border-radius: 8px;
}

View file

@ -0,0 +1,41 @@
/*
Copyright 2023 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
.starIcon {
cursor: pointer;
}
.starRating {
display: flex;
justify-content: center;
flex: 1;
}
.inputContainer {
display: inline-block;
}
.hideElement {
border: 0;
clip-path: content-box;
height: 0px;
width: 0px;
margin: -1px;
overflow: hidden;
padding: 0;
width: 1px;
display: inline-block;
}

View file

@ -0,0 +1,85 @@
/*
Copyright 2023 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import styles from "./StarRatingInput.module.css";
import { ReactComponent as StarSelected } from "../icons/StarSelected.svg";
import { ReactComponent as StarUnselected } from "../icons/StarUnselected.svg";
interface Props {
starCount: number;
onChange: (stars: number) => void;
required?: boolean;
}
export function StarRatingInput({
starCount,
onChange,
required,
}: Props): JSX.Element {
const [rating, setRating] = useState(0);
const [hover, setHover] = useState(0);
const { t } = useTranslation();
return (
<div className={styles.starRating}>
{[...Array(starCount)].map((_star, index) => {
index += 1;
return (
<div
className={styles.inputContainer}
onMouseEnter={() => setHover(index)}
onMouseLeave={() => setHover(rating)}
key={index}
>
<input
className={styles.hideElement}
type="radio"
id={"starInput" + String(index)}
value={String(index) + "Star"}
name="star rating"
onChange={(_ev) => {
setRating(index);
onChange(index);
}}
required
/>
<label
className={styles.hideElement}
id={"starInvisibleLabel" + String(index)}
htmlFor={String(index)}
>
{t("{{count}} stars", {
count: index,
})}
</label>
<label
className={styles.starIcon}
id={"starIcon" + String(index)}
htmlFor={String(index)}
>
{index <= (hover || rating) ? (
<StarSelected />
) : (
<StarUnselected />
)}
</label>
</div>
);
})}
</div>
);
}