Skip to content
Merged
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
7 changes: 5 additions & 2 deletions cypress/e2e/uxcg/uxcg-hy.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ describe('UXCG Armenian', () => {
});

it('Should open the first question and verify URL and content', () => {
cy.get('[data-cy="open-question"]').first().click();
cy.url().should('include', '/users-do-not-like-our-customer-support');
cy.get('[data-cy="open-question"]:visible').first().click();
cy.url({ timeout: 10000 }).should(
'include',
'/users-do-not-like-our-customer-support',
);
});
});
63 changes: 0 additions & 63 deletions lib/getArticleRedirects.ts

This file was deleted.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
"next-auth": "4.23.2",
"nodemailer": "^6.10.0",
"prettier": "^3.6.2",
"react": "19.0.1",
"react": "19.0.3",
"react-beautiful-dnd": "13.1.1",
"react-confetti": "6.1.0",
"react-confetti-explosion": "2.1.2",
"react-dom": "19.0.1",
"react-dom": "19.0.3",
"react-ga4": "1.4.1",
"react-icalendar-link": "3.0.2",
"react-intersection-observer": "^9.16.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/NPS/NPS.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.nps {
position: fixed;
bottom: 23px;
background-color: #ffffff;
background-color: #fafafa;
border: 1px solid #c4c4c4;
left: 50%;
border-radius: 4px;
padding: 14px 39px 12px 0;
Expand Down
1 change: 1 addition & 0 deletions src/components/ScorePanel/ScorePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const ScorePanel: FC<ScorePanelProps> = ({
width={110}
height={100}
alt={'Enlightened'}
unoptimized
/>
</div>
) : null
Expand Down
54 changes: 19 additions & 35 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { FC, memo, useCallback, useEffect, useRef, useState } from 'react';
import { useRouter } from 'next/router';
import cn from 'classnames';
import Link from 'next/link';

import Tag, { TTag } from '@components/Tag';
import Button from '@components/Button';
import Search from './TableSearch';

import type { QuestionType, TagType } from '@local-types/data';

import { TRouter } from '@local-types/global';

import tableIntl from '@data/table';

import Search from './TableSearch';
import styles from './Table.module.scss';
import Link from 'next/link';

type TableProps = {
data: QuestionType[];
Expand Down Expand Up @@ -51,10 +54,22 @@ const Table: FC<TableProps> = ({
setSearchValue,
setIsQuestionHovered,
}) => {
const router = useRouter();
const { locale } = router as TRouter;
const tableBodyRef = useRef(null);

const [data, setData] = useState(incomingData);
const [displayedItems, setDisplayedItems] = useState(data.length);
const [isActive, setIsActive] = useState(false);

const {
allQuestionsButtonLabel,
showMoreText,
showLessText,
noResultsText,
labelText,
} = tableIntl[locale];

const formatName = (number, title) => {
return `#${number}. ${title}`;
};
Expand All @@ -71,20 +86,6 @@ const Table: FC<TableProps> = ({
return () => clearInterval(interval);
}, []);

const router = useRouter();
const { locale } = router as TRouter;
const tableBodyRef = useRef(null);
const labelEn = 'Select your product stage';
const labelRu = 'Выберите стадию вашего проекта';
const labelHy = 'Ընտրեք ձեր պրոդուկտի փուլը';

const labelLocales = {
en: labelEn,
ru: labelRu,
hy: labelHy,
};
const label = labelLocales[locale];

const sortData = useCallback(dataToSort => {
const newData = [...dataToSort];
newData.sort((a: any, b: any) => {
Expand All @@ -96,19 +97,6 @@ const Table: FC<TableProps> = ({
return newData;
}, []);

const showMoreTxts = {
en: 'Show more',
ru: 'Показать больше',
hy: 'Ցույց տալ ավելին',
};
const showLessTxts = {
en: 'Show less',
ru: 'Показать меньше',
hy: 'Ցույց տալ պակաս',
};
const showMoreText = showMoreTxts[locale];
const showLessText = showLessTxts[locale];

const handleChange = useCallback(
(value: string) => {
onSearch && onSearch(value);
Expand All @@ -131,7 +119,6 @@ const Table: FC<TableProps> = ({

const findAnswerIndexByBiasNumber = useCallback(
(biasNumber: number, questionIndex: number) => {
// HYTranslation TODO
const answers = data[questionIndex]?.attributes?.answers.split('\n');
return answers.findIndex((item: string) => {
return item.includes(`{{${biasNumber}}}`);
Expand Down Expand Up @@ -171,7 +158,6 @@ const Table: FC<TableProps> = ({
}
}, [showMoreButton, data.length]);

const { allQuestionsButtonLabel } = tableIntl[locale];
return (
<>
{withSearch && (
Expand Down Expand Up @@ -200,7 +186,7 @@ const Table: FC<TableProps> = ({
[styles.LabelWrapperAnimation]: isActive,
})}
>
<span className={styles.SelectionTxt}> {label} </span>
<span className={styles.SelectionTxt}> {labelText} </span>
</div>
<Tag
dataId="all"
Expand Down Expand Up @@ -233,10 +219,9 @@ const Table: FC<TableProps> = ({
>
{noResults && (
<div className={styles.NoResults} data-cy={'No Results Found'}>
No results found
{noResultsText}
</div>
)}
{/*HYTranslation TODO*/}
{data.slice(0, displayedItems).map(({ attributes }, index) => {
const { slug } = attributes;
const itemTags = JSON.parse(attributes?.tags || '[]');
Expand All @@ -249,7 +234,6 @@ const Table: FC<TableProps> = ({

return (
<div
// style={{ display: isHidden ? 'none' : 'block' }}
data-cy="open-question"
key={index}
className={cn(styles.TableRow, {
Expand Down
10 changes: 5 additions & 5 deletions src/components/UXCGModal/UXCGModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,24 @@ const UXCGModal: FC<TUXCGModal> = ({

if (isOpen) {
handleHeightCalc();

if (modalBodyRef.current) {
modalBodyRef.current.scrollTo(0, 0);
}
setActiveTooltipId(null);

document.documentElement.style.overflowY = 'hidden';
document.body.classList.add('hide-body-move');
} else {
document.documentElement.style.overflowY = overflowDefaultValue;
document.body.classList.remove('hide-body-move');
}

// @ts-ignore
document.addEventListener('keydown', handleKeyDown);
document.addEventListener('keydown', handleKeyDown as any);

return () => {
document.documentElement.style.overflowY = overflowDefaultValue;
// @ts-ignore
document.removeEventListener('keydown', handleKeyDown);
document.body.classList.remove('hide-body-move');
document.removeEventListener('keydown', handleKeyDown as any);
};
}, [questionId, isOpen]);

Expand Down
4 changes: 4 additions & 0 deletions src/data/table/en.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const en = {
searchPlaceholder: 'Search by your keywords',
allQuestionsButtonLabel: 'All questions',
showMoreText: 'Show more',
showLessText: 'Show less',
noResultsText: ' No results found',
labelText: 'Select your product stage',
};

export default en;
4 changes: 4 additions & 0 deletions src/data/table/hy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const hy = {
searchPlaceholder: 'Որոնել ըստ բանալի բառերի',
allQuestionsButtonLabel: 'Բոլոր հարցերը',
showMoreText: 'Ցույց տալ ավելին',
showLessText: 'Ցույց տալ պակաս',
noResultsText: 'Արդյունքներ չեն գտնվել',
labelText: 'Ընտրեք ձեր պրոդուկտի փուլը',
};

export default hy;
4 changes: 4 additions & 0 deletions src/data/table/ru.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const ru = {
searchPlaceholder: 'Поиск по вашим словам',
allQuestionsButtonLabel: 'Все вопросы',
showMoreText: 'Показать больше',
showLessText: 'Показать меньше',
noResultsText: 'Результаты не найдены',
labelText: 'Выберите стадию вашего проекта',
};

export default ru;
2 changes: 1 addition & 1 deletion src/data/toolHeader/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const en = {
items: [
{
title: 'Cognitive biases in education',
link: '/uxeducation',
link: '/articles/uxeducation',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/data/toolHeader/hy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const hy = {
items: [
{
title: 'Կոգնիտիվ հակումները կրթության մեջ',
link: '/uxeducation',
link: '/articles/uxeducation',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion src/data/toolHeader/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ru = {
items: [
{
title: 'Использование проекта в образовательной системе',
link: '/ru/uxeducation',
link: '/ru/articles/uxeducation',
},
],
},
Expand Down
Loading
Loading