Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Updates #49

Open
wants to merge 182 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
b0e42b6
Add or update the Azure App Service build and deployment workflow config
borisno2 Mar 13, 2022
effab76
package
borisno2 Mar 13, 2022
f3ba77d
pkg manager
borisno2 Mar 13, 2022
cd38a89
fix deploy
borisno2 Mar 14, 2022
d8ac85c
add frontend
borisno2 Mar 14, 2022
14376f1
fix
borisno2 Mar 14, 2022
936eb38
env
borisno2 Mar 14, 2022
4c6f945
speeling
borisno2 Mar 14, 2022
19008cc
paths
borisno2 Mar 14, 2022
bec906b
a
borisno2 Mar 14, 2022
2332c93
paths
borisno2 Mar 14, 2022
531fe9a
add zip for SPEED
borisno2 Mar 15, 2022
7fc2a12
Add or update the Azure App Service build and deployment workflow config
borisno2 Mar 15, 2022
cf44dd3
actions fixup
borisno2 Mar 15, 2022
bdbe194
updates
borisno2 Mar 15, 2022
4db7b68
deploy
borisno2 Mar 15, 2022
fbaf4ba
folder
borisno2 Mar 15, 2022
b02910f
go go
borisno2 Mar 15, 2022
753b04e
start
borisno2 Mar 15, 2022
faaa7aa
update
borisno2 Mar 15, 2022
35d46df
propper
borisno2 Mar 15, 2022
70377d0
migrations
borisno2 Mar 16, 2022
4d3fc08
prisma
borisno2 Mar 16, 2022
a3de9f9
Some updates
borisno2 Mar 17, 2022
725f3c2
Ad bits
borisno2 Mar 17, 2022
2f2932c
Add or update the App Service deployment workflow configuration from …
borisno2 Mar 17, 2022
ccaa13b
github actions fixup
borisno2 Mar 17, 2022
15263b5
Add or update the App Service deployment workflow configuration from …
borisno2 Mar 17, 2022
02c9fd8
move to docker frontend
borisno2 Mar 17, 2022
4eb18ce
Fix name
borisno2 Mar 17, 2022
2499274
enable healthcheck
borisno2 Mar 17, 2022
3596563
name
borisno2 Mar 17, 2022
6dc58aa
add max header
borisno2 Mar 17, 2022
f5a6183
Types
borisno2 Mar 17, 2022
464ad82
variatioindid
borisno2 Mar 17, 2022
9ade409
bit more
borisno2 Mar 17, 2022
9a9d8d0
formatting
borisno2 Mar 17, 2022
6932a23
wh secret
borisno2 Mar 18, 2022
6d7710a
rm log
borisno2 Mar 18, 2022
93d7d19
header to /pantry home
borisno2 Mar 18, 2022
5af3575
[skip ci] rm things
borisno2 Mar 18, 2022
4d0a4cc
add isAdmin
borisno2 Mar 18, 2022
ed05b86
security updates
borisno2 Mar 18, 2022
bdaf331
some updates
borisno2 Mar 18, 2022
6f8b47f
update access filters
borisno2 Mar 20, 2022
e37f5cc
use graphql session for userid
borisno2 Mar 20, 2022
cbb40b1
update schema
borisno2 Mar 20, 2022
cdd15b4
[skip ci] rename build steps
borisno2 Mar 20, 2022
b1e27a1
fix up access control
borisno2 Mar 21, 2022
7601e35
role on session
borisno2 Mar 21, 2022
71845e2
access updates
borisno2 Mar 21, 2022
8e4c232
update stripe hooks
borisno2 Mar 22, 2022
8c8a092
soem logs
borisno2 Mar 22, 2022
5c41bae
remove logs
borisno2 Mar 22, 2022
c6bcd99
Merge branch 'master' into master
borisno2 Mar 25, 2022
b980f5f
[skip ci] update renovate
borisno2 Mar 25, 2022
a56dba0
Merge branch 'master' of https://github.com/NeighbourhoodCollective/p…
borisno2 Mar 25, 2022
53364cf
Fixin things
borisno2 Mar 29, 2022
5adbf48
Update dependency stripe to v8.213.0
renovate-bot Mar 29, 2022
c99fba8
Update actions/checkout action to v3
renovate-bot Mar 29, 2022
7e4aaf2
Update actions/setup-node action to v3
renovate-bot Mar 29, 2022
d67cb25
Merge pull request #13 from NeighbourhoodCollective/renovate/stripe-8.x
borisno2 Mar 31, 2022
c141c85
some updates
borisno2 Apr 5, 2022
c6f4f8e
Fixes and changes
borisno2 Apr 27, 2022
810e664
ingore camel_case
borisno2 Apr 27, 2022
ee084b7
updates
borisno2 Apr 28, 2022
8c56107
fix
borisno2 Apr 28, 2022
1b7218f
upgrades
borisno2 Apr 28, 2022
8cc516b
updates
borisno2 Apr 28, 2022
862a7a6
remove after operation for now on Variation
borisno2 Apr 28, 2022
dd8a695
subscription and variation update
borisno2 Apr 28, 2022
3b09cd6
asc
borisno2 Apr 28, 2022
30b8155
fix another thing
borisno2 Apr 28, 2022
85c7673
fix resolver
borisno2 Apr 28, 2022
d87832f
Fix the things...
borisno2 Apr 29, 2022
573ddcb
[skip-ci] Packages
borisno2 May 2, 2022
af1ad4f
Update docker/build-push-action action to v3
renovate-bot May 9, 2022
17fcabe
Update docker/login-action action to v2
renovate-bot May 9, 2022
d26d6e4
Update docker/setup-buildx-action action to v2
renovate-bot May 9, 2022
c962e9a
Update dependency turbo to ^1.2.12
renovate-bot May 24, 2022
bbe3ba6
Merge pull request #28 from NeighbourhoodCollective/renovate/turbo-1.x
borisno2 May 29, 2022
f1b4d30
updates
borisno2 May 29, 2022
052d475
renovate dev
borisno2 May 29, 2022
bf6813e
[skip ci] - change base branch (#48)
borisno2 May 29, 2022
2315113
Update dependency @opensaas/keystone-nextjs-auth to v22 (#42)
renovate[bot] May 29, 2022
f07c559
Update Yarn to v1.22.18 (#49)
renovate[bot] May 29, 2022
587e5a3
Update dependency @keystone-6/core to v1.1.1 (#50)
renovate[bot] May 29, 2022
51414b3
Update dependency @keystone-ui/fields to ^6.0.1 (#52)
renovate[bot] May 29, 2022
ece3904
Update dependency @stripe/react-stripe-js to ^1.7.2 (#53)
renovate[bot] May 29, 2022
e87841c
Update dependency date-fns to ^2.28.0 (#54)
renovate[bot] May 29, 2022
854628f
Update dependency dotenv to v16.0.1 (#55)
renovate[bot] May 29, 2022
351e918
Update dependency next-with-apollo to ^5.3.0 (#56)
renovate[bot] May 29, 2022
ce18cd1
Update dependency turbo to ^1.2.14 (#57)
renovate[bot] May 29, 2022
3d112cb
Update nextjs monorepo to ^12.1.6 (#59)
renovate[bot] May 29, 2022
0f95cfa
Update dependency graphql-upload to v15 (#60)
renovate[bot] May 29, 2022
64522a2
Update dependency @keystone-6/fields-document to v2.0.1 (#51)
renovate[bot] May 29, 2022
f87449e
Update dependency babel-plugin-styled-components to ^2.0.7 (#61)
renovate[bot] May 29, 2022
a76201f
Update dependency eslint-config-prettier to ^8.5.0 (#62)
renovate[bot] May 29, 2022
43248ca
Update dependency graphql to ^15.8.0 (#63)
renovate[bot] May 29, 2022
c9fc5e7
Update dependency styled-components to ^5.3.5 (#64)
renovate[bot] May 29, 2022
ec5b03c
Update dependency @apollo/client to ^3.5.10 (#65)
renovate[bot] May 29, 2022
b837999
Update dependency @stripe/react-stripe-js to ^1.8.1 (#66)
renovate[bot] May 29, 2022
d44be16
Update dependency express to v4.17.3 (#67)
renovate[bot] May 29, 2022
5bcde3a
Update dependency prop-types to ^15.8.1 (#68)
renovate[bot] May 29, 2022
97c8100
Update dependency @testing-library/jest-dom to ^5.16.4 (#69)
renovate[bot] May 29, 2022
dab20db
Update jest monorepo to ^27.5.1 (#58)
renovate[bot] May 29, 2022
4e302fb
Update dependency @testing-library/react to ^12.1.5 (#70)
renovate[bot] May 29, 2022
1caf402
Update dependency @apollo/client to ^3.6.5 (#71)
renovate[bot] May 29, 2022
fe17c15
soem updates
borisno2 May 29, 2022
c2644a0
Merge branch 'master' into dev
borisno2 May 29, 2022
663248b
Merge pull request #72 from NeighbourhoodCollective/dev
borisno2 May 29, 2022
092180d
null check
borisno2 May 29, 2022
70cbf82
test
borisno2 May 29, 2022
0c45028
Merge branch 'master' into git-tests
borisno2 May 29, 2022
7935f9e
fix build
borisno2 May 29, 2022
eb6b7db
Merge pull request #73 from NeighbourhoodCollective/git-tests
borisno2 May 29, 2022
b3d12b7
Merge pull request #74 from NeighbourhoodCollective/dev
borisno2 May 29, 2022
3abff06
add types
borisno2 May 29, 2022
564a798
Merge pull request #75 from NeighbourhoodCollective/dev
borisno2 May 29, 2022
e1984d0
more types
borisno2 May 29, 2022
b79cbcd
Merge pull request #76 from NeighbourhoodCollective/dev
borisno2 May 29, 2022
54f4a02
keystone upgrade
borisno2 Jun 11, 2022
28acb04
Merge pull request #81 from NeighbourhoodCollective/keystone-upgrade
borisno2 Jun 11, 2022
b3e182a
Merge pull request #82 from NeighbourhoodCollective/dev
borisno2 Jun 11, 2022
91f8603
Update dependency @apollo/client to ^3.6.8
renovate-bot Jun 13, 2022
6fc1ef4
Update dependency core-js to ^3.23.1
renovate-bot Jun 14, 2022
5a25637
Update dependency next-auth to ^4.5.0
renovate-bot Jun 14, 2022
a270b0d
Update dependency prettier to ^2.7.0
renovate-bot Jun 14, 2022
33fa478
Add or update the App Service deployment workflow configuration from …
borisno2 Jun 18, 2022
0bda737
Add or update the App Service deployment workflow configuration from …
borisno2 Jun 18, 2022
e47812d
update workflow
borisno2 Jun 18, 2022
7ac8766
remove reactPlayer for now
borisno2 Jun 18, 2022
0411c0e
fix reactPlayer Type
borisno2 Jun 18, 2022
75aa3fc
init first user
borisno2 Jun 19, 2022
edef497
add some log
borisno2 Jun 19, 2022
c32797b
fix management stripe button
borisno2 Jun 19, 2022
623e27d
Fix return status
borisno2 Jun 19, 2022
8ba7788
delete membership on error
borisno2 Jun 19, 2022
73f6593
Merge pull request #78 from NeighbourhoodCollective/renovate/patch-ap…
borisno2 Jun 19, 2022
6c187d4
Update dependency @next/bundle-analyzer to ^12.1.6
renovate[bot] Jun 19, 2022
8a0a19c
Merge pull request #85 from NeighbourhoodCollective/renovate/patch-ne…
borisno2 Jun 19, 2022
8c08fe9
Update dependency stripe to v9.9.0
renovate[bot] Jun 19, 2022
1f9d00b
Merge pull request #40 from NeighbourhoodCollective/renovate/stripe-9.x
borisno2 Jun 19, 2022
20e203b
Merge pull request #39 from NeighbourhoodCollective/renovate/docker-s…
borisno2 Jun 19, 2022
507d8f9
Update Yarn to v1.22.19
renovate[bot] Jun 19, 2022
1c41645
Merge pull request #38 from NeighbourhoodCollective/renovate/docker-l…
borisno2 Jun 19, 2022
c155a05
Update dependency turbo to ^1.2.16
renovate[bot] Jun 19, 2022
bfeb433
Merge pull request #37 from NeighbourhoodCollective/renovate/docker-b…
borisno2 Jun 19, 2022
2df4361
Merge pull request #17 from NeighbourhoodCollective/renovate/actions-…
borisno2 Jun 19, 2022
04f8d38
Merge pull request #16 from NeighbourhoodCollective/renovate/actions-…
borisno2 Jun 19, 2022
f5d13f3
Update dependency @changesets/cli to v2.23.0
renovate[bot] Jun 19, 2022
c32814a
Update dependency @stripe/stripe-js to ^1.32.0
renovate[bot] Jun 19, 2022
1aa3628
Merge pull request #83 from NeighbourhoodCollective/renovate/yarn-1.22.x
borisno2 Jun 19, 2022
017d299
Merge pull request #4 from NeighbourhoodCollective/renovate/changeset…
borisno2 Jun 19, 2022
fa0a5ad
Merge pull request #79 from NeighbourhoodCollective/renovate/turbo-1.2.x
borisno2 Jun 19, 2022
ed2f684
Merge pull request #10 from NeighbourhoodCollective/renovate/prettier…
borisno2 Jun 19, 2022
950afac
Merge pull request #7 from NeighbourhoodCollective/renovate/stripe-st…
borisno2 Jun 19, 2022
bec756a
Update babel monorepo
renovate[bot] Jun 19, 2022
dd00b09
Merge pull request #35 from NeighbourhoodCollective/renovate/babel-mo…
borisno2 Jun 19, 2022
4419e84
Update react monorepo to v18
renovate[bot] Jun 19, 2022
fdf41b5
Merge pull request #29 from NeighbourhoodCollective/renovate/core-js-3.x
borisno2 Jun 19, 2022
e6f9203
Merge pull request #25 from NeighbourhoodCollective/renovate/major-re…
borisno2 Jun 19, 2022
ac30400
Update dependency express to v4.18.1
renovate[bot] Jun 19, 2022
31bab99
Merge pull request #33 from NeighbourhoodCollective/renovate/express-4.x
borisno2 Jun 19, 2022
5139990
Merge pull request #87 from NeighbourhoodCollective/renovate/next-aut…
borisno2 Jun 19, 2022
04a97a7
Update dependency @types/react to v18.0.14
renovate[bot] Jun 19, 2022
ede1675
Update dependency prettier to ^2.7.1
renovate[bot] Jun 19, 2022
b0915aa
Update dependency @stripe/react-stripe-js to ^1.9.0
renovate[bot] Jun 19, 2022
8689efb
Update actions/checkout action to v3
renovate[bot] Jun 19, 2022
1c68b69
Update actions/setup-node action to v3
renovate[bot] Jun 19, 2022
56ba4f7
Update docker/build-push-action action to v3
renovate[bot] Jun 19, 2022
883534a
Update docker/login-action action to v2
renovate[bot] Jun 19, 2022
037b3ba
Update docker/setup-buildx-action action to v2
renovate[bot] Jun 19, 2022
ff2de2d
Merge pull request #99 from NeighbourhoodCollective/renovate/docker-l…
borisno2 Jun 19, 2022
3e9d81f
Merge pull request #95 from NeighbourhoodCollective/renovate/actions-…
borisno2 Jun 19, 2022
984286c
Merge pull request #96 from NeighbourhoodCollective/renovate/actions-…
borisno2 Jun 19, 2022
836906c
Merge pull request #100 from NeighbourhoodCollective/renovate/docker-…
borisno2 Jun 19, 2022
edd3ffa
Merge pull request #98 from NeighbourhoodCollective/renovate/docker-b…
borisno2 Jun 19, 2022
abf42e6
Merge pull request #92 from NeighbourhoodCollective/renovate/react-18…
borisno2 Jun 19, 2022
b9dd89a
Merge pull request #93 from NeighbourhoodCollective/renovate/prettier…
borisno2 Jun 19, 2022
0f569b6
Merge pull request #94 from NeighbourhoodCollective/renovate/stripe-r…
borisno2 Jun 19, 2022
dc36647
Merge pull request #91 from NeighbourhoodCollective/dev
borisno2 Jun 19, 2022
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
75 changes: 75 additions & 0 deletions .github/workflows/dev_pantrydeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy Node.js app to Azure Web App - pantryadmin

on:
push:
branches:
- dev
workflow_dispatch:

env:
BACKEND_BASE_URL: http://localhost:3000

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: "16.x"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to registry
uses: docker/login-action@v2
with:
registry: https://collectivereg.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}
password: ${{ secrets.AzureAppService_ContainerPassword_807a7babf8fc4bbab3814a0bd2d77375 }}

- name: Build and push backend container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}/pantry-backend-dev:${{ github.sha }}
file: ./backend/Dockerfile

- name: Build and push frontend container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_e63bb1905c6a4a45b5a231dfb2e20209 }}/pantry-frontend-dev:${{ github.sha }}
file: ./apps/Dockerfile

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: "Test"
url: ${{ steps.frontend-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy Backend to Azure Web App
id: backend-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: "pantrybackend-dev"
slot-name: "production"
publish-profile: ${{ secrets.AzureAppService_PublishProfile_b238d802ac8645e6b65a5edde468d12d }}
images: "collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}/pantry-backend-dev:${{ github.sha }}"

- name: Deploy Frontend to Azure Web App
id: frontend-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: "pantryfrontend-dev"
slot-name: "production"
publish-profile: ${{ secrets.AzureAppService_PublishProfile_3d252031ecc64559a923899a336cd451 }}
images: "collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_e63bb1905c6a4a45b5a231dfb2e20209 }}/pantry-frontend-dev:${{ github.sha }}"
16 changes: 8 additions & 8 deletions .github/workflows/master_pantrydeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Node.js version
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: "16.x"

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Log in to registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: https://collectivereg.azurecr.io/
username: ${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}
password: ${{ secrets.AzureAppService_ContainerPassword_807a7babf8fc4bbab3814a0bd2d77375 }}

- name: Build and push container image to registry
uses: docker/build-push-action@v2
- name: Build and push backend container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_28d39508e5734f558fc68a409d6d0fac }}/pantry-backend:${{ github.sha }}
file: ./backend/Dockerfile

- name: Build and push container image to registry
uses: docker/build-push-action@v2
- name: Build and push frontend container image to registry
uses: docker/build-push-action@v3
with:
push: true
tags: collectivereg.azurecr.io/${{ secrets.AzureAppService_ContainerUsername_e63bb1905c6a4a45b5a231dfb2e20209 }}/pantry-frontend:${{ github.sha }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test build

on:
push:
branches:
- master
- dev
pull_request:

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js LTS
uses: actions/setup-node@main
with:
node-version: lts/*

- name: Install Dependencies
run: yarn

- name: Turbo Run Build
run: BACKEND_BASE_URL=http://localhost:3000 yarn turbo run build
4 changes: 3 additions & 1 deletion apps/user-portal/components/DocumentBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
DocumentRenderer,
DocumentRendererProps,
} from '@keystone-6/document-renderer';
import ReactPlayer from 'react-player';
import { default as _ReactPlayer } from 'react-player';
import { ReactPlayerProps } from "react-player/types/lib";

const renderers: DocumentRendererProps['renderers'] = {
// use your editor's autocomplete to see what other renderers you can override
Expand Down Expand Up @@ -34,6 +35,7 @@ const componentBlockRenderers: DocumentRendererProps['componentBlocks'] = {
),
video: (props) => {
const { url } = props;
const ReactPlayer = _ReactPlayer as unknown as React.FC<ReactPlayerProps>;

return (
<div contentEditable={false}>
Expand Down
16 changes: 6 additions & 10 deletions apps/user-portal/components/ManageStripeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,34 @@ import { SigninButton } from './SigninButton';

export function ManageStripeButton() {
const { data: userData, status } = useSession();
const userSession = userData.data as User;
const userSession = userData?.data as User;
const router = useRouter();

const MANAGE_STRIPE_MUTATION = gql`
mutation MANAGE_STRIPE_MUTATION($userId: ID!, $returnUrl: String!) {
manageStripe(userId: $userId, returnUrl: $returnUrl)
mutation MANAGE_STRIPE_MUTATION($returnUrl: String!) {
stripeManage(returnUrl: $returnUrl)
}
`;

const [getPortalSession] = useMutation(MANAGE_STRIPE_MUTATION, {
// refetchQueries: [{ query: CURRENT_USER_QUERY }],
});
if (!userData.id) {
if (!userSession) {
return <SigninButton />;
}

return (
<Button
onClick={async () => {
console.log(userData.id);

const portalSession = await getPortalSession({
variables: {
userId: userSession.id,
returnUrl: `${window.location.origin}/profile`,
},
});
console.log(JSON.stringify(portalSession));
router.push(portalSession.data.url);
router.push(portalSession.data.stripeManage.url);
}}
>
Manage
Manage Membership
</Button>
);
}
2 changes: 1 addition & 1 deletion apps/user-portal/components/SigninButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from 'next/link';
export function SigninButton({ ...props }) {
const { returnUrl } = props;
const { data, status } = useSession();
if (!data)
if (!data?.itemId)
return (
<Button
onClick={() =>
Expand Down
13 changes: 2 additions & 11 deletions apps/user-portal/components/SubscribeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ export function SubscribeButton({ ...props }) {

const { variation, subscription, club } = props;
const SUBSCRIPTION_MUTATION = gql`
mutation SUBSCRIPTION_MUTATION(
$variationId: ID!
$userId: ID!
$returnUrl: String!
) {
membershipSignup(
userId: $userId
returnUrl: $returnUrl
variationId: $variationId
)
mutation SUBSCRIPTION_MUTATION($variationId: ID!, $returnUrl: String!) {
membershipSignup(returnUrl: $returnUrl, variationId: $variationId)
}
`;

Expand Down Expand Up @@ -66,7 +58,6 @@ export function SubscribeButton({ ...props }) {
const session = await getStripeSession({
variables: {
variationId: variation.id,
userId: userSession.id,
returnUrl: `${window.location.origin}/${club}/${subscription}`,
},
});
Expand Down
2 changes: 1 addition & 1 deletion apps/user-portal/components/theme/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Header() {
</Link>
{data && (
<>
<Link href="/pantry/my-membership" passHref>
<Link href="/pantry/subscriptions" passHref>
<Nav.Link>Pantry Membership</Nav.Link>
</Link>
<Link href="/profile" passHref>
Expand Down
1 change: 1 addition & 0 deletions apps/user-portal/emotion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { css, jsx, keyframes, Global, ClassNames } from '@emotion/react'; // ensure the same version of emotion
6 changes: 3 additions & 3 deletions apps/user-portal/lib/form/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import getConfig from 'next/config';

export const APOLLO_STATE_PROP_NAME = '__APOLLO_STATE__';

let apolloClient;
let apolloClient: ApolloClient<any>;

function createApolloClient() {
const { publicRuntimeConfig } = getConfig();
Expand Down Expand Up @@ -60,15 +60,15 @@ export function initializeApollo(initialState = null) {
return _apolloClient;
}

export function addApolloState(client, pageProps) {
export function addApolloState(client: any, pageProps: any) {
if (pageProps?.props) {
pageProps.props[APOLLO_STATE_PROP_NAME] = client.cache.extract();
}

return pageProps;
}

export function useApollo(pageProps) {
export function useApollo(pageProps: any) {
const state = pageProps[APOLLO_STATE_PROP_NAME];
const store = useMemo(() => initializeApollo(state), [state]);
return store;
Expand Down
16 changes: 11 additions & 5 deletions apps/user-portal/lib/form/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function useForm(initial = {}) {
setInputs(initial);
}, [initialValues]);

function handleStageButton(e) {
function handleStageButton(e: any) {
const { innerText } = e.target;
const value = innerText.toLowerCase();
setInputs({
Expand All @@ -19,13 +19,19 @@ export function useForm(initial = {}) {
});
}

function handleChange(e) {
let { value, name, type } = e.target;
function handleChange(e: any) {
let {
value,
name,
type,
}: { value: string | boolean | number; name: string; type: string } =
e.target;

if (type === 'number') {
value = parseInt(value);
value = parseInt(value as string);
}
if (type === 'checkbox') {
// @ts-ignore
value = !inputs[name];
}
if (type === 'radio') {
Expand All @@ -34,7 +40,7 @@ export function useForm(initial = {}) {
} else if (value === 'no') {
value = false;
} else if (name === 'feeAmount') {
value = parseInt(value);
value = parseInt(value as string);
}
}
if (type === 'file') {
Expand Down
2 changes: 1 addition & 1 deletion apps/user-portal/lib/form/withData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createUploadLink } from 'apollo-upload-client';
import withApollo from 'next-with-apollo';
import getConfig from 'next/config';

function createClient({ headers, initialState }) {
function createClient({ headers, initialState }: any) {
const { publicRuntimeConfig } = getConfig();
return new ApolloClient({
link: ApolloLink.from([
Expand Down
9 changes: 9 additions & 0 deletions apps/user-portal/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,13 @@ module.exports = withPreconstruct({
},
];
},
async redirects() {
return [
{
source: '/',
destination: '/pantry',
permanent: false,
},
];
},
});
Loading