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

Add Selected Filters in myHistory #332

Merged
merged 23 commits into from
Nov 3, 2023

Conversation

annacv
Copy link
Contributor

@annacv annacv commented Oct 16, 2023

EMP-2293

Implement selectedFilters in myHistory aside panel.

Test:
Choose & query and filter with one or more filters, check the aside panel & see filters shown below the query

@annacv annacv requested a review from a team as a code owner October 16, 2023 08:41
src/components/my-history/custom-my-history.vue Outdated Show resolved Hide resolved
src/components/my-history/custom-my-history.vue Outdated Show resolved Hide resolved
src/components/my-history/custom-my-history.vue Outdated Show resolved Hide resolved
@annacv annacv requested a review from CachedaCodes October 26, 2023 06:57
class="x-text1-sm x-text-lead-50 x-line-clamp-1"
>
<span v-for="filter in suggestion.selectedFilters" :key="filter.id" class="x-pr-8">
{{ filter.label ?? filter.id }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This filter.id should not be needed as soon as this empathyco/x#1325 is implemented

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

@@ -16,12 +16,28 @@
@click="closeModal"
data-test="my-history-query"
:suggestion="suggestion"
suggestionClass="x-suggestion"
suggestionClass="x-suggestion x-w-[320px]"
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have 320px as value in the theme's spacing

v-if="suggestion.selectedFilters && suggestion.selectedFilters.length > 0"
class="x-text1-sm x-flex x-text-lead-50"
>
<p class="x-line-clamp-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a line clamp of 1 is overkill, this should be done just with x-truncate.

The width limit should be here, not in the parent.

{{ label(filter) }}
</span>
</p>
<p class="x-pl-8">({{ suggestion.selectedFilters.length }})</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

You're adding extra 8px between the last filter and the filter count with this padding.
Also this should be an span

Suggested change
<p class="x-pl-8">({{ suggestion.selectedFilters.length }})</p>
<span>({{ suggestion.selectedFilters.length }})</span>

<p>{{ suggestion.query }}</p>
<p class="hover:x-underline">{{ suggestion.query }}</p>
<div
v-if="suggestion.selectedFilters && suggestion.selectedFilters.length > 0"
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
v-if="suggestion.selectedFilters && suggestion.selectedFilters.length > 0"
v-if="suggestion.selectedFilters && suggestion.selectedFilters.length"

>
<HistoryIcon class="max-desktop:x-icon-lg" />

<div class="x-flex x-flex-col x-gap-2">
<p>{{ suggestion.query }}</p>
<p class="hover:x-underline">{{ suggestion.query }}</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

This way you only get the underline when hovering this specific element. This underline should appear when you hover anywhere in the parent.
Use tailwind group for this

@@ -17,6 +17,9 @@ module.exports = {
paddingTop: theme('spacing.24'),
paddingBottom: theme('spacing.24')
}
},
'.history-query.suggestion-group:hover': {
Copy link
Contributor

Choose a reason for hiding this comment

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

This removes the hover decorations to all HQ, including the ones in the empathize.
You can deactivate the text decoration in the history query with tailwind.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still here and it's not needed

@CachedaCodes
Copy link
Contributor

The filters under the HQs in the empathize are missing

class="x-text1-sm x-text-lead-50 x-line-clamp-1"
>
<span v-for="filter in suggestion.selectedFilters" :key="filter.id" class="x-pr-8">
{{ filter.label ?? filter.id }}
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
{{ filter.label ?? filter.id }}
{{ filter.label }}

You can accept this commit by pointing to x-components "3.0.1-alpha.1"

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

v-if="suggestion.selectedFilters && suggestion.selectedFilters.length"
class="x-text1-sm x-flex x-gap-8 x-text-lead-50"
>
<div class="x-line-clamp-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

You're still using line clamp instead of truncate.
Also, this should have a width of 320px aprox.

"
class="x-text1-sm x-flex x-text-lead-50"
>
<div class="x-line-clamp-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this line clamp with truncate

<p>{{ suggestion.query }}</p>
<div class="x-group x-flex x-flex-col x-gap-2">
<p class="group-hover:x-underline">{{ suggestion.query }}</p>
<div
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty big chunk that is duplicated here and in the empathize, moving it to it's own component might be a good idea.

@@ -17,6 +17,9 @@ module.exports = {
paddingTop: theme('spacing.24'),
paddingBottom: theme('spacing.24')
}
},
'.history-query.suggestion-group:hover': {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still here and it's not needed

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

Copy link
Contributor

@CachedaCodes CachedaCodes left a comment

Choose a reason for hiding this comment

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

gj!

The HQ in mobile don't have the filters, I think it's because mobile uses the PredictiveLayer component instead of the full width one

});
</script>

<style scoped></style>
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
<style scoped></style>

Comment on lines 21 to 23
suggestion: {
type: HistoryQuery,
required: true
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need the whole suggestion

Suggested change
suggestion: {
type: HistoryQuery,
required: true
filtersList: {
type: HistoryQuery['selectedFilters'],
required: true

<div class="x-group x-flex x-flex-col x-gap-2">
<p class="group-hover:x-underline">{{ suggestion.query }}</p>

<HistoryQueryFilters class="x-w-192" :suggestion="suggestion"></HistoryQueryFilters>
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
<HistoryQueryFilters class="x-w-192" :suggestion="suggestion"></HistoryQueryFilters>
<HistoryQueryFilters class="x-w-192" :suggestion="suggestion"/>

Also, the list of filters could be have more width here, bump it to something around 250-320


<script>
import { defineComponent } from 'vue';
import { HistoryQuery } from '@empathyco/x-components/history-queries';
Copy link
Contributor

Choose a reason for hiding this comment

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

You're importing the component instead of the type.

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

@support-empathy
Copy link
Contributor

Check PR 332 preview 👀

https://x.test.empathy.co/preview/332/index.html

@CachedaCodes CachedaCodes merged commit 4a8b2b7 into main Nov 3, 2023
4 checks passed
@CachedaCodes CachedaCodes deleted the feature/EMP-2293-Add-filters-in-my-history branch November 3, 2023 07:20
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.

5 participants