Skip to content

Conversation

Salam-Dalloul
Copy link
Contributor

No description provided.

@Salam-Dalloul Salam-Dalloul changed the title Feature/dkn 205 Feature/dkn 205 Update the Query Assistant as per new design Oct 2, 2025
@ddelpiano ddelpiano changed the base branch from feature/DKN-204 to develop October 3, 2025 13:26
@Salam-Dalloul Salam-Dalloul changed the title Feature/dkn 205 Update the Query Assistant as per new design #DKN-205 Update the Query Assistant as per new design Oct 5, 2025
#DKN-206 #DKN-207 Update the filter question to have a single column in the ta…
@Copilot Copilot AI review requested due to automatic review settings October 5, 2025 12:40
@Salam-Dalloul Salam-Dalloul changed the title #DKN-205 Update the Query Assistant as per new design #DKN-205 Update the Query Assistant style Oct 5, 2025
@Salam-Dalloul Salam-Dalloul changed the title #DKN-205 Update the Query Assistant style #DKN-205 #DKN-206 #DKN-207 Update the Query Assistant style Oct 5, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the Query Assistant component to implement a new design based on ticket #DKN-205. The changes modernize the user interface with improved responsive behavior and better code organization.

  • Extracted reusable components and hooks for better maintainability
  • Implemented responsive sidebar and preview panel behavior
  • Added new design elements including better typography and styling

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
applications/dknet/frontend/src/utils/types.ts Adds TypeScript interfaces for component props and configuration
applications/dknet/frontend/src/utils/helpers.ts Adds utility function for identifying top match results
applications/dknet/frontend/src/utils/constants.ts Defines responsive breakpoints and configuration constants
applications/dknet/frontend/src/theme/variables.js Adds new color variables for updated design
applications/dknet/frontend/src/theme/Theme.tsx Updates typography, scrollbar, and component styling
applications/dknet/frontend/src/hooks/*.ts Creates custom hooks for responsive behavior and filter logic
applications/dknet/frontend/src/components/FilterAssistantDialog/*.tsx Refactors dialog components with new responsive layout and design
applications/dknet/frontend/src/components/ExpandableText.tsx Adds new expandable text component for question descriptions
applications/dknet/frontend/.eslintrc.yml Disables indent ESLint rule

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 112 to 118
const handleResetFilters = () => {
setContext({
...context,
showAll: false,
filterValues: resetFilters(context.allFilters)
});
};
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The handleResetFilters function should be wrapped in useCallback to prevent unnecessary re-renders of child components that depend on this function.

Suggested change
const handleResetFilters = () => {
setContext({
...context,
showAll: false,
filterValues: resetFilters(context.allFilters)
});
};
const handleResetFilters = useCallback(() => {
setContext({
...context,
showAll: false,
filterValues: resetFilters(context.allFilters)
});
}, [context, setContext]);

Copilot uses AI. Check for mistakes.

))}
</List>
{
!isFiltersEmpty && results.length !== 0 && <Box sx={styles.fadeOverlay(showPreview)} />
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The condition !isFiltersEmpty && results.length !== 0 is redundant. If filters are not empty and there are results, results.length !== 0 is implied by the results mapping above.

Suggested change
!isFiltersEmpty && results.length !== 0 && <Box sx={styles.fadeOverlay(showPreview)} />
!isFiltersEmpty && <Box sx={styles.fadeOverlay(showPreview)} />

Copilot uses AI. Check for mistakes.

Comment on lines +195 to +202
<Box
key={`itemKey_${index}`}
sx={{
...styles.getItemSx(getCheckedStateForSingle(currentQuestion, data) === 'checked-state'),
...styles.getSingleChoiceItem(shouldExpandHeight, isLastItem),
}}
onClick={(e) => handleOptionClick(e, data)}
>
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The inline arrow function in onClick will be recreated on every render. Consider using useCallback for handleOptionClick or move it to a separate handler function.

Copilot uses AI. Check for mistakes.

Comment on lines 47 to 55
return {
context,
isFiltersEmpty: isFiltersEmpty(),
handleSingleOptionSelect,
isOptionSelectedForMultiple,
isOptionSelectedForSingle,
filterValues: context.filterValues,
results: context.results
};
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The isFiltersEmpty() function is called on every render. Consider memoizing this value with useMemo since it depends on context.filterValues.

Copilot uses AI. Check for mistakes.

@Salam-Dalloul Salam-Dalloul requested a review from Copilot October 5, 2025 12:58
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

flex: 1,
overflow: 'auto',
height: '100%',
maxWidth: props.maxWidth || '100%',
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The maxWidth prop is not defined in the component's props interface. Consider adding proper TypeScript typing for the props parameter to improve type safety.

Copilot uses AI. Check for mistakes.

}, [results]);

const getPrimaryText = useCallback((el: ResultItem) => {
return !isNaN(el.pctMatch || 0) ? `${el.label} ${el.pctMatch}%` : el.label;
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The logic for checking !isNaN(el.pctMatch || 0) is duplicated in multiple places. Consider extracting this into a helper function like hasValidPercentageMatch for better maintainability.

Copilot uses AI. Check for mistakes.

Comment on lines +53 to +54
export const isTopMatch = (item: ResultItem, index: number, results: ResultItem[]): boolean => {
return (index === 0 || item.pctMatch === results[0]?.pctMatch) && !isNaN(item.pctMatch || 0);
Copy link
Preview

Copilot AI Oct 5, 2025

Choose a reason for hiding this comment

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

The same !isNaN(item.pctMatch || 0) pattern is used here and in PreviewPanel. Consider creating a shared utility function for this validation logic.

Suggested change
export const isTopMatch = (item: ResultItem, index: number, results: ResultItem[]): boolean => {
return (index === 0 || item.pctMatch === results[0]?.pctMatch) && !isNaN(item.pctMatch || 0);
export function isValidPctMatch(value: number | undefined | null): boolean {
return !isNaN(value ?? 0);
}
export const isTopMatch = (item: ResultItem, index: number, results: ResultItem[]): boolean => {
return (index === 0 || item.pctMatch === results[0]?.pctMatch) && isValidPctMatch(item.pctMatch);

Copilot uses AI. Check for mistakes.

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.

1 participant