Skip to content

Commit

Permalink
Merge branch 'main' into feat/paypal-test
Browse files Browse the repository at this point in the history
  • Loading branch information
doproiescu-plenty authored Jun 6, 2024
2 parents 107f649 + 97e5bfc commit 3bbc8a7
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 223 deletions.
5 changes: 0 additions & 5 deletions apps/web/assets/icons/edit.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const getLabel = (item: VariationMapProductAttributeValue): string => {
};
const getImagePath = (item: VariationMapProductAttributeValue): string => {
return domain + productAttributeGetters.getAttributeValueImageUrl(item);
const path = productAttributeGetters.getAttributeValueImageUrl(item);
return path.startsWith('http') ? path : domain + path;
};
const validationSchema = toTypedSchema(
Expand Down
18 changes: 16 additions & 2 deletions apps/web/components/ui/Review/Review.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
<SfIconVisibility v-if="isReviewVisibile" size="sm" class="fill-neutral-400" />
<SfIconVisibilityOff v-else size="sm" class="fill-neutral-400" />
</SfTooltip>
<PlentyEdit @click="openReviewEdit" class="text-primary-900 cursor-pointer" />
<SfIconBase @click="openReviewEdit" viewBox="0 0 32 32" size="xs" class="fill-primary-900 cursor-pointer">
<path
d="M31.25 7.003c0-0 0-0.001 0-0.001 0-0.346-0.14-0.659-0.365-0.886l-5-5c-0.227-0.226-0.539-0.366-0.885-0.366s-0.658 0.14-0.885 0.366v0l-20.999 20.999c-0.146 0.146-0.256 0.329-0.316 0.532l-0.002 0.009-2 7c-0.030 0.102-0.048 0.22-0.048 0.342 0 0.691 0.559 1.251 1.25 1.252h0c0.126-0 0.248-0.019 0.363-0.053l-0.009 0.002 6.788-2c0.206-0.063 0.383-0.17 0.527-0.311l-0 0 21.211-21c0.229-0.226 0.37-0.539 0.371-0.886v-0zM8.133 26.891l-4.307 1.268 1.287-4.504 14.891-14.891 3.219 3.187zM25 10.191l-3.228-3.196 3.228-3.228 3.229 3.228z"
/>
</SfIconBase>
<SfIconDelete @click="openDeleteReview" size="sm" class="fill-primary-900 cursor-pointer" />
</div>
</div>
Expand Down Expand Up @@ -57,7 +61,16 @@
<SfIconVisibility v-if="reviewGetters.getReviewVisibility(reply)" size="xs" class="fill-neutral-400" />
<SfIconVisibilityOff v-else size="xs" class="fill-neutral-400" />
</SfTooltip>
<PlentyEdit @click="openReplyEditor(reply)" class="text-primary-900 cursor-pointer" />
<SfIconBase
@click="openReplyEditor(reply)"
viewBox="0 0 38 38"
size="xs"
class="fill-primary-900 cursor-pointer"
>
<path
d="M31.25 7.003c0-0 0-0.001 0-0.001 0-0.346-0.14-0.659-0.365-0.886l-5-5c-0.227-0.226-0.539-0.366-0.885-0.366s-0.658 0.14-0.885 0.366v0l-20.999 20.999c-0.146 0.146-0.256 0.329-0.316 0.532l-0.002 0.009-2 7c-0.030 0.102-0.048 0.22-0.048 0.342 0 0.691 0.559 1.251 1.25 1.252h0c0.126-0 0.248-0.019 0.363-0.053l-0.009 0.002 6.788-2c0.206-0.063 0.383-0.17 0.527-0.311l-0 0 21.211-21c0.229-0.226 0.37-0.539 0.371-0.886v-0zM8.133 26.891l-4.307 1.268 1.287-4.504 14.891-14.891 3.219 3.187zM25 10.191l-3.228-3.196 3.228-3.228 3.229 3.228z"
/>
</SfIconBase>
<SfIconDelete @click="openReplyDeletion(reply)" size="xs" class="fill-primary-900 cursor-pointer" />
</div>
<br />
Expand Down Expand Up @@ -164,6 +177,7 @@ import {
SfIconClose,
SfTooltip,
useDisclosure,
SfIconBase,
} from '@storefront-ui/vue';
import type { ReviewProps } from './types';
import ReviewForm from '~/components/ReviewForm/ReviewForm.vue';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import ProductFixture from "./../../../utils/__tests__/__fixtures__/Product";

describe('useProductAttributes', () => {
it('should initialize state correctly', () => {
const { attributes, attributeValues, combinations, itemId, variationId } = useProductAttributes();

expect(attributes.value).toEqual([]);
expect(attributeValues.value).toEqual({});
expect(combinations.value).toEqual([]);
expect(itemId.value).toBe(0);
expect(variationId.value).toBe(0);
});

it('should update attribute values', () => {
const { setAttribute, updateValue, attributeValues } = useProductAttributes();
setAttribute(ProductFixture, true);
updateValue(1, 1);

expect(attributeValues.value).toEqual({ 1: 1 });
});


it('should should return empty object if value is not found during update', () => {
const { setAttribute, updateValue, attributeValues } = useProductAttributes();
setAttribute(ProductFixture, true);
updateValue(1, 2);

expect(attributeValues.value).toEqual({});
});

it('should get the correct combination of attributes', () => {
const { setAttribute, getCombination } = useProductAttributes();

setAttribute(ProductFixture, true);
const combination = getCombination();

expect(combination).toEqual({
attributes: [],
isSalable: true,
unitCombinationId: 9,
unitId: 5,
unitName: "2 liter",
variationId: 1100,
});
});

it('should get the correct attribute value', () => {
const { setAttribute, updateValue, getValue } = useProductAttributes();
setAttribute(ProductFixture, true);
updateValue(1, 1);

const value = getValue(1);

expect(value).toBe(1);
});
});
2 changes: 2 additions & 0 deletions apps/web/composables/useProductAttributes/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type GetCombination = () => VariationMapProductVariation | null;

export interface UseProductAttributesReturn {
attributes: Readonly<Ref<UseProductAttributesState['attributes']>>;
itemId: Readonly<Ref<UseProductAttributesState['itemId']>>;
variationId: Readonly<Ref<UseProductAttributesState['variationId']>>;
attributeValues: Ref<UseProductAttributesState['attributeValues']>;
combinations: Readonly<Ref<UseProductAttributesState['combinations']>>;
setAttribute: SetAttribute;
Expand Down
22 changes: 20 additions & 2 deletions apps/web/i18n.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export default defineI18nConfig(() => ({
import type { NuxtI18nOptions } from '@nuxtjs/i18n';

export default {
fallbackLocale: 'en',
detectBrowserLanguage: false,
numberFormats: {
Expand All @@ -17,4 +19,20 @@ export default defineI18nConfig(() => ({
},
},
},
}));
};

export const nuxtI18nOptions: NuxtI18nOptions = {
locales: [
{
code: 'en',
file: 'en.json',
},
{
code: 'de',
file: 'de.json',
},
],
langDir: 'lang',
defaultLocale: 'en',
strategy: 'prefix_and_default',
};
8 changes: 4 additions & 4 deletions apps/web/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,10 @@
"imageAlt": "Bild zum Bestätigen der erfolgreichen Anmeldung"
},
"benefits": {
"saveAddresses": "Save multiple addresses",
"orderTracking": "Keep track of your orders",
"wishlist": "Save items for later everywhere you go",
"orderHistory": "Your complete order history in one place"
"saveAddresses": "Speichern Sie mehrere Adressen",
"orderTracking": "Behalten Sie den Überblick über Ihre Bestellungen",
"wishlist": "Speichern Sie Ihre Artikel für später",
"orderHistory": "Ihre komplette Bestellhistorie an einem Ort"
},
"passwordValidation": {
"characters": "Das Passwort muss mindestens 8 Zeichen lang sein.",
Expand Down
Loading

0 comments on commit 3bbc8a7

Please sign in to comment.