Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-9069: Initial Product Tab #1397

Open
wants to merge 15 commits into
base: 4.6
Choose a base branch
from
Open

IBX-9069: Initial Product Tab #1397

wants to merge 15 commits into from

Conversation

tischsoic
Copy link
Contributor

@tischsoic tischsoic commented Nov 22, 2024

🎫 Issue IBX-9069

Related PRs:

Description:

For QA:

Documentation:

@tischsoic tischsoic self-assigned this Nov 22, 2024
@tischsoic tischsoic changed the base branch from 4.6 to IBX-9227-multipleItemsLimit-not-respected November 25, 2024 08:37
@tischsoic tischsoic marked this pull request as ready for review November 25, 2024 08:42
const Translator = getTranslator();
const adminUiConfig = getAdminUiConfig();
const itemsComponentsMap = useMemo(() => {
const { universalSelectItemsComponentsConfigs } = adminUiConfig.universalDiscoveryWidget;
Copy link
Contributor Author

@tischsoic tischsoic Nov 25, 2024

Choose a reason for hiding this comment

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

Note: We already have selectedItemActions config for selected locations, so I've chosen universalSelectItemsComponentsConfigs, but I'm not happy with this name. Better name suggestions are welcome.

Base automatically changed from IBX-9227-multipleItemsLimit-not-respected to 4.6 November 25, 2024 13:11
box-shadow: calculateRem(4px) calculateRem(22px) calculateRem(47px) 0 rgba($ibexa-color-info, 0.05);

&::before,
&::after {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we could do mixin from it? As I guess that's an arrow, already used in filters in two other places (also in theory arrow is also in dropdown, but in different direction, so probably unable to mixinise...)

}

&__collapsible {
& + #{$filterRowCssClass} {
Copy link
Contributor

Choose a reason for hiding this comment

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

couldn't we achieve it by setting some constant classname that would just need to be used in html?

Just looking for other solution, current one is probably ok, just looks strange for me (probably needs to get used to passing classname as variable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess you cannot generate a CSS selector based on the CSS variable set on the DOM element?

background: $ibexa-color-dark;
}

&::before {
Copy link
Contributor

Choose a reason for hiding this comment

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

oh hey, next arrow css code, so probably mixin makes sense now 100%. :)

};

FiltersPanel.propTypes = {
children: PropTypes.node.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

total nitpick, not sure if props like this should be required... depends how you look on it - this component would work without it 100% after all. But at the same time, probably wouldn't make sense in context we're using it in.

Copy link
Contributor Author

@tischsoic tischsoic Dec 2, 2024

Choose a reason for hiding this comment

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

I assumed this component would not make much sense without children, but on the other hand, I don't think such a requirement adds much value... I will delete it.


FiltersRow.propTypes = {
children: PropTypes.node.isRequired,
extraClasses: PropTypes.string.isRequired,
Copy link
Contributor

Choose a reason for hiding this comment

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

I doubt extraClasses should be treated as required, I think it was always optional to pass this specific prop in our system?

}, []);

useEffect(() => {
parseTooltip(refSelectedLocationsItem.current);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that's totally not place for it, but just a hunch I want to mention - shouldn't we put hideAllTooltips in return function? As probably we should make sure we hide all tooltips when component is destroyed (marginally low chance for such case, as such component would need to cease to exist independently from user input, as user needs to hover cursor over tooltipable element)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should put it in the ref function, I copied this code from another place and forgot to refactor it. :)

{selectedItems.map((selectedItem) => {
const ItemComponent = itemsComponentsMap[selectedItem.type].component;

return ItemComponent && <ItemComponent key={`${selectedItem.type}-${selectedItem.id}`} item={selectedItem} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a chance component wouldn't exist? and if there is, do we want to silent error the fact there's probably some misconfiguration and specific selected item doesn't show up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point!

@@ -13,8 +15,19 @@ const SortSwitcher = ({ isDisabled }) => {
setSortOrder(option.sortOrder);
};

const disabledParams = {};
Copy link
Contributor

Choose a reason for hiding this comment

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

There probably shouldn't be empty like above (line 15/17)?

const isNotSelectable =
(containersOnly && !isContainer) || (allowedContentTypes && !allowedContentTypes.includes(contentTypeIdentifier));
const isSelectionBlocked = multipleItemsLimit !== 0 && !isSelected && selectedLocations.length >= multipleItemsLimit;
Copy link
Contributor

Choose a reason for hiding this comment

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

you've created helper for it (src/bundle/ui-dev/src/modules/universal-discovery/helpers/selected.locations.helper.js) couldn't you use it here, or difference is structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These items are not necessarily locations so I didn't want to use location-specific helpers.


useEffect(() => {
dispatch({ type: FETCH_START });
const offset = state.pageIndex * itemsPerPage;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const offset = state.pageIndex * itemsPerPage;
const offset = state.pageIndex * itemsPerPage;

Copy link

sonarcloud bot commented Nov 27, 2024

Comment on lines +4 to +5
& + .c-filters-row,
& + .c-filters__row {
Copy link
Contributor

Choose a reason for hiding this comment

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

something is wrong with this for me :) c-filters-row and c-filters__row should be the same component but now it's separate or am I wrong

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created some new filters components and now we have c-filters-row and we no longer have c-filters__row, but because this is an add-on for 4.6 I wanted to be extra careful with BC break and didn't delete this CSS styles. But maybe I should not be that careful. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants