Skip to content
Snippets Groups Projects

feat(export): MIN-162 select annotation

Merged mateusz-winiarczyk requested to merge MIN-162-select-annotation into development
3 unresolved threads
Short description:

Added select annotation in export drawer

Approach:

Added export drawer with tabs. Select annotation was created along with fetching data from the backend.

export

Edited by mateusz-winiarczyk

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 import { stepTypeExportDrawerStateSelector } from '@/redux/drawer/drawer.selectors';
2 import { useAppSelector } from '@/redux/hooks/useAppSelector';
3 import { DrawerHeading } from '@/shared/DrawerHeading';
4 import { TabNavigator } from './TabNavigator';
5 import { Elements } from './Elements';
6
7 export const ExportDrawer = (): React.ReactNode => {
8 const stepType = useAppSelector(stepTypeExportDrawerStateSelector);
  • I'm curious what is behind this decision ;) It might be also locally stored state since it's simplest stepper and not that complicated compared to "stepper" in search drawer.

    According to redux FAQ

    Do I have to put all my state into Redux? Should I ever use React's useState or useReducer?
    There is no “right” answer for this. Some users prefer to keep every single piece of data in Redux,
    to maintain a fully serializable and controlled version of their application at all times. 
    Others prefer to keep non-critical or UI state, such as “is this dropdown currently open”, 
    inside a component's internal state.

    Don't get me wrong - it's not that implementation is bad. I'm asking just by curiosity

  • mateusz-winiarczyk changed this line in version 2 of the diff

    changed this line in version 2 of the diff

  • I wanted to adhere to the convention I observed in the store where a similar solution already existed. However, in this case, it seems like an overkill because we won't be using it anywhere globally, only in the export drawer component. We can keep it in the local state without any problem. I believe that if this is not our convention, the fewer things we add to the global store, the better.

    Fixed

  • Please register or sign in to reply
  • 10 const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
    11
    12 return (
    13 render(
    14 <Wrapper>
    15 <Annotations />
    16 </Wrapper>,
    17 ),
    18 {
    19 store,
    20 }
    21 );
    22 };
    23
    24 describe('Annotations Component', () => {
    25 test('renders without crashing', () => {
  • 1 /* eslint-disable no-magic-numbers */
    2 import Image from 'next/image';
    3 import React, { KeyboardEvent, useEffect, useState } from 'react';
    4 import lensIcon from '@/assets/vectors/icons/lens.svg';
    5
    6 type CheckboxItem = { id: string; label: string };
    7
    8 type CheckboxFilterProps = {
    9 options: CheckboxItem[];
    10 onFilterChange?: (filteredItems: CheckboxItem[]) => void;
    11 onCheckedChange?: (filteredItems: CheckboxItem[]) => void;
    12 };
    13
    14 const ENTER_KEY_CODE = 'Enter';
    15
    16 export const CheckboxFilter = ({
  • I found two solutions that might be discussed.

    Overall - good, clean code LGTM

  • Tadeusz Miesiąc approved this merge request

    approved this merge request

  • added 2 commits

    • 248d4bf2 - test(export): add additional tests for checkboxfilter and annotations
    • ef3ca496 - refactor(export): move export tabs state to local state

    Compare with previous version

  • added 1 commit

    • 26d66b48 - test(export): add tests for export drawer

    Compare with previous version

  • added 5 commits

    Compare with previous version

  • mentioned in commit 5a7c99ce

  • Please register or sign in to reply
    Loading