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

PF-1391 - Adding breakout room example app #226

Merged
merged 36 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5de2644
PF-1391 - Adding breakout room example app
fredcido Nov 15, 2023
147a0a9
PF-1391 - Creating breakout rooms
fredcido Nov 15, 2023
4218f51
PF-1391 - Initiate timer feature in breakout room
fredcido Nov 16, 2023
0eac2b6
PF-1391 - Timer UI
fredcido Nov 16, 2023
dfae4d3
PF-1391 - Adding TODO in styles
fredcido Nov 16, 2023
c80949c
PF-1391 - Implementing ticking time
fredcido Nov 17, 2023
fa90c8e
PF-1391 - Small adjustments in hooks
fredcido Nov 17, 2023
c297e7b
PF-1391 - Fixing session end hooks
fredcido Nov 20, 2023
248219b
Adding demo video
fredcido Nov 20, 2023
70d4831
PF-1391 - Iterating on README with folder structure
fredcido Nov 20, 2023
67b4d48
Remove video from selfie
fredcido Nov 20, 2023
8e2e56d
PF-1391 - Bumping @mirohq/[email protected]
fredcido Nov 20, 2023
815f67e
PF-1391 - Using multiple sessions
fredcido Nov 22, 2023
b3ccb05
UX iterations
fredcido Nov 27, 2023
f4b81e7
Adjusting styles
fredcido Nov 27, 2023
d056eb6
Use avatars
fredcido Nov 27, 2023
5e7a5db
Minor fixes
fredcido Nov 27, 2023
f177fc1
Update README.md
fredcido Nov 27, 2023
0483b91
Remove notes
fredcido Nov 27, 2023
8acd535
Merge branch 'PF-1391' of github.com:miroapp/app-examples into PF-1391
fredcido Nov 27, 2023
1faecbc
Update README.md
fredcido Nov 27, 2023
383c5b4
Update sdk types package
fredcido Nov 27, 2023
3c98937
PF-1391 - Update README with new folder structured
fredcido Nov 28, 2023
9bdd709
PF-1391 - Adding real-time events doc links
fredcido Nov 28, 2023
8369b71
Merge branch 'main' of github.com:miroapp/app-examples into PF-1391
fredcido Nov 28, 2023
8bff2dc
PF-1391 - Bumping @mirohq/sdk-types package to 2.9.10
fredcido Nov 28, 2023
efe1e9a
Update examples/breakout-rooms/src/components/BreakoutManager/Breakou…
fredcido Nov 29, 2023
52d38d6
PF-1391 - Styling using class names
fredcido Nov 29, 2023
b8f5c4f
PF-1391 - Reorganizing styles
fredcido Nov 29, 2023
6d9b63a
PF-1391 - Cleaning up imports
fredcido Nov 29, 2023
eb56091
PF-1391 - Treat facilitator differently
fredcido Nov 29, 2023
75caf1e
Update README.md with video and note about DS
fredcido Nov 29, 2023
8deaf27
PF-1391 - Bump SDK version
fredcido Nov 29, 2023
ad5aa1e
Merge branch 'PF-1391' of github.com:miroapp/app-examples into PF-1391
fredcido Nov 29, 2023
8bfb7bd
PF-1391 - Runs prettier
fredcido Nov 29, 2023
e2b1502
PF-1391 - Bump package
fredcido Nov 29, 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
20 changes: 10 additions & 10 deletions examples/breakout-rooms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,7 @@ https://github.com/miroapp/app-examples/assets/7162412/c4c02dde-6680-4970-a51e-2
- `boards:write`
- `identity:read`

4. Go back to your app home page, and under the `Permissions` section, you will see a blue button that says `Install app and get OAuth token`. Click that button. Then click on `Add` as shown in the video below. <b>In the video we install a different app, but the process is the same regardless of the app.</b>

> ⚠️ We recommend to install your app on a [developer team](https://developers.miro.com/docs/create-a-developer-team) while you are developing or testing apps.⚠️

https://github.com/miroapp/app-examples/assets/10428517/1e6862de-8617-46ef-b265-97ff1cbfe8bf

5. Go to your developer team, and open your boards.
6. Click on the app icon on the left sidebar.

### Example of app yaml
#### Example of app yaml

```yaml
# See https://developers.miro.com/docs/app-manifest on how to use this
Expand All @@ -84,6 +75,15 @@ scopes:
- identity:read
```

4. Go back to your app home page, and under the `Permissions` section, you will see a blue button that says `Install app and get OAuth token`. Click that button. Then click on `Add` as shown in the video below. <b>In the video we install a different app, but the process is the same regardless of the app.</b>

> ⚠️ We recommend to install your app on a [developer team](https://developers.miro.com/docs/create-a-developer-team) while you are developing or testing apps.⚠️

https://github.com/miroapp/app-examples/assets/10428517/1e6862de-8617-46ef-b265-97ff1cbfe8bf

5. Go to your developer team, and open your boards.
6. Click on the app icon on the left sidebar.

# 🗂️ Folder structure <a name="folder"></a>

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
padding: 1em;
}

.validation-messages h5 {
.validation-messages .validatino-messages-title {
fredcido marked this conversation as resolved.
Show resolved Hide resolved
font-size: 1em;
font-weight: 600;
line-height: 1em;
margin: 0;
color: #656b81;
}

.validation-messages ul {
.validation-messages .validatino-messages-items {
fredcido marked this conversation as resolved.
Show resolved Hide resolved
font-size: 0.9em;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
useSelectedItems,
useTimer,
} from "../../hooks";
import { convertTime, formatDisplayTime, isUser } from "../../utils";

Check warning on line 13 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'convertTime' is defined but never used
import { RoomConfig } from "../RoomConfig/RoomConfig";

Check warning on line 14 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'RoomConfig' is defined but never used
import { DEFAULT_TIME, Timer } from "../Timer/Timer";

Check warning on line 15 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'Timer' is defined but never used
import {
DropdownMenu,

Check warning on line 17 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'DropdownMenu' is defined but never used
IconButton,

Check warning on line 18 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'IconButton' is defined but never used
IconPlus,

Check warning on line 19 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'IconPlus' is defined but never used
IconHandFilled,

Check warning on line 20 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'IconHandFilled' is defined but never used
IconDotsThreeVertical,

Check warning on line 21 in examples/breakout-rooms/src/components/BreakoutManager/BreakoutManager.tsx

View workflow job for this annotation

GitHub Actions / Run linters

'IconDotsThreeVertical' is defined but never used
Button,
} from "@mirohq/design-system";
fredcido marked this conversation as resolved.
Show resolved Hide resolved

import "./BreakoutManager.css";
import { BreakoutStarter } from "../BreakoutStarter";
import { WaitingList } from "../WaitingList";
import { RoomsManager } from "../RoomsManager";
fredcido marked this conversation as resolved.
Show resolved Hide resolved

export const BreakoutManager: React.FC = () => {
const { breakout, rooms, isFacilitator, ...service } = useBreakout();
Expand Down Expand Up @@ -209,81 +210,44 @@
}

const canStartSession = validations.length < 1;
const isEditabled = breakout?.state !== "started";
const isEditable = breakout?.state !== "started";

return (
<main className="manager-container">
{breakout?.state !== "started" && rooms.length < 1 ? (
<BreakoutStarter onAddGroup={handleAddGroup} />
) : (
<div className="container">
<section className="rooms-container">
{rooms.map((room) => (
<RoomConfig
key={room.id}
room={room}
isEditable={isEditabled}
isSelected={room.id === selectedRoom?.id}
unassignedUsers={unassignedUsers}
onAddParticipant={handleAddParticipant}
onSelect={handleStartSelectTarget}
onRemove={handleRemoveRoom}
onRemoveParticipant={handleRemoveParticipant}
/>
))}
<div className="breakout-controls">
<IconButton
label="Add a room"
variant="solid-prominent"
css={{ borderRadius: "100%" }}
onClick={handleAddGroup}
>
<IconPlus />
</IconButton>

{canUseTimer && (
<Timer
onSet={setTimerDuration}
step={convertTime(1, "milliseconds", "minutes")}
/>
)}

{isFacilitator && (
<DropdownMenu>
<DropdownMenu.Trigger asChild>
<IconDotsThreeVertical />
</DropdownMenu.Trigger>
<DropdownMenu.Content>
<>
<DropdownMenu.Item
onClick={() => handleReleaseFacilitator()}
>
<DropdownMenu.IconSlot>
<IconHandFilled />
</DropdownMenu.IconSlot>
Release facilitator role
</DropdownMenu.Item>
</>
</DropdownMenu.Content>
</DropdownMenu>
)}
</div>
</section>
</div>
<RoomsManager
rooms={rooms}
isEditable={isEditable}
isFacilitator={isFacilitator}
canUseTimer={canUseTimer}
selectedRoom={selectedRoom}
unassignedUsers={unassignedUsers}
onAddParticipant={handleAddParticipant}
onSelectTarget={handleStartSelectTarget}
onRemove={handleRemoveRoom}
onRemoveParticipant={handleRemoveParticipant}
onAddGroup={handleAddGroup}
onReleaseFacilitator={handleReleaseFacilitator}
onSetTime={setTimerDuration}
/>
)}

{rooms.length && unassignedUsers.length ? (
<WaitingList
unassignedUsers={unassignedUsers}
onSplitUsers={handleSplitUsers}
disabled={!isEditabled}
disabled={!isEditable}
/>
) : null}

{isEditabled && validations.length > 0 ? (
{isEditable && validations.length > 0 ? (
<div className="validation-messages">
<h5>Before starting the session:</h5>
<ul>
<h5 className="validatino-messages-title">
Before starting the session:
</h5>
<ul className="validatino-messages-items">
{validations.map((message) => (
<li key={message}>{message}</li>
))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
flex-direction: column;
align-items: center;
flex: 1;
justify-content: space-between;
justify-content: center;
}

.breakout-starter .waiting-icon {
margin-bottom: 50%;
margin: auto;
}

.starter-action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type Props = {
isEditable: boolean;
isSelected: boolean;
unassignedUsers: OnlineUserInfo[];
onSelect: (room: Room) => void;
onSelectTarget: (room: Room) => void;
onRemove: (room: Room) => void;
onAddParticipant: (room: Room, user: OnlineUserInfo) => void;
onRemoveParticipant: (room: Room, participant: Participant) => void;
Expand All @@ -30,7 +30,7 @@ export const RoomConfig: React.FunctionComponent<Props> = ({
room,
isEditable,
unassignedUsers,
onSelect,
onSelectTarget,
onRemove,
onAddParticipant,
onRemoveParticipant,
Expand All @@ -43,7 +43,7 @@ export const RoomConfig: React.FunctionComponent<Props> = ({
label="Select frame"
variant="ghost"
disabled={!isEditable}
onClick={() => onSelect(room)}
onClick={() => onSelectTarget(room)}
>
<IconFrame />
</IconButton>
Expand Down
100 changes: 100 additions & 0 deletions examples/breakout-rooms/src/components/RoomsManager/RoomsManager.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import * as React from "react";
import { OnlineUserInfo } from "@mirohq/websdk-types";
import { convertTime } from "../../utils";
import { RoomConfig, Props as RoomConfigProps } from "../RoomConfig";
import {
DropdownMenu,
IconButton,
IconDotsThreeVertical,
IconHandFilled,
IconPlus,
} from "@mirohq/design-system";
import { Timer } from "../Timer";
import { Room } from "../../types";

export type Props = {
rooms: Room[];
selectedRoom?: Room;
isEditable: boolean;
isFacilitator: boolean;
canUseTimer: boolean;
unassignedUsers: OnlineUserInfo[];
onAddParticipant: RoomConfigProps["onAddParticipant"];
onSelectTarget: RoomConfigProps["onSelectTarget"];
onRemove: RoomConfigProps["onRemove"];
onRemoveParticipant: RoomConfigProps["onRemoveParticipant"];
onAddGroup: () => void;
onReleaseFacilitator: () => void;
onSetTime: (time: number) => void;
};

export const RoomsManager: React.FC<Props> = ({
rooms,
isEditable,
isFacilitator,
canUseTimer,
selectedRoom,
unassignedUsers,
onAddParticipant,
onSelectTarget,
onRemove,
onRemoveParticipant,
onAddGroup,
onSetTime,
onReleaseFacilitator,
}) => {
return (
<div className="container">
<section className="rooms-container">
{rooms.map((room) => (
<RoomConfig
key={room.id}
room={room}
isEditable={isEditable}
isSelected={room.id === selectedRoom?.id}
unassignedUsers={unassignedUsers}
onAddParticipant={onAddParticipant}
onSelectTarget={onSelectTarget}
onRemove={onRemove}
onRemoveParticipant={onRemoveParticipant}
/>
))}
<div className="breakout-controls">
<IconButton
label="Add a room"
variant="solid-prominent"
css={{ borderRadius: "100%" }}
onClick={onAddGroup}
>
<IconPlus />
</IconButton>

{canUseTimer && (
<Timer
onSet={onSetTime}
step={convertTime(1, "milliseconds", "minutes")}
/>
)}

{isFacilitator && (
<DropdownMenu>
<DropdownMenu.Trigger asChild>
<IconDotsThreeVertical />
</DropdownMenu.Trigger>
<DropdownMenu.Content>
<>
<DropdownMenu.Item onClick={() => onReleaseFacilitator()}>
<DropdownMenu.IconSlot>
<IconHandFilled />
</DropdownMenu.IconSlot>
Release facilitator role
</DropdownMenu.Item>
</>
</DropdownMenu.Content>
</DropdownMenu>
)}
</div>
</section>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./RoomsManager";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
gap: 1em;
}

.waiting-list h5 {
.waiting-list .waiting-list-title {
fredcido marked this conversation as resolved.
Show resolved Hide resolved
font-size: 1em;
margin: 0;
font-weight: 600;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const WaitingList: React.FC<Props> = ({
}) => {
return (
<section className="waiting-list">
<h5>{unassignedUsers.length} user(s) not in rooms</h5>
<h5 className="waiting-list-title">
{unassignedUsers.length} user(s) not in rooms
</h5>
<Button
variant="solid-subtle"
size="large"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
justify-content: center;
gap: 2em;
height: 100%;
}
Expand All @@ -18,5 +18,5 @@
}

.waiting-room-container .waiting-icon {
margin-bottom: 100%;
margin: auto;
}
Loading