Skip to content

REK-155 Admin effectiveness analysis list in consultations and webinars, mocked details page#1136

Merged
mateuszBieniekEscola merged 8 commits into
mainfrom
feature/REK-155
Apr 9, 2026
Merged

REK-155 Admin effectiveness analysis list in consultations and webinars, mocked details page#1136
mateuszBieniekEscola merged 8 commits into
mainfrom
feature/REK-155

Conversation

@mateuszBieniekEscola
Copy link
Copy Markdown
Contributor

@mateuszBieniekEscola mateuszBieniekEscola commented Mar 26, 2026

Close REK-155
Close REK-156
Close REK-157
Close REK-158

<PageWrapper style={{boxShadow: "none"}}>
<TitleSection>
<Title level={3} style={{ margin: 0 }}>
Konsultacja Testowa
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

translations

<ExpiryText type="secondary">
<FormattedMessage
id="recording_available_until"
values={{ time: <ExpiryTime>9h 35m</ExpiryTime> }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hardcoded

</Text>
<Space size="large">
<RatingValue>6.75</RatingValue>
<RatingDescription type="secondary">
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hardcoded

Comment thread src/utils/utils.ts Outdated
};

export const EMOTION_POOL = [
{ icon: '😳', key: 'surprised', labelId: 'emotion_surprised' },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

keys as enum

Comment thread src/utils/utils.ts Outdated
{ icon: '🤢', key: 'disgusted', labelId: 'emotion_disgusted' },
{ icon: '🙁', key: 'sad', labelId: 'emotion_sad' },
{ icon: '😨', key: 'fearful', labelId: 'emotion_fearful' },
{ icon: '😆', key: 'happy', labelId: 'emotion_happy' },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

map labels to keys enums

model_id: number;
model_name: string;
model_type: 'consultation' | string;
avg_attention: string;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

type should be more type safety


const getDetailsPath = useCallback((record: RecommenderTerm) => {
if (modelType === 'webinar') {
return `/courses/webinars/effectiveness-analysis/${record.model_id}/${record.id}`;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A dedicated effectiveness-analysis/:modelId/:id route was added only for consultations under /other/consultations/effectiveness-analysis/:modelId/:id. This looks like a real bug: clicking Details for a webinar will likely not navigate to the correct screen.

font-size: 26px;
text-align: center;
`;
export const EffectivenessAnalysisDetails = () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You added a route with :modelId/:id, but the EffectivenessAnalysisDetails component itself appears to be fully mocked and does not use the route params at all. There is no sign of useParams, and the displayed data is generated locally using TOTAL_DURATION_SEC, getAttention, and Array.from(...).

Comment thread src/locales/en-US.ts Outdated
name: 'Name',
ID: 'ID',
effectiveness_analysis: 'Effectiveness analysis',
averange_attention: 'Average attention',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

average_attention

const actionRef = useRef<ActionType>();
const [loading, setLoading] = useState(false);

const getRecommenderTerms = useCallback(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

duplicated function

try {
const resFrames = await getAnalyticsChartFrames(analysisMeta.id, { interval: res });
if (resFrames?.success && resFrames.data) {
const firstTs = new Date(resFrames.data[0].window_start).getTime();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If resFrames.data is an empty array ([]), data[0] will be undefined and .window_start will throw a TypeError: Cannot read properties of undefined.

if (resFrames?.success && resFrames.data && resFrames.data.length > 0) { const firstTs = new Date(resFrames.data[0].window_start).getTime(); // ... }

total: 0,
success: false,
};
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The new request handler has no error handling whatsoever. If the API returns an error related to the YouTube token, the user will not see a message and the TokenForm dialogue will not open.

const [chartData, setChartData] = useState<ChartPoint[]>([]);
const Y_AXIS_WIDTH = 45;

const modelType = useMemo(() => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extracting information from a URL string is fragile. If someone changes the URL routing, it will break silently (returning “”). The route can pass the modelType as a parameter (it’s already in useParams but not in the path). Add modelType to the route path or pass it as a prop.

{ value: 300, label: <FormattedMessage id="time.minutes" values={{ value: 5 }} /> },
];

const EffectivenessAnalysisDetails = () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The component is too large; it needs to be split into smaller ones with fewer responsibilities. A refactor is needed here.

const [loading, setLoading] = useState<boolean>(false);
const [analysisMeta, setAnalysisMeta] = useState<AnalysisMeta | null>(null);
const [chartData, setChartData] = useState<ChartPoint[]>([]);
const Y_AXIS_WIDTH = 45;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

const inside component

width: '80px',
},
{
title: <FormattedMessage id="dateRange" defaultMessage="Date Range" />,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A lot of code is being removed from the table here – are you sure that’s how it’s supposed t

@mateuszBieniekEscola mateuszBieniekEscola merged commit b2b5b96 into main Apr 9, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants