Skip to content

Commit 3fa8cc6

Browse files
committed
[feature] Set up initial project structure
1 parent d33ea57 commit 3fa8cc6

File tree

316 files changed

+52767
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

316 files changed

+52767
-0
lines changed

.eslintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.gitignore

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
.yarn/install-state.gz
8+
9+
# testing
10+
/coverage
11+
12+
# next.js
13+
/.next/
14+
/out/
15+
16+
# production
17+
/build
18+
19+
# misc
20+
.DS_Store
21+
*.pem
22+
23+
# debug
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts
37+
38+
.env
39+
yarn.lock
40+
41+
**/public/sw.js
42+
**/public/workbox-*.js
43+
**/public/worker-*.js
44+
**/public/sw.js.map
45+
**/public/workbox-*.js.map
46+
**/public/worker-*.js.map

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
README.md

.prettierrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"singleQuote": false,
3+
"bracketSpacing": true,
4+
"printWidth": 80,
5+
"tabWidth": 2
6+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"editor.formatOnSave": true,
4+
"cSpell.words": ["daisyui", "swiper"]
5+
}

env-sample

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
GRAPHQL_URL="https://wedocommerce.wedowebapps.com/graphql"
2+

next.config.js

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/** @type {import('next').NextConfig} */
2+
3+
const nextConfig = {
4+
reactStrictMode: true,
5+
swcMinify: true,
6+
compiler: {
7+
removeConsole: process.env.NODE_ENV !== "development", // Remove console.log in production
8+
},
9+
async rewrites() {
10+
return [
11+
{
12+
source: "/graphql",
13+
destination: process.env.GRAPHQL_URL,
14+
},
15+
];
16+
},
17+
env: {
18+
GRAPHQL_URL: process.env.GRAPHQL_URL,
19+
FBPIXEL_TRACK_ID: process.env.FBPIXEL_TRACK_ID,
20+
ENABLE_FACEBOOK_TRACKING: process.env.ENABLE_FACEBOOK_TRACKING,
21+
PAYPAL_RETURN_URL: process.env.PAYPAL_RETURN_URL,
22+
PAYPAL_CANCEL_URL: process.env.PAYPAL_CANCEL_URL,
23+
},
24+
images: {
25+
domains: [
26+
"daisyui.com",
27+
"i.postimg.cc",
28+
"rukminim2.flixcart.com",
29+
"m.media-amazon.com",
30+
"wedocommerce.wedowebapps.com",
31+
],
32+
},
33+
webpack(config, { webpack }) {
34+
config.module.rules.push({
35+
test: /\.(graphql|gql)$/,
36+
exclude: /node_modules/,
37+
use: [
38+
{
39+
loader: "graphql-tag/loader",
40+
},
41+
],
42+
});
43+
44+
return config;
45+
},
46+
};
47+
48+
const withPWA = require("next-pwa")({
49+
dest: "public", // Destination directory for the PWA files
50+
disable: process.env.NODE_ENV === "development", // Disable PWA in development mode
51+
register: true, // Register the PWA service worker
52+
skipWaiting: true, // Skip waiting for service worker activation
53+
});
54+
55+
module.exports = withPWA(nextConfig);

package.json

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "wedo-commerce",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint",
10+
"format": "npx prettier --write ."
11+
},
12+
"dependencies": {
13+
"@apollo/client": "^3.9.0",
14+
"@apollo/experimental-nextjs-app-support": "^0.7.0",
15+
"@hookform/resolvers": "^3.3.4",
16+
"@paypal/react-paypal-js": "^8.1.3",
17+
"@reduxjs/toolkit": "^2.1.0",
18+
"@types/react-lottie": "^1.2.10",
19+
"clsx": "^2.1.0",
20+
"embla-carousel": "^8.0.0-rc19",
21+
"embla-carousel-react": "^8.0.0-rc19",
22+
"graphql": "^16.8.1",
23+
"graphql-tag": "^2.12.6",
24+
"moment": "^2.30.1",
25+
"next": "14.0.4",
26+
"next-pwa": "^5.6.0",
27+
"prettier": "^3.1.1",
28+
"react": "^18",
29+
"react-dom": "^18",
30+
"react-dropdown": "^1.11.0",
31+
"react-hook-form": "^7.50.1",
32+
"react-lottie": "^1.2.4",
33+
"react-redux": "^9.1.0",
34+
"react-toastify": "^10.0.4",
35+
"swiper": "^11.0.5",
36+
"yup": "^1.3.3"
37+
},
38+
"devDependencies": {
39+
"@types/node": "^20",
40+
"@types/react": "^18",
41+
"@types/react-dom": "^18",
42+
"autoprefixer": "^10.0.1",
43+
"daisyui": "^4.6.0",
44+
"eslint": "^8",
45+
"eslint-config-next": "14.0.4",
46+
"postcss": "^8",
47+
"tailwindcss": "^3.3.0",
48+
"typescript": "^5"
49+
}
50+
}

postcss.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
};

public/manifest.json

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"name": "Wedo Commerce",
3+
"short_name": "wedo-commerce",
4+
"theme_color": "#000",
5+
"background_color": "#e9ecef",
6+
"display": "standalone",
7+
"orientation": "portrait",
8+
"scope": "/",
9+
"start_url": "/",
10+
"icons": [
11+
{
12+
"src": "/media/icons/icon-48x48.png",
13+
"sizes": "48x48",
14+
"type": "image/png",
15+
"purpose": "maskable any"
16+
},
17+
{
18+
"src": "/media/icons/icon-72x72.png",
19+
"sizes": "72x72",
20+
"type": "image/png",
21+
"purpose": "maskable any"
22+
},
23+
{
24+
"src": "/media/icons/icon-96x96.png",
25+
"sizes": "96x96",
26+
"type": "image/png",
27+
"purpose": "maskable any"
28+
},
29+
{
30+
"src": "/media/icons/icon-128x128.png",
31+
"sizes": "128x128",
32+
"type": "image/png",
33+
"purpose": "maskable any"
34+
},
35+
{
36+
"src": "/media/icons/icon-144x144.png",
37+
"sizes": "144x144",
38+
"type": "image/png",
39+
"purpose": "maskable any"
40+
},
41+
{
42+
"src": "/media/icons/icon-152x152.png",
43+
"sizes": "152x152",
44+
"type": "image/png",
45+
"purpose": "maskable any"
46+
},
47+
{
48+
"src": "/media/icons/icon-192x192.png",
49+
"sizes": "192x192",
50+
"type": "image/png",
51+
"purpose": "maskable any"
52+
},
53+
{
54+
"src": "/media/icons/icon-384x384.png",
55+
"sizes": "384x384",
56+
"type": "image/png",
57+
"purpose": "maskable any"
58+
},
59+
{
60+
"src": "/media/icons/icon-512x512.png",
61+
"sizes": "512x512",
62+
"type": "image/png",
63+
"purpose": "maskable any"
64+
}
65+
],
66+
"splash_pages": null
67+
}

public/next.svg

+1
Loading

public/vercel.svg

+1
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use client";
2+
3+
import { AccountInformationContainer } from "@/container";
4+
5+
export default function AccountInformationPage() {
6+
return <AccountInformationContainer />;
7+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use client";
2+
3+
import { AddressBookContainer } from "@/container";
4+
5+
export default function AddressBookPage() {
6+
return <AddressBookContainer />;
7+
}

src/app/(account)/layout.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use client";
2+
3+
import { AccountSidebar } from "@/components";
4+
5+
export default function AccountLayout({
6+
children,
7+
}: {
8+
children: React.ReactNode;
9+
}) {
10+
return (
11+
<div className="container mx-auto flex flex-col sm:flex-col md:flex-col lg:flex-row xl:flex-row py-8 gap-4">
12+
<div className="">
13+
<AccountSidebar />
14+
</div>
15+
<div className="w-full">{children}</div>
16+
</div>
17+
);
18+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"use client";
2+
3+
import { OrderHistoryContainer } from "@/container";
4+
5+
export default function OrderHistoryPage() {
6+
return <OrderHistoryContainer />;
7+
}

src/app/ApolloWrapper.tsx

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"use client";
2+
import { BrowserPersistence, localStorageKeys } from "@/utils";
3+
// ^ this file needs the "use client" pragma
4+
5+
import { ApolloLink, HttpLink } from "@apollo/client";
6+
import {
7+
ApolloNextAppProvider,
8+
NextSSRInMemoryCache,
9+
NextSSRApolloClient,
10+
SSRMultipartLink,
11+
} from "@apollo/experimental-nextjs-app-support/ssr";
12+
import React from "react";
13+
14+
// have a function to create a client for you
15+
function makeClient() {
16+
const storage = new BrowserPersistence();
17+
const token = storage.getItem(localStorageKeys.AUTH_TOKEN);
18+
19+
const uri = process.browser
20+
? new URL("/graphql", location.href)
21+
: new URL("/graphql", process.env.GRAPHQL_URL).href;
22+
23+
const httpLink = new HttpLink({
24+
headers: { Authorization: token ? `Bearer ${token}` : "" },
25+
26+
uri: uri as string,
27+
// you can disable result caching here if you want to
28+
// (this does not work if you are rendering your page with `export const dynamic = "force-static"`)
29+
fetchOptions: { cache: "no-store" },
30+
// you can override the default `fetchOptions` on a per query basis
31+
// via the `context` property on the options passed as a second argument
32+
// to an Apollo Client data fetching hook, e.g.:
33+
// const { data } = useSuspenseQuery(MY_QUERY, { context: { fetchOptions: { cache: "force-cache" }}});
34+
});
35+
36+
return new NextSSRApolloClient({
37+
// use the `NextSSRInMemoryCache`, not the normal `InMemoryCache`
38+
cache: new NextSSRInMemoryCache(),
39+
link:
40+
typeof window === "undefined"
41+
? ApolloLink.from([
42+
// in a SSR environment, if you use multipart features like
43+
// @defer, you need to decide how to handle these.
44+
// This strips all interfaces with a `@defer` directive from your queries.
45+
new SSRMultipartLink({
46+
stripDefer: true,
47+
}),
48+
httpLink,
49+
])
50+
: httpLink,
51+
});
52+
}
53+
54+
// you need to create a component to wrap your app in
55+
export function ApolloWrapper({ children }: React.PropsWithChildren) {
56+
return (
57+
<ApolloNextAppProvider makeClient={makeClient}>
58+
{children}
59+
</ApolloNextAppProvider>
60+
);
61+
}

src/app/cart/page.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use client";
2+
import { CartContainer } from "@/container";
3+
4+
export default function CartPage() {
5+
return <CartContainer />;
6+
}

0 commit comments

Comments
 (0)