Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 1 addition & 29 deletions core/app/[locale]/(default)/_components/slideshow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { useTranslations } from 'next-intl';

import { Slideshow as SlideshowSection } from '~/vibes/soul/sections/slideshow';

import SlideBg01 from './slide-bg-01.jpg';
import SlideBg02 from './slide-bg-02.jpg';
import SlideBg03 from './slide-bg-03.jpg';
import SlideBg01 from './commercia-slide.png';

export function Slideshow() {
const t = useTranslations('Home.Slideshow');
Expand All @@ -23,32 +21,6 @@ export function Slideshow() {
label: t('Slide01.cta'),
},
},
{
title: t('Slide02.title'),
image: {
src: SlideBg02.src,
alt: t('Slide02.alt'),
blurDataUrl: SlideBg02.blurDataURL,
},
description: t('Slide02.description'),
cta: {
href: '/shop-all',
label: t('Slide02.cta'),
},
},
{
title: t('Slide03.title'),
image: {
src: SlideBg03.src,
alt: t('Slide03.alt'),
blurDataUrl: SlideBg03.blurDataURL,
},
description: t('Slide03.description'),
cta: {
href: '/shop-all',
label: t('Slide03.cta'),
},
},
];

return <SlideshowSection slides={slides} />;
Expand Down
6 changes: 6 additions & 0 deletions core/app/[locale]/(default)/cart/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ export const DigitalItemFragment = graphql(`
}
}
url
stockPosition {
backorderMessage
quantityOnHand
quantityBackordered
quantityOutOfStock
}
}
`);

Expand Down
69 changes: 33 additions & 36 deletions core/app/[locale]/(default)/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,43 +127,40 @@ export default async function Cart({ params }: Props) {

let inventoryMessages;

if (item.__typename === 'CartPhysicalItem') {
if (item.stockPosition?.quantityOutOfStock === item.quantity) {
inventoryMessages = {
outOfStockMessage: data.site.settings?.inventory?.showOutOfStockMessage
? data.site.settings.inventory.defaultOutOfStockMessage
if (item.stockPosition?.quantityOutOfStock === item.quantity) {
inventoryMessages = {
outOfStockMessage: data.site.settings?.inventory?.showOutOfStockMessage
? data.site.settings.inventory.defaultOutOfStockMessage
: undefined,
};
} else {
inventoryMessages = {
quantityReadyToShipMessage:
data.site.settings?.inventory?.showQuantityOnHand && !!item.stockPosition?.quantityOnHand
? t('quantityReadyToShip', {
quantity: Number(item.stockPosition.quantityOnHand),
})
: undefined,
};
} else {
inventoryMessages = {
quantityReadyToShipMessage:
data.site.settings?.inventory?.showQuantityOnHand &&
!!item.stockPosition?.quantityOnHand
? t('quantityReadyToShip', {
quantity: Number(item.stockPosition.quantityOnHand),
})
: undefined,
quantityBackorderedMessage:
data.site.settings?.inventory?.showQuantityOnBackorder &&
!!item.stockPosition?.quantityBackordered
? t('quantityOnBackorder', {
quantity: Number(item.stockPosition.quantityBackordered),
})
: undefined,
quantityOutOfStockMessage:
data.site.settings?.inventory?.showOutOfStockMessage &&
!!item.stockPosition?.quantityOutOfStock
? t('partiallyAvailable', {
quantity: item.quantity - Number(item.stockPosition.quantityOutOfStock),
})
: undefined,
backorderMessage:
data.site.settings?.inventory?.showBackorderMessage &&
!!item.stockPosition?.quantityBackordered
? (item.stockPosition.backorderMessage ?? undefined)
: undefined,
};
}
quantityBackorderedMessage:
data.site.settings?.inventory?.showQuantityOnBackorder &&
!!item.stockPosition?.quantityBackordered
? t('quantityOnBackorder', {
quantity: Number(item.stockPosition.quantityBackordered),
})
: undefined,
quantityOutOfStockMessage:
data.site.settings?.inventory?.showOutOfStockMessage &&
!!item.stockPosition?.quantityOutOfStock
? t('partiallyAvailable', {
quantity: item.quantity - Number(item.stockPosition.quantityOutOfStock),
})
: undefined,
backorderMessage:
data.site.settings?.inventory?.showBackorderMessage &&
!!item.stockPosition?.quantityBackordered
? (item.stockPosition.backorderMessage ?? undefined)
: undefined,
};
}

return {
Expand Down
6 changes: 3 additions & 3 deletions core/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"Home": {
"Slideshow": {
"Slide01": {
"title": "Fresh finds for every occasion",
"description": "Explore our latest arrivals, curated to bring you style, functionality, and inspiration. Shop now and discover your next favorite.",
"alt": "Five small potted plants displayed on beige stacked blocks, featuring a variety of green foliage in dark gray pots against a neutral background.",
"title": "WELCOME TO COMMERCIA!",
"description": "A new nation state, structured for stability.",
"alt": "A new nation state, structured for stability.",
"cta": "Shop Now"
},
"Slide02": {
Expand Down
84 changes: 45 additions & 39 deletions core/vibes/soul/sections/slideshow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,52 +225,58 @@ export function Slideshow({ slides, playOnInit = true, interval = 5000, classNam
resetAutoplay();
}}
>
<div className="relative overflow-hidden">
{/* White Bar - Current Index Indicator / Progress Bar */}
<div
className={clsx(
'absolute h-0.5 bg-[var(--slideshow-pagination,hsl(var(--background)))]',
'opacity-0 fill-mode-forwards',
isPlaying ? 'running' : 'paused',
index === selectedIndex
? 'opacity-100 ease-linear animate-in slide-in-from-left'
: 'ease-out animate-out fade-out',
)}
key={`progress-${playCount}`} // Force the animation to restart when pressing "Play", to match animation with embla's autoplay timer
style={{
animationDuration: index === selectedIndex ? `${interval}ms` : '200ms',
width: `${150 / slides.length}px`,
}}
/>
{/* Grey Bar BG */}
<div
className="h-0.5 bg-[var(--slideshow-pagination,hsl(var(--background)))] opacity-30"
style={{ width: `${150 / slides.length}px` }}
/>
</div>
{slides.length > 1 && (
<div className="relative overflow-hidden">
{/* White Bar - Current Index Indicator / Progress Bar */}
<div
className={clsx(
'absolute h-0.5 bg-[var(--slideshow-pagination,hsl(var(--background)))]',
'opacity-0 fill-mode-forwards',
isPlaying ? 'running' : 'paused',
index === selectedIndex
? 'opacity-100 ease-linear animate-in slide-in-from-left'
: 'ease-out animate-out fade-out',
)}
key={`progress-${playCount}`} // Force the animation to restart when pressing "Play", to match animation with embla's autoplay timer
style={{
animationDuration: index === selectedIndex ? `${interval}ms` : '200ms',
width: `${150 / slides.length}px`,
}}
/>
{/* Grey Bar BG */}
<div
className="h-0.5 bg-[var(--slideshow-pagination,hsl(var(--background)))] opacity-30"
style={{ width: `${150 / slides.length}px` }}
/>
</div>
)}
</button>
);
})}

{/* Carousel Count - "01/03" */}
<span className="ml-auto mr-3 mt-px font-[family-name:var(--slideshow-number-font-family,var(--font-family-mono))] text-sm text-[var(--slideshow-number,hsl(var(--background)))]">
{selectedIndex + 1 < 10 ? `0${selectedIndex + 1}` : selectedIndex + 1}/
{slides.length < 10 ? `0${slides.length}` : slides.length}
</span>
{slides.length > 1 && (
<span className="ml-auto mr-3 mt-px font-[family-name:var(--slideshow-number-font-family,var(--font-family-mono))] text-sm text-[var(--slideshow-number,hsl(var(--background)))]">
{selectedIndex + 1 < 10 ? `0${selectedIndex + 1}` : selectedIndex + 1}/
{slides.length < 10 ? `0${slides.length}` : slides.length}
</span>
)}

{/* Stop / Start Button */}
<button
aria-label={isPlaying ? 'Pause' : 'Play'}
className="flex h-7 w-7 items-center justify-center rounded-lg border border-[var(--slideshow-play-border,hsl(var(--contrast-300)/50%))] text-[var(--slideshow-play-text,hsl(var(--background)))] ring-[var(--slideshow-focus)] transition-opacity duration-300 hover:border-[var(--slideshow-play-border-hover,hsl(var(--contrast-300)/80%))] focus-visible:outline-0 focus-visible:ring-2"
onClick={toggleAutoplay}
type="button"
>
{isPlaying ? (
<Pause className="pointer-events-none" size={16} strokeWidth={1.5} />
) : (
<Play className="pointer-events-none" size={16} strokeWidth={1.5} />
)}
</button>
{slides.length > 1 && (
<button
aria-label={isPlaying ? 'Pause' : 'Play'}
className="flex h-7 w-7 items-center justify-center rounded-lg border border-[var(--slideshow-play-border,hsl(var(--contrast-300)/50%))] text-[var(--slideshow-play-text,hsl(var(--background)))] ring-[var(--slideshow-focus)] transition-opacity duration-300 hover:border-[var(--slideshow-play-border-hover,hsl(var(--contrast-300)/80%))] focus-visible:outline-0 focus-visible:ring-2"
onClick={toggleAutoplay}
type="button"
>
{isPlaying ? (
<Pause className="pointer-events-none" size={16} strokeWidth={1.5} />
) : (
<Play className="pointer-events-none" size={16} strokeWidth={1.5} />
)}
</button>
)}
</div>
</section>
);
Expand Down
Loading