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

chore: merge development into main #120

Merged
merged 35 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a2bade7
Remove app board (#70)
yurii-ve Oct 7, 2024
753613e
Update error handling (#72)
yurii-ve Oct 7, 2024
c916143
Create CartItemView component, update ProductCard board (#74)
yurii-ve Oct 8, 2024
b36b9fb
Update codux config to use .env file (#76)
yurii-ve Oct 8, 2024
2d2546f
Handle trackQuantity property for out of stock indication (#80)
yurii-ve Oct 9, 2024
f05cc2b
Keep entire selected choice object in route state (#81)
yurii-ve Oct 9, 2024
bbb7494
Use selected choice media (#82)
yurii-ve Oct 9, 2024
98d3c23
fix: out of stock indication for products with variants (#83)
olehrakwix Oct 9, 2024
7a3a1c4
refactor: improve fix regarding navigation from error boundary (#84)
olehrakwix Oct 9, 2024
c209a0d
Fix missing SKU issue (#85)
yurii-ve Oct 9, 2024
095210f
Remove redundant instruction (#86)
yurii-ve Oct 9, 2024
9e75a81
Change background-color to background, use color variables (#87)
yurii-ve Oct 10, 2024
4125ffb
Remove absolute positioning from the intro board (#88)
yurii-ve Oct 10, 2024
e34d15c
Split Cart component into functional (Cart) and view parts (CartView)…
yurii-ve Oct 11, 2024
b64c859
Update cart related boards (#91)
yurii-ve Oct 11, 2024
8af097d
Added useCart hook (#92)
yurii-ve Oct 11, 2024
fbf9a59
Remove cart loading state (#93)
yurii-ve Oct 11, 2024
b302590
Update drawer component (#94)
yurii-ve Oct 14, 2024
506c1a4
feat: hide non-visible variants to disallow selection (#89)
olehrakwix Oct 16, 2024
4f146c7
Use quantity state (#95)
yurii-ve Oct 16, 2024
309d12b
Export addToCart from the useCart hook (#96)
yurii-ve Oct 16, 2024
d2d8862
refactor: improve select types (#97)
olehrakwix Oct 17, 2024
23c9ec4
feat: products filtering and sorting (#98)
olehrakwix Oct 17, 2024
1e5ae95
Sync latest changes from the ReClaim template (#102)
yurii-ve Oct 31, 2024
d2f5eb7
chore(deps): upgrade to latest (#104)
pilarbuchen Oct 31, 2024
dab5ad7
refactor: replace css reset (#107)
idoros Nov 7, 2024
4e1a69b
Fix (#111)
yurii-ve Nov 8, 2024
398543f
Use component wrapper instead of memory router (#112)
yurii-ve Nov 8, 2024
6e819e3
Update/fix meta tags (#105)
yurii-ve Nov 10, 2024
b2d4230
fix: regenerate lock file fixes run dev (#116)
matangeorgi Jan 14, 2025
11cb701
fix: position page layout correctly (#117)
matangeorgi Jan 14, 2025
13ba157
refactor: replace import with use (#118)
matangeorgi Jan 14, 2025
9d5b100
Merge branch 'development' into matan/merge-development
matangeorgi Jan 15, 2025
830fe90
remove import
matangeorgi Jan 15, 2025
79107b7
run install
matangeorgi Jan 15, 2025
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
24 changes: 24 additions & 0 deletions _codux/boards/components/cart/cart-item.board.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { createBoard } from '@wixc3/react-board';
import { cartItem, cartItemOutOfStock, cartItemWithDiscount } from '_codux/mocks/cart';
import { CartItem } from '~/src/components/cart/cart-item/cart-item';

const noop = () => {};

export default createBoard({
name: 'Cart Item',
Board: () => {
return (
<div>
<CartItem cartItem={cartItem} onQuantityChange={noop} onRemove={noop} />
<CartItem cartItem={cartItemOutOfStock} onQuantityChange={noop} onRemove={noop} />
<CartItem cartItem={cartItemWithDiscount} onQuantityChange={noop} onRemove={noop} />
</div>
);
},
tags: ['Component', 'Cart'],
isSnippet: false,
environmentProps: {
windowWidth: 500,
windowHeight: 300,
},
});
1 change: 1 addition & 0 deletions _codux/mocks/cart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function createCartItem(overrides: Partial<CartItemDetails> = {}): CartItemDetai
fixedQuantity: false,
priceUndetermined: false,
customLineItem: false,
policies: [],
...overrides,
};
}
Expand Down
4 changes: 4 additions & 0 deletions _codux/mocks/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export const mockOrder: orders.Order & orders.OrderNonNullableFields = {
_id: '111111111111',
lineItems: [
{
priceUndetermined: false,
fixedQuantity: false,
productName: { original: 'Tets Product' },
price: {
amount: '10.00',
Expand Down Expand Up @@ -43,6 +45,8 @@ export const mockOrder: orders.Order & orders.OrderNonNullableFields = {
quantity: 2,
},
{
priceUndetermined: false,
fixedQuantity: false,
productName: { original: 'Another Product' },
price: {
amount: '75.00',
Expand Down
3 changes: 1 addition & 2 deletions lib/utils/cart-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import ecom from '@wix/ecom';
import deepEqual from 'fast-deep-equal';
import { AddToCartOptions, Cart, CartItem, CartTotals } from '~/lib/ecom';

Expand All @@ -17,7 +16,7 @@ export function findItemIdInCart({ lineItems }: Cart, catalogItemId: string, opt
});
}

export function calculateCartItemsCount(cart: ecom.cart.Cart): number {
export function calculateCartItemsCount(cart: Cart): number {
return cart.lineItems?.reduce((total, item) => total + item.quantity!, 0) ?? 0;
}

Expand Down
30 changes: 30 additions & 0 deletions lib/utils/use-search-params-optimistic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { useNavigation, useSearchParams } from '@remix-run/react';
import { useCallback, useEffect, useState } from 'react';
import type { NavigateOptions } from 'react-router';

/**
* Similar to `useSearchParams` from Remix, but allows to update search params optimistically.
*/
export function useSearchParamsOptimistic() {
const navigation = useNavigation();
const [searchParams, setSearchParams] = useSearchParams();

const [optimisticSearchParams, setOptimisticSearchParams] = useState(searchParams);

const handleSearchParamsChange = useCallback(
(params: URLSearchParams | ((prevParams: URLSearchParams) => URLSearchParams), options?: NavigateOptions) => {
setOptimisticSearchParams(params);
setSearchParams(params, options);
},
[setSearchParams],
);

// Synchronize search params on back/forward browser button clicks.
useEffect(() => {
if (navigation.state !== 'loading') {
setOptimisticSearchParams(searchParams);
}
}, [navigation.state, searchParams]);

return [optimisticSearchParams, handleSearchParamsChange] as const;
}
Loading
Loading