Skip to content

Commit

Permalink
cleanup: make popup non group
Browse files Browse the repository at this point in the history
  • Loading branch information
cdxker committed Jan 10, 2025
1 parent b792cda commit c8dd845
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
10 changes: 5 additions & 5 deletions server/src/public/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,20 @@
<script type="module">
import {renderToDiv} from '{{ search_component_url | safe }}/dist/vanilla/index.js';
const root = document.querySelector("#root");
const params = {{params | tojson}};

const params = {{ params | tojson }};
if (params.inline) {
const inlineParams = {{ params | tojson }};
const inlineRoot = document.querySelector("#inline-root");
const inlineParams = params;
inlineParams.groupTrackingId = params.singleProductOptions.groupTrackingId;
inlineParams.cleanGroupName = params.singleProductOptions.productName;

if (params.singleProductOptions && params.singleProductOptions.productQuestions) {
inlineParams.defaultAiQuestions = params.singleProductOptions.productQuestions;
if (inlineParams.singleProductOptions && inlineParams.singleProductOptions.productQuestions) {
inlineParams.defaultAiQuestions = inlineParams.singleProductOptions.productQuestions;
}

renderToDiv(inlineRoot, {
...params,
...inlineParams,
})
}

Expand Down
10 changes: 5 additions & 5 deletions server/src/public/product.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h4 class="text-sm text-gray-500 mt-2 w-fit">
class="recs mt-6 flex flex-nowrap overflow-x-auto gap-x-4 sm:gap-x-6 xl:gap-x-8 py-2"
>
{% for i in range(5) %}
<div class="w-64 flex-shrink-0" x-key="{{ i }}">
<div class="mt-auto w-64 flex-shrink-0" x-key="{{ i }}">
<div class="h-72 w-full overflow-hidden rounded-lg">
<div class="h-full w-full bg-gray-200 animate-pulse"></div>
</div>
Expand Down Expand Up @@ -117,7 +117,7 @@ <h4 class="text-sm text-gray-500 mt-2 w-fit">
recProducts.forEach((recProduct, i) => {
if (!idsToKeep.includes(recProduct.getAttribute("x-group-tracking-id"))) {
const newDiv = document.createElement("div");
newDiv.classList.add("w-64", "flex-shrink-0");
newDiv.classList.add("w-64", "flex-shrink-0", "mt-auto");
newDiv.setAttribute("x-key", i);
newDiv.innerHTML = `
<div class="h-72 w-full overflow-hidden rounded-lg">
Expand Down Expand Up @@ -283,7 +283,7 @@ <h4 class="text-sm text-gray-500 mt-2 w-fit">
const price = priceNum ? `$${priceNum.toFixed(2)}` : null;

const chunkElement = document.createElement("div");
chunkElement.classList.add(...["rec", "w-64", "flex-shrink-0"]);
chunkElement.classList.add(...["rec", "w-64", "flex-shrink-0", "mt-auto"]);
chunkElement.setAttribute("x-group-tracking-id", groupTrackingId);
chunkElement.innerHTML = `
<div
Expand All @@ -302,12 +302,12 @@ <h6 class="rec-price mt-1 text-sm text-gray-700">${price}</h6>
</div>
<div class="mt-6 flex gap-2">
<button
class="similar-button rec-button bg-brand-color w-1/2 flex items-center justify-center rounded-md border border-transparent px-8 py-2 text-sm font-medium text-white"
class="similar-button rec-button bg-brand-color w-1/2 flex items-center justify-center rounded-md border border-transparent px-1 py-2 text-sm font-medium text-white"
>
More Like This
</button>
<button
class="different-button rec-button bg-brand-color w-1/2 flex items-center justify-center rounded-md border border-transparent px-8 py-2 text-sm font-medium text-white"
class="different-button rec-button bg-brand-color w-1/2 flex items-center justify-center rounded-md border border-transparent px-1 py-2 text-sm font-medium text-white"
>
Less Like This
</button>
Expand Down
14 changes: 9 additions & 5 deletions server/static/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ video {
margin-top: 2rem;
}

.mt-auto {
margin-top: auto;
}

.line-clamp-1 {
overflow: hidden;
display: -webkit-box;
Expand All @@ -639,11 +643,6 @@ video {
display: none;
}

.size-full {
width: 100%;
height: 100%;
}

.h-10 {
height: 2.5rem;
}
Expand Down Expand Up @@ -832,6 +831,11 @@ video {
object-fit: cover;
}

.px-1 {
padding-left: 0.25rem;
padding-right: 0.25rem;
}

.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem;
Expand Down

0 comments on commit c8dd845

Please sign in to comment.