Skip to content

Commit

Permalink
Merge branch 'main' into python-formatting-and-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
aykutaaykut committed Jul 13, 2023
2 parents 8532f50 + 51f1f88 commit 40c63bb
Show file tree
Hide file tree
Showing 48 changed files with 1,186 additions and 944 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/frontend-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches:
- "main"
paths: "frontend/**"
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm install
working-directory: ./frontend

- name: Run ESLint
run: npx eslint .
working-directory: ./frontend

- name: Format code with Prettier
run: npx prettier --write "**/*.{js,jsx,ts,tsx,css,scss}"
working-directory: ./frontend

- name: Build
run: CI=false npm run build
working-directory: ./frontend
16 changes: 5 additions & 11 deletions backend/session/data/participant/participant_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ class ParticipantData(BaseData):
Attributes
----------
id : str
first_name : str
last_name : str
participant_name : str
banned : bool
size : SizeData
muted_video : bool
Expand All @@ -54,11 +53,8 @@ class ParticipantData(BaseData):
id: str
"""Participant ID."""

first_name: str
"""First name of this participant."""

last_name: str
"""Last name of this participant."""
participant_name: str
"""Name of this participant."""

banned: bool = field(repr=False)
"""Whether this participant is banned."""
Expand Down Expand Up @@ -117,8 +113,7 @@ def asdict(self) -> ParticipantDict:
"""
return {
"id": self.id,
"first_name": self.first_name,
"last_name": self.last_name,
"participant_name": self.participant_name,
"banned": self.banned,
"size": self.size.asdict(),
"muted_video": self.muted_video,
Expand All @@ -138,8 +133,7 @@ def as_summary_dict(self) -> ParticipantSummaryDict:
ParticipantSummaryDict with some of the data in this ParticipantData.
"""
return {
"first_name": self.first_name,
"last_name": self.last_name,
"participant_name": self.participant_name,
"size": self.size.asdict(),
"position": self.position.asdict(),
"chat": self.chat,
Expand Down
3 changes: 1 addition & 2 deletions backend/session/data/participant/participant_data_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def participant_data_factory(participant_dict: ParticipantDict) -> ParticipantDa
positionData = PositionData(pos["x"], pos["y"], pos["z"])
return ParticipantData(
participant_dict["id"],
participant_dict["first_name"],
participant_dict["last_name"],
participant_dict["participant_name"],
participant_dict["banned"],
sizeData,
participant_dict["muted_video"],
Expand Down
9 changes: 3 additions & 6 deletions backend/session/data/participant/participant_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ class ParticipantDict(TypedDict):
id: str, default ""
Unique id for this participant in a Session. When creating a new Participant in
a Session, this field is initially set to an empty string.
first_name : str
First name of the participant.
last_name : str
Last name of the participant.
participant_name : str
Name of the participant.
muted_video : bool
Whether the participants' video is forcefully muted by the experimenter.
muted_audio : bool
Expand Down Expand Up @@ -51,8 +49,7 @@ class ParticipantDict(TypedDict):
"""

id: str
first_name: str
last_name: str
participant_name: str
muted_video: bool
muted_audio: bool
audio_filters: list[FilterDict]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def is_valid_participant(data, recursive: bool = True) -> TypeGuard[ParticipantD

return (
isinstance(data["id"], str)
and isinstance(data["first_name"], str)
and isinstance(data["last_name"], str)
and isinstance(data["participant_name"], str)
and isinstance(data["muted_video"], bool)
and isinstance(data["muted_audio"], bool)
and isinstance(data["banned"], bool)
Expand Down
9 changes: 3 additions & 6 deletions backend/session/data/participant/participant_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ class ParticipantSummaryDict(TypedDict):
Attributes
----------
first_name : str
First name of the participant.
last_name : str
Last name of the participant.
participant_name : str
Name of the participant.
position : custom_types.position.PositionDict
Position of the participant's stream on the canvas.
size : custom_types.size_types.SizeDict
Expand All @@ -40,8 +38,7 @@ class ParticipantSummaryDict(TypedDict):
https://github.com/TUMFARSynchorny/experimental-hub/wiki/Data-Types#participantsummary
"""

first_name: str
last_name: str
participant_name: str
position: PositionDict
size: SizeDict
chat: list[ChatMessageDict]
Loading

0 comments on commit 40c63bb

Please sign in to comment.