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

Refactor the app for individual users and admin view for management #35

Merged
merged 33 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
15596ff
docs: update README
swouf Nov 2, 2023
a79acd2
refactor: put tabs and rearrange views logic
swouf Nov 2, 2023
5de4b65
build: upgrade to yarn 4.0.1
swouf Nov 2, 2023
ba80762
chore(deps): upgrade commitlint
swouf Nov 2, 2023
24500e0
chore(deps): upgrade sentry
swouf Nov 2, 2023
b4cf773
chore(deps): upgrade mui
swouf Nov 2, 2023
049f44c
chore(deps): upgrade eslint and related pkg
swouf Nov 2, 2023
5ee30d9
chore(deps): upgrade types pkg and misc
swouf Nov 2, 2023
7736aac
chore(deps): upgrade graasp deps
swouf Nov 2, 2023
6bf9ac6
chore(deps): upgrade i18next
swouf Nov 2, 2023
a628221
chore(deps): upgrade vite
swouf Nov 2, 2023
564ea65
chore(deps): upgrade excalidraw
swouf Nov 2, 2023
6726299
chore(deps): upgrade to ts 5
swouf Nov 2, 2023
5ee18ca
refactor: minor fixes
swouf Nov 2, 2023
3966106
chore: clean tab component and almost fix height
swouf Nov 2, 2023
5001465
fix: app data visible to member only
swouf Nov 2, 2023
a0790cd
refactor: excalidraw component
swouf Nov 3, 2023
ab1dd91
feat: admin view
swouf Nov 3, 2023
e0668a3
feat: download button
swouf Nov 3, 2023
aa7f588
fix: state update and comparison
swouf Nov 16, 2023
794feea
ci: update github workflows
swouf Nov 16, 2023
d51c162
ci: cypress wf node v16 -> 20
swouf Nov 16, 2023
4c0e3bc
feat: set export dimensions
swouf Nov 16, 2023
5a11d76
ci: wf region secrets -> vars
swouf Nov 16, 2023
0982f98
feat: implement download all
swouf Nov 16, 2023
26a45dd
chore(assets): update icons
swouf Nov 16, 2023
eaaf1a9
refactor: use notistack for toasts
swouf Nov 17, 2023
12e3699
fix: app state replacing elements bug
swouf Nov 17, 2023
df4bfff
Update src/modules/main/AnalyticsView.tsx
swouf Nov 17, 2023
301944f
docs: fix missing links in README
swouf Nov 17, 2023
2a52e54
perf: remove unnecessary Sentry/tracing
swouf Nov 17, 2023
c7750a8
chore: misc fixes
swouf Nov 17, 2023
f99b181
fix: player view
swouf Nov 17, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: set up node
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'

- name: Yarn Install and Cache
uses: graasp/graasp-deploy/.github/actions/yarn-install-and-cache@v1
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ jobs:
- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_DEV }}
VITE_API_HOST: ${{ vars.API_HOST }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: development
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.sha }}
VITE_WS_HOST: ${{ vars.WS_HOST }}
# add any env variable needed by your app here
run: yarn build
shell: bash
Expand All @@ -39,10 +40,10 @@ jobs:
with:
# Replace input build-folder or version if needed
build-folder: 'build'
graasp-app-id: ${{ secrets.APP_KEY }}
graasp-app-id: ${{ secrets.APP_ID }}
version: 'latest'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_DEV }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEV }}
aws-region: ${{ secrets.APPS_AWS_REGION }}
aws-region: ${{ vars.APPS_AWS_REGION_DEV }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_DEV }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_DEV }}
11 changes: 6 additions & 5 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to staging environment
name: Deploy to production environment

# Controls when the action will run
on:
Expand All @@ -23,11 +23,12 @@ jobs:
- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_PROD }}
VITE_API_HOST: ${{ vars.API_HOST }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: production
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_WS_HOST: ${{ vars.WS_HOST }}
# add any env variable needed by your app here
run: yarn build
shell: bash
Expand All @@ -37,10 +38,10 @@ jobs:
with:
# Replace input build-folder or version if needed
build-folder: 'build'
graasp-app-id: ${{ secrets.APP_KEY }}
graasp-app-id: ${{ secrets.APP_ID }}
version: 'latest'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }}
aws-region: ${{ secrets.APPS_AWS_REGION }}
aws-region: ${{ vars.APPS_AWS_REGION_PROD }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_PROD }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_PROD }}
11 changes: 6 additions & 5 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
deploy-app:
name: Deploy to dev
name: Deploy to staging
runs-on: ubuntu-latest
environment: staging
steps:
Expand All @@ -23,11 +23,12 @@ jobs:
- name: Yarn build
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_STAGE }}
VITE_API_HOST: ${{ vars.API_HOST }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: staging
VITE_SENTRY_ENV: ${{ vars.SENTRY_ENV }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.event.client_payload.tag }}
VITE_WS_HOST: ${{ vars.WS_HOST }}
# add any env variable needed by your app here
run: yarn build
shell: bash
Expand All @@ -37,10 +38,10 @@ jobs:
with:
# Replace input build-folder or version if needed
build-folder: 'build'
graasp-app-id: ${{ secrets.APP_KEY }}
graasp-app-id: ${{ secrets.APP_ID }}
version: 'latest'
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGE }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGE }}
aws-region: ${{ secrets.APPS_AWS_REGION }}
aws-region: ${{ vars.APPS_AWS_REGION_STAGE }}
aws-s3-bucket-name: ${{ secrets.AWS_S3_BUCKET_NAME_APPS_STAGE }}
cloudfront-distribution-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_APPS_STAGE }}
541 changes: 0 additions & 541 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
nodeLinker: node-modules
compressionLevel: mixed

enableGlobalCache: false

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.6.1.cjs
yarnPath: .yarn/releases/yarn-4.0.1.cjs
55 changes: 34 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
# Graasp App Excalidraw

This repository hosts the code for Excalidraw's integration into a Graasp application.
This app allows the user to use 2D geometric primitives, free draw and style their design using the offered features.
It is written in TypeScript and uses React.js to import the open-source main component : Excalidraw.
## Getting Sarted
### Environment Variables
This repository hosts the code for Excalidraw's integration into the Graasp ecosystem.

To start developing locally, you should create a `.env.local` file in your root folder with the
following content:
Excalidraw is an open-source web drawing application. Find out more on the [Excalidraw website]()!
swouf marked this conversation as resolved.
Show resolved Hide resolved

## Awesome! How does it work?

## Development

### Local setup

To work with Graasp apps locally, follow the official Graasp documentation.

To get started with this app, clone this repo. You will need to add a dotenv file `.env.development`.

```dotenv
REACT_APP_APP_ID=
REACT_APP_GRAASP_DOMAIN=localhost
REACT_APP_HOST=
REACT_APP_VERSION=
REACT_APP_BASE=

GRAASP_DEVELOPER_ID=6505fd8e-9762-49a3-9906-4cbabbb81130 # Your developer UUID in your local Graasp instance.
swouf marked this conversation as resolved.
Show resolved Hide resolved

VITE_PORT=3335 # The port on which you would like to serve the app.
VITE_API_HOST=localhost # The hostname (localhost for local dev)
VITE_MOCK_API=false # Mock the API by default (overriden by yarn dev:mock)
VITE_GRAASP_APP_KEY=82582612-92aa-408f-bfe9-0d202414a3b6 # The app key in your local Graasp instance.
VITE_VERSION=latest # The version of your app (not important for development)
```

Install the dependencies by running [yarn]():
swouf marked this conversation as resolved.
Show resolved Hide resolved

```bash
yarn
```

### Installation
If used locally, the needed dependencies can be installed with
And finally start the app. To serve it within your local Graasp instance:

```bash
yarn
yarn dev
```
### Running the app

Run the app locally with:
And to serve it with a mocked API (see [the documentation]()):
swouf marked this conversation as resolved.
Show resolved Hide resolved

```bash
yarn start
yarn dev:mock
```

## How to use
Expand All @@ -37,6 +49,7 @@ To use this app, you can either run it locally which will give you direct access
Excalidraw's documentation can be found [here](https://github.com/excalidraw/excalidraw#documentation), and a description of the tools is available on canvas by clicking on the ? button.

## Example

Below you can find a screenshot of the app inside the Graasp Builder view.

![image](AppGraasp.png)
Expand All @@ -45,6 +58,6 @@ Below you can find a screenshot of the app inside the Graasp Builder view.

For future versions, here is a list of features to be implemented and points to be optimized:

* Enabling collaboration and saving state (tool selected, etc...)
* Creating admin view allowing access to a table of submissions linked to the corresponding Excalidraw canvas
* Choosing method to handle changes so that the list of current elements is checked for equality before treating the change.
- Enabling collaboration and saving state (tool selected, etc...)
- Creating admin view allowing access to a table of submissions linked to the corresponding Excalidraw canvas
- Choosing method to handle changes so that the list of current elements is checked for equality before treating the change.
95 changes: 50 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,38 @@
"email": "[email protected]"
}
],
"homepage": ".",
"homepage": "https://github.com/graasp/graasp-app-excalidraw/blob/main/README.md",
"dependencies": {
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@excalidraw/excalidraw": "^0.15.2",
"@graasp/apps-query-client": "^2.0.1",
"@graasp/sdk": "1.1.3",
"@graasp/ui": "^3.2.4",
"@mui/icons-material": "5.14.1",
"@mui/lab": "5.0.0-alpha.137",
"@mui/material": "5.14.1",
"@sentry/react": "7.59.3",
"@sentry/tracing": "7.59.3",
"@tanstack/react-query": "^4.29.25",
"@tanstack/react-query-devtools": "^4.29.25",
"@testing-library/react": "13.4.0",
"@types/lodash.debounce": "4.0.7",
"i18next": "22.5.1",
"@excalidraw/excalidraw": "^0.16.1",
"@graasp/apps-query-client": "^2.0.4",
"@graasp/sdk": "1.2.1",
"@graasp/ui": "^3.7.0",
"@mui/icons-material": "5.14.16",
"@mui/lab": "5.0.0-alpha.151",
"@mui/material": "5.14.16",
"@sentry/react": "7.77.0",
"@sentry/tracing": "7.77.0",
swouf marked this conversation as resolved.
Show resolved Hide resolved
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query-devtools": "^4.36.1",
"file-saver": "^2.0.5",
"i18next": "23.6.0",
"immutable": "^4.3.1",
"jszip": "^3.10.1",
"lodash.clonedeep": "^4.5.0",
"lodash.debounce": "4.0.8",
"lodash.isequal": "~4.5.0",
"lodash.isobject": "3.0.2",
"lodash.isstring": "4.0.1",
"qs": "6.11.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "12.3.1",
"react-router-dom": "^6.14.2",
"react-i18next": "13.3.1",
"react-router-dom": "^6.18.0",
"react-toastify": "9.1.3",
"typescript": "4.9.5",
"uuid": "9.0.0"
"typescript": "5.2.2",
"uuid": "9.0.1"
},
"scripts": {
"dev:mock": "VITE_MOCK_API=true && yarn vite",
Expand All @@ -68,44 +69,48 @@
"cov:report": "open ./coverage/lcov-report/index.html"
},
"devDependencies": {
"@commitlint/cli": "17.6.7",
"@commitlint/config-conventional": "17.6.7",
"@commitlint/cli": "18.2.0",
"@commitlint/config-conventional": "18.1.0",
"@cypress/code-coverage": "3.11.0",
"@cypress/instrument-cra": "1.4.0",
"@trivago/prettier-plugin-sort-imports": "4.2.0",
"@types/i18n": "0.13.6",
"@types/lodash.isequal": "~4.5.6",
"@types/lodash.isobject": "3.0.7",
"@types/lodash.isstring": "4.0.7",
"@types/node": "18.16.19",
"@types/react": "18.2.15",
"@types/react-dom": "18.2.7",
"@types/uuid": "9.0.2",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@trivago/prettier-plugin-sort-imports": "4.2.1",
"@types/file-saver": "^2.0.6",
"@types/i18n": "0.13.8",
"@types/lodash.clonedeep": "^4",
"@types/lodash.debounce": "4.0.8",
"@types/lodash.isequal": "~4.5.7",
"@types/lodash.isobject": "3.0.8",
"@types/lodash.isstring": "4.0.8",
"@types/node": "20.8.10",
"@types/react": "18.2.34",
"@types/react-dom": "18.2.14",
"@types/uuid": "9.0.6",
"@typescript-eslint/eslint-plugin": "6.9.1",
"@typescript-eslint/parser": "6.9.1",
"@vitejs/plugin-basic-ssl": "^1.0.1",
"@vitejs/plugin-react": "^4.0.3",
"concurrently": "8.2.0",
"@vitejs/plugin-react": "^4.1.1",
"concurrently": "8.2.2",
"cypress": "12.17.2",
"env-cmd": "10.1.0",
"eslint": "8.45.0",
"eslint": "8.52.0",
"eslint-config-airbnb": "19.0.4",
"eslint-config-prettier": "8.8.0",
"eslint-config-prettier": "8.10.0",
"eslint-config-react-app": "7.0.1",
"eslint-import-resolver-typescript": "3.5.5",
"eslint-plugin-cypress": "2.13.3",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-cypress": "2.15.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.33.0",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "8.0.3",
"nyc": "15.1.0",
"prettier": "2.8.8",
"pretty-quick": "3.1.3",
"vite": "^4.4.6",
"vite-plugin-checker": "^0.6.1",
"vite-plugin-istanbul": "^4.1.0",
"stylis-plugin-rtl": "^2.1.1",
"vite": "^4.5.0",
"vite-plugin-checker": "^0.6.2",
"vite-plugin-istanbul": "^5.0.0",
"wait-on": "7.0.1"
},
"browserslist": {
Expand Down Expand Up @@ -134,5 +139,5 @@
"resolutions": {
"immutable": "4.3.1"
},
"packageManager": "yarn@3.6.1"
"packageManager": "yarn@4.0.1"
}
Binary file modified public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/@types/i18next.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defaultNS, resources } from '../config/i18n';

declare module 'i18next' {
interface CustomTypeOptions {
defaultNS: typeof defaultNS;
resources: (typeof resources)['en'];
}
}
Loading