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

Implementing sign in #84

Open
wants to merge 84 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
a57402e
Update demo url to localhost:3000
Xertium Aug 7, 2024
e5b9906
Fix build
Xertium Aug 8, 2024
028a780
Update constants.ts
Xertium Aug 15, 2024
5449433
entry client hu locale
kinstadtnerbalint Aug 15, 2024
c03d41a
hu lang
kinstadtnerbalint Aug 15, 2024
c68decb
nextjs site build packages
Xertium Aug 16, 2024
5cfafb7
feat: init
kinstadtnerbalint Aug 16, 2024
dce1138
merge
kinstadtnerbalint Aug 16, 2024
b7a3477
fix: fix
kinstadtnerbalint Aug 16, 2024
a29fc26
Components
Xertium Aug 16, 2024
c935067
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 16, 2024
a69ee85
feat: font, header, footer
kinstadtnerbalint Aug 16, 2024
09eb48a
feat: rename default component folders
kinstadtnerbalint Aug 16, 2024
37f181f
feat: article page static
kinstadtnerbalint Aug 16, 2024
b1c174a
Index page
Xertium Aug 16, 2024
3540297
Index
Xertium Aug 16, 2024
69fe31e
feat: outletcontext layout management
kinstadtnerbalint Aug 16, 2024
ee782eb
merge
kinstadtnerbalint Aug 16, 2024
fa8fdea
fix: add function back to context
kinstadtnerbalint Aug 16, 2024
157cb39
fix: fix
kinstadtnerbalint Aug 16, 2024
18392a8
fix: fix
kinstadtnerbalint Aug 16, 2024
2e0c7a4
Fixes
Xertium Aug 16, 2024
24035b1
fixes
Xertium Aug 16, 2024
a7cbca0
feat:
kinstadtnerbalint Aug 16, 2024
1c7ac98
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 16, 2024
89e3be9
Some fix and features in collection page
Xertium Aug 19, 2024
5fa8567
Review collection and some collection page feature
Xertium Aug 20, 2024
1e08fd4
Fix searchParams on change
Xertium Aug 20, 2024
51e64a8
Breadcrumbs
Xertium Aug 20, 2024
057c8d0
Save scrollpositions
Xertium Aug 20, 2024
f66296b
ProductProfile
Xertium Aug 21, 2024
e6439ca
Change collection to collectionItems
Xertium Aug 21, 2024
f32f579
Filter sidebar props
Xertium Aug 21, 2024
27c123a
Elastic search
Xertium Aug 21, 2024
ec3520c
inline search in collection
Xertium Aug 21, 2024
7ee4762
feat: Link tags, product page, fake data
kinstadtnerbalint Aug 21, 2024
c8ef37c
fix: merge conf
kinstadtnerbalint Aug 21, 2024
55d5539
fix: merge import
kinstadtnerbalint Aug 21, 2024
4659d25
Try to fix elastic search
Xertium Aug 21, 2024
3f6cf9a
Merge
Xertium Aug 21, 2024
196f43e
fix: navbar prefetch
kinstadtnerbalint Aug 21, 2024
0acd2f9
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 21, 2024
4f053c9
fix: frontpage image to random image
kinstadtnerbalint Aug 21, 2024
e174580
Update ListingInfo.tsx
Xertium Aug 21, 2024
a6753f2
fix: logo main page prefetch
kinstadtnerbalint Aug 21, 2024
d0b3d3b
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 21, 2024
3061fd5
Elastic search
Xertium Aug 21, 2024
c6cece0
Merge branch 'master' of https://github.com/store-front/vendure-store…
Xertium Aug 21, 2024
6b4cd22
turn pagination variables into contants
Xertium Aug 22, 2024
cda421e
Fix import of pagination constants
Xertium Aug 22, 2024
d86c1e6
Some fixes
Xertium Aug 22, 2024
daf3143
autosuggestion features
Xertium Aug 22, 2024
bb3a259
Update AutoSuggestion.tsx
Xertium Aug 22, 2024
999d92f
Fix timer delays
Xertium Aug 22, 2024
ee1aa44
Typing delay move into constant
Xertium Aug 22, 2024
d49312e
fix: prevent scroll reset on link tag
kinstadtnerbalint Aug 22, 2024
810f281
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 22, 2024
8e64fc2
No result placeholder
Xertium Aug 22, 2024
cde5872
Merge branch 'master' of https://github.com/store-front/vendure-store…
Xertium Aug 22, 2024
3f93610
Update NavbarSearch.tsx
Xertium Aug 22, 2024
0f47f7c
fix: breadcrumbs
kinstadtnerbalint Aug 23, 2024
65e4f3a
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 23, 2024
97b5d30
Search by facet and filters
Xertium Aug 23, 2024
823a5de
Merge branch 'master' of https://github.com/store-front/vendure-store…
Xertium Aug 23, 2024
5dba947
Filters
Xertium Aug 23, 2024
fea9972
feat: menu bar query
kinstadtnerbalint Aug 23, 2024
9ebd456
fix: merge
kinstadtnerbalint Aug 23, 2024
28370e1
feat: alkategoriak 1. szinten
kinstadtnerbalint Aug 23, 2024
07cda8a
Some fix
Xertium Aug 26, 2024
96d424d
feat: category hierarchy menu
kinstadtnerbalint Aug 26, 2024
ae3efed
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 26, 2024
2ad03fd
Add to cart
Xertium Aug 26, 2024
8c59eef
Cart fixes
Xertium Aug 26, 2024
597b836
feat: truncate badge on product card
kinstadtnerbalint Aug 26, 2024
25651d7
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 26, 2024
4d0a708
Fixed avatars
Xertium Aug 26, 2024
8c4ca8f
fix: revert sheet animation
kinstadtnerbalint Aug 26, 2024
b405e3a
Merge branch 'master' of https://github.com/store-front/vendure-store…
kinstadtnerbalint Aug 26, 2024
e7fb8a2
feat: navbar grid
kinstadtnerbalint Aug 26, 2024
78d26a6
cart and checkout page
Xertium Aug 27, 2024
b7b6f4a
cart and checkout page
Xertium Aug 27, 2024
95a9cf9
Password reset
promartin Sep 13, 2024
b912cc2
Password reset
promartin Sep 13, 2024
5162c2e
Merge branch 'implementing-sign-in' of https://github.com/store-front…
promartin Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 0 additions & 9 deletions .env.template

This file was deleted.

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:20

WORKDIR /usr/src/app

COPY package.json ./
COPY yarn.lock ./
RUN yarn install --production
COPY . .
RUN yarn build

CMD [ "yarn", "start" ]
8 changes: 4 additions & 4 deletions app/routes/account.tsx → app/_routes/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import {
ShoppingBagIcon,
UserCircleIcon,
} from '@heroicons/react/24/solid';
import { Form, Outlet, useLoaderData, useMatches } from '@remix-run/react';
import { Form, Outlet, useLoaderData } from '@remix-run/react';
import { DataFunctionArgs, json, redirect } from '@remix-run/server-runtime';
import { TabProps } from '~/components/tabs/Tab';
import { TabsContainer } from '~/components/tabs/TabsContainer';
import { getActiveCustomerDetails } from '~/providers/customer/customer';
import { useTranslation } from 'react-i18next';
import { TabProps } from '~/components/_tabs/Tab';
import { TabsContainer } from '~/components/_tabs/TabsContainer';
import { getActiveCustomerDetails } from '~/providers/customer/customer';

export async function loader({ request }: DataFunctionArgs) {
const { activeCustomer } = await getActiveCustomerDetails({ request });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Outlet, useLoaderData } from '@remix-run/react';
import { LoaderFunctionArgs } from '@remix-run/router';
import { ActionFunctionArgs, json } from '@remix-run/server-runtime';
import AddAddressCard from '~/components/account/AddAddressCard';
import EditAddressCard from '~/components/account/EditAddressCard';
import AddAddressCard from '~/components/_account/AddAddressCard';
import EditAddressCard from '~/components/_account/EditAddressCard';
import { Address, ErrorCode, ErrorResult } from '~/generated/graphql';
import { getFixedT } from '~/i18next.server';
import {
deleteCustomerAddress,
updateCustomerAddress,
} from '~/providers/account/account';
import { getActiveCustomerAddresses } from '~/providers/customer/customer';
import { getFixedT } from '~/i18next.server';
import { LoaderFunctionArgs } from '@remix-run/router';

export async function loader({ request }: LoaderFunctionArgs) {
const res = await getActiveCustomerAddresses({ request });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import {
useActionData,
useLoaderData,
useNavigate,
useSubmit,
useNavigation,
useSubmit,
} from '@remix-run/react';
import { DataFunctionArgs, json, redirect } from '@remix-run/server-runtime';
import { useRef, useEffect } from 'react';
import { useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { validationError } from 'remix-validated-form';
import CustomerAddressForm, {
validator,
} from '~/components/_account/CustomerAddressForm';
import Modal from '~/components/_modal/Modal';
import { Button } from '~/components/Button';
import Modal from '~/components/modal/Modal';
import { HighlightedButton } from '~/components/HighlightedButton';
import { Address } from '~/generated/graphql';
import useToggleState from '~/utils/use-toggle-state';
import CustomerAddressForm, {
validator,
} from '~/components/account/CustomerAddressForm';
import { updateCustomerAddress } from '~/providers/account/account';
import { getAvailableCountries } from '~/providers/checkout/checkout';
import { getActiveCustomerAddresses } from '~/providers/customer/customer';
import { useTranslation } from 'react-i18next';
import useToggleState from '~/utils/use-toggle-state';

export async function loader({ request, params }: DataFunctionArgs) {
const { activeCustomer } = await getActiveCustomerAddresses({ request });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import {
useSubmit,
} from '@remix-run/react';
import { DataFunctionArgs, json } from '@remix-run/server-runtime';
import { useRef, useEffect } from 'react';
import { useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import { validationError } from 'remix-validated-form';
import { Button } from '~/components/Button';
import Modal from '~/components/modal/Modal';
import { HighlightedButton } from '~/components/HighlightedButton';
import useToggleState from '~/utils/use-toggle-state';
import CustomerAddressForm, {
validator,
} from '~/components/account/CustomerAddressForm';
} from '~/components/_account/CustomerAddressForm';
import Modal from '~/components/_modal/Modal';
import { Button } from '~/components/Button';
import { HighlightedButton } from '~/components/HighlightedButton';
import { createCustomerAddress } from '~/providers/account/account';
import { getAvailableCountries } from '~/providers/checkout/checkout';
import { useTranslation } from 'react-i18next';
import useToggleState from '~/utils/use-toggle-state';

export async function loader({ request, params }: DataFunctionArgs) {
const { availableCountries } = await getAvailableCountries({ request });
Expand Down
21 changes: 8 additions & 13 deletions app/routes/account/history.tsx → app/_routes/account/history.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { useLoaderData, useNavigation, useSubmit } from '@remix-run/react';
import { DataFunctionArgs, json, redirect } from '@remix-run/server-runtime';
import OrderHistoryItem from '~/components/account/OrderHistoryItem';
import { getActiveCustomerOrderList } from '~/providers/customer/customer';
import { OrderListOptions, SortOrder } from '~/generated/graphql';
import { Pagination } from '~/components/Pagination';
import { ValidatedForm } from 'remix-validated-form';
import { withZod } from '@remix-validated-form/with-zod';
import { useTranslation } from 'react-i18next';
import { ValidatedForm } from 'remix-validated-form';
import OrderHistoryItem from '~/components/_account/OrderHistoryItem';
import { Pagination } from '~/components/Pagination';
import { allowedPaginationLimits, paginationLimitMinimumDefault } from '~/constants';
import { OrderListOptions, SortOrder } from '~/generated/graphql';
import { getActiveCustomerOrderList } from '~/providers/customer/customer';
import {
paginationValidationSchema,
translatePaginationFrom,
translatePaginationTo,
paginationValidationSchema,
} from '~/utils/pagination';
import { useTranslation } from 'react-i18next';

const paginationLimitMinimumDefault = 10;
const allowedPaginationLimits = new Set<number>([
paginationLimitMinimumDefault,
20,
30,
]);
const orderPaginationSchema = paginationValidationSchema(
allowedPaginationLimits,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import { useActionData, useLoaderData, useNavigation } from '@remix-run/react';
import { DataFunctionArgs, json, redirect } from '@remix-run/server-runtime';
import { withZod } from '@remix-validated-form/with-zod';
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { ValidatedForm, validationError } from 'remix-validated-form';
import { z } from 'zod';
import { Button } from '~/components/Button';
import { ErrorMessage } from '~/components/ErrorMessage';
import { HighlightedButton } from '~/components/HighlightedButton';
import { Input } from '~/components/Input';
import Modal from '~/components/modal/Modal';
import Modal from '~/components/_modal/Modal';
import {
requestUpdateCustomerEmailAddress,
updateCustomer,
} from '~/providers/account/account';
import { getActiveCustomerDetails } from '~/providers/customer/customer';
import useToggleState from '~/utils/use-toggle-state';
import { replaceEmptyString } from '~/utils/validation';
import { useTranslation } from 'react-i18next';

enum FormIntent {
UpdateEmail = 'updateEmail',
Expand Down
File renamed without changes.
163 changes: 163 additions & 0 deletions app/_routes/api/active-order.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import {
addItemToOrder,
adjustOrderLine,
getActiveOrder,
removeOrderLine,
setCustomerForOrder,
setOrderShippingAddress,
setOrderShippingMethod,
} from '~/providers/orders/order';
import { DataFunctionArgs, json } from '@remix-run/server-runtime';
import {
CreateAddressInput,
CreateCustomerInput,
ErrorCode,
ErrorResult,
OrderDetailFragment,
} from '~/generated/graphql';
import { getSessionStorage } from '~/sessions';
import { shippingFormDataIsValid } from '~/utils/validation';

export type CartLoaderData = Awaited<ReturnType<typeof loader>>;

export async function loader({ request }: DataFunctionArgs) {
return {
activeOrder: await getActiveOrder({ request }),
};
}

export async function action({ request, params }: DataFunctionArgs) {
const body = await request.formData();
const formAction = body.get('action');
let activeOrder: OrderDetailFragment | undefined = undefined;
let error: ErrorResult = {
errorCode: ErrorCode.NoActiveOrderError,
message: '',
};
switch (formAction) {
case 'setCheckoutShipping':
if (shippingFormDataIsValid(body)) {
const shippingFormData = Object.fromEntries<any>(
body.entries(),
) as CreateAddressInput;
const result = await setOrderShippingAddress(
{
city: shippingFormData.city,
company: shippingFormData.company,
countryCode: shippingFormData.countryCode,
customFields: shippingFormData.customFields,
fullName: shippingFormData.fullName,
phoneNumber: shippingFormData.phoneNumber,
postalCode: shippingFormData.postalCode,
province: shippingFormData.province,
streetLine1: shippingFormData.streetLine1,
streetLine2: shippingFormData.streetLine2,
},
{ request },
);
if (result.setOrderShippingAddress.__typename === 'Order') {
activeOrder = result.setOrderShippingAddress;
} else {
error = result.setOrderShippingAddress;
}
}
break;
case 'setOrderCustomer': {
const customerData = Object.fromEntries<any>(
body.entries(),
) as CreateCustomerInput;
const result = await setCustomerForOrder(
{
emailAddress: customerData.emailAddress,
firstName: customerData.firstName,
lastName: customerData.lastName,
},
{ request },
);
if (result.setCustomerForOrder.__typename === 'Order') {
activeOrder = result.setCustomerForOrder;
} else {
error = result.setCustomerForOrder;
}
break;
}
case 'setShippingMethod': {
const shippingMethodId = body.get('shippingMethodId');
if (typeof shippingMethodId === 'string') {
const result = await setOrderShippingMethod(shippingMethodId, {
request,
});
if (result.setOrderShippingMethod.__typename === 'Order') {
activeOrder = result.setOrderShippingMethod;
} else {
error = result.setOrderShippingMethod;
}
}
break;
}
case 'removeItem': {
const lineId = body.get('lineId');
const result = await removeOrderLine(lineId?.toString() ?? '', {
request,
});
if (result.removeOrderLine.__typename === 'Order') {
activeOrder = result.removeOrderLine;
} else {
error = result.removeOrderLine;
}
break;
}
case 'adjustItem': {
const lineId = body.get('lineId');
const quantity = body.get('quantity');
if (lineId && quantity != null) {
const result = await adjustOrderLine(lineId?.toString(), +quantity, {
request,
});
if (result.adjustOrderLine.__typename === 'Order') {
activeOrder = result.adjustOrderLine;
} else {
error = result.adjustOrderLine;
}
}
break;
}
case 'addItemToOrder': {
const variantId = body.get('variantId')?.toString();
const quantity = Number(body.get('quantity')?.toString() ?? 1);
if (!variantId || !(quantity > 0)) {
throw new Error(
`Invalid input: variantId ${variantId}, quantity ${quantity}`,
);
}
const result = await addItemToOrder(variantId, quantity, {
request,
});
if (result.addItemToOrder.__typename === 'Order') {
activeOrder = result.addItemToOrder;
} else {
error = result.addItemToOrder;
}
break;
}
case 'addPaymentToOrder': {
}
default:
// Don't do anything
}
let headers: ResponseInit['headers'] = {};
const sessionStorage = await getSessionStorage();
const session = await sessionStorage.getSession(
request?.headers.get('Cookie'),
);
session.flash('activeOrderError', error);
headers = {
'Set-Cookie': await sessionStorage.commitSession(session),
};
return json(
{ activeOrder: activeOrder || (await getActiveOrder({ request })) },
{
headers,
},
);
}
11 changes: 11 additions & 0 deletions app/_routes/api/logout.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { DataFunctionArgs, redirect } from '@remix-run/server-runtime';
import { logout } from '~/providers/account/account';

export async function action({ request }: DataFunctionArgs) {
const result = await logout({ request });
return redirect('/', { headers: result._headers });
}

export async function loader() {
return redirect('/');
}
Loading