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

feat: create related prompts module #1642

Merged
merged 52 commits into from
Nov 1, 2024
Merged

Conversation

victorcg88
Copy link
Contributor

@victorcg88 victorcg88 commented Oct 22, 2024

Pull request template

The Related Prompts module. Includes:

  • The Related Prompts store including query, status, and extra params.
  • The RelatedPrompt component. Including three slots: header, next queries, and query-preview.
  • The RelatedPromptList component. Same functionality as the NextQueriesList component. (Injects related prompts in the results list)

Motivation and context

  • Dependencies. If any, specify:
  • Open issue. If applicable, link:

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to not work as expected)
  • Change requires a documentation update

What is the destination branch of this PR?

How has this been tested?

Tests performed according to testing guidelines:

Checklist:

  • My code follows the style guidelines of this project.
  • I have performed a self-review on my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

victorcg88 and others added 30 commits July 23, 2024 17:05
* feat(x-installer): update to vue3 and adapt x-installer

* feat(x-installer): simplify internal createApp fn

* feat(scroll): fix import path

* feat(component): keep injector const export

* feat(mixins): removing deprecated mixins
BREAKING-CHANGE: refactors the GlobalXBus to use a prop to receive the listeners instead of relying on attributes.
This PR resolves several warnings when running the internal demo app:

- Initial warning about overwriting the store modules.
- Warnings about `v-on="listeners"` deprecation.
- Removal of `v-bind="attrs"` and `inheritAttrs=false`, because Vue3 implemented by default the attributes inheritance.
- Fixing warning on `attrs` inheritance in RenderlessFilter.
- Fixing some components that throw warnings because the render function was incorrect.
…rective and deprecated layouts (#1576)

* get rid of deprecated `MultiColumnMaxWidthLayout`

* Revert "get rid of deprecated `MultiColumnMaxWidthLayout`"

This reverts commit 7fd0374.

* fix(list-components): fix list components, migrate infinite-scroll directive and deprecated layouts

* fix(list-components): avoid injecting undefined default value since Vue does it
* refactor(animation-factory): fix Vue3 breaking changes

* refactor(animation-factory): await animation to load

* refactor(animation-factory): improve type infer

* refactor(animations): Vue3 transition class breaking change
* test(components): propsData is now props

* test(components): revert skip on test cases

* test(components): fix duplicated bus instance

* test(components): provide moved inside global property

* test(components): remove useless nextTick()

* test(components): update jsdoc for installNewXPlugin()
BREAKING CHANGE: @empathyco/x-archetype-utils is only compatible with vue 3
BREAKING CHANGE:

@empathyco/x-components v6 and @empathyco/x-archetype-utils v2 are only compatible with Vue 3 and if you are looking for the Vue 2 versions, take look at the main brach.
* test: fix experience-controls and tagging tests

* test: fix scroll module and clear-search-input tests

* test:fix related-tag test

* test: fix tests in search module

* test: fix tests in history-queries module

* test: fix x-modules tests

* tests: QueryPreview

* test: fix semantic queries test

* test: fix semantic query test

* test: fix x-modules tests

* test: query preview button test

* test: use queries preview composable

* test: queries preview getter

* fix e2e tests

* fix e2e tests

* test: rm unneeded reset in queries preview composable

* test: query preview actions test

* test: query preview utils test

* test: fix x-modules tests

* test: fix x-modules tests

* test: query preview list test

* test: fix facets module tests

* test: adjust some filters lists tests

* test: facets getter test

* test: use-filters-injection composable

* test: fix facets module tests

* test: test facets-service

* test: adapt some filters tests

* test: rm localVue from url module's utils

* test: fix tagging actions test

* test: fix pdp-add-to-cart service

* test: fix search button test

* test: fix semantics module tests

* test: fix experience-controls getter test

* test: adjust selected-filters-list test

* test: fix getters-proxy.spec.ts

* test: fix search input test

* test: fix search input placeholder test

* test: fix search box module actions test

* test: fix facets-provider.spec.ts

* test: adjust preselected-filters test

* test: fix base-event-button and use-x-bus test sheets

* test: fix test sheets of filter components

* test: fix highlight and result-variants-provider-and-selector tests

---------

Co-authored-by: Diego Pascual <[email protected]>
Co-authored-by: albertjcuac <[email protected]>
Co-authored-by: acondal <[email protected]>
Co-authored-by: Jose Antonio Cabañeros <[email protected]>
@victorcg88 victorcg88 force-pushed the feat/related-prompts-module branch from c364d7b to 45ae37d Compare October 22, 2024 14:19
@victorcg88 victorcg88 marked this pull request as ready for review October 28, 2024 14:42
@victorcg88 victorcg88 requested a review from a team as a code owner October 28, 2024 14:42
Base automatically changed from feat/add-related-prompts-adapter to main October 28, 2024 15:24
@@ -0,0 +1,80 @@
<template>
<div
class="x-related-prompt x-bg-neutral-10 x-p-24 x-flex x-flex-col x-gap-16"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure about the styling. Usually we don't add those styles to the x-component and we leave it to the consumer to style it as desired.

v-for="(nextQuery, index) in relatedPrompt.nextQueries"
:key="index"
@click="onClick(nextQuery)"
class="x-button x-button-lead x-button-sm x-button-outlined x-rounded-sm x-border-lead-50 x-text-neutral-75 hover:x-text-neutral-0 selected:x-text-neutral-0 selected:hover:x-bg-lead-50"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. Probably is better to have a prop to pass the desired classes. This way is easier from the outside customize the UI

@@ -390,8 +390,9 @@

<template #related-prompts-group="{ item: { relatedPrompts } }">
<RelatedPrompt
class="x-flex x-flex-col x-pt-24"
class="x-bg-neutral-10 x-flex x-flex-col x-gap-16 x-pt-24"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi, maybe this background is another possible customizable style for customers, maybe we could add a containerClass in the component to handle this attribute, which could also be used to add the gap & other spacing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can already achieve this by attribute inheritance. Those classes will fall to the root element inside RelatedPrompt, just like is done here.

:relatedPrompt="relatedPrompts[0]"
nextQueryButtonClass="x-button x-button-lead x-button-sm x-button-outlined"
Copy link
Contributor

@annacv annacv Oct 31, 2024

Choose a reason for hiding this comment

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

Hi, IMO the x-button class would rely on the component itself, the rest of them ok here

<button
v-for="(nextQuery, index) in relatedPrompt.nextQueries"
:key="index"
@click="onClick(nextQuery)"
class="x-button x-button-lead x-button-sm x-button-outlined x-rounded-sm x-border-lead-50 x-text-neutral-75 hover:x-text-neutral-0 selected:x-text-neutral-0 selected:hover:x-bg-lead-50"
:class="{ 'x-selected': selectedNextQuery === nextQuery }"
:class="[{ 'x-selected': selectedNextQuery === nextQuery }, nextQueryButtonClass]"
Copy link
Contributor

@annacv annacv Oct 31, 2024

Choose a reason for hiding this comment

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

Hi, I would name it buttonClass so it is shorter

Copy link
Contributor

Choose a reason for hiding this comment

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

There are more than one button, I think it's better to have a more clear name for this

Comment on lines 21 to 18
class="x-whitespace-nowrap"
:class="
selectedNextQuery === nextQuery ? 'x-title3 x-title3-md' : 'x-text1 x-text1-lg'
"
>
{{ nextQuery }}
</span>
<span>{{ nextQuery }}</span>
<CrossTinyIcon v-if="selectedNextQuery === nextQuery" class="x-icon" />
<PlusIcon v-else class="x-icon" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it is worth also adding a slot for the item

@annacv
Copy link
Contributor

annacv commented Oct 31, 2024

Hi @victorcg88! Great job!
I've added some suggestions, & I miss the generic component description above the defineComponent f() in related-prompt.vue.

@annacv annacv merged commit 36cdcc6 into main Nov 1, 2024
4 checks passed
@annacv annacv deleted the feat/related-prompts-module branch November 1, 2024 09:16
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.

6 participants