Skip to content

Commit

Permalink
chore: update branch
Browse files Browse the repository at this point in the history
RST-2559
  • Loading branch information
annacv committed Dec 10, 2024
2 parents ffa63b8 + 8ef329c commit 7994fad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/components/related-prompts/custom-related-prompts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</i18n-t>

<div class="x-flex x-flex-col">
<RelatedPromptsTagList class="x-my-24" />
<RelatedPromptsTagList class="x-mt-24" />
<CustomQueryPreview
v-if="selectedPrompt !== -1"
:key="queriesPreviewInfo.length"
Expand Down
55 changes: 3 additions & 52 deletions src/components/related-prompts/related-prompts-tag-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
:class="[isSelected(index) ? 'x-w-full' : 'x-w-[204px] x-grow desktop:x-w-[303px]']"
@click="toggleSuggestion(index)"
>
<div class="x-flex">
<div class="x-flex x-min-h-[32px]">
<span
class="x-typewritter-initial"
:class="[{ 'x-typewritter-animation': isVisible }]"
Expand All @@ -42,36 +42,9 @@
{{ suggestion.suggestionText }}
</span>
</div>
<CrossTinyIcon v-if="isSelected(index)" class="x-icon-lg" />
<PlusIcon v-else class="x-icon-neutral-80 x-icon-lg" />
<CrossTinyIcon v-if="isSelected(index)" class="x-icon-lg" />
<PlusIcon v-else class="x-icon-neutral-80 x-icon-lg" />
</button>

<!-- Next queries -->
<div
v-if="isSelected(index)"
class="x-no-scrollbar x-pb-16 x-flex x-w-full x-gap-12 x-overflow-y-hidden x-overflow-x-scroll x-px-16"
>
<button
v-for="(query, queryIndex) in suggestion.nextQueries"
:key="query"
:style="{ animationDelay: `${queryIndex * 0.3}s` }"
class="x-tag-outlined x-flex x-h-[40px] x-items-center x-justify-center x-gap-4 x-rounded-full x-border-1 x-px-12 x-staggered-initial x-staggered-animation"
:class="[
{ 'x-hidden': shouldHideButton(queryIndex) },
isQuerySelected(queryIndex) ? 'x-bg-neutral-25' : 'x-bg-neutral-0',
]"
@click="toggleQuery(queryIndex)"
>
<span
class="x-whitespace-nowrap x-text-sm"
:class="[isQuerySelected(queryIndex) ? ' x-text-neutral-90' : 'x-text-neutral-75']"
>
{{ query }}
</span>
<CrossTinyIcon v-if="isQuerySelected(queryIndex)" class="x-text-16 x-h-20" />
<PlusIcon v-else class="x-text-16 x-h-20" />
</button>
</div>
</div>
</div>
</CustomSlidingPanel>
Expand All @@ -96,7 +69,6 @@ export default defineComponent({
const isVisible = ref(false)
const selectedIndex = ref<number>(-1)
const selectedQuery = ref<number>(-1)
const observer = new IntersectionObserver(([entry]) => {
isVisible.value = entry.isIntersecting
Expand All @@ -116,51 +88,30 @@ export default defineComponent({
} else {
selectedIndex.value = index
}
selectedQuery.value = -1
x.emit('UserSelectedARelatedPrompt', selectedIndex.value)
x.emit('UserSelectedARelatedPromptQuery', selectedQuery.value)
}
const isSelected = (index: number): boolean => selectedIndex.value === index
const toggleQuery = (queryIndex: number): void => {
if (selectedQuery.value === queryIndex) {
selectedQuery.value = -1
} else {
selectedQuery.value = queryIndex
}
x.emit('UserSelectedARelatedPromptQuery', selectedQuery.value)
}
const isQuerySelected = (queryIndex: number): boolean => selectedQuery.value === queryIndex
const shouldHideButton = (index: number): boolean =>
selectedIndex.value !== -1 && selectedIndex.value !== index
const shouldHideQuery = (queryIndex: number): boolean =>
selectedQuery.value !== -1 && selectedQuery.value !== queryIndex
x.on('UserAcceptedAQueryPreview', false).subscribe(() => {
toggleSuggestion(-1)
toggleQuery(-1)
})
x.on('SearchRequestChanged', false).subscribe(() => {
toggleSuggestion(-1)
toggleQuery(-1)
})
return {
isQuerySelected,
isSelected,
isTouchable,
isVisible,
relatedPrompts,
selectedIndex,
shouldHideButton,
shouldHideQuery,
slidingPanelContent,
toggleQuery,
toggleSuggestion,
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/search/results/results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
</MainScrollItem>
</template>
<template #related-prompts-group>
<RelatedPromptsTagList v-if="!isLowResult" class="x-my-24" />
<RelatedPromptsTagList v-if="!isLowResult" class="-x-mb-1 x-mt-24 desktop:x-mt-0" />
<CustomQueryPreview
v-if="selectedPrompt !== -1"
:key="queriesPreviewInfo.length"
class="x-rounded-[12px] x-bg-neutral-10 x-px-8 desktop:x-px-16"
class="x-rounded-b-[12px] x-bg-neutral-10 x-px-8 desktop:x-px-16"
:queries-preview-info="queriesPreviewInfo"
></CustomQueryPreview>
</template>
Expand Down

0 comments on commit 7994fad

Please sign in to comment.