From 3b61a0b52793260c758d096a4297671ae72590fd Mon Sep 17 00:00:00 2001 From: Ada Date: Mon, 7 Oct 2024 16:28:25 +0200 Subject: [PATCH 1/9] v0.0.0 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8fa211e..95e072d 100644 --- a/package.json +++ b/package.json @@ -65,5 +65,6 @@ "serverless-s3-sync": "3.1.0", "sort-package-json": "^1.46.0", "typescript": "^5.2.2" - } + }, + "version": "0.0.0" } From 4c098e4ee098371e4e89c5fa8b02f43160ee2ddf Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Oct 2024 15:58:50 +0200 Subject: [PATCH 2/9] fix: command out s3 in severless --- serverless.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serverless.yml b/serverless.yml index 5cb29c4..1e1716e 100644 --- a/serverless.yml +++ b/serverless.yml @@ -17,7 +17,7 @@ plugins: - serverless-jetpack - serverless-iam-roles-per-function - serverless-dynamodb - - serverless-s3-sync + # - serverless-s3-sync - serverless-s3-local - serverless-offline From 5b7aff2e4be9a8456963e2f63757423ec4007376 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Oct 2024 15:59:26 +0200 Subject: [PATCH 3/9] fix: eslint rule --- packages/backend/.eslintrc.js | 6 ++++++ packages/components/src/text-time-input.tsx | 1 + 2 files changed, 7 insertions(+) diff --git a/packages/backend/.eslintrc.js b/packages/backend/.eslintrc.js index 8a40323..9a6a531 100644 --- a/packages/backend/.eslintrc.js +++ b/packages/backend/.eslintrc.js @@ -3,5 +3,11 @@ module.exports = { rules: { '@typescript-eslint/explicit-function-return-type': 'off', 'react/prop-types': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + 'argsIgnorePattern': '^_' + } + ] }, } diff --git a/packages/components/src/text-time-input.tsx b/packages/components/src/text-time-input.tsx index 1923225..9e53948 100644 --- a/packages/components/src/text-time-input.tsx +++ b/packages/components/src/text-time-input.tsx @@ -9,6 +9,7 @@ interface WrapperProps extends FlexProps { readonly focused: boolean } +// eslint-disable-next-line @typescript-eslint/no-unused-vars export const StyledTextTimeInputWrapper = styled(({ focused, ...rest }: WrapperProps) => ( ))` From 97e16bccf3278429c4f7c2941d62148bcade7ee1 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Oct 2024 16:09:39 +0200 Subject: [PATCH 4/9] docs: updated Prerequisites in Readme --- readme.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index dcad5c8..81751d7 100644 --- a/readme.md +++ b/readme.md @@ -8,7 +8,14 @@ Lara is a tool for writing your "Berichtsheft" digitally. In Germany all trainee ### Prerequisites -In order to run the project we need `node=18` installed. +To run the project, ensure the following are installed: +1. Node.js (version 18) +2. Yarn + - Install Yarn globally using + ```npm install --global yarn``` +3. Java + - Install Java using Homebrew + ```brew install --cask temurin``` ## 🛠 Under the hood From ed38778b45c55672277e3a58971aa191c160fe30 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Oct 2024 16:12:53 +0200 Subject: [PATCH 5/9] docs: fixed bash --- readme.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 81751d7..dd0286d 100644 --- a/readme.md +++ b/readme.md @@ -12,10 +12,14 @@ To run the project, ensure the following are installed: 1. Node.js (version 18) 2. Yarn - Install Yarn globally using - ```npm install --global yarn``` + ```bash + npm install --global yarn + ``` 3. Java - Install Java using Homebrew - ```brew install --cask temurin``` + ``bash + brew install --cask temurin + ``` ## 🛠 Under the hood From 056b126c4ce4fa4f3a4d2f70c61660a12a1c98e7 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 8 Oct 2024 16:13:31 +0200 Subject: [PATCH 6/9] docs: fixed typo --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index dd0286d..a9dba8f 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ To run the project, ensure the following are installed: ``` 3. Java - Install Java using Homebrew - ``bash + ```bash brew install --cask temurin ``` From 272d88a67fc416647b0717b677fcb32e52f96e24 Mon Sep 17 00:00:00 2001 From: Ada Date: Wed, 16 Oct 2024 11:54:49 +0200 Subject: [PATCH 7/9] docs: added local server instruction in readme --- readme.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/readme.md b/readme.md index a9dba8f..a2a49be 100644 --- a/readme.md +++ b/readme.md @@ -195,6 +195,10 @@ The following variables can be added to your cloned version of Lara. - TEST_TRAINER_ID - ID of test trainer on the staging environment for e2e tests. If not provided e2e tests are skipped. +### For local Environment variables (add these extra two lines) +- AWS_ACCESS_KEY_ID=S3RVER +- AWS_SECRET_ACCESS_KEY=S3RVER + ### NEW AWS SETUP #### IAM User From 92c78c287d80d19fe62700c50d2ab82791bcb857 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 22 Oct 2024 16:25:46 +0200 Subject: [PATCH 8/9] fix: login window focus and close fixed --- .../src/components/ms-sign-in-button.tsx | 54 +++++++++++++------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/packages/frontend/src/components/ms-sign-in-button.tsx b/packages/frontend/src/components/ms-sign-in-button.tsx index b74b198..22b0469 100644 --- a/packages/frontend/src/components/ms-sign-in-button.tsx +++ b/packages/frontend/src/components/ms-sign-in-button.tsx @@ -1,4 +1,4 @@ -import React, { ButtonHTMLAttributes } from 'react' +import React, { ButtonHTMLAttributes, useState } from 'react' import AppHistory from '../app-history' import { PrimaryButton } from './button' import { useMsal } from '@azure/msal-react' @@ -6,6 +6,7 @@ import { loginRequest } from '../hooks/ms-auth' import { useAuthentication } from '../hooks/use-authentication' import { useLoginPageLoginMutation } from '../graphql' import { useIsAuthenticated } from '@azure/msal-react' +import { EventMessage, EventType, PopupEvent } from '@azure/msal-browser' export interface ButtonProps extends ButtonHTMLAttributes { fullsize?: boolean @@ -17,23 +18,46 @@ export const SignInButton: React.FunctionComponent = () => { const [mutate] = useLoginPageLoginMutation() const isAuthenticated = useIsAuthenticated() + const [popupWindow, setPopupWindow] = useState(null); + const handleLogin = async () => { - const loginResponse = await instance.loginPopup(loginRequest) if (isAuthenticated) { - const email = loginResponse.account?.username - if (email) { - mutate({ variables: { email } }) - .then((response) => { - const { data } = response - if (!data?.login) { - return AppHistory.getInstance().push('/no-user-found') - } - login(data.login) - }) - .catch((err) => { - console.log(err) - }) + AppHistory.getInstance().push('/'); + } + + if (popupWindow) { + popupWindow.focus(); + return; + } + + instance.addEventCallback((message: EventMessage) => { + if (message.eventType === EventType.POPUP_OPENED) { + setPopupWindow((message.payload as PopupEvent).popupWindow) + } + } + ) + + try { + const loginResponse = await instance.loginPopup(loginRequest) + const email = loginResponse.account?.username + if (email) { + mutate({ variables: { email } }) + .then((response) => { + const { data } = response + if (!data?.login) { + return AppHistory.getInstance().push('/no-user-found') + } + login(data.login) + }) + .catch((err) => { + console.log(err) + }) + } + } catch (error) { + console.log(error) } + finally { + setPopupWindow(null) } } return handleLogin()}>Sign in with Microsoft From a2bc08d1532fd70b119baa34e8869dfb75f5b930 Mon Sep 17 00:00:00 2001 From: Ada Date: Tue, 22 Oct 2024 17:15:19 +0200 Subject: [PATCH 9/9] fix: yarn format --- package.json | 4 +- packages/backend/.eslintrc.js | 6 +-- .../src/components/ms-sign-in-button.tsx | 46 +++++++++---------- readme.md | 18 ++++---- 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 95e072d..6d0e38f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "lara", + "version": "0.0.0", "private": true, "license": "MIT", "workspaces": { @@ -65,6 +66,5 @@ "serverless-s3-sync": "3.1.0", "sort-package-json": "^1.46.0", "typescript": "^5.2.2" - }, - "version": "0.0.0" + } } diff --git a/packages/backend/.eslintrc.js b/packages/backend/.eslintrc.js index 9a6a531..3d31b59 100644 --- a/packages/backend/.eslintrc.js +++ b/packages/backend/.eslintrc.js @@ -6,8 +6,8 @@ module.exports = { '@typescript-eslint/no-unused-vars': [ 'error', { - 'argsIgnorePattern': '^_' - } - ] + argsIgnorePattern: '^_', + }, + ], }, } diff --git a/packages/frontend/src/components/ms-sign-in-button.tsx b/packages/frontend/src/components/ms-sign-in-button.tsx index 22b0469..66b687e 100644 --- a/packages/frontend/src/components/ms-sign-in-button.tsx +++ b/packages/frontend/src/components/ms-sign-in-button.tsx @@ -18,45 +18,43 @@ export const SignInButton: React.FunctionComponent = () => { const [mutate] = useLoginPageLoginMutation() const isAuthenticated = useIsAuthenticated() - const [popupWindow, setPopupWindow] = useState(null); + const [popupWindow, setPopupWindow] = useState(null) const handleLogin = async () => { if (isAuthenticated) { - AppHistory.getInstance().push('/'); + AppHistory.getInstance().push('/') } - + if (popupWindow) { - popupWindow.focus(); - return; + popupWindow.focus() + return } instance.addEventCallback((message: EventMessage) => { if (message.eventType === EventType.POPUP_OPENED) { setPopupWindow((message.payload as PopupEvent).popupWindow) } - } - ) + }) try { const loginResponse = await instance.loginPopup(loginRequest) - const email = loginResponse.account?.username - if (email) { - mutate({ variables: { email } }) - .then((response) => { - const { data } = response - if (!data?.login) { - return AppHistory.getInstance().push('/no-user-found') - } - login(data.login) - }) - .catch((err) => { - console.log(err) - }) - } - } catch (error) { - console.log(error) + const email = loginResponse.account?.username + if (email) { + mutate({ variables: { email } }) + .then((response) => { + const { data } = response + if (!data?.login) { + return AppHistory.getInstance().push('/no-user-found') + } + login(data.login) + }) + .catch((err) => { + console.log(err) + }) } - finally { + } catch (error) { + console.log(error) + } finally { setPopupWindow(null) } } diff --git a/readme.md b/readme.md index a2a49be..8cefdf6 100644 --- a/readme.md +++ b/readme.md @@ -9,17 +9,18 @@ Lara is a tool for writing your "Berichtsheft" digitally. In Germany all trainee ### Prerequisites To run the project, ensure the following are installed: + 1. Node.js (version 18) 2. Yarn - - Install Yarn globally using - ```bash - npm install --global yarn - ``` + - Install Yarn globally using + ```bash + npm install --global yarn + ``` 3. Java - - Install Java using Homebrew - ```bash - brew install --cask temurin - ``` + - Install Java using Homebrew + ```bash + brew install --cask temurin + ``` ## 🛠 Under the hood @@ -196,6 +197,7 @@ The following variables can be added to your cloned version of Lara. - ID of test trainer on the staging environment for e2e tests. If not provided e2e tests are skipped. ### For local Environment variables (add these extra two lines) + - AWS_ACCESS_KEY_ID=S3RVER - AWS_SECRET_ACCESS_KEY=S3RVER