Skip to content

Commit 1a15bbe

Browse files
authored
Merge pull request #1382 from w3bdesign/dev
Prettier
2 parents 9890284 + b7d7c85 commit 1a15bbe

File tree

11 files changed

+597
-642
lines changed

11 files changed

+597
-642
lines changed

app.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<!DOCTYPE html>
2+
<!doctype html>
33
<Html lang="en">
4-
<title>Nuxt 3 Woocommerce</title>
4+
<title>Nuxt 3 Woocommerce</title>
55
<Body
66
class="antialiased duration-300 transition-colors text-gray-800 bg-white"
77
>

components/Cart/CartContents.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
<h2 class="mt-64 text-3xl text-center">Loading cart...</h2>
44
</div>
55
<div v-else-if="error">
6-
<h2 class="mt-64 text-3xl text-center text-red-500">Error loading cart. Please try again.</h2>
6+
<h2 class="mt-64 text-3xl text-center text-red-500">
7+
Error loading cart. Please try again.
8+
</h2>
79
</div>
810
<div v-else-if="cartItems.length">
911
<h1 class="h-10 p-6 text-3xl font-bold text-center">Cart</h1>
@@ -29,15 +31,15 @@
2931
* @module CartContents
3032
* @returns {Object} The Vue.js component object.
3133
*/
32-
import { computed, ref, onMounted } from 'vue';
34+
import { computed, ref, onMounted } from "vue";
3335
import { useCart } from "@/store/useCart";
34-
import CommonButton from '@/components/common/CommonButton.vue';
36+
import CommonButton from "@/components/common/CommonButton.vue";
3537
3638
const props = defineProps({
3739
showCheckoutButton: {
3840
type: Boolean,
39-
default: false
40-
}
41+
default: false,
42+
},
4143
});
4244
4345
const cart = useCart();
@@ -55,7 +57,7 @@ const handleRemoveProduct = async (key) => {
5557
try {
5658
await cart.removeProductFromCart(key);
5759
} catch (error) {
58-
console.error('Error removing product from cart:', error);
60+
console.error("Error removing product from cart:", error);
5961
// Optionally, you can add a user-friendly notification here
6062
// without exposing the error details
6163
}
@@ -65,7 +67,7 @@ onMounted(async () => {
6567
try {
6668
await cart.refetch();
6769
} catch (err) {
68-
console.error('Error fetching cart:', err);
70+
console.error("Error fetching cart:", err);
6971
error.value = err;
7072
} finally {
7173
isLoading.value = false;

components/Cart/CartItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
* @emits CartItem#remove - Emitted when the remove button is clicked.
4747
*/
4848
49-
import { ref } from 'vue';
49+
import { ref } from "vue";
5050
import { formatPrice } from "@/utils/functions";
5151
5252
const isRemoving = ref(false);

components/Layout/LayoutMobileMenu.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
</NuxtLink>
2525
</li>
2626
<li class="text-xl linkStyle">
27-
<NuxtLink to="/search" @click="displayMobileMenu"> Search </NuxtLink>
27+
<NuxtLink to="/search" @click="displayMobileMenu">
28+
Search
29+
</NuxtLink>
2830
</li>
2931
</ul>
3032
</div>
@@ -50,7 +52,7 @@
5052
</template>
5153

5254
<script setup>
53-
import { ref } from 'vue'
55+
import { ref } from "vue";
5456
5557
const expandedMenu = useState("expandedMenu", () => false);
5658
const mobileMenu = ref(null);
@@ -61,10 +63,9 @@ const displayMobileMenu = () => {
6163
</script>
6264

6365
<style scoped>
64-
6566
.mobile-menu {
6667
top: 0;
67-
bottom: 80px;
68+
bottom: 80px;
6869
max-height: calc(100vh - 80px);
6970
}
7071

components/Products/ProductsSingleProduct.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ watch(
113113
dataValue.product?.variations?.nodes[0].databaseId;
114114
}
115115
},
116-
{ immediate: true }
116+
{ immediate: true },
117117
);
118118
119119
/**
@@ -127,7 +127,7 @@ const addProductToCart = async (product) => {
127127
await cart.addToCart(product);
128128
toast.value.show();
129129
} catch (error) {
130-
console.error('Error adding product to cart:', error);
130+
console.error("Error adding product to cart:", error);
131131
// You might want to show an error message to the user here
132132
}
133133
};

components/common/Toast.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
</template>
1212

1313
<script setup>
14-
import { ref, watch } from 'vue';
14+
import { ref, watch } from "vue";
1515
1616
const props = defineProps({
1717
message: {
1818
type: String,
19-
default: 'Product added to cart'
19+
default: "Product added to cart",
2020
},
2121
duration: {
2222
type: Number,
23-
default: 3000
24-
}
23+
default: 3000,
24+
},
2525
});
2626
2727
const isVisible = ref(false);
@@ -45,7 +45,7 @@ defineExpose({ show });
4545
}
4646
4747
.toast-content {
48-
background-color: #4CAF50;
48+
background-color: #4caf50;
4949
color: white;
5050
padding: 16px;
5151
border-radius: 4px;
@@ -68,4 +68,4 @@ defineExpose({ show });
6868
opacity: 1;
6969
transform: translateX(0);
7070
}
71-
</style>
71+
</style>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"preview": "nuxt preview",
99
"postinstall": "nuxt prepare",
1010
"format": "prettier --write \"**/*.{js,ts,vue}\"",
11-
"refresh": "rm -rf node_modules && rm pnpm-lock.yaml && pnpm i && npm run format"
11+
"refresh": "rm -rf node_modules && rm pnpm-lock.yaml && pnpm i && pnpm run format"
1212
},
1313
"devDependencies": {
1414
"@playwright/test": "^1.47.1",

plugins/apollo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default defineNuxtPlugin((nuxtApp) => {
7777
cache,
7878
defaultOptions: {
7979
watchQuery: {
80-
fetchPolicy: 'cache-and-network',
80+
fetchPolicy: "cache-and-network",
8181
},
8282
},
8383
});

plugins/cartUpdater.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { useCart } from '@/store/useCart';
1+
import { useCart } from "@/store/useCart";
22

33
export default defineNuxtPlugin((nuxtApp) => {
4-
nuxtApp.hook('app:created', () => {
4+
nuxtApp.hook("app:created", () => {
55
const cart = useCart();
6-
6+
77
// Refetch cart data on initial load
88
cart.refetch();
99

@@ -13,4 +13,4 @@ export default defineNuxtPlugin((nuxtApp) => {
1313
next();
1414
});
1515
});
16-
});
16+
});

0 commit comments

Comments
 (0)