Skip to content

Commit

Permalink
moved to helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabowskiM committed Mar 18, 2024
1 parent 45905be commit da117be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const getLoadedLocationsLimitedMap = (loadedLocationsFullMap, activeLocationId) => {
const itemIndex = loadedLocationsFullMap.findIndex(({ parentLocationId }) => parentLocationId === activeLocationId);

if (itemIndex === -1) {
return [];
}

return loadedLocationsFullMap.slice(0, itemIndex + 1);
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ import React, { useContext, useState, useMemo, useEffect, useCallback } from 're

import Icon from '../../../common/icon/icon';

import { getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';
import { createCssClassNames } from '../../../common/helpers/css.class.names';
import { getLoadedLocationsLimitedMap } from './breadcrumbs.helpers';
import { LoadedLocationsMapContext, MarkedLocationIdContext, GridActiveLocationIdContext } from '../../universal.discovery.module';
import { getTranslator } from '@ibexa-admin-ui/src/bundle/Resources/public/js/scripts/helpers/context.helper';

const getLoadedLocationsLimitedMap = (loadedLocationsFullMap, activeLocationId) => {
const itemIndex = loadedLocationsFullMap.findIndex(({ parentLocationId }) => parentLocationId === activeLocationId);

return loadedLocationsFullMap.slice(0, itemIndex + 1);
};

const Breadcrumbs = () => {
const Translator = getTranslator();
Expand Down

0 comments on commit da117be

Please sign in to comment.