Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "lara",
"version": "0.0.0",
"private": true,
"license": "MIT",
"workspaces": {
Expand Down
6 changes: 6 additions & 0 deletions packages/backend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '^_',
},
],
},
}
1 change: 1 addition & 0 deletions packages/components/src/text-time-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) => (
<StyledEntryValueWrapper {...rest} />
))<WrapperProps>`
Expand Down
26 changes: 24 additions & 2 deletions packages/frontend/src/components/ms-sign-in-button.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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'
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<HTMLButtonElement> {
fullsize?: boolean
Expand All @@ -17,9 +18,26 @@ export const SignInButton: React.FunctionComponent<ButtonProps> = () => {
const [mutate] = useLoginPageLoginMutation()
const isAuthenticated = useIsAuthenticated()

const [popupWindow, setPopupWindow] = useState<Window | null>(null)

const handleLogin = async () => {
const loginResponse = await instance.loginPopup(loginRequest)
if (isAuthenticated) {
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 } })
Expand All @@ -34,6 +52,10 @@ export const SignInButton: React.FunctionComponent<ButtonProps> = () => {
console.log(err)
})
}
} catch (error) {
console.log(error)
} finally {
setPopupWindow(null)
}
}
return <PrimaryButton onClick={() => handleLogin()}>Sign in with Microsoft</PrimaryButton>
Expand Down
19 changes: 18 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,19 @@ 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
```bash
npm install --global yarn
```
3. Java
- Install Java using Homebrew
```bash
brew install --cask temurin
```

## 🛠 Under the hood

Expand Down Expand Up @@ -184,6 +196,11 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading