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

Fix compile warnings #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const AdvancedQuestionOptions = ({ item, parentArray }: AdvancedQuestionOptionsP
<div className="msg-error" aria-live="polite">
{`${t('LinkId is already in use')} `}
<button onClick={resetLinkId}>
<img src={UndoIcon} height={16} />
<img src={UndoIcon} alt="Undo Button" height={16} />
{` ${t('Sett tilbake til opprinnelig verdi')}`}
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Languages/Translation/TranslateSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const TranslateSettings = ({
<div>
<div className="translation-section-header">{t('Questionnaire settings')}</div>
{Object.values(translatableSettings).map((extensionToTranslate) => {
if (!extensionToTranslate) return;
if (!extensionToTranslate) return [];

const mainExtension = (extensions || []).find((e) => e.url === extensionToTranslate.extension);
let baseValue;
Expand Down
12 changes: 0 additions & 12 deletions src/components/Metadata/MetadataEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { TreeContext } from '../../store/treeStore/treeStore';
import { updateQuestionnaireMetadataAction } from '../../store/treeStore/treeActions';
import RadioBtn from '../RadioBtn/RadioBtn';
import InputField from '../InputField/inputField';
import { UseContextSystem } from '../../types/IQuestionnareItemType';

const MetadataEditor = (): JSX.Element => {
const { t } = useTranslation();
Expand All @@ -31,17 +30,6 @@ const MetadataEditor = (): JSX.Element => {
dispatch(updateQuestionnaireMetadataAction(propName, value));
};

const getUseContextSystem = (): string => {
const system =
qMetadata.useContext &&
qMetadata.useContext.length > 0 &&
qMetadata.useContext[0].valueCodeableConcept?.coding &&
qMetadata.useContext[0].valueCodeableConcept.coding.length > 0 &&
qMetadata.useContext[0].valueCodeableConcept.coding[0].system;

return system || UseContextSystem.helsetjeneste_full;
};

return (
<div id="metadata-editor">
<FormField label={t('Identifier')}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const Navbar = ({
<>
<header ref={navBarRef}>
<div className="pull-left form-title">
<h1><IconBtn type="x" title={t('Close')} onClick={() => {close()}} /><a className="survey-title-button" onClick={toggleFormDetails}>{title || 'Phoenix Survey Builder'}</a></h1>
<h1><IconBtn type="x" title={t('Close')} onClick={() => {close()}} /><a className="survey-title-button" href="#!" onClick={toggleFormDetails}>{title || 'Phoenix Survey Builder'}</a></h1>
</div>

<div className="pull-right">
Expand Down
9 changes: 2 additions & 7 deletions src/components/Question/Question.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IExtentionType, IItemProperty, IQuestionnaireItemType } from '../../typ
import { updateItemAction } from '../../store/treeStore/treeActions';
import { isRecipientList } from '../../helpers/QuestionHelper';
import { createMarkdownExtension, removeItemExtension, setItemExtension, hasExtension } from '../../helpers/extensionHelper';
import { isItemControlInline, isItemControlReceiverComponent, isItemControlHighlight } from '../../helpers/itemControl';
import { isItemControlInline, isItemControlHighlight } from '../../helpers/itemControl';

import Accordion from '../Accordion/Accordion';
import { ActionType } from '../../store/treeStore/treeStore';
Expand All @@ -36,7 +36,6 @@ import { ValidationErrors } from '../../helpers/orphanValidation';
import {
canTypeBeRequired,
canTypeBeValidated,
canTypeHaveSublabel,
getItemDisplayType,
} from '../../helpers/questionTypeFeatures';
import SliderSettings from './SliderSettings/SliderSettings';
Expand All @@ -54,7 +53,7 @@ interface QuestionProps {

const Question = (props: QuestionProps): JSX.Element => {
const { t } = useTranslation();
const [isMarkdownActivated, setIsMarkdownActivated] = React.useState<boolean>(!!props.item._text);
const [isMarkdownActivated] = React.useState<boolean>(!!props.item._text);
Comment on lines -57 to +56
Copy link
Member

@vishnuravi vishnuravi Aug 23, 2024

Choose a reason for hiding this comment

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

If we are removing the function that allows us to set this state variable, what is the purpose of keeping the state variable? Can we remove it all together and refactor the code referencing it?

const codeElements = props.item.code ? `(${props.item.code.length})` : '(0)';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const removeMd = require('remove-markdown');
Expand All @@ -75,10 +74,6 @@ const Question = (props: QuestionProps): JSX.Element => {
return labelText || props.item.text || '';
};

const getSublabelText = (): string => {
return props.item.extension?.find((x) => x.url === IExtentionType.sublabel)?.valueMarkdown || '';
};

Comment on lines -78 to -81
Copy link
Member

Choose a reason for hiding this comment

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

There appears to be some code referencing this helper function that is currently commented out. If this function is to be removed, I would also recommend removing the commented out code that is referencing it.

const convertToPlaintext = (stringToBeConverted: string) => {
let plainText = removeMd(stringToBeConverted);
plainText = plainText.replaceAll('\\*', '*');
Expand Down
2 changes: 1 addition & 1 deletion src/components/Question/QuestionType/Choice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import SwitchBtn from '../../SwitchBtn/SwitchBtn';
import { createUriUUID } from '../../../helpers/uriHelper';
import DraggableAnswerOptions from '../../AnswerOption/DraggableAnswerOptions';
import PredefinedValueSets from './PredefinedValueSets';
import { ItemControlType, isItemControlCheckbox, isItemControlDropDown } from '../../../helpers/itemControl';
import { ItemControlType, isItemControlCheckbox } from '../../../helpers/itemControl';
import { checkboxExtension } from '../../../helpers/QuestionHelper';

type Props = {
Expand Down
Loading