Skip to content

Commit

Permalink
added yaml config, adjusted contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic committed Nov 1, 2024
1 parent 679f733 commit 82b5698
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 90 deletions.
8 changes: 8 additions & 0 deletions src/bundle/Resources/config/universal_discovery_widget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,11 @@ system:
multiple: false
image_picker:
active_tab: 'browse'
products_tab:
active_tab: 'products'
active_sort_clause: 'ContentName'
active_view: 'product-tab-table-view'
tabs_config:
products:
items_per_page: 50
priority: 30
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { SelectedLocationsContext, AllowConfirmationContext } from '../../univer
const SelectedLocations = () => {
const Translator = getTranslator();
const refSelectedLocations = useRef(null);
const refTogglerButton = useRef(null);
const [selectedLocations, dispatchSelectedLocationsAction] = useContext(SelectedLocationsContext);
const allowConfirmation = useContext(AllowConfirmationContext);
const [isExpanded, setIsExpanded] = useState(false);
Expand Down Expand Up @@ -54,7 +53,6 @@ const SelectedLocations = () => {
const renderToggleButton = () => {
return (
<button
ref={refTogglerButton}
type="button"
className="c-selected-locations__toggle-button btn ibexa-btn ibexa-btn--tertiary ibexa-btn--small ibexa-btn--no-text"
onClick={toggleExpanded}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ import PropTypes from 'prop-types';

import SimpleDropdown from '../../../common/simple-dropdown/simple.dropdown';
import { getTranslator } from '../../../../../../Resources/public/js/scripts/helpers/context.helper';
import { CurrentViewContext, VIEWS } from '../../universal.discovery.module';
import { CurrentViewContext, ViewContext } from '../../universal.discovery.module';

const ViewSwitcher = ({ isDisabled }) => {
const Translator = getTranslator();
const viewLabel = Translator.trans(/*@Desc("View")*/ 'view_switcher.view', {}, 'ibexa_universal_discovery_widget');
const [currentView, setCurrentView] = useContext(CurrentViewContext);
const selectedOption = VIEWS.find((option) => option.value === currentView);
const { views } = useContext(ViewContext);
const selectedOption = views.find((option) => option.value === currentView);
const onOptionClick = ({ value }) => {
setCurrentView(value);
};

return (
<div className="c-udw-view-switcher">
<SimpleDropdown
options={VIEWS}
options={views}
selectedOption={selectedOption}
onOptionClick={onOptionClick}
isDisabled={isDisabled}
Expand Down
Loading

0 comments on commit 82b5698

Please sign in to comment.