mirror of
https://github.com/vector-im/element-call.git
synced 2026-11-19 09:32:29 +08:00
Compare commits
91
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05c079e3ed | ||
|
|
cf174261c9 | ||
|
|
e36029c9c0 | ||
|
|
0469d8ef56 | ||
|
|
fc8da6ef58 | ||
|
|
4e1b4fae19 | ||
|
|
5c18868aa4 | ||
|
|
9ce16b68e9 | ||
|
|
ad9114a6e4 | ||
|
|
44e1c136df | ||
|
|
1bbbd519c7 | ||
|
|
51e4a3b14b | ||
|
|
8da38d173a | ||
|
|
13887a8943 | ||
|
|
03721f078b | ||
|
|
d146bedf05 | ||
|
|
63f595f958 | ||
|
|
279912d951 | ||
|
|
94e5d032a1 | ||
|
|
720c400e5f | ||
|
|
0718774cef | ||
|
|
a2b452c1d8 | ||
|
|
465a784345 | ||
|
|
8de96878c0 | ||
|
|
b7b9771577 | ||
|
|
3885eefa4c | ||
|
|
9176e06195 | ||
|
|
380fa67f57 | ||
|
|
8830bd74cb | ||
|
|
3ab9bb72e2 | ||
|
|
38085baab8 | ||
|
|
8891a9a70e | ||
|
|
826d0ee40d | ||
|
|
fbc2cd3e97 | ||
|
|
770730ba6c | ||
|
|
b3ceb5300c | ||
|
|
ffbc48fe86 | ||
|
|
4655da3c35 | ||
|
|
585998cb87 | ||
|
|
8ec2f9bb31 | ||
|
|
2ee468ba44 | ||
|
|
17eb435a7a | ||
|
|
1678ca71c1 | ||
|
|
90fe8e0529 | ||
|
|
64749d0b7a | ||
|
|
79cd3047e9 | ||
|
|
9078c35e06 | ||
|
|
2833d9a816 | ||
|
|
8598be1d92 | ||
|
|
02d2de3831 | ||
|
|
6d1aa0087b | ||
|
|
8b4b9f4494 | ||
|
|
a551cde47b | ||
|
|
01b9d7a70e | ||
|
|
f56d4a32a3 | ||
|
|
eed1b98cf9 | ||
|
|
c1208ac7b6 | ||
|
|
d77e9e8f08 | ||
|
|
2e172aa3be | ||
|
|
9650ca9687 | ||
|
|
f7e4b79502 | ||
|
|
20840d901e | ||
|
|
4c1c818ba9 | ||
|
|
f022eb09a2 | ||
|
|
50934a53cd | ||
|
|
99d5886e32 | ||
|
|
137a53dbee | ||
|
|
6e5c468780 | ||
|
|
1478dbe6a1 | ||
|
|
85d8e036d5 | ||
|
|
84e172a2ba | ||
|
|
7fddad02e0 | ||
|
|
3b3f7762a7 | ||
|
|
2297675b06 | ||
|
|
8f4b932c3c | ||
|
|
88782a0332 | ||
|
|
9eae1f4145 | ||
|
|
3d096426be | ||
|
|
83fa9661cf | ||
|
|
6c24763196 | ||
|
|
c4c266536b | ||
|
|
3535cbe2e6 | ||
|
|
dac89b97ae | ||
|
|
854e0ab7ae | ||
|
|
20976e1ee3 | ||
|
|
f12e6601fe | ||
|
|
4b2d8403d7 | ||
|
|
03f0fffa57 | ||
|
|
6486ffe777 | ||
|
|
3dad62f9e3 | ||
|
|
e37f36937e |
@@ -37,6 +37,7 @@ module.exports = {
|
|||||||
"@typescript-eslint/promise-function-async": "error",
|
"@typescript-eslint/promise-function-async": "error",
|
||||||
"@typescript-eslint/require-await": "error",
|
"@typescript-eslint/require-await": "error",
|
||||||
"@typescript-eslint/await-thenable": "error",
|
"@typescript-eslint/await-thenable": "error",
|
||||||
|
"rxjs/no-exposed-subjects": "error",
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
|
|||||||
@@ -23,3 +23,4 @@ jobs:
|
|||||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||||
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
SENTRY_AUTH_TOKEN:
|
SENTRY_AUTH_TOKEN:
|
||||||
required: true
|
required: true
|
||||||
|
CODECOV_TOKEN:
|
||||||
|
required: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -36,6 +38,7 @@ jobs:
|
|||||||
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
|
||||||
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
SENTRY_URL: ${{ secrets.SENTRY_URL }}
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
VITE_APP_VERSION: ${{ inputs.vite_app_version }}
|
VITE_APP_VERSION: ${{ inputs.vite_app_version }}
|
||||||
NODE_OPTIONS: "--max-old-space-size=4096"
|
NODE_OPTIONS: "--max-old-space-size=4096"
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
run: "yarn install --frozen-lockfile"
|
run: "yarn install --frozen-lockfile"
|
||||||
|
|
||||||
- name: Prune i18n
|
- name: Prune i18n
|
||||||
run: "rm -R public/locales"
|
run: "rm -R locales"
|
||||||
|
|
||||||
- name: Download translation files
|
- name: Download translation files
|
||||||
uses: localazy/download@0a79880fb66150601e3b43606fab69c88123c087 # v1.1.0
|
uses: localazy/download@0a79880fb66150601e3b43606fab69c88123c087 # v1.1.0
|
||||||
@@ -32,7 +32,7 @@ jobs:
|
|||||||
groups: "-p includeSourceLang:true"
|
groups: "-p includeSourceLang:true"
|
||||||
|
|
||||||
- name: Fix the owner of the downloaded files
|
- name: Fix the owner of the downloaded files
|
||||||
run: "sudo chown runner:docker -R public/locales"
|
run: "sudo chown runner:docker -R locales"
|
||||||
|
|
||||||
- name: Prettier
|
- name: Prettier
|
||||||
run: yarn prettier:format
|
run: yarn prettier:format
|
||||||
|
|||||||
@@ -2,9 +2,3 @@ FROM nginxinc/nginx-unprivileged:alpine
|
|||||||
|
|
||||||
COPY ./dist /app
|
COPY ./dist /app
|
||||||
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY config/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
USER root
|
|
||||||
|
|
||||||
RUN rm -rf /usr/share/nginx/html
|
|
||||||
|
|
||||||
USER 101
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ rc_message:
|
|||||||
|
|
||||||
MSC3266 allows to request a room summary of rooms you are not joined. The
|
MSC3266 allows to request a room summary of rooms you are not joined. The
|
||||||
summary contains the room join rules. We need that to decide if the user gets
|
summary contains the room join rules. We need that to decide if the user gets
|
||||||
prompted with the option to knock ("ask to join"), a cannot join error or the
|
prompted with the option to knock ("Request to join call"), a cannot join error or the
|
||||||
join view.
|
join view.
|
||||||
|
|
||||||
Element Call requires a Livekit SFU alongside a [Livekit JWT
|
Element Call requires a Livekit SFU alongside a [Livekit JWT
|
||||||
@@ -213,7 +213,7 @@ To add a new translation key you can do these steps:
|
|||||||
|
|
||||||
1. Add the new key entry to the code where the new key is used: `t("some_new_key")`
|
1. Add the new key entry to the code where the new key is used: `t("some_new_key")`
|
||||||
1. Run `yarn i18n` to extract the new key and update the translation files. This
|
1. Run `yarn i18n` to extract the new key and update the translation files. This
|
||||||
will add a skeleton entry to the `public/locales/en-GB/app.json` file:
|
will add a skeleton entry to the `locales/en-GB/app.json` file:
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
@@ -221,7 +221,7 @@ To add a new translation key you can do these steps:
|
|||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
1. Update the skeleton entry in the `public/locales/en-GB/app.json` file with
|
1. Update the skeleton entry in the `locales/en-GB/app.json` file with
|
||||||
the English translation:
|
the English translation:
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
|
|||||||
+4
-10
@@ -3,23 +3,17 @@ server {
|
|||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /app;
|
root /app;
|
||||||
|
gzip_static on;
|
||||||
|
gzip_vary on;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
# disable cache entriely by default (apart from Etag which is accurate enough)
|
|
||||||
add_header Cache-Control 'private no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
|
|
||||||
if_modified_since off;
|
|
||||||
expires off;
|
|
||||||
# also turn off last-modified since they are just the timestamps of the file in the docker image
|
|
||||||
# and may or may not bear any resemblance to when the resource changed
|
|
||||||
add_header Last-Modified "";
|
|
||||||
|
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
|
add_header Cache-Control "public, max-age=30, stale-while-revalidate=30";
|
||||||
}
|
}
|
||||||
|
|
||||||
# assets can be cached because they have hashed filenames
|
# assets can be cached because they have hashed filenames
|
||||||
location /assets {
|
location /assets {
|
||||||
expires 1w;
|
add_header Cache-Control "public, immutable, max-age=31536000";
|
||||||
add_header Cache-Control "public, no-transform";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
location /apple-app-site-association {
|
location /apple-app-site-association {
|
||||||
|
|||||||
+31
-223
@@ -25,230 +25,38 @@ There are two formats for Element Call urls.
|
|||||||
```
|
```
|
||||||
|
|
||||||
With this format the livekit alias that will be used is the `<room_name>`.
|
With this format the livekit alias that will be used is the `<room_name>`.
|
||||||
All ppl connecting to this url will end up in the same unencrypted room.
|
All people connecting to this URL will end up in the same unencrypted room.
|
||||||
This does not scale, is super unsecure
|
This does not scale, is super unsecure
|
||||||
(ppl could end up in the same room by accident) and it also is not really
|
(people could end up in the same room by accident) and it also is not really
|
||||||
possible to support encryption.
|
possible to support encryption.
|
||||||
The url parameters are spit into two categories: **general** and **widget related**.
|
|
||||||
|
|
||||||
## Widget related params
|
## Parameters
|
||||||
|
|
||||||
**widgetId**
|
| Name | Values | Required for widget | Required for SPA | Description |
|
||||||
The id used by the widget. The presence of this parameter implies that element
|
| ------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
call will not connect to a homeserver directly and instead tries to establish
|
| `allowIceFallback` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Allows use of fallback STUN servers for ICE if the user's homeserver doesn’t provide any. |
|
||||||
postMessage communication via the `parentUrl`.
|
| `analyticsID` | Posthog analytics ID | No | No | Available only with user's consent for sharing telemetry in Element Web. |
|
||||||
|
| `appPrompt` | `true` or `false` | No, defaults to `true` | No, defaults to `true` | Prompts the user to launch the native mobile app upon entering a room, applicable only on Android and iOS, and must be enabled in config. |
|
||||||
```ts
|
| `baseUrl` | | Yes | Not applicable | The base URL of the homeserver to use for media lookups. |
|
||||||
widgetId: string | null;
|
| `confineToRoom` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Keeps the user confined to the current call/room. |
|
||||||
```
|
| `deviceId` | Matrix device ID | Yes | Not applicable | The Matrix device ID for the widget host. |
|
||||||
|
| `displayName` | | No | No | Display name used for auto-registration. |
|
||||||
**parentUrl**
|
| `enableE2EE` (deprecated) | `true` or `false` | No, defaults to `true` | No, defaults to `true` | Legacy flag to enable end-to-end encryption, not used in the `livekit` branch. |
|
||||||
The url used to send widget action postMessages. This should be the domain of
|
| `fontScale` | A decimal number such as `0.9` | No | No | Factor by which to scale the interface's font size. |
|
||||||
the client or the webview the widget is hosted in. (in case the widget is not
|
| `fonts` | | No | No | Defines the font(s) used by the interface. Multiple font parameters can be specified: `?font=font-one&font=font-two...`. |
|
||||||
in an Iframe but in a dedicated webview we send the postMessages same webview
|
| `hideHeader` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Hides the room header when in a call. |
|
||||||
the widget lives in. Filtering is done in the widget so it ignores the messages
|
| `hideScreensharing` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Hides the screen-sharing button. |
|
||||||
it receives from itself)
|
| `homeserver` | | Not applicable | No | Homeserver for registering a new (guest) user, configures non-default guest user server when creating a spa link. |
|
||||||
|
| `lang` | [BCP 47](https://www.rfc-editor.org/info/bcp47) code | No | No | The language the app should use. |
|
||||||
```ts
|
| `parentUrl` | | Yes | Not applicable | The url used to send widget action postMessages. This should be the domain of the client or the webview the widget is hosted in. (in case the widget is not in an Iframe but in a dedicated webview we send the postMessages same WebView the widget lives in. Filtering is done in the widget so it ignores the messages it receives from itself) |
|
||||||
parentUrl: string | null;
|
| `password` | | No | No | E2EE password when using a shared secret. (For individual sender keys in embedded mode this is not required.) |
|
||||||
```
|
| `perParticipantE2EE` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Enables per participant encryption with Keys exchanged over encrypted matrix room messages. |
|
||||||
|
| `preload` | `true` or `false` | No, defaults to `false` | Not applicable | Pauses app before joining a call until an `io.element.join` widget action is seen, allowing preloading. |
|
||||||
**userId**
|
| `returnToLobby` | `true` or `false` | No, defaults to `false` | Not applicable | Displays the lobby in widget mode after leaving a call; shows a blank page if set to `false`. Useful for video rooms. |
|
||||||
The user's ID (only used in matryoshka mode).
|
| `roomId` | [Matrix Room ID](https://spec.matrix.org/v1.12/appendices/#room-ids) | Yes | No | Anything about what room we're pointed to should be from useRoomIdentifier which parses the path and resolves alias with respect to the default server name, however roomId is an exception as we need the room ID in embedded widget mode, and not the room alias (or even the via params because we are not trying to join it). This is also not validated, where it is in `useRoomIdentifier()`. |
|
||||||
|
| `showControls` | `true` or `false` | No, defaults to `true` | No, defaults to `true` | Displays controls like mute, screen-share, invite, and hangup buttons during a call. |
|
||||||
```ts
|
| `skipLobby` | `true` or `false` | No, defaults to `false` | No, defaults to `false` | Skips the lobby to join a call directly, can be combined with preload in widget. |
|
||||||
userId: string | null;
|
| `theme` | One of: `light`, `dark`, `light-high-contrast`, `dark-high-contrast` | No, defaults to `dark` | No, defaults to `dark` | UI theme to use. |
|
||||||
```
|
| `userId` | [Matrix User Identifier](https://spec.matrix.org/v1.12/appendices/#user-identifiers) | Yes | Not applicable | The Matrix user ID. |
|
||||||
|
| `viaServers` | Comma separated list of [Matrix Server Names](https://spec.matrix.org/v1.12/appendices/#server-name) | Not applicable | No | Homeserver for joining a room, non-empty value required for rooms not on the user’s default homeserver. |
|
||||||
**deviceId**
|
| `widgetId` | [MSC2774](https://github.com/matrix-org/matrix-spec-proposals/pull/2774) format widget ID | Yes | Not applicable | The id used by the widget. The presence of this parameter implies that element call will not connect to a homeserver directly and instead tries to establish postMessage communication via the `parentUrl`. |
|
||||||
The device's ID (only used in matryoshka mode).
|
|
||||||
|
|
||||||
```ts
|
|
||||||
deviceId: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**baseUrl**
|
|
||||||
The base URL of the homeserver to use for media lookups in matryoshka mode.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
baseUrl: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
### General url parameters
|
|
||||||
|
|
||||||
**roomId**
|
|
||||||
Anything about what room we're pointed to should be from useRoomIdentifier which
|
|
||||||
parses the path and resolves alias with respect to the default server name, however
|
|
||||||
roomId is an exception as we need the room ID in embedded (matroyska) mode, and not
|
|
||||||
the room alias (or even the via params because we are not trying to join it). This
|
|
||||||
is also not validated, where it is in useRoomIdentifier().
|
|
||||||
|
|
||||||
```ts
|
|
||||||
roomId: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**confineToRoom**
|
|
||||||
Whether the app should keep the user confined to the current call/room.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
confineToRoom: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**appPrompt**
|
|
||||||
Whether upon entering a room, the user should be prompted to launch the
|
|
||||||
native mobile app. (Affects only Android and iOS.)
|
|
||||||
|
|
||||||
The app prompt must also be enabled in the config for this to take effect.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
appPrompt: boolean; (default: true)
|
|
||||||
```
|
|
||||||
|
|
||||||
**preload**
|
|
||||||
Whether the app should pause before joining the call until it sees an
|
|
||||||
io.element.join widget action, allowing it to be preloaded.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
preload: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**hideHeader**
|
|
||||||
Whether to hide the room header when in a call.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
hideHeader: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**showControls**
|
|
||||||
Whether to show the buttons to mute, screen-share, invite, hangup are shown
|
|
||||||
when in a call.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
showControls: boolean; (default: true)
|
|
||||||
```
|
|
||||||
|
|
||||||
**hideScreensharing**
|
|
||||||
Whether to hide the screen-sharing button.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
hideScreensharing: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**enableE2EE** (Deprecated)
|
|
||||||
Whether to use end-to-end encryption. This is a legacy flag for the full mesh branch.
|
|
||||||
It is not used on the livekit branch and has no impact there!
|
|
||||||
|
|
||||||
```ts
|
|
||||||
enableE2EE: boolean; (default: true)
|
|
||||||
```
|
|
||||||
|
|
||||||
**perParticipantE2EE**
|
|
||||||
Whether to use per participant encryption.
|
|
||||||
Keys will be exchanged over encrypted matrix room messages.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
perParticipantE2EE: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**password**
|
|
||||||
E2EE password when using a shared secret.
|
|
||||||
(For individual sender keys in embedded mode this is not required.)
|
|
||||||
|
|
||||||
```ts
|
|
||||||
password: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**displayName**
|
|
||||||
The display name to use for auto-registration.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
displayName: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**lang**
|
|
||||||
The BCP 47 code of the language the app should use.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
lang: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**fonts**
|
|
||||||
The font/fonts which the interface should use.
|
|
||||||
There can be multiple font url parameters: `?font=font-one&font=font-two...`
|
|
||||||
|
|
||||||
```ts
|
|
||||||
font: string;
|
|
||||||
font: string;
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
**fontScale**
|
|
||||||
The factor by which to scale the interface's font size.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
fontScale: number | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**analyticsID**
|
|
||||||
The Posthog analytics ID. It is only available if the user has given consent for
|
|
||||||
sharing telemetry in element web.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
analyticsID: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**allowIceFallback**
|
|
||||||
Whether the app is allowed to use fallback STUN servers for ICE in case the
|
|
||||||
user's homeserver doesn't provide any.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
allowIceFallback: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**skipLobby**
|
|
||||||
Setting this flag skips the lobby and brings you in the call directly.
|
|
||||||
In the widget this can be combined with preload to pass the device settings
|
|
||||||
with the join widget action.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
skipLobby: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**returnToLobby**
|
|
||||||
Setting this flag makes element call show the lobby in widget mode after leaving
|
|
||||||
a call.
|
|
||||||
This is useful for video rooms.
|
|
||||||
If set to false, the widget will show a blank page after leaving the call.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
returnToLobby: boolean; (default: false)
|
|
||||||
```
|
|
||||||
|
|
||||||
**theme**
|
|
||||||
The theme to use for element call.
|
|
||||||
can be "light", "dark", "light-high-contrast" or "dark-high-contrast".
|
|
||||||
If not set element call will use the dark theme.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
theme: string | null;
|
|
||||||
```
|
|
||||||
|
|
||||||
**viaServers**
|
|
||||||
This defines the homeserver that is going to be used when joining a room.
|
|
||||||
It has to be set to a non default value for links to rooms
|
|
||||||
that are not on the default homeserver,
|
|
||||||
that is in use for the current user.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
viaServers: string; (default: undefined)
|
|
||||||
```
|
|
||||||
|
|
||||||
**homeserver**
|
|
||||||
This defines the homeserver that is going to be used when registering
|
|
||||||
a new (guest) user.
|
|
||||||
This can be user to configure a non default guest user server when
|
|
||||||
creating a spa link.
|
|
||||||
|
|
||||||
```ts
|
|
||||||
homeserver: string; (default: undefined)
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
locales: ["en-GB"],
|
locales: ["en-GB"],
|
||||||
output: "public/locales/$LOCALE/$NAMESPACE.json",
|
output: "locales/$LOCALE/$NAMESPACE.json",
|
||||||
input: ["src/**/*.{ts,tsx}"],
|
input: ["src/**/*.{ts,tsx}"],
|
||||||
sort: true,
|
sort: true,
|
||||||
};
|
};
|
||||||
|
|||||||
+4
-4
@@ -7,13 +7,13 @@
|
|||||||
"features": ["plural_postfix_us", "filter_untranslated"],
|
"features": ["plural_postfix_us", "filter_untranslated"],
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"pattern": "public/locales/en-GB/*.json",
|
"pattern": "locales/en-GB/*.json",
|
||||||
"lang": "inherited"
|
"lang": "inherited"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"group": "existing",
|
"group": "existing",
|
||||||
"pattern": "public/locales/*/*.json",
|
"pattern": "locales/*/*.json",
|
||||||
"excludes": ["public/locales/en-GB/*.json"],
|
"excludes": ["locales/en-GB/*.json"],
|
||||||
"lang": "${autodetectLang}"
|
"lang": "${autodetectLang}"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"download": {
|
"download": {
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
"output": "public/locales/${langLsrDash}/${file}"
|
"output": "locales/${langLsrDash}/${file}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"includeSourceLang": "${includeSourceLang|false}",
|
"includeSourceLang": "${includeSourceLang|false}",
|
||||||
|
|||||||
@@ -4,19 +4,18 @@
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"close": "Schließen",
|
"close": "Schließen",
|
||||||
"close_search": "Suche beenden",
|
|
||||||
"copy_link": "Link kopieren",
|
"copy_link": "Link kopieren",
|
||||||
"edit": "Bearbeiten",
|
"edit": "Bearbeiten",
|
||||||
"go": "Los geht’s",
|
"go": "Los geht’s",
|
||||||
"invite": "Einladen",
|
"invite": "Einladen",
|
||||||
"lower_hand": "Handmeldung zurücknehmen",
|
"lower_hand": "Handmeldung zurücknehmen",
|
||||||
"no": "Nein",
|
"no": "Nein",
|
||||||
"open_search": "Suchen",
|
|
||||||
"pick_reaction": "Reaktion auswählen",
|
"pick_reaction": "Reaktion auswählen",
|
||||||
"raise_hand": "Handmeldung",
|
"raise_hand": "Handmeldung",
|
||||||
"raise_hand_or_send_reaction": "Handmeldung oder Reaktion senden",
|
|
||||||
"register": "Registrieren",
|
"register": "Registrieren",
|
||||||
"remove": "Entfernen",
|
"remove": "Entfernen",
|
||||||
|
"show_less": "Weniger anzeigen",
|
||||||
|
"show_more": "Mehr anzeigen",
|
||||||
"sign_in": "Anmelden",
|
"sign_in": "Anmelden",
|
||||||
"sign_out": "Abmelden",
|
"sign_out": "Abmelden",
|
||||||
"submit": "Absenden",
|
"submit": "Absenden",
|
||||||
@@ -62,7 +61,7 @@
|
|||||||
"preferences": "Einstellungen",
|
"preferences": "Einstellungen",
|
||||||
"profile": "Profil",
|
"profile": "Profil",
|
||||||
"reaction": "Reaktion",
|
"reaction": "Reaktion",
|
||||||
"search": "Suche",
|
"reactions": "Reaktionen",
|
||||||
"settings": "Einstellungen",
|
"settings": "Einstellungen",
|
||||||
"something_went_wrong": "Etwas ist schief gelaufen",
|
"something_went_wrong": "Etwas ist schief gelaufen",
|
||||||
"unencrypted": "Nicht verschlüsselt",
|
"unencrypted": "Nicht verschlüsselt",
|
||||||
@@ -81,8 +80,8 @@
|
|||||||
"call_ended_heading": "Anruf beendet",
|
"call_ended_heading": "Anruf beendet",
|
||||||
"failed_heading": "Beitreten fehlgeschlagen",
|
"failed_heading": "Beitreten fehlgeschlagen",
|
||||||
"failed_text": "Anruf nicht gefunden oder Beitritt nicht erlaubt",
|
"failed_text": "Anruf nicht gefunden oder Beitritt nicht erlaubt",
|
||||||
"knock_reject_body": "Die Mitglieder des Raums haben Deine Beitrittsanfrage abgelehnt.",
|
"knock_reject_body": "Die Teilnahmeanfrage wurde abgelehnt.",
|
||||||
"knock_reject_heading": "Beitritt nicht erlaubt",
|
"knock_reject_heading": "Zugriff verweigert",
|
||||||
"reason": "Grund"
|
"reason": "Grund"
|
||||||
},
|
},
|
||||||
"hangup_button_label": "Anruf beenden",
|
"hangup_button_label": "Anruf beenden",
|
||||||
@@ -100,11 +99,11 @@
|
|||||||
"layout_grid_label": "Raster",
|
"layout_grid_label": "Raster",
|
||||||
"layout_spotlight_label": "Fokus",
|
"layout_spotlight_label": "Fokus",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Beitritt anfragen",
|
"ask_to_join": "Teilnahmeanfrage senden",
|
||||||
"join_as_guest": "Als Gast beitreten",
|
"join_as_guest": "Als Gast beitreten",
|
||||||
"join_button": "Anruf beitreten",
|
"join_button": "Anruf beitreten",
|
||||||
"leave_button": "Zurück zu kürzlichen Anrufen",
|
"leave_button": "Zurück zu kürzlichen Anrufen",
|
||||||
"waiting_for_invite": "Anfrage gesendet"
|
"waiting_for_invite": "Anfrage gesendet! Warten auf Teilnahmefreigabe …"
|
||||||
},
|
},
|
||||||
"log_in": "Anmelden",
|
"log_in": "Anmelden",
|
||||||
"logging_in": "Anmelden …",
|
"logging_in": "Anmelden …",
|
||||||
@@ -115,7 +114,7 @@
|
|||||||
"matrix_id": "Matrix-ID: {{id}}",
|
"matrix_id": "Matrix-ID: {{id}}",
|
||||||
"microphone_off": "Mikrofon aus",
|
"microphone_off": "Mikrofon aus",
|
||||||
"microphone_on": "Mikrofon an",
|
"microphone_on": "Mikrofon an",
|
||||||
"mute_microphone_button_label": "Mikrofon deaktivieren",
|
"mute_microphone_button_label": "Mikrofon stumm schalten",
|
||||||
"participant_count_one": "{{count, number}}",
|
"participant_count_one": "{{count, number}}",
|
||||||
"participant_count_other": "{{count, number}}",
|
"participant_count_other": "{{count, number}}",
|
||||||
"qr_code": "QR-Code",
|
"qr_code": "QR-Code",
|
||||||
@@ -128,7 +127,6 @@
|
|||||||
"rageshake_sending": "Senden …",
|
"rageshake_sending": "Senden …",
|
||||||
"rageshake_sending_logs": "Sende Debug-Protokolle …",
|
"rageshake_sending_logs": "Sende Debug-Protokolle …",
|
||||||
"rageshake_sent": "Danke!",
|
"rageshake_sent": "Danke!",
|
||||||
"reaction_search": "Reaktionen suchen...",
|
|
||||||
"recaptcha_caption": "Diese Seite wird durch reCAPTCHA geschützt und es gelten Googles <2>Datenschutzerklärung</2> und <6>Nutzungsbedingungen</6>. <9></9>Mit einem Klick auf „Registrieren“ akzeptierst du unseren <2>Endbenutzer-Lizenzvertrag (EULA)</2>",
|
"recaptcha_caption": "Diese Seite wird durch reCAPTCHA geschützt und es gelten Googles <2>Datenschutzerklärung</2> und <6>Nutzungsbedingungen</6>. <9></9>Mit einem Klick auf „Registrieren“ akzeptierst du unseren <2>Endbenutzer-Lizenzvertrag (EULA)</2>",
|
||||||
"recaptcha_dismissed": "Recaptcha abgelehnt",
|
"recaptcha_dismissed": "Recaptcha abgelehnt",
|
||||||
"recaptcha_not_loaded": "Recaptcha nicht geladen",
|
"recaptcha_not_loaded": "Recaptcha nicht geladen",
|
||||||
@@ -163,8 +161,8 @@
|
|||||||
"preferences_tab": {
|
"preferences_tab": {
|
||||||
"reactions_play_sound_description": "Einen Soundeffekt abspielen, wenn jemand eine Reaktion sendet",
|
"reactions_play_sound_description": "Einen Soundeffekt abspielen, wenn jemand eine Reaktion sendet",
|
||||||
"reactions_play_sound_label": "Reaktionstöne abspielen",
|
"reactions_play_sound_label": "Reaktionstöne abspielen",
|
||||||
"reactions_show_description": "Reaktionen anzeigen",
|
"reactions_show_description": "Zeige eine Animation, wenn jemand eine Reaktion sendet.",
|
||||||
"reactions_show_label": "Zeige eine Animation, wenn jemand eine Reaktion sendet.",
|
"reactions_show_label": "Reaktionen anzeigen",
|
||||||
"reactions_title": "Reaktionen"
|
"reactions_title": "Reaktionen"
|
||||||
},
|
},
|
||||||
"preferences_tab_body": "Hier können zusätzliche Optionen für individuelle Anforderungen eingestellt werden",
|
"preferences_tab_body": "Hier können zusätzliche Optionen für individuelle Anforderungen eingestellt werden",
|
||||||
@@ -184,14 +182,15 @@
|
|||||||
"unauthenticated_view_body": "Noch nicht registriert? <2>Konto erstellen</2>",
|
"unauthenticated_view_body": "Noch nicht registriert? <2>Konto erstellen</2>",
|
||||||
"unauthenticated_view_eula_caption": "Mit einem Klick auf „Los geht’s“ akzeptierst du unseren <2>Endbenutzer-Lizenzvertrag (EULA)</2>",
|
"unauthenticated_view_eula_caption": "Mit einem Klick auf „Los geht’s“ akzeptierst du unseren <2>Endbenutzer-Lizenzvertrag (EULA)</2>",
|
||||||
"unauthenticated_view_login_button": "Melde dich mit deinem Konto an",
|
"unauthenticated_view_login_button": "Melde dich mit deinem Konto an",
|
||||||
"unmute_microphone_button_label": "Mikrofon aktivieren",
|
"unmute_microphone_button_label": "Mikrofon einschalten",
|
||||||
"version": "{{productName}} Version: {{version}}",
|
"version": "{{productName}} Version: {{version}}",
|
||||||
"video_tile": {
|
"video_tile": {
|
||||||
"always_show": "Immer anzeigen",
|
"always_show": "Immer anzeigen",
|
||||||
"change_fit_contain": "An Fenster anpassen",
|
"change_fit_contain": "An Fenster anpassen",
|
||||||
"collapse": "Minimieren",
|
"collapse": "Minimieren",
|
||||||
"expand": "Erweitern",
|
"expand": "Erweitern",
|
||||||
"mute_for_me": "Für mich stummschalten",
|
"mute_for_me": "Für mich stumm schalten",
|
||||||
|
"muted_for_me": "Für mich stumm geschaltet",
|
||||||
"volume": "Lautstärke"
|
"volume": "Lautstärke"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,19 +4,18 @@
|
|||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"close_search": "Close search",
|
|
||||||
"copy_link": "Copy link",
|
"copy_link": "Copy link",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"go": "Go",
|
"go": "Go",
|
||||||
"invite": "Invite",
|
"invite": "Invite",
|
||||||
"lower_hand": "Lower hand",
|
"lower_hand": "Lower hand",
|
||||||
"no": "No",
|
"no": "No",
|
||||||
"open_search": "Open search",
|
|
||||||
"pick_reaction": "Pick reaction",
|
"pick_reaction": "Pick reaction",
|
||||||
"raise_hand": "Raise hand",
|
"raise_hand": "Raise hand",
|
||||||
"raise_hand_or_send_reaction": "Raise hand or send reaction",
|
|
||||||
"register": "Register",
|
"register": "Register",
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
|
"show_less": "Show less",
|
||||||
|
"show_more": "Show more",
|
||||||
"sign_in": "Sign in",
|
"sign_in": "Sign in",
|
||||||
"sign_out": "Sign out",
|
"sign_out": "Sign out",
|
||||||
"submit": "Submit",
|
"submit": "Submit",
|
||||||
@@ -62,7 +61,7 @@
|
|||||||
"preferences": "Preferences",
|
"preferences": "Preferences",
|
||||||
"profile": "Profile",
|
"profile": "Profile",
|
||||||
"reaction": "Reaction",
|
"reaction": "Reaction",
|
||||||
"search": "Search",
|
"reactions": "Reactions",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"something_went_wrong": "Something went wrong",
|
"something_went_wrong": "Something went wrong",
|
||||||
"unencrypted": "Not encrypted",
|
"unencrypted": "Not encrypted",
|
||||||
@@ -81,8 +80,8 @@
|
|||||||
"call_ended_heading": "Call ended",
|
"call_ended_heading": "Call ended",
|
||||||
"failed_heading": "Failed to join",
|
"failed_heading": "Failed to join",
|
||||||
"failed_text": "Call not found or is not accessible.",
|
"failed_text": "Call not found or is not accessible.",
|
||||||
"knock_reject_body": "The room members declined your request to join.",
|
"knock_reject_body": "Your request to join was declined.",
|
||||||
"knock_reject_heading": "Not allowed to join",
|
"knock_reject_heading": "Access denied",
|
||||||
"reason": "Reason"
|
"reason": "Reason"
|
||||||
},
|
},
|
||||||
"hangup_button_label": "End call",
|
"hangup_button_label": "End call",
|
||||||
@@ -100,11 +99,11 @@
|
|||||||
"layout_grid_label": "Grid",
|
"layout_grid_label": "Grid",
|
||||||
"layout_spotlight_label": "Spotlight",
|
"layout_spotlight_label": "Spotlight",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Ask to join call",
|
"ask_to_join": "Request to join call",
|
||||||
"join_as_guest": "Join as guest",
|
"join_as_guest": "Join as guest",
|
||||||
"join_button": "Join call",
|
"join_button": "Join call",
|
||||||
"leave_button": "Back to recents",
|
"leave_button": "Back to recents",
|
||||||
"waiting_for_invite": "Request sent"
|
"waiting_for_invite": "Request sent! Waiting for permission to join…"
|
||||||
},
|
},
|
||||||
"log_in": "Log In",
|
"log_in": "Log In",
|
||||||
"logging_in": "Logging in…",
|
"logging_in": "Logging in…",
|
||||||
@@ -128,7 +127,6 @@
|
|||||||
"rageshake_sending": "Sending…",
|
"rageshake_sending": "Sending…",
|
||||||
"rageshake_sending_logs": "Sending debug logs…",
|
"rageshake_sending_logs": "Sending debug logs…",
|
||||||
"rageshake_sent": "Thanks!",
|
"rageshake_sent": "Thanks!",
|
||||||
"reaction_search": "Search reactions…",
|
|
||||||
"recaptcha_caption": "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy</2> and <6>Terms of Service</6> apply.<9></9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)</12>",
|
"recaptcha_caption": "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy</2> and <6>Terms of Service</6> apply.<9></9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)</12>",
|
||||||
"recaptcha_dismissed": "Recaptcha dismissed",
|
"recaptcha_dismissed": "Recaptcha dismissed",
|
||||||
"recaptcha_not_loaded": "Recaptcha not loaded",
|
"recaptcha_not_loaded": "Recaptcha not loaded",
|
||||||
@@ -163,8 +161,8 @@
|
|||||||
"preferences_tab": {
|
"preferences_tab": {
|
||||||
"reactions_play_sound_description": "Play a sound effect when anyone sends a reaction into a call.",
|
"reactions_play_sound_description": "Play a sound effect when anyone sends a reaction into a call.",
|
||||||
"reactions_play_sound_label": "Play reaction sounds",
|
"reactions_play_sound_label": "Play reaction sounds",
|
||||||
"reactions_show_description": "Show reactions",
|
"reactions_show_description": "Show an animation when anyone sends a reaction.",
|
||||||
"reactions_show_label": "Show an animation when anyone sends a reaction.",
|
"reactions_show_label": "Show reactions",
|
||||||
"reactions_title": "Reactions"
|
"reactions_title": "Reactions"
|
||||||
},
|
},
|
||||||
"preferences_tab_body": "Here you can configure extra options for an improved experience",
|
"preferences_tab_body": "Here you can configure extra options for an improved experience",
|
||||||
@@ -173,7 +171,7 @@
|
|||||||
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
"preferences_tab_show_hand_raised_timer_label": "Show hand raise duration",
|
||||||
"speaker_device_selection_label": "Speaker"
|
"speaker_device_selection_label": "Speaker"
|
||||||
},
|
},
|
||||||
"star_rating_input_label_one": "{{count}} stars",
|
"star_rating_input_label_one": "{{count}} star",
|
||||||
"star_rating_input_label_other": "{{count}} stars",
|
"star_rating_input_label_other": "{{count}} stars",
|
||||||
"start_new_call": "Start new call",
|
"start_new_call": "Start new call",
|
||||||
"start_video_button_label": "Start video",
|
"start_video_button_label": "Start video",
|
||||||
@@ -192,6 +190,7 @@
|
|||||||
"collapse": "Collapse",
|
"collapse": "Collapse",
|
||||||
"expand": "Expand",
|
"expand": "Expand",
|
||||||
"mute_for_me": "Mute for me",
|
"mute_for_me": "Mute for me",
|
||||||
|
"muted_for_me": "Muted for me",
|
||||||
"volume": "Volume"
|
"volume": "Volume"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-7
@@ -24,13 +24,16 @@
|
|||||||
"@babel/preset-env": "^7.22.20",
|
"@babel/preset-env": "^7.22.20",
|
||||||
"@babel/preset-react": "^7.22.15",
|
"@babel/preset-react": "^7.22.15",
|
||||||
"@babel/preset-typescript": "^7.23.0",
|
"@babel/preset-typescript": "^7.23.0",
|
||||||
|
"@codecov/vite-plugin": "^1.3.0",
|
||||||
|
"@fontsource/inconsolata": "^5.1.0",
|
||||||
|
"@fontsource/inter": "^5.1.0",
|
||||||
"@formatjs/intl-durationformat": "^0.6.1",
|
"@formatjs/intl-durationformat": "^0.6.1",
|
||||||
"@formatjs/intl-segmenter": "^11.7.3",
|
"@formatjs/intl-segmenter": "^11.7.3",
|
||||||
"@livekit/components-core": "^0.11.0",
|
"@livekit/components-core": "^0.11.0",
|
||||||
"@livekit/components-react": "^2.0.0",
|
"@livekit/components-react": "^2.0.0",
|
||||||
"@opentelemetry/api": "^1.4.0",
|
"@opentelemetry/api": "^1.4.0",
|
||||||
"@opentelemetry/core": "^1.25.1",
|
"@opentelemetry/core": "^1.25.1",
|
||||||
"@opentelemetry/exporter-trace-otlp-http": "^0.54.0",
|
"@opentelemetry/exporter-trace-otlp-http": "^0.55.0",
|
||||||
"@opentelemetry/resources": "^1.25.1",
|
"@opentelemetry/resources": "^1.25.1",
|
||||||
"@opentelemetry/sdk-trace-base": "^1.25.1",
|
"@opentelemetry/sdk-trace-base": "^1.25.1",
|
||||||
"@opentelemetry/sdk-trace-web": "^1.9.1",
|
"@opentelemetry/sdk-trace-web": "^1.9.1",
|
||||||
@@ -42,14 +45,16 @@
|
|||||||
"@sentry/react": "^8.0.0",
|
"@sentry/react": "^8.0.0",
|
||||||
"@sentry/vite-plugin": "^2.0.0",
|
"@sentry/vite-plugin": "^2.0.0",
|
||||||
"@testing-library/dom": "^10.1.0",
|
"@testing-library/dom": "^10.1.0",
|
||||||
|
"@testing-library/jest-dom": "^6.6.3",
|
||||||
"@testing-library/react": "^16.0.0",
|
"@testing-library/react": "^16.0.0",
|
||||||
"@testing-library/react-hooks": "^8.0.1",
|
"@testing-library/react-hooks": "^8.0.1",
|
||||||
"@testing-library/user-event": "^14.5.1",
|
"@testing-library/user-event": "^14.5.1",
|
||||||
"@types/content-type": "^1.1.5",
|
"@types/content-type": "^1.1.5",
|
||||||
"@types/grecaptcha": "^3.0.9",
|
"@types/grecaptcha": "^3.0.9",
|
||||||
"@types/jsdom": "^21.1.7",
|
"@types/jsdom": "^21.1.7",
|
||||||
"@types/lodash": "^4.14.199",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^20.0.0",
|
"@types/node": "^20.0.0",
|
||||||
|
"@types/pako": "^2.0.3",
|
||||||
"@types/qrcode": "^1.5.5",
|
"@types/qrcode": "^1.5.5",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
@@ -80,15 +85,14 @@
|
|||||||
"history": "^4.0.0",
|
"history": "^4.0.0",
|
||||||
"i18next": "^23.0.0",
|
"i18next": "^23.0.0",
|
||||||
"i18next-browser-languagedetector": "^8.0.0",
|
"i18next-browser-languagedetector": "^8.0.0",
|
||||||
"i18next-http-backend": "^2.0.0",
|
|
||||||
"i18next-parser": "^9.0.0",
|
"i18next-parser": "^9.0.0",
|
||||||
"jsdom": "^25.0.0",
|
"jsdom": "^25.0.0",
|
||||||
"knip": "^5.27.2",
|
"knip": "^5.27.2",
|
||||||
"livekit-client": "^2.5.7",
|
"livekit-client": "^2.5.7",
|
||||||
"lodash": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"loglevel": "^1.9.1",
|
"loglevel": "^1.9.1",
|
||||||
"matrix-js-sdk": "matrix-org/matrix-js-sdk#fcb69b16ad8d170c67ea844f83543d467bbd7707",
|
"matrix-js-sdk": "matrix-org/matrix-js-sdk#2210255d6ffc909c574fb8ef16f92140b2fb7797",
|
||||||
"matrix-widget-api": "^1.8.2",
|
"matrix-widget-api": "^1.10.0",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"observable-hooks": "^4.2.3",
|
"observable-hooks": "^4.2.3",
|
||||||
"pako": "^2.0.4",
|
"pako": "^2.0.4",
|
||||||
@@ -108,8 +112,9 @@
|
|||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"typescript-eslint-language-service": "^5.0.5",
|
"typescript-eslint-language-service": "^5.0.5",
|
||||||
"unique-names-generator": "^4.6.0",
|
"unique-names-generator": "^4.6.0",
|
||||||
"vaul": "^0.9.0",
|
"vaul": "^1.0.0",
|
||||||
"vite": "^5.0.0",
|
"vite": "^5.0.0",
|
||||||
|
"vite-plugin-compression2": "^1.3.1",
|
||||||
"vite-plugin-html-template": "^1.1.0",
|
"vite-plugin-html-template": "^1.1.0",
|
||||||
"vite-plugin-svgr": "^4.0.0",
|
"vite-plugin-svgr": "^4.0.0",
|
||||||
"vitest": "^2.0.0",
|
"vitest": "^2.0.0",
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"applinks": {
|
|
||||||
"details": [
|
|
||||||
{
|
|
||||||
"appIDs": [
|
|
||||||
"7J4U792NQT.io.element.elementx",
|
|
||||||
"7J4U792NQT.io.element.elementx.nightly",
|
|
||||||
"7J4U792NQT.io.element.elementx.pr"
|
|
||||||
],
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"?": {
|
|
||||||
"no_universal_links": "?*"
|
|
||||||
},
|
|
||||||
"exclude": true,
|
|
||||||
"comment": "Opt out of universal links"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/*",
|
|
||||||
"comment": "Matches any URL"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"relation": ["delegate_permission/common.handle_all_urls"],
|
|
||||||
"target": {
|
|
||||||
"namespace": "android_app",
|
|
||||||
"package_name": "io.element.android.x.debug",
|
|
||||||
"sha256_cert_fingerprints": [
|
|
||||||
"B0:B0:51:DC:56:5C:81:2F:E1:7F:6F:3E:94:5B:4D:79:04:71:23:AB:0D:A6:12:86:76:9E:B2:94:91:97:13:0E"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"relation": ["delegate_permission/common.handle_all_urls"],
|
|
||||||
"target": {
|
|
||||||
"namespace": "android_app",
|
|
||||||
"package_name": "io.element.android.x.nightly",
|
|
||||||
"sha256_cert_fingerprints": [
|
|
||||||
"CA:D3:85:16:84:3A:05:CC:EB:00:AB:7B:D3:80:0F:01:BA:8F:E0:4B:38:86:F3:97:D8:F7:9A:1B:C4:54:E4:0F"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"relation": ["delegate_permission/common.handle_all_urls"],
|
|
||||||
"target": {
|
|
||||||
"namespace": "android_app",
|
|
||||||
"package_name": "io.element.android.x",
|
|
||||||
"sha256_cert_fingerprints": [
|
|
||||||
"C6:DB:9B:9C:8C:BD:D6:5D:16:E8:EC:8C:8B:91:C8:31:B9:EF:C9:5C:BF:98:AE:41:F6:A9:D8:35:15:1A:7E:16"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="favicon.png" />
|
<link rel="icon" type="image/svg+xml" href="favicon.png" />
|
||||||
|
<link rel="preload" href="/config.json" as="fetch" />
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0"
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:base"],
|
"extends": ["config:recommended"],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"groupName": "all non-major dependencies",
|
"groupName": "all non-major dependencies",
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"groupName": "Compound",
|
"groupName": "Compound",
|
||||||
"matchPackagePrefixes": ["@vector-im/compound-"],
|
"schedule": "before 5am on Tuesday and Friday",
|
||||||
"schedule": "before 5am on Tuesday and Friday"
|
"matchPackageNames": ["@vector-im/compound-{/,}**"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"groupName": "LiveKit client",
|
"groupName": "LiveKit client",
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"groupName": "LiveKit components",
|
"groupName": "LiveKit components",
|
||||||
"matchPackagePrefixes": ["@livekit/components-"]
|
"matchPackageNames": ["@livekit/components-{/,}**"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"groupName": "Vaul",
|
"groupName": "Vaul",
|
||||||
|
|||||||
Vendored
+6
@@ -6,6 +6,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import "matrix-js-sdk/src/@types/global";
|
import "matrix-js-sdk/src/@types/global";
|
||||||
|
import type { DurationFormat as PolyfillDurationFormat } from "@formatjs/intl-durationformat";
|
||||||
import { Controls } from "../controls";
|
import { Controls } from "../controls";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@@ -23,4 +24,9 @@ declare global {
|
|||||||
// Safari only supports this prefixed, so tell the type system about it
|
// Safari only supports this prefixed, so tell the type system about it
|
||||||
webkitRequestFullscreen: () => void;
|
webkitRequestFullscreen: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Intl {
|
||||||
|
// Add DurationFormat as part of the Intl namespace because we polyfill it
|
||||||
|
const DurationFormat: typeof PolyfillDurationFormat;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import "i18next";
|
import "i18next";
|
||||||
// import all namespaces (for the default language, only)
|
// import all namespaces (for the default language, only)
|
||||||
import app from "../../public/locales/en-GB/app.json";
|
import app from "../../locales/en-GB/app.json";
|
||||||
|
|
||||||
declare module "i18next" {
|
declare module "i18next" {
|
||||||
interface CustomTypeOptions {
|
interface CustomTypeOptions {
|
||||||
|
|||||||
+6
-1
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useMemo, FC } from "react";
|
import { useMemo, FC, CSSProperties } from "react";
|
||||||
import { Avatar as CompoundAvatar } from "@vector-im/compound-web";
|
import { Avatar as CompoundAvatar } from "@vector-im/compound-web";
|
||||||
|
|
||||||
import { getAvatarUrl } from "./utils/matrix";
|
import { getAvatarUrl } from "./utils/matrix";
|
||||||
@@ -33,6 +33,7 @@ interface Props {
|
|||||||
className?: string;
|
className?: string;
|
||||||
src?: string;
|
src?: string;
|
||||||
size?: Size | number;
|
size?: Size | number;
|
||||||
|
style?: CSSProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Avatar: FC<Props> = ({
|
export const Avatar: FC<Props> = ({
|
||||||
@@ -41,6 +42,8 @@ export const Avatar: FC<Props> = ({
|
|||||||
name,
|
name,
|
||||||
src,
|
src,
|
||||||
size = Size.MD,
|
size = Size.MD,
|
||||||
|
style,
|
||||||
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const { client } = useClient();
|
const { client } = useClient();
|
||||||
|
|
||||||
@@ -64,6 +67,8 @@ export const Avatar: FC<Props> = ({
|
|||||||
name={name}
|
name={name}
|
||||||
size={`${sizePx}px`}
|
size={`${sizePx}px`}
|
||||||
src={resolvedSrc}
|
src={resolvedSrc}
|
||||||
|
style={style}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+5
-54
@@ -16,19 +16,13 @@ import {
|
|||||||
useMemo,
|
useMemo,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
import {
|
|
||||||
ClientEvent,
|
|
||||||
ICreateClientOpts,
|
|
||||||
MatrixClient,
|
|
||||||
} from "matrix-js-sdk/src/client";
|
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync";
|
import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync";
|
||||||
import { MatrixError } from "matrix-js-sdk/src/matrix";
|
import { ClientEvent, type MatrixClient } from "matrix-js-sdk/src/client";
|
||||||
import { WidgetApi } from "matrix-widget-api";
|
|
||||||
|
|
||||||
|
import type { WidgetApi } from "matrix-widget-api";
|
||||||
import { ErrorView } from "./FullScreenView";
|
import { ErrorView } from "./FullScreenView";
|
||||||
import { fallbackICEServerAllowed, initClient } from "./utils/matrix";
|
|
||||||
import { widget } from "./widget";
|
import { widget } from "./widget";
|
||||||
import {
|
import {
|
||||||
PosthogAnalytics,
|
PosthogAnalytics,
|
||||||
@@ -36,7 +30,6 @@ import {
|
|||||||
} from "./analytics/PosthogAnalytics";
|
} from "./analytics/PosthogAnalytics";
|
||||||
import { translatedError } from "./TranslatedError";
|
import { translatedError } from "./TranslatedError";
|
||||||
import { useEventTarget } from "./useEvents";
|
import { useEventTarget } from "./useEvents";
|
||||||
import { Config } from "./config/Config";
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
@@ -359,7 +352,7 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
type InitResult = {
|
export type InitResult = {
|
||||||
widgetApi: WidgetApi | null;
|
widgetApi: WidgetApi | null;
|
||||||
client: MatrixClient;
|
client: MatrixClient;
|
||||||
passwordlessUser: boolean;
|
passwordlessUser: boolean;
|
||||||
@@ -376,50 +369,8 @@ async function loadClient(): Promise<InitResult | null> {
|
|||||||
passwordlessUser: false,
|
passwordlessUser: false,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// We're running as a standalone application
|
const { initSPA } = await import("./utils/spa");
|
||||||
try {
|
return initSPA(loadSession, clearSession);
|
||||||
const session = loadSession();
|
|
||||||
if (!session) {
|
|
||||||
logger.log("No session stored; continuing without a client");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.log("Using a standalone client");
|
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
|
||||||
const { user_id, device_id, access_token, passwordlessUser } = session;
|
|
||||||
const initClientParams: ICreateClientOpts = {
|
|
||||||
baseUrl: Config.defaultHomeserverUrl()!,
|
|
||||||
accessToken: access_token,
|
|
||||||
userId: user_id,
|
|
||||||
deviceId: device_id,
|
|
||||||
fallbackICEServerAllowed: fallbackICEServerAllowed,
|
|
||||||
livekitServiceURL: Config.get().livekit?.livekit_service_url,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const client = await initClient(initClientParams, true);
|
|
||||||
return {
|
|
||||||
widgetApi: null,
|
|
||||||
client,
|
|
||||||
passwordlessUser,
|
|
||||||
};
|
|
||||||
} catch (err) {
|
|
||||||
if (err instanceof MatrixError && err.errcode === "M_UNKNOWN_TOKEN") {
|
|
||||||
// We can't use this session anymore, so let's log it out
|
|
||||||
logger.log(
|
|
||||||
"The session from local store is invalid; continuing without a client",
|
|
||||||
);
|
|
||||||
clearSession();
|
|
||||||
// returning null = "no client` pls register" (undefined = "loading" which is the current value when reaching this line)
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
clearSession();
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
|
--inset-inline: 520px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
.drawer {
|
.drawer {
|
||||||
background: var(--cpd-color-bg-canvas-default);
|
background: var(--cpd-color-bg-canvas-default);
|
||||||
inset-block-end: 0;
|
inset-block-end: 0;
|
||||||
inset-inline: max(0px, calc((100% - 520px) / 2));
|
inset-inline: max(0px, calc((100% - var(--inset-inline)) / 2));
|
||||||
max-block-size: 90%;
|
max-block-size: 90%;
|
||||||
border-start-start-radius: var(--border-radius);
|
border-start-start-radius: var(--border-radius);
|
||||||
border-start-end-radius: var(--border-radius);
|
border-start-end-radius: var(--border-radius);
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ Please see LICENSE in the repository root for full details.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.overlay.animate {
|
.overlay.animate {
|
||||||
|
--overlay-top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
top: 50%;
|
top: var(--overlay-top);
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import { FC, useCallback } from "react";
|
import { FC, useCallback } from "react";
|
||||||
import { Root, Track, Range, Thumb } from "@radix-ui/react-slider";
|
import { Root, Track, Range, Thumb } from "@radix-ui/react-slider";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { Tooltip } from "@vector-im/compound-web";
|
||||||
|
|
||||||
import styles from "./Slider.module.css";
|
import styles from "./Slider.module.css";
|
||||||
|
|
||||||
@@ -66,7 +67,10 @@ export const Slider: FC<Props> = ({
|
|||||||
<Track className={styles.track}>
|
<Track className={styles.track}>
|
||||||
<Range className={styles.highlight} />
|
<Range className={styles.highlight} />
|
||||||
</Track>
|
</Track>
|
||||||
<Thumb className={styles.handle} aria-label={label} />
|
{/* Note: This is expected not to be visible on mobile.*/}
|
||||||
|
<Tooltip placement="top" label={Math.round(value * 100).toString() + "%"}>
|
||||||
|
<Thumb className={styles.handle} aria-label={label} />
|
||||||
|
</Tooltip>
|
||||||
</Root>
|
</Root>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+15
-1
@@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import { getRoomIdentifierFromUrl } from "../src/UrlParams";
|
import { getRoomIdentifierFromUrl, getUrlParams } from "../src/UrlParams";
|
||||||
|
|
||||||
const ROOM_NAME = "roomNameHere";
|
const ROOM_NAME = "roomNameHere";
|
||||||
const ROOM_ID = "!d45f138fsd";
|
const ROOM_ID = "!d45f138fsd";
|
||||||
@@ -86,4 +86,18 @@ describe("UrlParams", () => {
|
|||||||
.roomAlias,
|
.roomAlias,
|
||||||
).toBeFalsy();
|
).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("preload", () => {
|
||||||
|
it("defaults to false", () => {
|
||||||
|
expect(getUrlParams().preload).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("ignored in SPA mode", () => {
|
||||||
|
expect(getUrlParams("?preload=true").preload).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("respected in widget mode", () => {
|
||||||
|
expect(getUrlParams("?preload=true&widgetId=12345").preload).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
+5
-2
@@ -211,8 +211,11 @@ export const getUrlParams = (
|
|||||||
|
|
||||||
const fontScale = parseFloat(parser.getParam("fontScale") ?? "");
|
const fontScale = parseFloat(parser.getParam("fontScale") ?? "");
|
||||||
|
|
||||||
|
const widgetId = parser.getParam("widgetId");
|
||||||
|
const isWidget = !!widgetId;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
widgetId: parser.getParam("widgetId"),
|
widgetId,
|
||||||
parentUrl: parser.getParam("parentUrl"),
|
parentUrl: parser.getParam("parentUrl"),
|
||||||
|
|
||||||
// NB. we don't validate roomId here as we do in getRoomIdentifierFromUrl:
|
// NB. we don't validate roomId here as we do in getRoomIdentifierFromUrl:
|
||||||
@@ -224,7 +227,7 @@ export const getUrlParams = (
|
|||||||
confineToRoom:
|
confineToRoom:
|
||||||
parser.getFlagParam("confineToRoom") || parser.getFlagParam("embed"),
|
parser.getFlagParam("confineToRoom") || parser.getFlagParam("embed"),
|
||||||
appPrompt: parser.getFlagParam("appPrompt", true),
|
appPrompt: parser.getFlagParam("appPrompt", true),
|
||||||
preload: parser.getFlagParam("preload"),
|
preload: isWidget ? parser.getFlagParam("preload") : false,
|
||||||
hideHeader: parser.getFlagParam("hideHeader"),
|
hideHeader: parser.getFlagParam("hideHeader"),
|
||||||
showControls: parser.getFlagParam("showControls", true),
|
showControls: parser.getFlagParam("showControls", true),
|
||||||
hideScreensharing: parser.getFlagParam("hideScreensharing"),
|
hideScreensharing: parser.getFlagParam("hideScreensharing"),
|
||||||
|
|||||||
@@ -39,13 +39,16 @@ exports[`the modal renders as a drawer in mobile viewports 1`] = `
|
|||||||
aria-labelledby="radix-:ra:"
|
aria-labelledby="radix-:ra:"
|
||||||
class="overlay modal drawer"
|
class="overlay modal drawer"
|
||||||
data-state="open"
|
data-state="open"
|
||||||
|
data-vaul-animate="true"
|
||||||
|
data-vaul-custom-container="false"
|
||||||
|
data-vaul-delayed-snap-points="false"
|
||||||
|
data-vaul-drawer=""
|
||||||
|
data-vaul-drawer-direction="bottom"
|
||||||
|
data-vaul-snap-points="false"
|
||||||
id="radix-:r9:"
|
id="radix-:r9:"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
style="pointer-events: auto;"
|
style="pointer-events: auto;"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
vaul-drawer=""
|
|
||||||
vaul-drawer-direction="bottom"
|
|
||||||
vaul-drawer-visible="true"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="content"
|
class="content"
|
||||||
|
|||||||
@@ -3,78 +3,99 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenu {
|
.reactionPopupMenu {
|
||||||
|
--reaction-button-padding: 10px;
|
||||||
|
--reaction-button-fontsize: 20px;
|
||||||
|
--reaction-button-gap: var(--cpd-separator-spacing);
|
||||||
display: flex;
|
display: flex;
|
||||||
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenuModal {
|
@media (max-width: 420px) {
|
||||||
width: fit-content !important;
|
.reactionPopupMenu {
|
||||||
top: 82vh !important;
|
--reaction-button-padding: 8px;
|
||||||
|
--reaction-button-fontsize: 16px;
|
||||||
|
--reaction-button-gap: 6px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenuModal > div > div {
|
div.reactionPopupMenuRoot.reactionPopupMenuModal {
|
||||||
padding-inline: var(--cpd-space-6x) !important;
|
--overlay-top: 82vh;
|
||||||
padding-block: var(--cpd-space-6x) var(--cpd-space-8x) !important;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenu menu {
|
div.reactionPopupMenuRoot {
|
||||||
margin: 0;
|
/* Center the drawer */
|
||||||
padding: 0;
|
--inset-inline: 30em;
|
||||||
display: flex;
|
}
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: var(--cpd-separator-spacing);
|
.reactionPopupMenuRoot > div {
|
||||||
|
width: fit-content;
|
||||||
|
max-width: 100vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.reactionPopupMenuRoot.reactionPopupMenuModal > div > div {
|
||||||
|
padding-inline: var(--cpd-space-6x);
|
||||||
|
padding-block: var(--cpd-space-6x);
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenu section {
|
.reactionPopupMenu section {
|
||||||
height: fit-content;
|
height: fit-content;
|
||||||
margin-top: auto;
|
flex: 1;
|
||||||
margin-bottom: auto;
|
max-width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionPopupMenuItem {
|
.reactionPopupMenu section.reactionsMenuSection {
|
||||||
list-style: none;
|
margin: auto 0;
|
||||||
|
flex: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionsMenu {
|
.reactionsMenu {
|
||||||
min-height: 3em;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
flex-grow: 1;
|
||||||
|
gap: var(--reaction-button-gap);
|
||||||
|
/* Height of 3 rows plus padding. */
|
||||||
|
max-height: calc(
|
||||||
|
((var(--reaction-button-fontsize) + var(--cpd-separator-spacing)) * 2) * 3
|
||||||
|
);
|
||||||
|
max-width: calc(
|
||||||
|
((var(--reaction-button-fontsize) + var(--cpd-separator-spacing)) * 2) * 5
|
||||||
|
);
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
list-style: none;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: start;
|
||||||
|
align-items: auto;
|
||||||
|
align-content: start;
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reactionsMenu > * {
|
||||||
|
flex: 0 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionButton {
|
.reactionButton {
|
||||||
padding: 1em;
|
padding: var(--reaction-button-padding);
|
||||||
font-size: 1.6em;
|
|
||||||
width: 1.4em;
|
|
||||||
height: 1.4em;
|
|
||||||
border-radius: var(--cpd-radius-pill-effect);
|
border-radius: var(--cpd-radius-pill-effect);
|
||||||
}
|
font-size: var(--reaction-button-fontsize);
|
||||||
|
min-block-size: unset;
|
||||||
@media (max-width: 800px) {
|
border: none;
|
||||||
.reactionButton {
|
aspect-ratio: 1 / 1;
|
||||||
padding: 1em;
|
height: 100%;
|
||||||
font-size: 1em;
|
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
|
||||||
min-block-size: unset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.verticalSeperator {
|
.verticalSeperator {
|
||||||
background-color: var(--cpd-color-gray-800);
|
background-color: var(--cpd-color-gray-800);
|
||||||
width: 1px;
|
width: 2px;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin-left: var(--cpd-separator-spacing);
|
margin-left: var(--cpd-separator-spacing);
|
||||||
margin-right: var(--cpd-separator-spacing);
|
margin-right: var(--cpd-separator-spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
.searchForm {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
gap: var(--cpd-separator-spacing);
|
|
||||||
margin-bottom: var(--cpd-space-3x);
|
|
||||||
}
|
|
||||||
|
|
||||||
.searchForm > label {
|
|
||||||
flex: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.alert {
|
.alert {
|
||||||
margin-bottom: var(--cpd-space-3x);
|
margin-bottom: var(--cpd-space-3x);
|
||||||
animation: grow-in 200ms;
|
animation: grow-in 200ms;
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { fireEvent, render } from "@testing-library/react";
|
import { render } from "@testing-library/react";
|
||||||
import { act } from "react";
|
|
||||||
import { expect, test } from "vitest";
|
import { expect, test } from "vitest";
|
||||||
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc";
|
|
||||||
import { TooltipProvider } from "@vector-im/compound-web";
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
import { userEvent } from "@testing-library/user-event";
|
import { userEvent } from "@testing-library/user-event";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
@@ -30,18 +28,13 @@ const membership: Record<string, string> = {
|
|||||||
|
|
||||||
function TestComponent({
|
function TestComponent({
|
||||||
rtcSession,
|
rtcSession,
|
||||||
room,
|
|
||||||
}: {
|
}: {
|
||||||
rtcSession: MockRTCSession;
|
rtcSession: MockRTCSession;
|
||||||
room: MockRoom;
|
|
||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
return (
|
return (
|
||||||
<TooltipProvider>
|
<TooltipProvider>
|
||||||
<TestReactionsWrapper rtcSession={rtcSession}>
|
<TestReactionsWrapper rtcSession={rtcSession}>
|
||||||
<ReactionToggleButton
|
<ReactionToggleButton userId={memberUserIdAlice} />
|
||||||
rtcSession={rtcSession as unknown as MatrixRTCSession}
|
|
||||||
client={room.client}
|
|
||||||
/>
|
|
||||||
</TestReactionsWrapper>
|
</TestReactionsWrapper>
|
||||||
</TooltipProvider>
|
</TooltipProvider>
|
||||||
);
|
);
|
||||||
@@ -52,9 +45,9 @@ test("Can open menu", async () => {
|
|||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByLabelText, container } = render(
|
const { getByLabelText, container } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -63,9 +56,9 @@ test("Can raise hand", async () => {
|
|||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByLabelText, container } = render(
|
const { getByLabelText, container } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
await user.click(getByLabelText("action.raise_hand"));
|
await user.click(getByLabelText("action.raise_hand"));
|
||||||
expect(room.testSentEvents).toEqual([
|
expect(room.testSentEvents).toEqual([
|
||||||
[
|
[
|
||||||
@@ -88,10 +81,10 @@ test("Can lower hand", async () => {
|
|||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByLabelText, container } = render(
|
const { getByLabelText, container } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
const reactionEvent = room.testSendHandRaise(memberEventAlice, membership);
|
const reactionEvent = room.testSendHandRaise(memberEventAlice, membership);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
await user.click(getByLabelText("action.lower_hand"));
|
await user.click(getByLabelText("action.lower_hand"));
|
||||||
expect(room.testRedactedEvents).toEqual([[undefined, reactionEvent]]);
|
expect(room.testRedactedEvents).toEqual([[undefined, reactionEvent]]);
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
@@ -102,9 +95,9 @@ test("Can react with emoji", async () => {
|
|||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByLabelText, getByText } = render(
|
const { getByLabelText, getByText } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
await user.click(getByText("🐶"));
|
await user.click(getByText("🐶"));
|
||||||
expect(room.testSentEvents).toEqual([
|
expect(room.testSentEvents).toEqual([
|
||||||
[
|
[
|
||||||
@@ -122,17 +115,15 @@ test("Can react with emoji", async () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Can search for and send emoji", async () => {
|
test("Can fully expand emoji picker", async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByText, container, getByLabelText } = render(
|
const { getByText, container, getByLabelText } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
await user.click(getByLabelText("action.open_search"));
|
await user.click(getByLabelText("action.show_more"));
|
||||||
// Search should autofocus.
|
|
||||||
await user.keyboard("crickets");
|
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
await user.click(getByText("🦗"));
|
await user.click(getByText("🦗"));
|
||||||
|
|
||||||
@@ -152,63 +143,15 @@ test("Can search for and send emoji", async () => {
|
|||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Can search for and send emoji with the keyboard", async () => {
|
test("Can close reaction dialog", async () => {
|
||||||
const user = userEvent.setup();
|
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
|
||||||
const { getByLabelText, getByPlaceholderText, container } = render(
|
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
|
||||||
);
|
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
|
||||||
await user.click(getByLabelText("action.open_search"));
|
|
||||||
const searchField = getByPlaceholderText("reaction_search");
|
|
||||||
// Search should autofocus.
|
|
||||||
await user.keyboard("crickets");
|
|
||||||
expect(container).toMatchSnapshot();
|
|
||||||
act(() => {
|
|
||||||
fireEvent.keyDown(searchField, { key: "Enter" });
|
|
||||||
});
|
|
||||||
expect(room.testSentEvents).toEqual([
|
|
||||||
[
|
|
||||||
undefined,
|
|
||||||
ElementCallReactionEventType,
|
|
||||||
{
|
|
||||||
"m.relates_to": {
|
|
||||||
event_id: memberEventAlice,
|
|
||||||
rel_type: "m.reference",
|
|
||||||
},
|
|
||||||
name: "crickets",
|
|
||||||
emoji: "🦗",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Can close search", async () => {
|
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
const room = new MockRoom(memberUserIdAlice);
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
const rtcSession = new MockRTCSession(room, membership);
|
||||||
const { getByLabelText, container } = render(
|
const { getByLabelText, container } = render(
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
<TestComponent rtcSession={rtcSession} />,
|
||||||
);
|
);
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
await user.click(getByLabelText("common.reactions"));
|
||||||
await user.click(getByLabelText("action.open_search"));
|
await user.click(getByLabelText("action.show_more"));
|
||||||
await user.click(getByLabelText("action.close_search"));
|
await user.click(getByLabelText("action.show_less"));
|
||||||
expect(container).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Can close search with the escape key", async () => {
|
|
||||||
const user = userEvent.setup();
|
|
||||||
const room = new MockRoom(memberUserIdAlice);
|
|
||||||
const rtcSession = new MockRTCSession(room, membership);
|
|
||||||
const { getByLabelText, container, getByPlaceholderText } = render(
|
|
||||||
<TestComponent rtcSession={rtcSession} room={room} />,
|
|
||||||
);
|
|
||||||
await user.click(getByLabelText("action.raise_hand_or_send_reaction"));
|
|
||||||
await user.click(getByLabelText("action.open_search"));
|
|
||||||
const searchField = getByPlaceholderText("reaction_search");
|
|
||||||
act(() => {
|
|
||||||
fireEvent.keyDown(searchField, { key: "Escape" });
|
|
||||||
});
|
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,24 +5,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { Button as CpdButton, Tooltip, Alert } from "@vector-im/compound-web";
|
||||||
import {
|
import {
|
||||||
Button as CpdButton,
|
|
||||||
Tooltip,
|
|
||||||
Search,
|
|
||||||
Form,
|
|
||||||
Alert,
|
|
||||||
} from "@vector-im/compound-web";
|
|
||||||
import {
|
|
||||||
SearchIcon,
|
|
||||||
CloseIcon,
|
|
||||||
RaisedHandSolidIcon,
|
RaisedHandSolidIcon,
|
||||||
ReactionIcon,
|
ChevronDownIcon,
|
||||||
|
ChevronUpIcon,
|
||||||
|
ReactionSolidIcon,
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
import {
|
import {
|
||||||
ChangeEventHandler,
|
|
||||||
ComponentPropsWithoutRef,
|
ComponentPropsWithoutRef,
|
||||||
FC,
|
FC,
|
||||||
KeyboardEventHandler,
|
|
||||||
ReactNode,
|
ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
@@ -31,19 +23,11 @@ import {
|
|||||||
} from "react";
|
} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { EventType, RelationType } from "matrix-js-sdk/src/matrix";
|
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
|
||||||
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { useReactions } from "../useReactions";
|
import { useReactions } from "../useReactions";
|
||||||
import { useMatrixRTCSessionMemberships } from "../useMatrixRTCSessionMemberships";
|
|
||||||
import styles from "./ReactionToggleButton.module.css";
|
import styles from "./ReactionToggleButton.module.css";
|
||||||
import {
|
import { ReactionOption, ReactionSet, ReactionsRowSize } from "../reactions";
|
||||||
ReactionOption,
|
|
||||||
ReactionSet,
|
|
||||||
ElementCallReactionEventType,
|
|
||||||
} from "../reactions";
|
|
||||||
import { Modal } from "../Modal";
|
import { Modal } from "../Modal";
|
||||||
|
|
||||||
interface InnerButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface InnerButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
@@ -55,15 +39,14 @@ const InnerButton: FC<InnerButtonProps> = ({ raised, open, ...props }) => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip label={t("action.raise_hand_or_send_reaction")}>
|
<Tooltip label={t("common.reactions")}>
|
||||||
<CpdButton
|
<CpdButton
|
||||||
className={classNames(raised && styles.raisedButton)}
|
className={classNames(raised && styles.raisedButton)}
|
||||||
aria-expanded={open}
|
aria-expanded={open}
|
||||||
aria-haspopup
|
aria-haspopup
|
||||||
aria-label={t("action.raise_hand_or_send_reaction")}
|
|
||||||
kind={raised || open ? "primary" : "secondary"}
|
kind={raised || open ? "primary" : "secondary"}
|
||||||
iconOnly
|
iconOnly
|
||||||
Icon={raised ? RaisedHandSolidIcon : ReactionIcon}
|
Icon={raised ? RaisedHandSolidIcon : ReactionSolidIcon}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -84,43 +67,11 @@ export function ReactionPopupMenu({
|
|||||||
canReact: boolean;
|
canReact: boolean;
|
||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [searchText, setSearchText] = useState("");
|
const [isFullyExpanded, setExpanded] = useState(false);
|
||||||
const [isSearching, setIsSearching] = useState(false);
|
|
||||||
const onSearch = useCallback<ChangeEventHandler<HTMLInputElement>>((ev) => {
|
|
||||||
ev.preventDefault();
|
|
||||||
setSearchText(ev.target.value.trim().toLocaleLowerCase());
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const filteredReactionSet = useMemo(
|
const filteredReactionSet = useMemo(
|
||||||
() =>
|
() => (isFullyExpanded ? ReactionSet : ReactionSet.slice(0, 5)),
|
||||||
ReactionSet.filter(
|
[isFullyExpanded],
|
||||||
(reaction) =>
|
|
||||||
!isSearching ||
|
|
||||||
(!!searchText &&
|
|
||||||
(reaction.name.startsWith(searchText) ||
|
|
||||||
reaction.alias?.some((a) => a.startsWith(searchText)))),
|
|
||||||
).slice(0, 6),
|
|
||||||
[searchText, isSearching],
|
|
||||||
);
|
|
||||||
|
|
||||||
const onSearchKeyDown = useCallback<KeyboardEventHandler<never>>(
|
|
||||||
(ev) => {
|
|
||||||
if (ev.key === "Enter") {
|
|
||||||
ev.preventDefault();
|
|
||||||
if (!canReact) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (filteredReactionSet.length !== 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sendReaction(filteredReactionSet[0]);
|
|
||||||
setIsSearching(false);
|
|
||||||
} else if (ev.key === "Escape") {
|
|
||||||
ev.preventDefault();
|
|
||||||
setIsSearching(false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[sendReaction, filteredReactionSet, canReact, setIsSearching],
|
|
||||||
);
|
);
|
||||||
const label = isHandRaised ? t("action.lower_hand") : t("action.raise_hand");
|
const label = isHandRaised ? t("action.lower_hand") : t("action.raise_hand");
|
||||||
return (
|
return (
|
||||||
@@ -136,9 +87,10 @@ export function ReactionPopupMenu({
|
|||||||
)}
|
)}
|
||||||
<div className={styles.reactionPopupMenu}>
|
<div className={styles.reactionPopupMenu}>
|
||||||
<section className={styles.handRaiseSection}>
|
<section className={styles.handRaiseSection}>
|
||||||
<Tooltip label={label}>
|
<Tooltip label={label} caption="H">
|
||||||
<CpdButton
|
<CpdButton
|
||||||
kind={isHandRaised ? "primary" : "secondary"}
|
kind={isHandRaised ? "primary" : "secondary"}
|
||||||
|
aria-keyshortcuts="H"
|
||||||
aria-pressed={isHandRaised}
|
aria-pressed={isHandRaised}
|
||||||
aria-label={label}
|
aria-label={label}
|
||||||
onClick={() => toggleRaisedHand()}
|
onClick={() => toggleRaisedHand()}
|
||||||
@@ -148,41 +100,33 @@ export function ReactionPopupMenu({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</section>
|
</section>
|
||||||
<div className={styles.verticalSeperator} />
|
<div className={styles.verticalSeperator} />
|
||||||
<section>
|
<section className={styles.reactionsMenuSection}>
|
||||||
{isSearching ? (
|
<menu
|
||||||
<>
|
className={classNames(
|
||||||
<Form.Root className={styles.searchForm}>
|
isFullyExpanded && styles.reactionsMenuExpanded,
|
||||||
<Search
|
styles.reactionsMenu,
|
||||||
required
|
)}
|
||||||
value={searchText}
|
>
|
||||||
name="reactionSearch"
|
{filteredReactionSet.map((reaction, index) => (
|
||||||
placeholder={t("reaction_search")}
|
<li key={reaction.name}>
|
||||||
onChange={onSearch}
|
<Tooltip
|
||||||
onKeyDown={onSearchKeyDown}
|
label={reaction.name}
|
||||||
// This is a reasonable use of autofocus, we are focusing when
|
caption={
|
||||||
// the search button is clicked (which matches the Element Web reaction picker)
|
index < ReactionsRowSize
|
||||||
// eslint-disable-next-line jsx-a11y/no-autofocus
|
? (index + 1).toString()
|
||||||
autoFocus
|
: undefined
|
||||||
/>
|
}
|
||||||
<CpdButton
|
>
|
||||||
Icon={CloseIcon}
|
|
||||||
aria-label={t("action.close_search")}
|
|
||||||
size="sm"
|
|
||||||
kind="destructive"
|
|
||||||
onClick={() => setIsSearching(false)}
|
|
||||||
/>
|
|
||||||
</Form.Root>
|
|
||||||
</>
|
|
||||||
) : null}
|
|
||||||
<menu className={styles.reactionsMenu}>
|
|
||||||
{filteredReactionSet.map((reaction) => (
|
|
||||||
<li className={styles.reactionPopupMenuItem} key={reaction.name}>
|
|
||||||
<Tooltip label={reaction.name}>
|
|
||||||
<CpdButton
|
<CpdButton
|
||||||
kind="secondary"
|
kind="secondary"
|
||||||
className={styles.reactionButton}
|
className={styles.reactionButton}
|
||||||
disabled={!canReact}
|
disabled={!canReact}
|
||||||
onClick={() => sendReaction(reaction)}
|
onClick={() => sendReaction(reaction)}
|
||||||
|
aria-keyshortcuts={
|
||||||
|
index < ReactionsRowSize
|
||||||
|
? (index + 1).toString()
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{reaction.emoji}
|
{reaction.emoji}
|
||||||
</CpdButton>
|
</CpdButton>
|
||||||
@@ -191,73 +135,56 @@ export function ReactionPopupMenu({
|
|||||||
))}
|
))}
|
||||||
</menu>
|
</menu>
|
||||||
</section>
|
</section>
|
||||||
{!isSearching ? (
|
<section style={{ marginLeft: "var(--cpd-separator-spacing)" }}>
|
||||||
<section style={{ marginLeft: "var(--cpd-separator-spacing)" }}>
|
<Tooltip
|
||||||
<li key="search" className={styles.reactionPopupMenuItem}>
|
label={
|
||||||
<Tooltip label={t("common.search")}>
|
isFullyExpanded ? t("action.show_less") : t("action.show_more")
|
||||||
<CpdButton
|
}
|
||||||
iconOnly
|
>
|
||||||
aria-label={t("action.open_search")}
|
<CpdButton
|
||||||
Icon={SearchIcon}
|
iconOnly
|
||||||
kind="tertiary"
|
aria-label={
|
||||||
onClick={() => setIsSearching(true)}
|
isFullyExpanded ? t("action.show_less") : t("action.show_more")
|
||||||
/>
|
}
|
||||||
</Tooltip>
|
Icon={isFullyExpanded ? ChevronUpIcon : ChevronDownIcon}
|
||||||
</li>
|
kind="tertiary"
|
||||||
</section>
|
onClick={() => setExpanded(!isFullyExpanded)}
|
||||||
) : null}
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
rtcSession: MatrixRTCSession;
|
userId: string;
|
||||||
client: MatrixClient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ReactionToggleButton({
|
export function ReactionToggleButton({
|
||||||
client,
|
userId,
|
||||||
rtcSession,
|
|
||||||
...props
|
...props
|
||||||
}: ReactionToggleButtonProps): ReactNode {
|
}: ReactionToggleButtonProps): ReactNode {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { raisedHands, lowerHand, reactions } = useReactions();
|
const { raisedHands, toggleRaisedHand, sendReaction, reactions } =
|
||||||
|
useReactions();
|
||||||
const [busy, setBusy] = useState(false);
|
const [busy, setBusy] = useState(false);
|
||||||
const userId = client.getUserId()!;
|
|
||||||
const isHandRaised = !!raisedHands[userId];
|
|
||||||
const memberships = useMatrixRTCSessionMemberships(rtcSession);
|
|
||||||
const [showReactionsMenu, setShowReactionsMenu] = useState(false);
|
const [showReactionsMenu, setShowReactionsMenu] = useState(false);
|
||||||
const [errorText, setErrorText] = useState<string>();
|
const [errorText, setErrorText] = useState<string>();
|
||||||
|
|
||||||
|
const isHandRaised = !!raisedHands[userId];
|
||||||
|
const canReact = !reactions[userId];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Clear whenever the reactions menu state changes.
|
// Clear whenever the reactions menu state changes.
|
||||||
setErrorText(undefined);
|
setErrorText(undefined);
|
||||||
}, [showReactionsMenu]);
|
}, [showReactionsMenu]);
|
||||||
|
|
||||||
const canReact = !reactions[userId];
|
|
||||||
|
|
||||||
const sendRelation = useCallback(
|
const sendRelation = useCallback(
|
||||||
async (reaction: ReactionOption) => {
|
async (reaction: ReactionOption) => {
|
||||||
try {
|
try {
|
||||||
const myMembership = memberships.find((m) => m.sender === userId);
|
|
||||||
if (!myMembership?.eventId) {
|
|
||||||
throw new Error("Cannot find own membership event");
|
|
||||||
}
|
|
||||||
const parentEventId = myMembership.eventId;
|
|
||||||
setBusy(true);
|
setBusy(true);
|
||||||
await client.sendEvent(
|
await sendReaction(reaction);
|
||||||
rtcSession.room.roomId,
|
|
||||||
ElementCallReactionEventType,
|
|
||||||
{
|
|
||||||
"m.relates_to": {
|
|
||||||
rel_type: RelationType.Reference,
|
|
||||||
event_id: parentEventId,
|
|
||||||
},
|
|
||||||
emoji: reaction.emoji,
|
|
||||||
name: reaction.name,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
setErrorText(undefined);
|
setErrorText(undefined);
|
||||||
setShowReactionsMenu(false);
|
setShowReactionsMenu(false);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
@@ -267,59 +194,25 @@ export function ReactionToggleButton({
|
|||||||
setBusy(false);
|
setBusy(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[memberships, client, userId, rtcSession],
|
[sendReaction],
|
||||||
);
|
);
|
||||||
|
|
||||||
const toggleRaisedHand = useCallback(() => {
|
const wrappedToggleRaisedHand = useCallback(() => {
|
||||||
const raiseHand = async (): Promise<void> => {
|
const toggleHand = async (): Promise<void> => {
|
||||||
if (isHandRaised) {
|
try {
|
||||||
try {
|
setBusy(true);
|
||||||
setBusy(true);
|
await toggleRaisedHand();
|
||||||
await lowerHand();
|
setShowReactionsMenu(false);
|
||||||
setShowReactionsMenu(false);
|
} catch (ex) {
|
||||||
} finally {
|
setErrorText(ex instanceof Error ? ex.message : "Unknown error");
|
||||||
setBusy(false);
|
logger.error("Failed to raise/lower hand", ex);
|
||||||
}
|
} finally {
|
||||||
} else {
|
setBusy(false);
|
||||||
try {
|
|
||||||
const myMembership = memberships.find((m) => m.sender === userId);
|
|
||||||
if (!myMembership?.eventId) {
|
|
||||||
throw new Error("Cannot find own membership event");
|
|
||||||
}
|
|
||||||
const parentEventId = myMembership.eventId;
|
|
||||||
setBusy(true);
|
|
||||||
const reaction = await client.sendEvent(
|
|
||||||
rtcSession.room.roomId,
|
|
||||||
EventType.Reaction,
|
|
||||||
{
|
|
||||||
"m.relates_to": {
|
|
||||||
rel_type: RelationType.Annotation,
|
|
||||||
event_id: parentEventId,
|
|
||||||
key: "🖐️",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
);
|
|
||||||
logger.debug("Sent raise hand event", reaction.event_id);
|
|
||||||
setErrorText(undefined);
|
|
||||||
setShowReactionsMenu(false);
|
|
||||||
} catch (ex) {
|
|
||||||
setErrorText(ex instanceof Error ? ex.message : "Unknown error");
|
|
||||||
logger.error("Failed to raise hand", ex);
|
|
||||||
} finally {
|
|
||||||
setBusy(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void raiseHand();
|
void toggleHand();
|
||||||
}, [
|
}, [toggleRaisedHand]);
|
||||||
client,
|
|
||||||
isHandRaised,
|
|
||||||
memberships,
|
|
||||||
lowerHand,
|
|
||||||
rtcSession.room.roomId,
|
|
||||||
userId,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -335,14 +228,15 @@ export function ReactionToggleButton({
|
|||||||
title={t("action.pick_reaction")}
|
title={t("action.pick_reaction")}
|
||||||
hideHeader
|
hideHeader
|
||||||
classNameModal={styles.reactionPopupMenuModal}
|
classNameModal={styles.reactionPopupMenuModal}
|
||||||
|
className={styles.reactionPopupMenuRoot}
|
||||||
onDismiss={() => setShowReactionsMenu(false)}
|
onDismiss={() => setShowReactionsMenu(false)}
|
||||||
>
|
>
|
||||||
<ReactionPopupMenu
|
<ReactionPopupMenu
|
||||||
errorText={errorText}
|
errorText={errorText}
|
||||||
isHandRaised={isHandRaised}
|
isHandRaised={isHandRaised}
|
||||||
canReact={canReact}
|
canReact={!busy && canReact}
|
||||||
sendReaction={(reaction) => void sendRelation(reaction)}
|
sendReaction={(reaction) => void sendRelation(reaction)}
|
||||||
toggleRaisedHand={toggleRaisedHand}
|
toggleRaisedHand={wrappedToggleRaisedHand}
|
||||||
/>
|
/>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
exports[`Can close search 1`] = `
|
exports[`Can close reaction dialog 1`] = `
|
||||||
<div
|
<div
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
data-aria-hidden="true"
|
data-aria-hidden="true"
|
||||||
@@ -9,8 +9,7 @@ exports[`Can close search 1`] = `
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
aria-expanded="true"
|
aria-expanded="true"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
aria-labelledby=":r9l:"
|
||||||
aria-labelledby=":rec:"
|
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
@@ -26,26 +25,27 @@ exports[`Can close search 1`] = `
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
clip-rule="evenodd"
|
||||||
/>
|
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm3.536-6.464a1 1 0 0 0-1.415-1.415A2.988 2.988 0 0 1 12 15a2.988 2.988 0 0 1-2.121-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
||||||
<path
|
fill-rule="evenodd"
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`Can close search with the escape key 1`] = `
|
exports[`Can fully expand emoji picker 1`] = `
|
||||||
<div>
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
data-aria-hidden="true"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
aria-expanded="false"
|
aria-expanded="true"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
aria-labelledby=":r6c:"
|
||||||
aria-labelledby=":rhh:"
|
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
||||||
data-kind="secondary"
|
data-kind="primary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
role="button"
|
role="button"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
@@ -59,10 +59,9 @@ exports[`Can close search with the escape key 1`] = `
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
clip-rule="evenodd"
|
||||||
/>
|
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm3.536-6.464a1 1 0 0 0-1.415-1.415A2.988 2.988 0 0 1 12 15a2.988 2.988 0 0 1-2.121-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
||||||
<path
|
fill-rule="evenodd"
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
@@ -75,8 +74,7 @@ exports[`Can lower hand 1`] = `
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
aria-labelledby=":r36:"
|
||||||
aria-labelledby=":r3i:"
|
|
||||||
class="_button_i91xf_17 raisedButton _has-icon_i91xf_66 _icon-only_i91xf_59"
|
class="_button_i91xf_17 raisedButton _has-icon_i91xf_66 _icon-only_i91xf_59"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
@@ -108,7 +106,6 @@ exports[`Can open menu 1`] = `
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
aria-expanded="true"
|
aria-expanded="true"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
|
||||||
aria-labelledby=":r0:"
|
aria-labelledby=":r0:"
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
@@ -125,10 +122,9 @@ exports[`Can open menu 1`] = `
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
clip-rule="evenodd"
|
||||||
/>
|
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm3.536-6.464a1 1 0 0 0-1.415-1.415A2.988 2.988 0 0 1 12 15a2.988 2.988 0 0 1-2.121-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
||||||
<path
|
fill-rule="evenodd"
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
@@ -141,8 +137,7 @@ exports[`Can raise hand 1`] = `
|
|||||||
aria-disabled="false"
|
aria-disabled="false"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
aria-labelledby=":r1j:"
|
||||||
aria-labelledby=":r1p:"
|
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
||||||
data-kind="secondary"
|
data-kind="secondary"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
@@ -158,82 +153,9 @@ exports[`Can raise hand 1`] = `
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
clip-rule="evenodd"
|
||||||
/>
|
d="M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Zm3.536-6.464a1 1 0 0 0-1.415-1.415A2.988 2.988 0 0 1 12 15a2.988 2.988 0 0 1-2.121-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
||||||
<path
|
fill-rule="evenodd"
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Can search for and send emoji 1`] = `
|
|
||||||
<div
|
|
||||||
aria-hidden="true"
|
|
||||||
data-aria-hidden="true"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
aria-disabled="false"
|
|
||||||
aria-expanded="true"
|
|
||||||
aria-haspopup="true"
|
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
|
||||||
aria-labelledby=":r74:"
|
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
|
||||||
data-kind="primary"
|
|
||||||
data-size="lg"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
fill="currentColor"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
width="24"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`Can search for and send emoji with the keyboard 1`] = `
|
|
||||||
<div
|
|
||||||
aria-hidden="true"
|
|
||||||
data-aria-hidden="true"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
aria-disabled="false"
|
|
||||||
aria-expanded="true"
|
|
||||||
aria-haspopup="true"
|
|
||||||
aria-label="action.raise_hand_or_send_reaction"
|
|
||||||
aria-labelledby=":ra3:"
|
|
||||||
class="_button_i91xf_17 _has-icon_i91xf_66 _icon-only_i91xf_59"
|
|
||||||
data-kind="primary"
|
|
||||||
data-size="lg"
|
|
||||||
role="button"
|
|
||||||
tabindex="0"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
aria-hidden="true"
|
|
||||||
fill="currentColor"
|
|
||||||
height="24"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
width="24"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M15.536 15.536a1 1 0 0 0-1.415-1.415 2.987 2.987 0 0 1-2.12.879 2.988 2.988 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A4.987 4.987 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464ZM10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"
|
|
||||||
/>
|
|
||||||
<path
|
|
||||||
d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
+7
-11
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { merge } from "lodash";
|
import { merge } from "lodash-es";
|
||||||
|
|
||||||
import { getUrlParams } from "../UrlParams";
|
import { getUrlParams } from "../UrlParams";
|
||||||
import {
|
import {
|
||||||
@@ -28,11 +28,11 @@ export class Config {
|
|||||||
const internalInstance = new Config();
|
const internalInstance = new Config();
|
||||||
Config.internalInstance = internalInstance;
|
Config.internalInstance = internalInstance;
|
||||||
|
|
||||||
Config.internalInstance.initPromise = downloadConfig(
|
Config.internalInstance.initPromise = downloadConfig("/config.json").then(
|
||||||
"../config.json",
|
(config) => {
|
||||||
).then((config) => {
|
internalInstance.config = merge({}, DEFAULT_CONFIG, config);
|
||||||
internalInstance.config = merge({}, DEFAULT_CONFIG, config);
|
},
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
return Config.internalInstance.initPromise;
|
return Config.internalInstance.initPromise;
|
||||||
}
|
}
|
||||||
@@ -74,11 +74,7 @@ async function downloadConfig(
|
|||||||
configJsonFilename: string,
|
configJsonFilename: string,
|
||||||
): Promise<ConfigOptions> {
|
): Promise<ConfigOptions> {
|
||||||
const url = new URL(configJsonFilename, window.location.href);
|
const url = new URL(configJsonFilename, window.location.href);
|
||||||
url.searchParams.set("cachebuster", Date.now().toString());
|
const res = await fetch(url);
|
||||||
const res = await fetch(url, {
|
|
||||||
cache: "no-cache",
|
|
||||||
method: "GET",
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!res.ok || res.status === 404 || res.status === 0) {
|
if (!res.ok || res.status === 404 || res.status === 0) {
|
||||||
// Lack of a config isn't an error, we should just use the defaults.
|
// Lack of a config isn't an error, we should just use the defaults.
|
||||||
|
|||||||
+7
-98
@@ -5,14 +5,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Inter unexpectedly contains various codepoints which collide with emoji, even
|
|
||||||
when variation-16 is applied to request the emoji variant. From eyeballing
|
|
||||||
the emoji picker, these are: 20e3, 23cf, 24c2, 25a0-25c1, 2665, 2764, 2b06, 2b1c.
|
|
||||||
Therefore we define a unicode-range to load which excludes the glyphs
|
|
||||||
(to avoid having to maintain a fork of Inter). */
|
|
||||||
|
|
||||||
@layer normalize, compound-legacy, compound;
|
@layer normalize, compound-legacy, compound;
|
||||||
|
|
||||||
|
@import url("@fontsource/inter/400.css");
|
||||||
|
@import url("@fontsource/inter/500.css");
|
||||||
|
@import url("@fontsource/inter/600.css");
|
||||||
|
@import url("@fontsource/inter/700.css");
|
||||||
|
@import url("@fontsource/inconsolata/400.css");
|
||||||
|
@import url("@fontsource/inconsolata/700.css");
|
||||||
|
|
||||||
@import url("normalize.css/normalize.css") layer(normalize);
|
@import url("normalize.css/normalize.css") layer(normalize);
|
||||||
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css")
|
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css")
|
||||||
layer(compound);
|
layer(compound);
|
||||||
@@ -52,94 +53,6 @@ layer(compound);
|
|||||||
--stopgap-background-85: rgba(16, 19, 23, 0.85);
|
--stopgap-background-85: rgba(16, 19, 23, 0.85);
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-Regular.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-Regular.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 400;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-Italic.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-Italic.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 500;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-Medium.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-Medium.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 500;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-MediumItalic.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-MediumItalic.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 600;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-SemiBold.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-SemiBold.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 600;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-SemiBoldItalic.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-SemiBoldItalic.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-Bold.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-Bold.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: "Inter";
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 700;
|
|
||||||
font-display: swap;
|
|
||||||
unicode-range: var(--inter-unicode-range);
|
|
||||||
src:
|
|
||||||
url("/fonts/Inter/Inter-BoldItalic.woff2") format("woff2"),
|
|
||||||
url("/fonts/Inter/Inter-BoldItalic.woff") format("woff");
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background-color: var(--cpd-color-bg-canvas-default);
|
background-color: var(--cpd-color-bg-canvas-default);
|
||||||
background-size: calc(max(1440px, 100vw)) calc(max(800px, 100vh));
|
background-size: calc(max(1440px, 100vw)) calc(max(800px, 100vh));
|
||||||
@@ -185,10 +98,6 @@ body[data-platform="ios"] {
|
|||||||
--cpd-font-family-sans: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
|
--cpd-font-family-sans: -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-platform="desktop"] {
|
|
||||||
--cpd-font-family-sans: "Inter", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
@layer compound-legacy {
|
@layer compound-legacy {
|
||||||
h1,
|
h1,
|
||||||
h2,
|
h2,
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import { expect, test } from "vitest";
|
|||||||
|
|
||||||
import { Initializer } from "../src/initializer";
|
import { Initializer } from "../src/initializer";
|
||||||
|
|
||||||
test("initBeforeReact sets font family from URL param", () => {
|
test("initBeforeReact sets font family from URL param", async () => {
|
||||||
window.location.hash = "#?font=DejaVu Sans";
|
window.location.hash = "#?font=DejaVu Sans";
|
||||||
Initializer.initBeforeReact();
|
await Initializer.initBeforeReact();
|
||||||
expect(
|
expect(
|
||||||
getComputedStyle(document.documentElement).getPropertyValue(
|
getComputedStyle(document.documentElement).getPropertyValue(
|
||||||
"--font-family",
|
"--font-family",
|
||||||
@@ -19,9 +19,9 @@ test("initBeforeReact sets font family from URL param", () => {
|
|||||||
).toBe('"DejaVu Sans"');
|
).toBe('"DejaVu Sans"');
|
||||||
});
|
});
|
||||||
|
|
||||||
test("initBeforeReact sets font scale from URL param", () => {
|
test("initBeforeReact sets font scale from URL param", async () => {
|
||||||
window.location.hash = "#?fontScale=1.2";
|
window.location.hash = "#?fontScale=1.2";
|
||||||
Initializer.initBeforeReact();
|
await Initializer.initBeforeReact();
|
||||||
expect(
|
expect(
|
||||||
getComputedStyle(document.documentElement).getPropertyValue("--font-scale"),
|
getComputedStyle(document.documentElement).getPropertyValue("--font-scale"),
|
||||||
).toBe("1.2");
|
).toBe("1.2");
|
||||||
|
|||||||
+82
-10
@@ -5,18 +5,85 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import i18n from "i18next";
|
import i18n, {
|
||||||
|
type BackendModule,
|
||||||
|
type ReadCallback,
|
||||||
|
type ResourceKey,
|
||||||
|
} from "i18next";
|
||||||
import { initReactI18next } from "react-i18next";
|
import { initReactI18next } from "react-i18next";
|
||||||
import LanguageDetector from "i18next-browser-languagedetector";
|
import LanguageDetector from "i18next-browser-languagedetector";
|
||||||
import Backend from "i18next-http-backend";
|
|
||||||
import * as Sentry from "@sentry/react";
|
import * as Sentry from "@sentry/react";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
import { shouldPolyfill as shouldPolyfillSegmenter } from "@formatjs/intl-segmenter/should-polyfill";
|
||||||
|
import { shouldPolyfill as shouldPolyfillDurationFormat } from "@formatjs/intl-durationformat/should-polyfill";
|
||||||
|
|
||||||
import { getUrlParams } from "./UrlParams";
|
import { getUrlParams } from "./UrlParams";
|
||||||
import { Config } from "./config/Config";
|
import { Config } from "./config/Config";
|
||||||
import { ElementCallOpenTelemetry } from "./otel/otel";
|
import { ElementCallOpenTelemetry } from "./otel/otel";
|
||||||
import { platform } from "./Platform";
|
import { platform } from "./Platform";
|
||||||
|
|
||||||
|
// This generates a map of locale names to their URL (based on import.meta.url), which looks like this:
|
||||||
|
// {
|
||||||
|
// "../locales/en-GB/app.json": "/whatever/assets/root/locales/en-aabbcc.json",
|
||||||
|
// ...
|
||||||
|
// }
|
||||||
|
const locales = import.meta.glob<string>("../locales/*/*.json", {
|
||||||
|
query: "?url",
|
||||||
|
import: "default",
|
||||||
|
eager: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const getLocaleUrl = (
|
||||||
|
language: string,
|
||||||
|
namespace: string,
|
||||||
|
): string | undefined => locales[`../locales/${language}/${namespace}.json`];
|
||||||
|
|
||||||
|
const supportedLngs = [
|
||||||
|
...new Set(
|
||||||
|
Object.keys(locales).map((url) => {
|
||||||
|
// The URLs are of the form ../locales/en-GB/app.json
|
||||||
|
// This extracts the language code from the URL
|
||||||
|
const lang = url.match(/\/([^/]+)\/[^/]+\.json$/)?.[1];
|
||||||
|
if (!lang) {
|
||||||
|
throw new Error(`Could not parse locale URL ${url}`);
|
||||||
|
}
|
||||||
|
return lang;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
// A backend that fetches the locale files from the URLs generated by the glob above
|
||||||
|
const Backend = {
|
||||||
|
type: "backend",
|
||||||
|
init(): void {},
|
||||||
|
read(language: string, namespace: string, callback: ReadCallback): void {
|
||||||
|
(async (): Promise<ResourceKey> => {
|
||||||
|
const url = getLocaleUrl(language, namespace);
|
||||||
|
if (!url) {
|
||||||
|
throw new Error(
|
||||||
|
`Namespace ${namespace} for locale ${language} not found`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(url, {
|
||||||
|
credentials: "omit",
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw Error(`Failed to fetch ${url}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await response.json();
|
||||||
|
})().then(
|
||||||
|
(data) => callback(null, data),
|
||||||
|
(error) => callback(error, null),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
} satisfies BackendModule;
|
||||||
|
|
||||||
enum LoadState {
|
enum LoadState {
|
||||||
None,
|
None,
|
||||||
Loading,
|
Loading,
|
||||||
@@ -41,10 +108,17 @@ export class Initializer {
|
|||||||
return Initializer.internalInstance?.isInitialized;
|
return Initializer.internalInstance?.isInitialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static initBeforeReact(): void {
|
public static async initBeforeReact(): Promise<void> {
|
||||||
// this maybe also needs to return a promise in the future,
|
const polyfills: Promise<unknown>[] = [];
|
||||||
// if we have to do async inits before showing the loading screen
|
if (shouldPolyfillSegmenter()) {
|
||||||
// but this should be avoided if possible
|
polyfills.push(import("@formatjs/intl-segmenter/polyfill-force"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldPolyfillDurationFormat()) {
|
||||||
|
polyfills.push(import("@formatjs/intl-durationformat/polyfill-force"));
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(polyfills);
|
||||||
|
|
||||||
//i18n
|
//i18n
|
||||||
const languageDetector = new LanguageDetector();
|
const languageDetector = new LanguageDetector();
|
||||||
@@ -54,7 +128,7 @@ export class Initializer {
|
|||||||
lookup: () => getUrlParams().lang ?? undefined,
|
lookup: () => getUrlParams().lang ?? undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
i18n
|
await i18n
|
||||||
.use(Backend)
|
.use(Backend)
|
||||||
.use(languageDetector)
|
.use(languageDetector)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
@@ -65,6 +139,7 @@ export class Initializer {
|
|||||||
nsSeparator: false,
|
nsSeparator: false,
|
||||||
pluralSeparator: "_",
|
pluralSeparator: "_",
|
||||||
contextSeparator: "|",
|
contextSeparator: "|",
|
||||||
|
supportedLngs,
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false, // React has built-in XSS protections
|
escapeValue: false, // React has built-in XSS protections
|
||||||
},
|
},
|
||||||
@@ -74,9 +149,6 @@ export class Initializer {
|
|||||||
order: ["urlFragment", "navigator"],
|
order: ["urlFragment", "navigator"],
|
||||||
caches: [],
|
caches: [],
|
||||||
},
|
},
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
logger.error("Failed to initialize i18n", e);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Custom Themeing
|
// Custom Themeing
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
audioInput as audioInputSetting,
|
audioInput as audioInputSetting,
|
||||||
audioOutput as audioOutputSetting,
|
audioOutput as audioOutputSetting,
|
||||||
videoInput as videoInputSetting,
|
videoInput as videoInputSetting,
|
||||||
|
Setting,
|
||||||
} from "../settings/settings";
|
} from "../settings/settings";
|
||||||
import { isFirefox } from "../Platform";
|
import { isFirefox } from "../Platform";
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ function useObservableState<T>(
|
|||||||
|
|
||||||
function useMediaDevice(
|
function useMediaDevice(
|
||||||
kind: MediaDeviceKind,
|
kind: MediaDeviceKind,
|
||||||
fallbackDevice: string | undefined,
|
setting: Setting<string | undefined>,
|
||||||
usingNames: boolean,
|
usingNames: boolean,
|
||||||
alwaysDefault: boolean = false,
|
alwaysDefault: boolean = false,
|
||||||
): MediaDevice {
|
): MediaDevice {
|
||||||
@@ -84,15 +85,21 @@ function useMediaDevice(
|
|||||||
[kind, requestPermissions],
|
[kind, requestPermissions],
|
||||||
);
|
);
|
||||||
const available = useObservableState(deviceObserver, []);
|
const available = useObservableState(deviceObserver, []);
|
||||||
const [selectedId, select] = useState(fallbackDevice);
|
const [preferredId, select] = useSetting(setting);
|
||||||
|
|
||||||
return useMemo(() => {
|
return useMemo(() => {
|
||||||
let devId;
|
let selectedId: string | undefined = undefined;
|
||||||
if (available) {
|
if (!alwaysDefault && available) {
|
||||||
devId = available.some((d) => d.deviceId === selectedId)
|
// If the preferred device is available, use it. Or if every available
|
||||||
? selectedId
|
// device ID is falsy, the browser is probably just being paranoid about
|
||||||
: available.some((d) => d.deviceId === fallbackDevice)
|
// fingerprinting and we should still try using the preferred device.
|
||||||
? fallbackDevice
|
// Worst case it is not available and the browser will gracefully fall
|
||||||
|
// back to some other device for us when requesting the media stream.
|
||||||
|
// Otherwise, select the first available device.
|
||||||
|
selectedId =
|
||||||
|
available.some((d) => d.deviceId === preferredId) ||
|
||||||
|
available.every((d) => d.deviceId === "")
|
||||||
|
? preferredId
|
||||||
: available.at(0)?.deviceId;
|
: available.at(0)?.deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,10 +109,10 @@ function useMediaDevice(
|
|||||||
// device entries for the exact same device ID; deduplicate them
|
// device entries for the exact same device ID; deduplicate them
|
||||||
[...new Map(available.map((d) => [d.deviceId, d])).values()]
|
[...new Map(available.map((d) => [d.deviceId, d])).values()]
|
||||||
: [],
|
: [],
|
||||||
selectedId: alwaysDefault ? undefined : devId,
|
selectedId,
|
||||||
select,
|
select,
|
||||||
};
|
};
|
||||||
}, [available, selectedId, fallbackDevice, select, alwaysDefault]);
|
}, [available, preferredId, select, alwaysDefault]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const deviceStub: MediaDevice = {
|
const deviceStub: MediaDevice = {
|
||||||
@@ -141,36 +148,22 @@ export const MediaDevicesProvider: FC<Props> = ({ children }) => {
|
|||||||
// for ouput devices because the selector wont be shown on FF.
|
// for ouput devices because the selector wont be shown on FF.
|
||||||
const useOutputNames = usingNames && !isFirefox();
|
const useOutputNames = usingNames && !isFirefox();
|
||||||
|
|
||||||
const [storedAudioInput, setStoredAudioInput] = useSetting(audioInputSetting);
|
const audioInput = useMediaDevice(
|
||||||
const [storedAudioOutput, setStoredAudioOutput] =
|
"audioinput",
|
||||||
useSetting(audioOutputSetting);
|
audioInputSetting,
|
||||||
const [storedVideoInput, setStoredVideoInput] = useSetting(videoInputSetting);
|
usingNames,
|
||||||
|
);
|
||||||
const audioInput = useMediaDevice("audioinput", storedAudioInput, usingNames);
|
|
||||||
const audioOutput = useMediaDevice(
|
const audioOutput = useMediaDevice(
|
||||||
"audiooutput",
|
"audiooutput",
|
||||||
storedAudioOutput,
|
audioOutputSetting,
|
||||||
useOutputNames,
|
useOutputNames,
|
||||||
alwaysUseDefaultAudio,
|
alwaysUseDefaultAudio,
|
||||||
);
|
);
|
||||||
const videoInput = useMediaDevice("videoinput", storedVideoInput, usingNames);
|
const videoInput = useMediaDevice(
|
||||||
|
"videoinput",
|
||||||
useEffect(() => {
|
videoInputSetting,
|
||||||
if (audioInput.selectedId !== undefined)
|
usingNames,
|
||||||
setStoredAudioInput(audioInput.selectedId);
|
);
|
||||||
}, [setStoredAudioInput, audioInput.selectedId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Skip setting state for ff output. Redundent since it is set to always return 'undefined'
|
|
||||||
// but makes it clear while debugging that this is not happening on FF. + perf ;)
|
|
||||||
if (audioOutput.selectedId !== undefined && !isFirefox())
|
|
||||||
setStoredAudioOutput(audioOutput.selectedId);
|
|
||||||
}, [setStoredAudioOutput, audioOutput.selectedId]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (videoInput.selectedId !== undefined)
|
|
||||||
setStoredVideoInput(videoInput.selectedId);
|
|
||||||
}, [setStoredVideoInput, videoInput.selectedId]);
|
|
||||||
|
|
||||||
const startUsingDeviceNames = useCallback(
|
const startUsingDeviceNames = useCallback(
|
||||||
() => setNumCallersUsingNames((n) => n + 1),
|
() => setNumCallersUsingNames((n) => n + 1),
|
||||||
|
|||||||
+13
-10
@@ -20,8 +20,6 @@ import {
|
|||||||
setLogExtension as setLKLogExtension,
|
setLogExtension as setLKLogExtension,
|
||||||
setLogLevel as setLKLogLevel,
|
setLogLevel as setLKLogLevel,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import "@formatjs/intl-segmenter/polyfill";
|
|
||||||
import "@formatjs/intl-durationformat/polyfill";
|
|
||||||
|
|
||||||
import { App } from "./App";
|
import { App } from "./App";
|
||||||
import { init as initRageshake } from "./settings/rageshake";
|
import { init as initRageshake } from "./settings/rageshake";
|
||||||
@@ -57,12 +55,17 @@ if (fatalError !== null) {
|
|||||||
throw fatalError; // Stop the app early
|
throw fatalError; // Stop the app early
|
||||||
}
|
}
|
||||||
|
|
||||||
Initializer.initBeforeReact();
|
Initializer.initBeforeReact()
|
||||||
|
.then(() => {
|
||||||
|
const history = createBrowserHistory();
|
||||||
|
|
||||||
const history = createBrowserHistory();
|
root.render(
|
||||||
|
<StrictMode>
|
||||||
root.render(
|
<App history={history} />
|
||||||
<StrictMode>
|
</StrictMode>,
|
||||||
<App history={history} />
|
);
|
||||||
</StrictMode>,
|
})
|
||||||
);
|
.catch((e) => {
|
||||||
|
logger.error("Failed to initialize app", e);
|
||||||
|
root.render(e.message);
|
||||||
|
});
|
||||||
|
|||||||
@@ -11,19 +11,12 @@ import {
|
|||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useState,
|
useState,
|
||||||
|
useMemo,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { DurationFormat } from "@formatjs/intl-durationformat";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import { ReactionIndicator } from "./ReactionIndicator";
|
import { ReactionIndicator } from "./ReactionIndicator";
|
||||||
|
|
||||||
const durationFormatter = new DurationFormat(undefined, {
|
|
||||||
minutesDisplay: "always",
|
|
||||||
secondsDisplay: "always",
|
|
||||||
hoursDisplay: "auto",
|
|
||||||
style: "digital",
|
|
||||||
});
|
|
||||||
|
|
||||||
export function RaisedHandIndicator({
|
export function RaisedHandIndicator({
|
||||||
raisedHandTime,
|
raisedHandTime,
|
||||||
miniature,
|
miniature,
|
||||||
@@ -38,6 +31,17 @@ export function RaisedHandIndicator({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [raisedHandDuration, setRaisedHandDuration] = useState("");
|
const [raisedHandDuration, setRaisedHandDuration] = useState("");
|
||||||
|
|
||||||
|
const durationFormatter = useMemo(
|
||||||
|
() =>
|
||||||
|
new Intl.DurationFormat(undefined, {
|
||||||
|
minutesDisplay: "always",
|
||||||
|
secondsDisplay: "always",
|
||||||
|
hoursDisplay: "auto",
|
||||||
|
style: "digital",
|
||||||
|
}),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
const clickCallback = useCallback<MouseEventHandler<HTMLButtonElement>>(
|
const clickCallback = useCallback<MouseEventHandler<HTMLButtonElement>>(
|
||||||
(event) => {
|
(event) => {
|
||||||
if (!onClick) {
|
if (!onClick) {
|
||||||
@@ -69,7 +73,7 @@ export function RaisedHandIndicator({
|
|||||||
calculateTime();
|
calculateTime();
|
||||||
const to = setInterval(calculateTime, 1000);
|
const to = setInterval(calculateTime, 1000);
|
||||||
return (): void => clearInterval(to);
|
return (): void => clearInterval(to);
|
||||||
}, [setRaisedHandDuration, raisedHandTime, showTimer]);
|
}, [setRaisedHandDuration, raisedHandTime, showTimer, durationFormatter]);
|
||||||
|
|
||||||
if (!raisedHandTime) {
|
if (!raisedHandTime) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
.reactionIndicatorWidget {
|
.reactionIndicatorWidget {
|
||||||
display: flex;
|
display: flex;
|
||||||
background-color: var(--cpd-color-bg-subtle-primary);
|
/* background-color: var(--cpd-color-bg-subtle-primary); */
|
||||||
border-radius: var(--cpd-radius-pill-effect);
|
border-radius: var(--cpd-radius-pill-effect);
|
||||||
color: var(--cpd-color-icon-secondary);
|
box-shadow: 0 0 var(--cpd-space-2x) #00000040;
|
||||||
|
background: "ffffff40";
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
outline: var(--cpd-border-width-1) solid var(--cpd-color-alpha-gray-400);
|
||||||
|
outline-offset: calc(-1 * var(--cpd-border-width-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionIndicatorWidget > p {
|
.reactionIndicatorWidget > p {
|
||||||
padding: none;
|
padding: none;
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
width: 4em;
|
width: 3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionIndicatorWidgetLarge > p {
|
.reactionIndicatorWidgetLarge > p {
|
||||||
padding: var(--cpd-space-2x);
|
padding: var(--cpd-space-2x);
|
||||||
|
padding-right: var(--cpd-space-4x);
|
||||||
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactionLarge {
|
.reactionLarge {
|
||||||
@@ -25,13 +31,13 @@
|
|||||||
.reaction {
|
.reaction {
|
||||||
margin: var(--cpd-space-1x);
|
margin: var(--cpd-space-1x);
|
||||||
color: var(--cpd-color-icon-secondary);
|
color: var(--cpd-color-icon-secondary);
|
||||||
background-color: var(--cpd-color-icon-secondary);
|
/* background-color: var(--cpd-color-icon-secondary); */
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: var(--cpd-radius-pill-effect);
|
border-radius: var(--cpd-radius-pill-effect);
|
||||||
user-select: none;
|
user-select: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: var(--small-drop-shadow);
|
/* box-shadow: var(--small-drop-shadow); */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-inline-size: 100%;
|
max-inline-size: 100%;
|
||||||
max-width: fit-content;
|
max-width: fit-content;
|
||||||
|
|||||||
@@ -73,7 +73,9 @@ export const GenericReaction: ReactionOption = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// The first 6 reactions are always visible.
|
export const ReactionsRowSize = 5;
|
||||||
|
|
||||||
|
// The first {ReactionsRowSize} reactions are always visible.
|
||||||
export const ReactionSet: ReactionOption[] = [
|
export const ReactionSet: ReactionOption[] = [
|
||||||
{
|
{
|
||||||
emoji: "👍",
|
emoji: "👍",
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2022-2024 New Vector Ltd.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
Please see LICENSE in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/client";
|
|
||||||
import { useTranslation } from "react-i18next";
|
|
||||||
import { MatrixError } from "matrix-js-sdk/src/matrix";
|
|
||||||
import { Heading, Text } from "@vector-im/compound-web";
|
|
||||||
|
|
||||||
import { Link } from "../button/Link";
|
|
||||||
import {
|
|
||||||
useLoadGroupCall,
|
|
||||||
GroupCallStatus,
|
|
||||||
CallTerminatedMessage,
|
|
||||||
} from "./useLoadGroupCall";
|
|
||||||
import { ErrorView, FullScreenView } from "../FullScreenView";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
client: MatrixClient;
|
|
||||||
roomIdOrAlias: string;
|
|
||||||
viaServers: string[];
|
|
||||||
children: (groupCallState: GroupCallStatus) => JSX.Element;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function GroupCallLoader({
|
|
||||||
client,
|
|
||||||
roomIdOrAlias,
|
|
||||||
viaServers,
|
|
||||||
children,
|
|
||||||
}: Props): JSX.Element {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const groupCallState = useLoadGroupCall(client, roomIdOrAlias, viaServers);
|
|
||||||
|
|
||||||
switch (groupCallState.kind) {
|
|
||||||
case "loaded":
|
|
||||||
case "waitForInvite":
|
|
||||||
case "canKnock":
|
|
||||||
return children(groupCallState);
|
|
||||||
case "loading":
|
|
||||||
return (
|
|
||||||
<FullScreenView>
|
|
||||||
<h1>{t("common.loading")}</h1>
|
|
||||||
</FullScreenView>
|
|
||||||
);
|
|
||||||
case "failed":
|
|
||||||
if ((groupCallState.error as MatrixError).errcode === "M_NOT_FOUND") {
|
|
||||||
return (
|
|
||||||
<FullScreenView>
|
|
||||||
<Heading>{t("group_call_loader.failed_heading")}</Heading>
|
|
||||||
<Text>{t("group_call_loader.failed_text")}</Text>
|
|
||||||
{/* XXX: A 'create it for me' button would be the obvious UX here. Two screens already have
|
|
||||||
dupes of this flow, let's make a common component and put it here. */}
|
|
||||||
<Link to="/">{t("common.home")}</Link>
|
|
||||||
</FullScreenView>
|
|
||||||
);
|
|
||||||
} else if (groupCallState.error instanceof CallTerminatedMessage) {
|
|
||||||
return (
|
|
||||||
<FullScreenView>
|
|
||||||
<Heading>{groupCallState.error.message}</Heading>
|
|
||||||
<Text>{groupCallState.error.messageBody}</Text>
|
|
||||||
{groupCallState.error.reason && (
|
|
||||||
<>
|
|
||||||
{t("group_call_loader.reason")}:
|
|
||||||
<Text size="sm">"{groupCallState.error.reason}"</Text>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<Link to="/">{t("common.home")}</Link>
|
|
||||||
</FullScreenView>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return <ErrorView error={groupCallState.error} />;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+31
-23
@@ -177,29 +177,37 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (widget && preload && skipLobby) {
|
if (skipLobby) {
|
||||||
// In preload mode without lobby we wait for a join action before entering
|
if (widget) {
|
||||||
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
if (preload) {
|
||||||
(async (): Promise<void> => {
|
// In preload mode without lobby we wait for a join action before entering
|
||||||
await defaultDeviceSetup(ev.detail.data as unknown as JoinCallData);
|
const onJoin = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
||||||
await enterRTCSession(rtcSession, perParticipantE2EE);
|
(async (): Promise<void> => {
|
||||||
widget!.api.transport.reply(ev.detail, {});
|
await defaultDeviceSetup(
|
||||||
})().catch((e) => {
|
ev.detail.data as unknown as JoinCallData,
|
||||||
logger.error("Error joining RTC session", e);
|
);
|
||||||
});
|
await enterRTCSession(rtcSession, perParticipantE2EE);
|
||||||
};
|
widget!.api.transport.reply(ev.detail, {});
|
||||||
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
})().catch((e) => {
|
||||||
return (): void => {
|
logger.error("Error joining RTC session", e);
|
||||||
widget!.lazyActions.off(ElementWidgetActions.JoinCall, onJoin);
|
});
|
||||||
};
|
};
|
||||||
} else if (widget && !preload && skipLobby) {
|
widget.lazyActions.on(ElementWidgetActions.JoinCall, onJoin);
|
||||||
// No lobby and no preload: we enter the rtc session right away
|
return (): void => {
|
||||||
(async (): Promise<void> => {
|
widget!.lazyActions.off(ElementWidgetActions.JoinCall, onJoin);
|
||||||
await defaultDeviceSetup({ audioInput: null, videoInput: null });
|
};
|
||||||
await enterRTCSession(rtcSession, perParticipantE2EE);
|
} else {
|
||||||
})().catch((e) => {
|
// No lobby and no preload: we enter the rtc session right away
|
||||||
logger.error("Error joining RTC session", e);
|
(async (): Promise<void> => {
|
||||||
});
|
await defaultDeviceSetup({ audioInput: null, videoInput: null });
|
||||||
|
await enterRTCSession(rtcSession, perParticipantE2EE);
|
||||||
|
})().catch((e) => {
|
||||||
|
logger.error("Error joining RTC session", e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
void enterRTCSession(rtcSession, perParticipantE2EE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [rtcSession, preload, skipLobby, perParticipantE2EE]);
|
}, [rtcSession, preload, skipLobby, perParticipantE2EE]);
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,8 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
onShareClick,
|
onShareClick,
|
||||||
}) => {
|
}) => {
|
||||||
const [soundEffectVolume] = useSetting(soundEffectVolumeSetting);
|
const [soundEffectVolume] = useSetting(soundEffectVolumeSetting);
|
||||||
const { supportsReactions, raisedHands } = useReactions();
|
const { supportsReactions, raisedHands, sendReaction, toggleRaisedHand } =
|
||||||
|
useReactions();
|
||||||
const raisedHandCount = useMemo(
|
const raisedHandCount = useMemo(
|
||||||
() => Object.keys(raisedHands).length,
|
() => Object.keys(raisedHands).length,
|
||||||
[raisedHands],
|
[raisedHands],
|
||||||
@@ -227,6 +228,8 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
toggleMicrophone,
|
toggleMicrophone,
|
||||||
toggleCamera,
|
toggleCamera,
|
||||||
(muted) => muteStates.audio.setEnabled?.(!muted),
|
(muted) => muteStates.audio.setEnabled?.(!muted),
|
||||||
|
(reaction) => void sendReaction(reaction),
|
||||||
|
() => void toggleRaisedHand(),
|
||||||
);
|
);
|
||||||
|
|
||||||
const windowMode = useObservableEagerState(vm.windowMode);
|
const windowMode = useObservableEagerState(vm.windowMode);
|
||||||
@@ -572,8 +575,7 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
<ReactionToggleButton
|
<ReactionToggleButton
|
||||||
key="raise_hand"
|
key="raise_hand"
|
||||||
className={styles.raiseHand}
|
className={styles.raiseHand}
|
||||||
client={client}
|
userId={client.getUserId()!}
|
||||||
rtcSession={rtcSession}
|
|
||||||
onTouchEnd={onControlsTouchEnd}
|
onTouchEnd={onControlsTouchEnd}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|||||||
+112
-87
@@ -5,15 +5,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { FC, useEffect, useState, useCallback, ReactNode } from "react";
|
import { FC, useEffect, useState, ReactNode, useRef } from "react";
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { CheckIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
import { CheckIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
|
import { MatrixError } from "matrix-js-sdk/src/http-api";
|
||||||
|
import { Heading, Text } from "@vector-im/compound-web";
|
||||||
|
|
||||||
import { useClientLegacy } from "../ClientContext";
|
import { useClientLegacy } from "../ClientContext";
|
||||||
import { ErrorView, LoadingView } from "../FullScreenView";
|
import { ErrorView, FullScreenView, LoadingView } from "../FullScreenView";
|
||||||
import { RoomAuthView } from "./RoomAuthView";
|
import { RoomAuthView } from "./RoomAuthView";
|
||||||
import { GroupCallLoader } from "./GroupCallLoader";
|
|
||||||
import { GroupCallView } from "./GroupCallView";
|
import { GroupCallView } from "./GroupCallView";
|
||||||
import { useRoomIdentifier, useUrlParams } from "../UrlParams";
|
import { useRoomIdentifier, useUrlParams } from "../UrlParams";
|
||||||
import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser";
|
import { useRegisterPasswordlessUser } from "../auth/useRegisterPasswordlessUser";
|
||||||
@@ -21,13 +22,14 @@ import { HomePage } from "../home/HomePage";
|
|||||||
import { platform } from "../Platform";
|
import { platform } from "../Platform";
|
||||||
import { AppSelectionModal } from "./AppSelectionModal";
|
import { AppSelectionModal } from "./AppSelectionModal";
|
||||||
import { widget } from "../widget";
|
import { widget } from "../widget";
|
||||||
import { GroupCallStatus } from "./useLoadGroupCall";
|
import { CallTerminatedMessage, useLoadGroupCall } from "./useLoadGroupCall";
|
||||||
import { LobbyView } from "./LobbyView";
|
import { LobbyView } from "./LobbyView";
|
||||||
import { E2eeType } from "../e2ee/e2eeType";
|
import { E2eeType } from "../e2ee/e2eeType";
|
||||||
import { useProfile } from "../profile/useProfile";
|
import { useProfile } from "../profile/useProfile";
|
||||||
import { useMuteStates } from "./MuteStates";
|
import { useMuteStates } from "./MuteStates";
|
||||||
import { useOptInAnalytics } from "../settings/settings";
|
import { useOptInAnalytics } from "../settings/settings";
|
||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
|
import { Link } from "../button/Link";
|
||||||
|
|
||||||
export const RoomPage: FC = () => {
|
export const RoomPage: FC = () => {
|
||||||
const {
|
const {
|
||||||
@@ -53,6 +55,7 @@ export const RoomPage: FC = () => {
|
|||||||
useClientLegacy();
|
useClientLegacy();
|
||||||
const { avatarUrl, displayName: userDisplayName } = useProfile(client);
|
const { avatarUrl, displayName: userDisplayName } = useProfile(client);
|
||||||
|
|
||||||
|
const groupCallState = useLoadGroupCall(client, roomIdOrAlias, viaServers);
|
||||||
const muteStates = useMuteStates();
|
const muteStates = useMuteStates();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -82,82 +85,112 @@ export const RoomPage: FC = () => {
|
|||||||
if (optInAnalytics === null && setOptInAnalytics) setOptInAnalytics(true);
|
if (optInAnalytics === null && setOptInAnalytics) setOptInAnalytics(true);
|
||||||
}, [optInAnalytics, setOptInAnalytics]);
|
}, [optInAnalytics, setOptInAnalytics]);
|
||||||
|
|
||||||
const groupCallView = useCallback(
|
const wasInWaitForInviteState = useRef<boolean>(false);
|
||||||
(groupCallState: GroupCallStatus): JSX.Element => {
|
|
||||||
switch (groupCallState.kind) {
|
useEffect(() => {
|
||||||
case "loaded":
|
if (groupCallState.kind === "loaded" && wasInWaitForInviteState.current) {
|
||||||
return (
|
logger.log("Play join sound 'Not yet implemented'");
|
||||||
<GroupCallView
|
}
|
||||||
client={client!}
|
}, [groupCallState.kind]);
|
||||||
rtcSession={groupCallState.rtcSession}
|
|
||||||
isPasswordlessUser={passwordlessUser}
|
const groupCallView = (): JSX.Element => {
|
||||||
confineToRoom={confineToRoom}
|
switch (groupCallState.kind) {
|
||||||
preload={preload}
|
case "loaded":
|
||||||
skipLobby={skipLobby}
|
return (
|
||||||
hideHeader={hideHeader}
|
<GroupCallView
|
||||||
muteStates={muteStates}
|
client={client!}
|
||||||
/>
|
rtcSession={groupCallState.rtcSession}
|
||||||
|
isPasswordlessUser={passwordlessUser}
|
||||||
|
confineToRoom={confineToRoom}
|
||||||
|
preload={preload}
|
||||||
|
skipLobby={skipLobby || wasInWaitForInviteState.current}
|
||||||
|
hideHeader={hideHeader}
|
||||||
|
muteStates={muteStates}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
case "waitForInvite":
|
||||||
|
case "canKnock": {
|
||||||
|
wasInWaitForInviteState.current =
|
||||||
|
wasInWaitForInviteState.current ||
|
||||||
|
groupCallState.kind === "waitForInvite";
|
||||||
|
const knock =
|
||||||
|
groupCallState.kind === "canKnock" ? groupCallState.knock : null;
|
||||||
|
const label: string | JSX.Element =
|
||||||
|
groupCallState.kind === "canKnock" ? (
|
||||||
|
t("lobby.ask_to_join")
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{t("lobby.waiting_for_invite")}
|
||||||
|
<CheckIcon />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
case "waitForInvite":
|
return (
|
||||||
case "canKnock": {
|
<LobbyView
|
||||||
const knock =
|
client={client!}
|
||||||
groupCallState.kind === "canKnock" ? groupCallState.knock : null;
|
matrixInfo={{
|
||||||
const label: string | JSX.Element =
|
userId: client!.getUserId() ?? "",
|
||||||
groupCallState.kind === "canKnock" ? (
|
displayName: userDisplayName ?? "",
|
||||||
t("lobby.ask_to_join")
|
avatarUrl: avatarUrl ?? "",
|
||||||
) : (
|
roomAlias: null,
|
||||||
<>
|
roomId: groupCallState.roomSummary.room_id,
|
||||||
{t("lobby.waiting_for_invite")}
|
roomName: groupCallState.roomSummary.name ?? "",
|
||||||
<CheckIcon />
|
roomAvatar: groupCallState.roomSummary.avatar_url ?? null,
|
||||||
</>
|
e2eeSystem: {
|
||||||
);
|
kind: groupCallState.roomSummary["im.nheko.summary.encryption"]
|
||||||
return (
|
? E2eeType.PER_PARTICIPANT
|
||||||
<LobbyView
|
: E2eeType.NONE,
|
||||||
client={client!}
|
},
|
||||||
matrixInfo={{
|
}}
|
||||||
userId: client!.getUserId() ?? "",
|
onEnter={(): void => knock?.()}
|
||||||
displayName: userDisplayName ?? "",
|
enterLabel={label}
|
||||||
avatarUrl: avatarUrl ?? "",
|
waitingForInvite={groupCallState.kind === "waitForInvite"}
|
||||||
roomAlias: null,
|
confineToRoom={confineToRoom}
|
||||||
roomId: groupCallState.roomSummary.room_id,
|
hideHeader={hideHeader}
|
||||||
roomName: groupCallState.roomSummary.name ?? "",
|
participantCount={null}
|
||||||
roomAvatar: groupCallState.roomSummary.avatar_url ?? null,
|
muteStates={muteStates}
|
||||||
e2eeSystem: {
|
onShareClick={null}
|
||||||
kind: groupCallState.roomSummary[
|
/>
|
||||||
"im.nheko.summary.encryption"
|
);
|
||||||
]
|
|
||||||
? E2eeType.PER_PARTICIPANT
|
|
||||||
: E2eeType.NONE,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
onEnter={(): void => knock?.()}
|
|
||||||
enterLabel={label}
|
|
||||||
waitingForInvite={groupCallState.kind === "waitForInvite"}
|
|
||||||
confineToRoom={confineToRoom}
|
|
||||||
hideHeader={hideHeader}
|
|
||||||
participantCount={null}
|
|
||||||
muteStates={muteStates}
|
|
||||||
onShareClick={null}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return <> </>;
|
|
||||||
}
|
}
|
||||||
},
|
case "loading":
|
||||||
[
|
return (
|
||||||
client,
|
<FullScreenView>
|
||||||
passwordlessUser,
|
<h1>{t("common.loading")}</h1>
|
||||||
confineToRoom,
|
</FullScreenView>
|
||||||
preload,
|
);
|
||||||
skipLobby,
|
case "failed":
|
||||||
hideHeader,
|
wasInWaitForInviteState.current = false;
|
||||||
muteStates,
|
if ((groupCallState.error as MatrixError).errcode === "M_NOT_FOUND") {
|
||||||
t,
|
return (
|
||||||
userDisplayName,
|
<FullScreenView>
|
||||||
avatarUrl,
|
<Heading>{t("group_call_loader.failed_heading")}</Heading>
|
||||||
],
|
<Text>{t("group_call_loader.failed_text")}</Text>
|
||||||
);
|
{/* XXX: A 'create it for me' button would be the obvious UX here. Two screens already have
|
||||||
|
dupes of this flow, let's make a common component and put it here. */}
|
||||||
|
<Link to="/">{t("common.home")}</Link>
|
||||||
|
</FullScreenView>
|
||||||
|
);
|
||||||
|
} else if (groupCallState.error instanceof CallTerminatedMessage) {
|
||||||
|
return (
|
||||||
|
<FullScreenView>
|
||||||
|
<Heading>{groupCallState.error.message}</Heading>
|
||||||
|
<Text>{groupCallState.error.messageBody}</Text>
|
||||||
|
{groupCallState.error.reason && (
|
||||||
|
<>
|
||||||
|
{t("group_call_loader.reason")}:
|
||||||
|
<Text size="sm">"{groupCallState.error.reason}"</Text>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
<Link to="/">{t("common.home")}</Link>
|
||||||
|
</FullScreenView>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return <ErrorView error={groupCallState.error} />;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return <> </>;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let content: ReactNode;
|
let content: ReactNode;
|
||||||
if (loading || isRegistering) {
|
if (loading || isRegistering) {
|
||||||
@@ -170,15 +203,7 @@ export const RoomPage: FC = () => {
|
|||||||
// TODO: This doesn't belong here, the app routes need to be reworked
|
// TODO: This doesn't belong here, the app routes need to be reworked
|
||||||
content = <HomePage />;
|
content = <HomePage />;
|
||||||
} else {
|
} else {
|
||||||
content = (
|
content = groupCallView();
|
||||||
<GroupCallLoader
|
|
||||||
client={client}
|
|
||||||
roomIdOrAlias={roomIdOrAlias}
|
|
||||||
viaServers={viaServers}
|
|
||||||
>
|
|
||||||
{groupCallView}
|
|
||||||
</GroupCallLoader>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ export class CallTerminatedMessage extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useLoadGroupCall = (
|
export const useLoadGroupCall = (
|
||||||
client: MatrixClient,
|
client: MatrixClient | undefined,
|
||||||
roomIdOrAlias: string,
|
roomIdOrAlias: string | null,
|
||||||
viaServers: string[],
|
viaServers: string[],
|
||||||
): GroupCallStatus => {
|
): GroupCallStatus => {
|
||||||
const [state, setState] = useState<GroupCallStatus>({ kind: "loading" });
|
const [state, setState] = useState<GroupCallStatus>({ kind: "loading" });
|
||||||
@@ -159,6 +159,9 @@ export const useLoadGroupCall = (
|
|||||||
?.getContent().reason;
|
?.getContent().reason;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!client || !roomIdOrAlias) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const getRoomByAlias = async (alias: string): Promise<Room> => {
|
const getRoomByAlias = async (alias: string): Promise<Room> => {
|
||||||
// We lowercase the localpart when we create the room, so we must lowercase
|
// We lowercase the localpart when we create the room, so we must lowercase
|
||||||
// it here too (we just do the whole alias). We can't do the same to room IDs
|
// it here too (we just do the whole alias). We can't do the same to room IDs
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
TrackEvent,
|
TrackEvent,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import { useObservable, useObservableEagerState } from "observable-hooks";
|
import { useObservable, useObservableEagerState } from "observable-hooks";
|
||||||
import { useEffect } from "react";
|
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
|
|
||||||
import { useMediaDevices } from "../livekit/MediaDevicesContext";
|
import { useMediaDevices } from "../livekit/MediaDevicesContext";
|
||||||
@@ -35,6 +34,7 @@ export function useSwitchCamera(
|
|||||||
video: Observable<LocalVideoTrack | null>,
|
video: Observable<LocalVideoTrack | null>,
|
||||||
): (() => void) | null {
|
): (() => void) | null {
|
||||||
const mediaDevices = useMediaDevices();
|
const mediaDevices = useMediaDevices();
|
||||||
|
const setVideoInput = useLatest(mediaDevices.videoInput.select);
|
||||||
|
|
||||||
// Produce an observable like the input 'video' observable, except make it
|
// Produce an observable like the input 'video' observable, except make it
|
||||||
// emit whenever the track is muted or the device changes
|
// emit whenever the track is muted or the device changes
|
||||||
@@ -75,6 +75,12 @@ export function useSwitchCamera(
|
|||||||
.restartTrack({
|
.restartTrack({
|
||||||
facingMode: facingMode === "user" ? "environment" : "user",
|
facingMode: facingMode === "user" ? "environment" : "user",
|
||||||
})
|
})
|
||||||
|
.then(() => {
|
||||||
|
// Inform the MediaDeviceContext which camera was chosen
|
||||||
|
const deviceId =
|
||||||
|
track.mediaStreamTrack.getSettings().deviceId;
|
||||||
|
if (deviceId !== undefined) setVideoInput.current(deviceId);
|
||||||
|
})
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
logger.error("Failed to switch camera", facingMode, e),
|
logger.error("Failed to switch camera", facingMode, e),
|
||||||
);
|
);
|
||||||
@@ -83,16 +89,5 @@ export function useSwitchCamera(
|
|||||||
[videoTrack],
|
[videoTrack],
|
||||||
);
|
);
|
||||||
|
|
||||||
const setVideoInput = useLatest(mediaDevices.videoInput.select);
|
|
||||||
useEffect(() => {
|
|
||||||
// Watch for device changes due to switching the camera and feed them back
|
|
||||||
// into the MediaDeviceContext
|
|
||||||
const subscription = videoTrack.subscribe((track) => {
|
|
||||||
const deviceId = track?.mediaStreamTrack.getSettings().deviceId;
|
|
||||||
if (deviceId !== undefined) setVideoInput.current(deviceId);
|
|
||||||
});
|
|
||||||
return (): void => subscription.unsubscribe();
|
|
||||||
}, [videoTrack, setVideoInput]);
|
|
||||||
|
|
||||||
return useObservableEagerState(switchCamera);
|
return useObservableEagerState(switchCamera);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,20 @@ const widgetPostHangupProcedure = async (
|
|||||||
// We send the hangup event after the memberships have been updated
|
// We send the hangup event after the memberships have been updated
|
||||||
// calling leaveRTCSession.
|
// calling leaveRTCSession.
|
||||||
// We need to wait because this makes the client hosting this widget killing the IFrame.
|
// We need to wait because this makes the client hosting this widget killing the IFrame.
|
||||||
await widget.api.transport.send(ElementWidgetActions.HangupCall, {});
|
try {
|
||||||
|
await widget.api.transport.send(ElementWidgetActions.HangupCall, {});
|
||||||
|
} catch (e) {
|
||||||
|
logger.error("Failed to send hangup action", e);
|
||||||
|
}
|
||||||
|
// To make the hangup procedure behave more similarly to what future versions
|
||||||
|
// of Element Call will do, we additionally send a close action (even though
|
||||||
|
// we're not yet employing the distinction between 'hangup' and 'close' to
|
||||||
|
// display error screens)
|
||||||
|
try {
|
||||||
|
await widget.api.transport.send(ElementWidgetActions.Close, {});
|
||||||
|
} catch (e) {
|
||||||
|
logger.error("Failed to send close action", e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function leaveRTCSession(
|
export async function leaveRTCSession(
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
.selection {
|
||||||
|
gap: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
color: var(--cpd-color-text-secondary);
|
||||||
|
margin-block: var(--cpd-space-3x) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.separator {
|
||||||
|
margin-block: 6px var(--cpd-space-4x);
|
||||||
|
}
|
||||||
|
|
||||||
|
.options {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--cpd-space-4x);
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ChangeEvent, FC, useCallback, useId } from "react";
|
||||||
|
import {
|
||||||
|
Heading,
|
||||||
|
InlineField,
|
||||||
|
Label,
|
||||||
|
RadioControl,
|
||||||
|
Separator,
|
||||||
|
} from "@vector-im/compound-web";
|
||||||
|
|
||||||
|
import { MediaDevice } from "../livekit/MediaDevicesContext";
|
||||||
|
import styles from "./DeviceSelection.module.css";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
devices: MediaDevice;
|
||||||
|
caption: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DeviceSelection: FC<Props> = ({ devices, caption }) => {
|
||||||
|
const groupId = useId();
|
||||||
|
const onChange = useCallback(
|
||||||
|
(e: ChangeEvent<HTMLInputElement>) => {
|
||||||
|
devices.select(e.target.value);
|
||||||
|
},
|
||||||
|
[devices],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (devices.available.length == 0) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={styles.selection}>
|
||||||
|
<Heading
|
||||||
|
type="body"
|
||||||
|
weight="semibold"
|
||||||
|
size="sm"
|
||||||
|
as="h4"
|
||||||
|
className={styles.title}
|
||||||
|
>
|
||||||
|
{caption}
|
||||||
|
</Heading>
|
||||||
|
<Separator className={styles.separator} />
|
||||||
|
<div className={styles.options}>
|
||||||
|
{devices.available.map(({ deviceId, label }, index) => (
|
||||||
|
<InlineField
|
||||||
|
key={deviceId}
|
||||||
|
name={groupId}
|
||||||
|
control={
|
||||||
|
<RadioControl
|
||||||
|
checked={deviceId === devices.selectedId}
|
||||||
|
onChange={onChange}
|
||||||
|
value={deviceId}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Label>
|
||||||
|
{!!label && label.trim().length > 0
|
||||||
|
? label
|
||||||
|
: `${caption} ${index + 1}`}
|
||||||
|
</Label>
|
||||||
|
</InlineField>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -8,7 +8,8 @@ Please see LICENSE in the repository root for full details.
|
|||||||
.content {
|
.content {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 350px;
|
max-width: 350px;
|
||||||
align-self: center;
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatarFieldRow {
|
.avatarFieldRow {
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { ChangeEvent, FC, ReactNode, useCallback } from "react";
|
import { ChangeEvent, FC, useCallback } from "react";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
import { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||||
import { Dropdown, Separator, Text } from "@vector-im/compound-web";
|
import { Root as Form, Text } from "@vector-im/compound-web";
|
||||||
|
|
||||||
import { Modal } from "../Modal";
|
import { Modal } from "../Modal";
|
||||||
import styles from "./SettingsModal.module.css";
|
import styles from "./SettingsModal.module.css";
|
||||||
@@ -19,7 +19,6 @@ import { ProfileSettingsTab } from "./ProfileSettingsTab";
|
|||||||
import { FeedbackSettingsTab } from "./FeedbackSettingsTab";
|
import { FeedbackSettingsTab } from "./FeedbackSettingsTab";
|
||||||
import {
|
import {
|
||||||
useMediaDevices,
|
useMediaDevices,
|
||||||
MediaDevice,
|
|
||||||
useMediaDeviceNames,
|
useMediaDeviceNames,
|
||||||
} from "../livekit/MediaDevicesContext";
|
} from "../livekit/MediaDevicesContext";
|
||||||
import { widget } from "../widget";
|
import { widget } from "../widget";
|
||||||
@@ -33,6 +32,7 @@ import {
|
|||||||
import { isFirefox } from "../Platform";
|
import { isFirefox } from "../Platform";
|
||||||
import { PreferencesSettingsTab } from "./PreferencesSettingsTab";
|
import { PreferencesSettingsTab } from "./PreferencesSettingsTab";
|
||||||
import { Slider } from "../Slider";
|
import { Slider } from "../Slider";
|
||||||
|
import { DeviceSelection } from "./DeviceSelection";
|
||||||
|
|
||||||
type SettingsTab =
|
type SettingsTab =
|
||||||
| "audio"
|
| "audio"
|
||||||
@@ -70,40 +70,6 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
);
|
);
|
||||||
const [duplicateTiles, setDuplicateTiles] = useSetting(duplicateTilesSetting);
|
const [duplicateTiles, setDuplicateTiles] = useSetting(duplicateTilesSetting);
|
||||||
|
|
||||||
// Generate a `SelectInput` with a list of devices for a given device kind.
|
|
||||||
const generateDeviceSelection = (
|
|
||||||
devices: MediaDevice,
|
|
||||||
caption: string,
|
|
||||||
): ReactNode => {
|
|
||||||
if (devices.available.length == 0) return null;
|
|
||||||
|
|
||||||
const values = devices.available.map(
|
|
||||||
({ deviceId, label }, index) =>
|
|
||||||
[
|
|
||||||
deviceId,
|
|
||||||
!!label && label.trim().length > 0
|
|
||||||
? label
|
|
||||||
: `${caption} ${index + 1}`,
|
|
||||||
] as [string, string],
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dropdown
|
|
||||||
label={caption}
|
|
||||||
defaultValue={
|
|
||||||
devices.selectedId === "" || !devices.selectedId
|
|
||||||
? "default"
|
|
||||||
: devices.selectedId
|
|
||||||
}
|
|
||||||
onValueChange={(id): void => devices.select(id)}
|
|
||||||
values={values}
|
|
||||||
// XXX This is unused because we set a defaultValue. The component
|
|
||||||
// shouldn't require this prop.
|
|
||||||
placeholder=""
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const optInDescription = (
|
const optInDescription = (
|
||||||
<Text size="sm">
|
<Text size="sm">
|
||||||
<Trans i18nKey="settings.opt_in_description">
|
<Trans i18nKey="settings.opt_in_description">
|
||||||
@@ -125,25 +91,30 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
name: t("common.audio"),
|
name: t("common.audio"),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
{generateDeviceSelection(devices.audioInput, t("common.microphone"))}
|
<Form>
|
||||||
{!isFirefox() &&
|
<DeviceSelection
|
||||||
generateDeviceSelection(
|
devices={devices.audioInput}
|
||||||
devices.audioOutput,
|
caption={t("common.microphone")}
|
||||||
t("settings.speaker_device_selection_label"),
|
|
||||||
)}
|
|
||||||
<Separator />
|
|
||||||
<div className={styles.volumeSlider}>
|
|
||||||
<label>{t("settings.audio_tab.effect_volume_label")}</label>
|
|
||||||
<p>{t("settings.audio_tab.effect_volume_description")}</p>
|
|
||||||
<Slider
|
|
||||||
label={t("video_tile.volume")}
|
|
||||||
value={soundVolume}
|
|
||||||
onValueChange={setSoundVolume}
|
|
||||||
min={0}
|
|
||||||
max={1}
|
|
||||||
step={0.01}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
{!isFirefox() && (
|
||||||
|
<DeviceSelection
|
||||||
|
devices={devices.audioOutput}
|
||||||
|
caption={t("settings.speaker_device_selection_label")}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className={styles.volumeSlider}>
|
||||||
|
<label>{t("settings.audio_tab.effect_volume_label")}</label>
|
||||||
|
<p>{t("settings.audio_tab.effect_volume_description")}</p>
|
||||||
|
<Slider
|
||||||
|
label={t("video_tile.volume")}
|
||||||
|
value={soundVolume}
|
||||||
|
onValueChange={setSoundVolume}
|
||||||
|
min={0}
|
||||||
|
max={1}
|
||||||
|
step={0.01}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Form>
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
@@ -151,7 +122,14 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
const videoTab: Tab<SettingsTab> = {
|
const videoTab: Tab<SettingsTab> = {
|
||||||
key: "video",
|
key: "video",
|
||||||
name: t("common.video"),
|
name: t("common.video"),
|
||||||
content: generateDeviceSelection(devices.videoInput, t("common.camera")),
|
content: (
|
||||||
|
<Form>
|
||||||
|
<DeviceSelection
|
||||||
|
devices={devices.videoInput}
|
||||||
|
caption={t("common.camera")}
|
||||||
|
/>
|
||||||
|
</Form>
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
const preferencesTab: Tab<SettingsTab> = {
|
const preferencesTab: Tab<SettingsTab> = {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
// purge on startup to prevent logs from accumulating.
|
// purge on startup to prevent logs from accumulating.
|
||||||
|
|
||||||
import EventEmitter from "events";
|
import EventEmitter from "events";
|
||||||
import { throttle } from "lodash";
|
import { throttle } from "lodash-es";
|
||||||
import { Logger, logger } from "matrix-js-sdk/src/logger";
|
import { Logger, logger } from "matrix-js-sdk/src/logger";
|
||||||
import { randomString } from "matrix-js-sdk/src/randomstring";
|
import { randomString } from "matrix-js-sdk/src/randomstring";
|
||||||
import loglevel, { LoggingMethod } from "loglevel";
|
import loglevel, { LoggingMethod } from "loglevel";
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export const playReactionsSound = new Setting<boolean>(
|
|||||||
|
|
||||||
export const soundEffectVolumeSetting = new Setting<number>(
|
export const soundEffectVolumeSetting = new Setting<number>(
|
||||||
"sound-effect-volume",
|
"sound-effect-volume",
|
||||||
1,
|
0.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
export const alwaysShowSelf = new Setting<boolean>("always-show-self", true);
|
export const alwaysShowSelf = new Setting<boolean>("always-show-self", true);
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { ComponentProps, useCallback, useEffect, useState } from "react";
|
import { ComponentProps, useCallback, useEffect, useState } from "react";
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
||||||
// @ts-ignore
|
|
||||||
import pako from "pako";
|
|
||||||
import { logger } from "matrix-js-sdk/src/logger";
|
import { logger } from "matrix-js-sdk/src/logger";
|
||||||
import {
|
import {
|
||||||
ClientEvent,
|
ClientEvent,
|
||||||
@@ -23,11 +20,14 @@ import { Config } from "../config/Config";
|
|||||||
import { ElementCallOpenTelemetry } from "../otel/otel";
|
import { ElementCallOpenTelemetry } from "../otel/otel";
|
||||||
import { RageshakeRequestModal } from "../room/RageshakeRequestModal";
|
import { RageshakeRequestModal } from "../room/RageshakeRequestModal";
|
||||||
|
|
||||||
const gzip = (text: string): Blob => {
|
const gzip = async (text: string): Promise<Blob> => {
|
||||||
|
// pako is relatively large (200KB), so we only import it when needed
|
||||||
|
const { gzip: pakoGzip } = await import("pako");
|
||||||
|
|
||||||
// encode as UTF-8
|
// encode as UTF-8
|
||||||
const buf = new TextEncoder().encode(text);
|
const buf = new TextEncoder().encode(text);
|
||||||
// compress
|
// compress
|
||||||
return new Blob([pako.gzip(buf)]);
|
return new Blob([pakoGzip(buf)]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,12 +253,14 @@ export function useSubmitRageshake(): {
|
|||||||
const logs = await getLogsForReport();
|
const logs = await getLogsForReport();
|
||||||
|
|
||||||
for (const entry of logs) {
|
for (const entry of logs) {
|
||||||
body.append("compressed-log", gzip(entry.lines), entry.id);
|
body.append("compressed-log", await gzip(entry.lines), entry.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
body.append(
|
body.append(
|
||||||
"file",
|
"file",
|
||||||
gzip(ElementCallOpenTelemetry.instance.rageshakeProcessor!.dump()),
|
await gzip(
|
||||||
|
ElementCallOpenTelemetry.instance.rageshakeProcessor!.dump(),
|
||||||
|
),
|
||||||
"traces.json.gz",
|
"traces.json.gz",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+194
-165
@@ -20,17 +20,18 @@ import {
|
|||||||
ConnectionState,
|
ConnectionState,
|
||||||
LocalParticipant,
|
LocalParticipant,
|
||||||
Participant,
|
Participant,
|
||||||
|
ParticipantEvent,
|
||||||
RemoteParticipant,
|
RemoteParticipant,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import * as ComponentsCore from "@livekit/components-core";
|
import * as ComponentsCore from "@livekit/components-core";
|
||||||
import { isEqual } from "lodash";
|
import { isEqual } from "lodash-es";
|
||||||
|
|
||||||
import { CallViewModel, Layout } from "./CallViewModel";
|
import { CallViewModel, Layout } from "./CallViewModel";
|
||||||
import {
|
import {
|
||||||
mockLivekitRoom,
|
mockLivekitRoom,
|
||||||
mockLocalParticipant,
|
mockLocalParticipant,
|
||||||
mockMatrixRoom,
|
mockMatrixRoom,
|
||||||
mockMember,
|
mockMatrixRoomMember,
|
||||||
mockRemoteParticipant,
|
mockRemoteParticipant,
|
||||||
withTestScheduler,
|
withTestScheduler,
|
||||||
} from "../utils/test";
|
} from "../utils/test";
|
||||||
@@ -42,10 +43,10 @@ import { E2eeType } from "../e2ee/e2eeType";
|
|||||||
|
|
||||||
vi.mock("@livekit/components-core");
|
vi.mock("@livekit/components-core");
|
||||||
|
|
||||||
const alice = mockMember({ userId: "@alice:example.org" });
|
const alice = mockMatrixRoomMember({ userId: "@alice:example.org" });
|
||||||
const bob = mockMember({ userId: "@bob:example.org" });
|
const bob = mockMatrixRoomMember({ userId: "@bob:example.org" });
|
||||||
const carol = mockMember({ userId: "@carol:example.org" });
|
const carol = mockMatrixRoomMember({ userId: "@carol:example.org" });
|
||||||
const dave = mockMember({ userId: "@dave:example.org" });
|
const dave = mockMatrixRoomMember({ userId: "@dave:example.org" });
|
||||||
|
|
||||||
const aliceId = `${alice.userId}:AAAA`;
|
const aliceId = `${alice.userId}:AAAA`;
|
||||||
const bobId = `${bob.userId}:BBBB`;
|
const bobId = `${bob.userId}:BBBB`;
|
||||||
@@ -188,11 +189,15 @@ function withCallViewModel(
|
|||||||
);
|
);
|
||||||
const eventsSpy = vi
|
const eventsSpy = vi
|
||||||
.spyOn(ComponentsCore, "observeParticipantEvents")
|
.spyOn(ComponentsCore, "observeParticipantEvents")
|
||||||
.mockImplementation((p) =>
|
.mockImplementation((p, ...eventTypes) => {
|
||||||
(speaking.get(p) ?? of(false)).pipe(
|
if (eventTypes.includes(ParticipantEvent.IsSpeakingChanged)) {
|
||||||
map((s) => ({ ...p, isSpeaking: s }) as Participant),
|
return (speaking.get(p) ?? of(false)).pipe(
|
||||||
),
|
map((s) => ({ ...p, isSpeaking: s }) as Participant),
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return of(p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const roomEventSelectorSpy = vi
|
const roomEventSelectorSpy = vi
|
||||||
.spyOn(ComponentsCore, "roomEventSelector")
|
.spyOn(ComponentsCore, "roomEventSelector")
|
||||||
@@ -229,52 +234,55 @@ function withCallViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
test("participants are retained during a focus switch", () => {
|
test("participants are retained during a focus switch", () => {
|
||||||
withTestScheduler(({ cold, expectObservable }) => {
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
// Participants disappear on frame 2 and come back on frame 3
|
// Participants disappear on frame 2 and come back on frame 3
|
||||||
const participantMarbles = "a-ba";
|
const participantInputMarbles = "a-ba";
|
||||||
// Start switching focus on frame 1 and reconnect on frame 3
|
// Start switching focus on frame 1 and reconnect on frame 3
|
||||||
const connectionMarbles = " cs-c";
|
const connectionInputMarbles = " cs-c";
|
||||||
// The visible participants should remain the same throughout the switch
|
// The visible participants should remain the same throughout the switch
|
||||||
const layoutMarbles = " a";
|
const expectedLayoutMarbles = " a";
|
||||||
|
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
cold(participantMarbles, {
|
hot(participantInputMarbles, {
|
||||||
a: [aliceParticipant, bobParticipant],
|
a: [aliceParticipant, bobParticipant],
|
||||||
b: [],
|
b: [],
|
||||||
}),
|
}),
|
||||||
cold(connectionMarbles, {
|
hot(connectionInputMarbles, {
|
||||||
c: ConnectionState.Connected,
|
c: ConnectionState.Connected,
|
||||||
s: ECAddonConnectionState.ECSwitchingFocus,
|
s: ECAddonConnectionState.ECSwitchingFocus,
|
||||||
}),
|
}),
|
||||||
new Map(),
|
new Map(),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "grid",
|
{
|
||||||
spotlight: undefined,
|
a: {
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("screen sharing activates spotlight layout", () => {
|
test("screen sharing activates spotlight layout", () => {
|
||||||
withTestScheduler(({ cold, schedule, expectObservable }) => {
|
withTestScheduler(({ hot, schedule, expectObservable }) => {
|
||||||
// Start with no screen shares, then have Alice and Bob share their screens,
|
// Start with no screen shares, then have Alice and Bob share their screens,
|
||||||
// then return to no screen shares, then have just Alice share for a bit
|
// then return to no screen shares, then have just Alice share for a bit
|
||||||
const participantMarbles = " abcda-ba";
|
const participantInputMarbles = " abcda-ba";
|
||||||
// While there are no screen shares, switch to spotlight manually, and then
|
// While there are no screen shares, switch to spotlight manually, and then
|
||||||
// switch back to grid at the end
|
// switch back to grid at the end
|
||||||
const modeMarbles = " -----s--g";
|
const modeInputMarbles = " -----s--g";
|
||||||
// We should automatically enter spotlight for the first round of screen
|
// We should automatically enter spotlight for the first round of screen
|
||||||
// sharing, then return to grid, then manually go into spotlight, and
|
// sharing, then return to grid, then manually go into spotlight, and
|
||||||
// remain in spotlight until we manually go back to grid
|
// remain in spotlight until we manually go back to grid
|
||||||
const layoutMarbles = " abcdaefeg";
|
const expectedLayoutMarbles = " abcdaefeg";
|
||||||
const showSpeakingMarbles = "y----nyny";
|
const expectedShowSpeakingMarbles = "y----nyny";
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
cold(participantMarbles, {
|
hot(participantInputMarbles, {
|
||||||
a: [aliceParticipant, bobParticipant],
|
a: [aliceParticipant, bobParticipant],
|
||||||
b: [aliceSharingScreen, bobParticipant],
|
b: [aliceSharingScreen, bobParticipant],
|
||||||
c: [aliceSharingScreen, bobSharingScreen],
|
c: [aliceSharingScreen, bobSharingScreen],
|
||||||
@@ -283,80 +291,89 @@ test("screen sharing activates spotlight layout", () => {
|
|||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.setGridMode("spotlight"),
|
||||||
g: () => vm.setGridMode("grid"),
|
g: () => vm.setGridMode("grid"),
|
||||||
});
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "grid",
|
{
|
||||||
spotlight: undefined,
|
a: {
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0:screen-share`],
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [
|
||||||
|
`${aliceId}:0:screen-share`,
|
||||||
|
`${bobId}:0:screen-share`,
|
||||||
|
],
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
d: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${bobId}:0:screen-share`],
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
e: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
grid: ["local:0", `${bobId}:0`],
|
||||||
|
},
|
||||||
|
f: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0:screen-share`],
|
||||||
|
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
||||||
|
},
|
||||||
|
g: {
|
||||||
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
b: {
|
);
|
||||||
type: "spotlight-landscape",
|
expectObservable(vm.showSpeakingIndicators).toBe(
|
||||||
spotlight: [`${aliceId}:0:screen-share`],
|
expectedShowSpeakingMarbles,
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
{
|
||||||
|
y: true,
|
||||||
|
n: false,
|
||||||
},
|
},
|
||||||
c: {
|
);
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${aliceId}:0:screen-share`, `${bobId}:0:screen-share`],
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
d: {
|
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${bobId}:0:screen-share`],
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
e: {
|
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${aliceId}:0`],
|
|
||||||
grid: ["local:0", `${bobId}:0`],
|
|
||||||
},
|
|
||||||
f: {
|
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${aliceId}:0:screen-share`],
|
|
||||||
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
|
||||||
},
|
|
||||||
g: {
|
|
||||||
type: "grid",
|
|
||||||
spotlight: undefined,
|
|
||||||
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expectObservable(vm.showSpeakingIndicators).toBe(showSpeakingMarbles, {
|
|
||||||
y: true,
|
|
||||||
n: false,
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("participants stay in the same order unless to appear/disappear", () => {
|
test("participants stay in the same order unless to appear/disappear", () => {
|
||||||
withTestScheduler(({ cold, schedule, expectObservable }) => {
|
withTestScheduler(({ hot, schedule, expectObservable }) => {
|
||||||
const modeMarbles = "a";
|
const modeInputMarbles = " a";
|
||||||
// First Bob speaks, then Dave, then Alice
|
// First Bob speaks, then Dave, then Alice
|
||||||
const aSpeakingMarbles = "n- 1998ms - 1999ms y";
|
const aSpeakingInputMarbles = "n- 1998ms - 1999ms y";
|
||||||
const bSpeakingMarbles = "ny 1998ms n 1999ms ";
|
const bSpeakingInputMarbles = "ny 1998ms n 1999ms ";
|
||||||
const dSpeakingMarbles = "n- 1998ms y 1999ms n";
|
const dSpeakingInputMarbles = "n- 1998ms y 1999ms n";
|
||||||
// Nothing should change when Bob speaks, because Bob is already on screen.
|
// Nothing should change when Bob speaks, because Bob is already on screen.
|
||||||
// When Dave speaks he should switch with Alice because she's the one who
|
// When Dave speaks he should switch with Alice because she's the one who
|
||||||
// hasn't spoken at all. Then when Alice speaks, she should return to her
|
// hasn't spoken at all. Then when Alice speaks, she should return to her
|
||||||
// place at the top.
|
// place at the top.
|
||||||
const layoutMarbles = " a 1999ms b 1999ms a 57999ms c 1999ms a";
|
const expectedLayoutMarbles = "a 1999ms b 1999ms a 57999ms c 1999ms a";
|
||||||
|
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
of([aliceParticipant, bobParticipant, daveParticipant]),
|
of([aliceParticipant, bobParticipant, daveParticipant]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map([
|
new Map([
|
||||||
[aliceParticipant, cold(aSpeakingMarbles, { y: true, n: false })],
|
[aliceParticipant, hot(aSpeakingInputMarbles, { y: true, n: false })],
|
||||||
[bobParticipant, cold(bSpeakingMarbles, { y: true, n: false })],
|
[bobParticipant, hot(bSpeakingInputMarbles, { y: true, n: false })],
|
||||||
[daveParticipant, cold(dSpeakingMarbles, { y: true, n: false })],
|
[daveParticipant, hot(dSpeakingInputMarbles, { y: true, n: false })],
|
||||||
]),
|
]),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
a: () => {
|
a: () => {
|
||||||
// We imagine that only three tiles (the first three) will be visible
|
// We imagine that only three tiles (the first three) will be visible
|
||||||
// on screen at a time
|
// on screen at a time
|
||||||
@@ -369,75 +386,81 @@ test("participants stay in the same order unless to appear/disappear", () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "grid",
|
{
|
||||||
spotlight: undefined,
|
a: {
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`],
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`, `${daveId}:0`],
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`],
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
b: {
|
);
|
||||||
type: "grid",
|
|
||||||
spotlight: undefined,
|
|
||||||
grid: ["local:0", `${daveId}:0`, `${bobId}:0`, `${aliceId}:0`],
|
|
||||||
},
|
|
||||||
c: {
|
|
||||||
type: "grid",
|
|
||||||
spotlight: undefined,
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("spotlight speakers swap places", () => {
|
test("spotlight speakers swap places", () => {
|
||||||
withTestScheduler(({ cold, schedule, expectObservable }) => {
|
withTestScheduler(({ hot, schedule, expectObservable }) => {
|
||||||
// Go immediately into spotlight mode for the test
|
// Go immediately into spotlight mode for the test
|
||||||
const modeMarbles = " s";
|
const modeInputMarbles = " s";
|
||||||
// First Bob speaks, then Dave, then Alice
|
// First Bob speaks, then Dave, then Alice
|
||||||
const aSpeakingMarbles = "n--y";
|
const aSpeakingInputMarbles = "n--y";
|
||||||
const bSpeakingMarbles = "nyn";
|
const bSpeakingInputMarbles = "nyn";
|
||||||
const dSpeakingMarbles = "n-yn";
|
const dSpeakingInputMarbles = "n-yn";
|
||||||
// Alice should start in the spotlight, then Bob, then Dave, then Alice
|
// Alice should start in the spotlight, then Bob, then Dave, then Alice
|
||||||
// again. However, the positions of Dave and Bob in the grid should be
|
// again. However, the positions of Dave and Bob in the grid should be
|
||||||
// reversed by the end because they've been swapped in and out of the
|
// reversed by the end because they've been swapped in and out of the
|
||||||
// spotlight.
|
// spotlight.
|
||||||
const layoutMarbles = " abcd";
|
const expectedLayoutMarbles = "abcd";
|
||||||
|
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
of([aliceParticipant, bobParticipant, daveParticipant]),
|
of([aliceParticipant, bobParticipant, daveParticipant]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map([
|
new Map([
|
||||||
[aliceParticipant, cold(aSpeakingMarbles, { y: true, n: false })],
|
[aliceParticipant, hot(aSpeakingInputMarbles, { y: true, n: false })],
|
||||||
[bobParticipant, cold(bSpeakingMarbles, { y: true, n: false })],
|
[bobParticipant, hot(bSpeakingInputMarbles, { y: true, n: false })],
|
||||||
[daveParticipant, cold(dSpeakingMarbles, { y: true, n: false })],
|
[daveParticipant, hot(dSpeakingInputMarbles, { y: true, n: false })],
|
||||||
]),
|
]),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeMarbles, { s: () => vm.setGridMode("spotlight") });
|
schedule(modeInputMarbles, { s: () => vm.setGridMode("spotlight") });
|
||||||
|
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "spotlight-landscape",
|
{
|
||||||
spotlight: [`${aliceId}:0`],
|
a: {
|
||||||
grid: ["local:0", `${bobId}:0`, `${daveId}:0`],
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
grid: ["local:0", `${bobId}:0`, `${daveId}:0`],
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${bobId}:0`],
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`],
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${daveId}:0`],
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
d: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
grid: ["local:0", `${daveId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
b: {
|
);
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${bobId}:0`],
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${daveId}:0`],
|
|
||||||
},
|
|
||||||
c: {
|
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${daveId}:0`],
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
d: {
|
|
||||||
type: "spotlight-landscape",
|
|
||||||
spotlight: [`${aliceId}:0`],
|
|
||||||
grid: ["local:0", `${daveId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -446,31 +469,34 @@ test("spotlight speakers swap places", () => {
|
|||||||
test("layout enters picture-in-picture mode when requested", () => {
|
test("layout enters picture-in-picture mode when requested", () => {
|
||||||
withTestScheduler(({ schedule, expectObservable }) => {
|
withTestScheduler(({ schedule, expectObservable }) => {
|
||||||
// Enable then disable picture-in-picture
|
// Enable then disable picture-in-picture
|
||||||
const pipControlMarbles = "-ed";
|
const pipControlInputMarbles = "-ed";
|
||||||
// Should go into picture-in-picture layout then back to grid
|
// Should go into picture-in-picture layout then back to grid
|
||||||
const layoutMarbles = " aba";
|
const expectedLayoutMarbles = " aba";
|
||||||
|
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
of([aliceParticipant, bobParticipant]),
|
of([aliceParticipant, bobParticipant]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(pipControlMarbles, {
|
schedule(pipControlInputMarbles, {
|
||||||
e: () => window.controls.enablePip(),
|
e: () => window.controls.enablePip(),
|
||||||
d: () => window.controls.disablePip(),
|
d: () => window.controls.disablePip(),
|
||||||
});
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "grid",
|
{
|
||||||
spotlight: undefined,
|
a: {
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "pip",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
b: {
|
);
|
||||||
type: "pip",
|
|
||||||
spotlight: [`${aliceId}:0`],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -480,23 +506,23 @@ test("spotlight remembers whether it's expanded", () => {
|
|||||||
withTestScheduler(({ schedule, expectObservable }) => {
|
withTestScheduler(({ schedule, expectObservable }) => {
|
||||||
// Start in spotlight mode, then switch to grid and back to spotlight a
|
// Start in spotlight mode, then switch to grid and back to spotlight a
|
||||||
// couple times
|
// couple times
|
||||||
const modeMarbles = " s-gs-gs";
|
const modeInputMarbles = " s-gs-gs";
|
||||||
// Expand and collapse the spotlight
|
// Expand and collapse the spotlight
|
||||||
const expandMarbles = "-a--a";
|
const expandInputMarbles = " -a--a";
|
||||||
// Spotlight should stay expanded during the first mode switch, and stay
|
// Spotlight should stay expanded during the first mode switch, and stay
|
||||||
// collapsed during the second mode switch
|
// collapsed during the second mode switch
|
||||||
const layoutMarbles = "abcbada";
|
const expectedLayoutMarbles = "abcbada";
|
||||||
|
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
of([aliceParticipant, bobParticipant]),
|
of([aliceParticipant, bobParticipant]),
|
||||||
of(ConnectionState.Connected),
|
of(ConnectionState.Connected),
|
||||||
new Map(),
|
new Map(),
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.setGridMode("spotlight"),
|
||||||
g: () => vm.setGridMode("grid"),
|
g: () => vm.setGridMode("grid"),
|
||||||
});
|
});
|
||||||
schedule(expandMarbles, {
|
schedule(expandInputMarbles, {
|
||||||
a: () => {
|
a: () => {
|
||||||
let toggle: () => void;
|
let toggle: () => void;
|
||||||
vm.toggleSpotlightExpanded.subscribe((val) => (toggle = val!));
|
vm.toggleSpotlightExpanded.subscribe((val) => (toggle = val!));
|
||||||
@@ -504,28 +530,31 @@ test("spotlight remembers whether it's expanded", () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout(vm.layout)).toBe(layoutMarbles, {
|
expectObservable(summarizeLayout(vm.layout)).toBe(
|
||||||
a: {
|
expectedLayoutMarbles,
|
||||||
type: "spotlight-landscape",
|
{
|
||||||
spotlight: [`${aliceId}:0`],
|
a: {
|
||||||
grid: ["local:0", `${bobId}:0`],
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
grid: ["local:0", `${bobId}:0`],
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "spotlight-expanded",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
pip: "local:0",
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
d: {
|
||||||
|
type: "grid",
|
||||||
|
spotlight: undefined,
|
||||||
|
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
b: {
|
);
|
||||||
type: "spotlight-expanded",
|
|
||||||
spotlight: [`${aliceId}:0`],
|
|
||||||
pip: "local:0",
|
|
||||||
},
|
|
||||||
c: {
|
|
||||||
type: "grid",
|
|
||||||
spotlight: undefined,
|
|
||||||
grid: ["local:0", `${aliceId}:0`, `${bobId}:0`],
|
|
||||||
},
|
|
||||||
d: {
|
|
||||||
type: "grid",
|
|
||||||
spotlight: undefined,
|
|
||||||
grid: ["local:0", `${bobId}:0`, `${aliceId}:0`],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
+44
-45
@@ -27,7 +27,6 @@ import {
|
|||||||
EMPTY,
|
EMPTY,
|
||||||
Observable,
|
Observable,
|
||||||
Subject,
|
Subject,
|
||||||
audit,
|
|
||||||
combineLatest,
|
combineLatest,
|
||||||
concat,
|
concat,
|
||||||
distinctUntilChanged,
|
distinctUntilChanged,
|
||||||
@@ -76,6 +75,7 @@ import { spotlightExpandedLayout } from "./SpotlightExpandedLayout";
|
|||||||
import { oneOnOneLayout } from "./OneOnOneLayout";
|
import { oneOnOneLayout } from "./OneOnOneLayout";
|
||||||
import { pipLayout } from "./PipLayout";
|
import { pipLayout } from "./PipLayout";
|
||||||
import { EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
import { EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
||||||
|
import { observeSpeaker } from "./observeSpeaker";
|
||||||
|
|
||||||
// How long we wait after a focus switch before showing the real participant
|
// How long we wait after a focus switch before showing the real participant
|
||||||
// list again
|
// list again
|
||||||
@@ -248,23 +248,7 @@ class UserMedia {
|
|||||||
livekitRoom,
|
livekitRoom,
|
||||||
);
|
);
|
||||||
|
|
||||||
this.speaker = this.vm.speaking.pipe(
|
this.speaker = observeSpeaker(this.vm.speaking).pipe(this.scope.state());
|
||||||
// Require 1 s of continuous speaking to become a speaker, and 60 s of
|
|
||||||
// continuous silence to stop being considered a speaker
|
|
||||||
audit((s) =>
|
|
||||||
merge(
|
|
||||||
timer(s ? 1000 : 60000),
|
|
||||||
// If the speaking flag resets to its original value during this time,
|
|
||||||
// end the silencing window to stick with that original value
|
|
||||||
this.vm.speaking.pipe(filter((s1) => s1 !== s)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
startWith(false),
|
|
||||||
distinctUntilChanged(),
|
|
||||||
// Make this Observable hot so that the timers don't reset when you
|
|
||||||
// resubscribe
|
|
||||||
this.scope.state(),
|
|
||||||
);
|
|
||||||
|
|
||||||
this.presenter = observeParticipantEvents(
|
this.presenter = observeParticipantEvents(
|
||||||
participant,
|
participant,
|
||||||
@@ -307,7 +291,7 @@ class ScreenShare {
|
|||||||
|
|
||||||
type MediaItem = UserMedia | ScreenShare;
|
type MediaItem = UserMedia | ScreenShare;
|
||||||
|
|
||||||
function findMatrixMember(
|
function findMatrixRoomMember(
|
||||||
room: MatrixRoom,
|
room: MatrixRoom,
|
||||||
id: string,
|
id: string,
|
||||||
): RoomMember | undefined {
|
): RoomMember | undefined {
|
||||||
@@ -342,12 +326,16 @@ export class CallViewModel extends ViewModel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly rawRemoteParticipants = connectedParticipantsObserver(
|
/**
|
||||||
this.livekitRoom,
|
* The raw list of RemoteParticipants as reported by LiveKit
|
||||||
).pipe(this.scope.state());
|
*/
|
||||||
|
private readonly rawRemoteParticipants: Observable<RemoteParticipant[]> =
|
||||||
|
connectedParticipantsObserver(this.livekitRoom).pipe(this.scope.state());
|
||||||
|
|
||||||
// Lists of participants to "hold" on display, even if LiveKit claims that
|
/**
|
||||||
// they've left
|
* Lists of RemoteParticipants to "hold" on display, even if LiveKit claims that
|
||||||
|
* they've left
|
||||||
|
*/
|
||||||
private readonly remoteParticipantHolds: Observable<RemoteParticipant[][]> =
|
private readonly remoteParticipantHolds: Observable<RemoteParticipant[][]> =
|
||||||
this.connectionState.pipe(
|
this.connectionState.pipe(
|
||||||
withLatestFrom(this.rawRemoteParticipants),
|
withLatestFrom(this.rawRemoteParticipants),
|
||||||
@@ -382,6 +370,9 @@ export class CallViewModel extends ViewModel {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The RemoteParticipants including those that are being "held" on the screen
|
||||||
|
*/
|
||||||
private readonly remoteParticipants: Observable<RemoteParticipant[]> =
|
private readonly remoteParticipants: Observable<RemoteParticipant[]> =
|
||||||
combineLatest(
|
combineLatest(
|
||||||
[this.rawRemoteParticipants, this.remoteParticipantHolds],
|
[this.rawRemoteParticipants, this.remoteParticipantHolds],
|
||||||
@@ -403,6 +394,9 @@ export class CallViewModel extends ViewModel {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of MediaItems that we want to display
|
||||||
|
*/
|
||||||
private readonly mediaItems: Observable<MediaItem[]> = combineLatest([
|
private readonly mediaItems: Observable<MediaItem[]> = combineLatest([
|
||||||
this.remoteParticipants,
|
this.remoteParticipants,
|
||||||
observeParticipantMedia(this.livekitRoom.localParticipant),
|
observeParticipantMedia(this.livekitRoom.localParticipant),
|
||||||
@@ -419,7 +413,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
function* (this: CallViewModel): Iterable<[string, MediaItem]> {
|
||||||
for (const p of [localParticipant, ...remoteParticipants]) {
|
for (const p of [localParticipant, ...remoteParticipants]) {
|
||||||
const id = p === localParticipant ? "local" : p.identity;
|
const id = p === localParticipant ? "local" : p.identity;
|
||||||
const member = findMatrixMember(this.matrixRoom, id);
|
const member = findMatrixRoomMember(this.matrixRoom, id);
|
||||||
if (member === undefined)
|
if (member === undefined)
|
||||||
logger.warn(
|
logger.warn(
|
||||||
`Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`,
|
`Ruh, roh! No matrix member found for SFU participant '${p.identity}': creating g-g-g-ghost!`,
|
||||||
@@ -472,6 +466,9 @@ export class CallViewModel extends ViewModel {
|
|||||||
this.scope.state(),
|
this.scope.state(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of MediaItems that we want to display, that are of type UserMedia
|
||||||
|
*/
|
||||||
private readonly userMedia: Observable<UserMedia[]> = this.mediaItems.pipe(
|
private readonly userMedia: Observable<UserMedia[]> = this.mediaItems.pipe(
|
||||||
map((mediaItems) =>
|
map((mediaItems) =>
|
||||||
mediaItems.filter((m): m is UserMedia => m instanceof UserMedia),
|
mediaItems.filter((m): m is UserMedia => m instanceof UserMedia),
|
||||||
@@ -483,6 +480,9 @@ export class CallViewModel extends ViewModel {
|
|||||||
map((ms) => ms.find((m) => m.vm.local)!.vm as LocalUserMediaViewModel),
|
map((ms) => ms.find((m) => m.vm.local)!.vm as LocalUserMediaViewModel),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of MediaItems that we want to display, that are of type ScreenShare
|
||||||
|
*/
|
||||||
private readonly screenShares: Observable<ScreenShare[]> =
|
private readonly screenShares: Observable<ScreenShare[]> =
|
||||||
this.mediaItems.pipe(
|
this.mediaItems.pipe(
|
||||||
map((mediaItems) =>
|
map((mediaItems) =>
|
||||||
@@ -672,7 +672,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
this.gridModeUserSelection.next(value);
|
this.gridModeUserSelection.next(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly gridLayout: Observable<LayoutMedia> = combineLatest(
|
private readonly gridLayoutMedia: Observable<GridLayoutMedia> = combineLatest(
|
||||||
[this.grid, this.spotlight],
|
[this.grid, this.spotlight],
|
||||||
(grid, spotlight) => ({
|
(grid, spotlight) => ({
|
||||||
type: "grid",
|
type: "grid",
|
||||||
@@ -683,28 +683,28 @@ export class CallViewModel extends ViewModel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly spotlightLandscapeLayout: Observable<LayoutMedia> =
|
private readonly spotlightLandscapeLayoutMedia: Observable<SpotlightLandscapeLayoutMedia> =
|
||||||
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
||||||
type: "spotlight-landscape",
|
type: "spotlight-landscape",
|
||||||
spotlight,
|
spotlight,
|
||||||
grid,
|
grid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
private readonly spotlightPortraitLayout: Observable<LayoutMedia> =
|
private readonly spotlightPortraitLayoutMedia: Observable<SpotlightPortraitLayoutMedia> =
|
||||||
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
combineLatest([this.grid, this.spotlight], (grid, spotlight) => ({
|
||||||
type: "spotlight-portrait",
|
type: "spotlight-portrait",
|
||||||
spotlight,
|
spotlight,
|
||||||
grid,
|
grid,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
private readonly spotlightExpandedLayout: Observable<LayoutMedia> =
|
private readonly spotlightExpandedLayoutMedia: Observable<SpotlightExpandedLayoutMedia> =
|
||||||
combineLatest([this.spotlight, this.pip], (spotlight, pip) => ({
|
combineLatest([this.spotlight, this.pip], (spotlight, pip) => ({
|
||||||
type: "spotlight-expanded",
|
type: "spotlight-expanded",
|
||||||
spotlight,
|
spotlight,
|
||||||
pip: pip ?? undefined,
|
pip: pip ?? undefined,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
private readonly oneOnOneLayout: Observable<LayoutMedia | null> =
|
private readonly oneOnOneLayoutMedia: Observable<OneOnOneLayoutMedia | null> =
|
||||||
this.mediaItems.pipe(
|
this.mediaItems.pipe(
|
||||||
map((mediaItems) => {
|
map((mediaItems) => {
|
||||||
if (mediaItems.length !== 2) return null;
|
if (mediaItems.length !== 2) return null;
|
||||||
@@ -722,9 +722,8 @@ export class CallViewModel extends ViewModel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly pipLayout: Observable<LayoutMedia> = this.spotlight.pipe(
|
private readonly pipLayoutMedia: Observable<LayoutMedia> =
|
||||||
map((spotlight) => ({ type: "pip", spotlight })),
|
this.spotlight.pipe(map((spotlight) => ({ type: "pip", spotlight })));
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The media to be used to produce a layout.
|
* The media to be used to produce a layout.
|
||||||
@@ -737,24 +736,24 @@ export class CallViewModel extends ViewModel {
|
|||||||
switchMap((gridMode) => {
|
switchMap((gridMode) => {
|
||||||
switch (gridMode) {
|
switch (gridMode) {
|
||||||
case "grid":
|
case "grid":
|
||||||
return this.oneOnOneLayout.pipe(
|
return this.oneOnOneLayoutMedia.pipe(
|
||||||
switchMap((oneOnOne) =>
|
switchMap((oneOnOne) =>
|
||||||
oneOnOne === null ? this.gridLayout : of(oneOnOne),
|
oneOnOne === null ? this.gridLayoutMedia : of(oneOnOne),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case "spotlight":
|
case "spotlight":
|
||||||
return this.spotlightExpanded.pipe(
|
return this.spotlightExpanded.pipe(
|
||||||
switchMap((expanded) =>
|
switchMap((expanded) =>
|
||||||
expanded
|
expanded
|
||||||
? this.spotlightExpandedLayout
|
? this.spotlightExpandedLayoutMedia
|
||||||
: this.spotlightLandscapeLayout,
|
: this.spotlightLandscapeLayoutMedia,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
case "narrow":
|
case "narrow":
|
||||||
return this.oneOnOneLayout.pipe(
|
return this.oneOnOneLayoutMedia.pipe(
|
||||||
switchMap((oneOnOne) =>
|
switchMap((oneOnOne) =>
|
||||||
oneOnOne === null
|
oneOnOne === null
|
||||||
? combineLatest(
|
? combineLatest(
|
||||||
@@ -762,12 +761,12 @@ export class CallViewModel extends ViewModel {
|
|||||||
(grid, spotlight) =>
|
(grid, spotlight) =>
|
||||||
grid.length > smallMobileCallThreshold ||
|
grid.length > smallMobileCallThreshold ||
|
||||||
spotlight.some((vm) => vm instanceof ScreenShareViewModel)
|
spotlight.some((vm) => vm instanceof ScreenShareViewModel)
|
||||||
? this.spotlightPortraitLayout
|
? this.spotlightPortraitLayoutMedia
|
||||||
: this.gridLayout,
|
: this.gridLayoutMedia,
|
||||||
).pipe(switchAll())
|
).pipe(switchAll())
|
||||||
: // The expanded spotlight layout makes for a better one-on-one
|
: // The expanded spotlight layout makes for a better one-on-one
|
||||||
// experience in narrow windows
|
// experience in narrow windows
|
||||||
this.spotlightExpandedLayout,
|
this.spotlightExpandedLayoutMedia,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
case "flat":
|
case "flat":
|
||||||
@@ -777,14 +776,14 @@ export class CallViewModel extends ViewModel {
|
|||||||
case "grid":
|
case "grid":
|
||||||
// Yes, grid mode actually gets you a "spotlight" layout in
|
// Yes, grid mode actually gets you a "spotlight" layout in
|
||||||
// this window mode.
|
// this window mode.
|
||||||
return this.spotlightLandscapeLayout;
|
return this.spotlightLandscapeLayoutMedia;
|
||||||
case "spotlight":
|
case "spotlight":
|
||||||
return this.spotlightExpandedLayout;
|
return this.spotlightExpandedLayoutMedia;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
case "pip":
|
case "pip":
|
||||||
return this.pipLayout;
|
return this.pipLayoutMedia;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
this.scope.state(),
|
this.scope.state(),
|
||||||
@@ -942,7 +941,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
this.scope.state(),
|
this.scope.state(),
|
||||||
);
|
);
|
||||||
|
|
||||||
public readonly showFooter = this.windowMode.pipe(
|
public readonly showFooter: Observable<boolean> = this.windowMode.pipe(
|
||||||
switchMap((mode) => {
|
switchMap((mode) => {
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case "pip":
|
case "pip":
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { describe, test } from "vitest";
|
||||||
|
|
||||||
|
import { withTestScheduler } from "../utils/test";
|
||||||
|
import { observeSpeaker } from "./observeSpeaker";
|
||||||
|
|
||||||
|
const yesNo = {
|
||||||
|
y: true,
|
||||||
|
n: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
describe("observeSpeaker", () => {
|
||||||
|
describe("does not activate", () => {
|
||||||
|
const expectedOutputMarbles = "n";
|
||||||
|
test("starts correctly", () => {
|
||||||
|
// should default to false when no input is given
|
||||||
|
const speakingInputMarbles = "";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("after no speaking", () => {
|
||||||
|
const speakingInputMarbles = "n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with speaking for 1ms", () => {
|
||||||
|
const speakingInputMarbles = "y n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with speaking for 999ms", () => {
|
||||||
|
const speakingInputMarbles = "y 999ms n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with speaking intermittently", () => {
|
||||||
|
const speakingInputMarbles =
|
||||||
|
"y 199ms n 199ms y 199ms n 199ms y 199ms n 199ms y 199ms n 199ms y 199ms n 199ms y 199ms n 199ms y 199ms n 199ms y 199ms n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("with consecutive speaking then stops speaking", () => {
|
||||||
|
const speakingInputMarbles = "y y y y y y y y y y n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("activates", () => {
|
||||||
|
test("after 1s", () => {
|
||||||
|
// this will active after 1s as no `n` follows it:
|
||||||
|
const speakingInputMarbles = " y";
|
||||||
|
const expectedOutputMarbles = "n 999ms y";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("speaking for 1001ms activates for 60s", () => {
|
||||||
|
const speakingInputMarbles = " y 1s n ";
|
||||||
|
const expectedOutputMarbles = "n 999ms y 60s n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("speaking for 5s activates for 64s", () => {
|
||||||
|
const speakingInputMarbles = " y 5s n ";
|
||||||
|
const expectedOutputMarbles = "n 999ms y 64s n";
|
||||||
|
withTestScheduler(({ hot, expectObservable }) => {
|
||||||
|
expectObservable(observeSpeaker(hot(speakingInputMarbles, yesNo))).toBe(
|
||||||
|
expectedOutputMarbles,
|
||||||
|
yesNo,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
import {
|
||||||
|
Observable,
|
||||||
|
audit,
|
||||||
|
merge,
|
||||||
|
timer,
|
||||||
|
filter,
|
||||||
|
startWith,
|
||||||
|
distinctUntilChanged,
|
||||||
|
} from "rxjs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require 1 second of continuous speaking to become a speaker, and 60 second of
|
||||||
|
* continuous silence to stop being considered a speaker
|
||||||
|
*/
|
||||||
|
export function observeSpeaker(
|
||||||
|
isSpeakingObservable: Observable<boolean>,
|
||||||
|
): Observable<boolean> {
|
||||||
|
const distinct = isSpeakingObservable.pipe(distinctUntilChanged());
|
||||||
|
|
||||||
|
return distinct.pipe(
|
||||||
|
// Either change to the new value after the timer or re-emit the same value if it toggles back
|
||||||
|
// (audit will return the latest (toggled back) value) before the timeout.
|
||||||
|
audit((s) =>
|
||||||
|
merge(timer(s ? 1000 : 60000), distinct.pipe(filter((s1) => s1 !== s))),
|
||||||
|
),
|
||||||
|
// Filter the re-emissions (marked as: | ) that happen if we toggle quickly (<1s) from false->true->false|->..
|
||||||
|
startWith(false),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
);
|
||||||
|
}
|
||||||
+22
-7
@@ -26,6 +26,7 @@ import {
|
|||||||
VisibilityOnIcon,
|
VisibilityOnIcon,
|
||||||
UserProfileIcon,
|
UserProfileIcon,
|
||||||
ExpandIcon,
|
ExpandIcon,
|
||||||
|
VolumeOffSolidIcon,
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
import {
|
import {
|
||||||
ContextMenu,
|
ContextMenu,
|
||||||
@@ -62,6 +63,7 @@ interface TileProps {
|
|||||||
interface UserMediaTileProps extends TileProps {
|
interface UserMediaTileProps extends TileProps {
|
||||||
vm: UserMediaViewModel;
|
vm: UserMediaViewModel;
|
||||||
mirror: boolean;
|
mirror: boolean;
|
||||||
|
locallyMuted: boolean;
|
||||||
menuStart?: ReactNode;
|
menuStart?: ReactNode;
|
||||||
menuEnd?: ReactNode;
|
menuEnd?: ReactNode;
|
||||||
}
|
}
|
||||||
@@ -71,6 +73,7 @@ const UserMediaTile = forwardRef<HTMLDivElement, UserMediaTileProps>(
|
|||||||
{
|
{
|
||||||
vm,
|
vm,
|
||||||
showSpeakingIndicators,
|
showSpeakingIndicators,
|
||||||
|
locallyMuted,
|
||||||
menuStart,
|
menuStart,
|
||||||
menuEnd,
|
menuEnd,
|
||||||
className,
|
className,
|
||||||
@@ -94,9 +97,18 @@ const UserMediaTile = forwardRef<HTMLDivElement, UserMediaTileProps>(
|
|||||||
},
|
},
|
||||||
[vm],
|
[vm],
|
||||||
);
|
);
|
||||||
const { raisedHands, lowerHand, reactions } = useReactions();
|
const { raisedHands, toggleRaisedHand, reactions } = useReactions();
|
||||||
|
|
||||||
const MicIcon = audioEnabled ? MicOnSolidIcon : MicOffSolidIcon;
|
const AudioIcon = locallyMuted
|
||||||
|
? VolumeOffSolidIcon
|
||||||
|
: audioEnabled
|
||||||
|
? MicOnSolidIcon
|
||||||
|
: MicOffSolidIcon;
|
||||||
|
const audioIconLabel = locallyMuted
|
||||||
|
? t("video_tile.muted_for_me")
|
||||||
|
: audioEnabled
|
||||||
|
? t("microphone_on")
|
||||||
|
: t("microphone_off");
|
||||||
|
|
||||||
const [menuOpen, setMenuOpen] = useState(false);
|
const [menuOpen, setMenuOpen] = useState(false);
|
||||||
const menu = (
|
const menu = (
|
||||||
@@ -115,8 +127,9 @@ const UserMediaTile = forwardRef<HTMLDivElement, UserMediaTileProps>(
|
|||||||
const handRaised: Date | undefined = raisedHands[vm.member?.userId ?? ""];
|
const handRaised: Date | undefined = raisedHands[vm.member?.userId ?? ""];
|
||||||
const currentReaction: ReactionOption | undefined =
|
const currentReaction: ReactionOption | undefined =
|
||||||
reactions[vm.member?.userId ?? ""];
|
reactions[vm.member?.userId ?? ""];
|
||||||
const raisedHandOnClick =
|
const raisedHandOnClick = vm.local
|
||||||
vm.local && handRaised ? (): void => void lowerHand() : undefined;
|
? (): void => void toggleRaisedHand()
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const showSpeaking = showSpeakingIndicators && speaking;
|
const showSpeaking = showSpeakingIndicators && speaking;
|
||||||
|
|
||||||
@@ -134,11 +147,11 @@ const UserMediaTile = forwardRef<HTMLDivElement, UserMediaTileProps>(
|
|||||||
[styles.handRaised]: !showSpeaking && !!handRaised,
|
[styles.handRaised]: !showSpeaking && !!handRaised,
|
||||||
})}
|
})}
|
||||||
nameTagLeadingIcon={
|
nameTagLeadingIcon={
|
||||||
<MicIcon
|
<AudioIcon
|
||||||
width={20}
|
width={20}
|
||||||
height={20}
|
height={20}
|
||||||
aria-label={audioEnabled ? t("microphone_on") : t("microphone_off")}
|
aria-label={audioIconLabel}
|
||||||
data-muted={!audioEnabled}
|
data-muted={locallyMuted || !audioEnabled}
|
||||||
className={styles.muteIcon}
|
className={styles.muteIcon}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
@@ -199,6 +212,7 @@ const LocalUserMediaTile = forwardRef<HTMLDivElement, LocalUserMediaTileProps>(
|
|||||||
<UserMediaTile
|
<UserMediaTile
|
||||||
ref={ref}
|
ref={ref}
|
||||||
vm={vm}
|
vm={vm}
|
||||||
|
locallyMuted={false}
|
||||||
mirror={mirror}
|
mirror={mirror}
|
||||||
menuStart={
|
menuStart={
|
||||||
<ToggleMenuItem
|
<ToggleMenuItem
|
||||||
@@ -255,6 +269,7 @@ const RemoteUserMediaTile = forwardRef<
|
|||||||
<UserMediaTile
|
<UserMediaTile
|
||||||
ref={ref}
|
ref={ref}
|
||||||
vm={vm}
|
vm={vm}
|
||||||
|
locallyMuted={locallyMuted}
|
||||||
mirror={false}
|
mirror={false}
|
||||||
menuStart={
|
menuStart={
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -34,10 +34,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media.videoMuted video {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg {
|
.bg {
|
||||||
background-color: var(--cpd-color-bg-subtle-secondary);
|
background-color: var(--cpd-color-bg-subtle-secondary);
|
||||||
inline-size: 100%;
|
inline-size: 100%;
|
||||||
@@ -47,7 +43,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
}
|
}
|
||||||
|
|
||||||
.avatar {
|
.avatar {
|
||||||
display: none;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
@@ -55,10 +50,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.media.videoMuted .avatar {
|
|
||||||
display: initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CSS makes us put a condition here, even though all we want to do is
|
/* CSS makes us put a condition here, even though all we want to do is
|
||||||
unconditionally select the container so we can use cqmin units */
|
unconditionally select the container so we can use cqmin units */
|
||||||
@container mediaView (width > 0) {
|
@container mediaView (width > 0) {
|
||||||
|
|||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2024 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { describe, expect, test } from "vitest";
|
||||||
|
import { render, screen } from "@testing-library/react";
|
||||||
|
import { axe } from "vitest-axe";
|
||||||
|
import { TooltipProvider } from "@vector-im/compound-web";
|
||||||
|
import {
|
||||||
|
TrackReference,
|
||||||
|
TrackReferencePlaceholder,
|
||||||
|
} from "@livekit/components-core";
|
||||||
|
import { Track, TrackPublication } from "livekit-client";
|
||||||
|
import { type ComponentProps } from "react";
|
||||||
|
|
||||||
|
import { MediaView } from "./MediaView";
|
||||||
|
import { EncryptionStatus } from "../state/MediaViewModel";
|
||||||
|
import { mockLocalParticipant } from "../utils/test";
|
||||||
|
|
||||||
|
describe("MediaView", () => {
|
||||||
|
const participant = mockLocalParticipant({});
|
||||||
|
const trackReferencePlaceholder: TrackReferencePlaceholder = {
|
||||||
|
participant,
|
||||||
|
source: Track.Source.Camera,
|
||||||
|
};
|
||||||
|
const trackReference: TrackReference = {
|
||||||
|
...trackReferencePlaceholder,
|
||||||
|
publication: new TrackPublication(Track.Kind.Video, "id", "name"),
|
||||||
|
};
|
||||||
|
|
||||||
|
const baseProps: ComponentProps<typeof MediaView> = {
|
||||||
|
displayName: "some name",
|
||||||
|
videoEnabled: true,
|
||||||
|
videoFit: "contain",
|
||||||
|
targetWidth: 300,
|
||||||
|
targetHeight: 200,
|
||||||
|
encryptionStatus: EncryptionStatus.Connecting,
|
||||||
|
mirror: false,
|
||||||
|
unencryptedWarning: false,
|
||||||
|
video: trackReference,
|
||||||
|
member: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
test("is accessible", async () => {
|
||||||
|
const { container } = render(<MediaView {...baseProps} />);
|
||||||
|
expect(await axe(container)).toHaveNoViolations();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("placeholder track", () => {
|
||||||
|
test("neither video nor avatar are shown", () => {
|
||||||
|
render(<MediaView {...baseProps} video={trackReferencePlaceholder} />);
|
||||||
|
expect(screen.queryByTestId("video")).toBeNull();
|
||||||
|
expect(screen.queryAllByRole("img", { name: "some name" }).length).toBe(
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("name tag", () => {
|
||||||
|
test("is shown with name", () => {
|
||||||
|
render(<MediaView {...baseProps} displayName="Bob" />);
|
||||||
|
expect(screen.getByTestId("name_tag")).toHaveTextContent("Bob");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("unencryptedWarning", () => {
|
||||||
|
test("is shown and accessible", async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<TooltipProvider>
|
||||||
|
<MediaView {...baseProps} unencryptedWarning={true} />
|
||||||
|
</TooltipProvider>,
|
||||||
|
);
|
||||||
|
expect(await axe(container)).toHaveNoViolations();
|
||||||
|
expect(
|
||||||
|
screen.getByRole("img", { name: "common.unencrypted" }),
|
||||||
|
).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("is not shown", () => {
|
||||||
|
render(
|
||||||
|
<TooltipProvider>
|
||||||
|
<MediaView {...baseProps} unencryptedWarning={false} />
|
||||||
|
</TooltipProvider>,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
screen.queryAllByRole("img", { name: "common.unencrypted" }).length,
|
||||||
|
).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("videoEnabled", () => {
|
||||||
|
test("just video is visible", () => {
|
||||||
|
render(
|
||||||
|
<TooltipProvider>
|
||||||
|
<MediaView {...baseProps} videoEnabled={true} />
|
||||||
|
</TooltipProvider>,
|
||||||
|
);
|
||||||
|
expect(screen.getByTestId("video")).toBeVisible();
|
||||||
|
expect(screen.queryAllByRole("img", { name: "some name" }).length).toBe(
|
||||||
|
0,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("just avatar is visible", () => {
|
||||||
|
render(
|
||||||
|
<TooltipProvider>
|
||||||
|
<MediaView {...baseProps} videoEnabled={false} />
|
||||||
|
</TooltipProvider>,
|
||||||
|
);
|
||||||
|
expect(screen.getByRole("img", { name: "some name" })).toBeVisible();
|
||||||
|
expect(screen.getByTestId("video")).not.toBeVisible();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
+13
-3
@@ -76,7 +76,6 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
<animated.div
|
<animated.div
|
||||||
className={classNames(styles.media, className, {
|
className={classNames(styles.media, className, {
|
||||||
[styles.mirror]: mirror,
|
[styles.mirror]: mirror,
|
||||||
[styles.videoMuted]: !videoEnabled,
|
|
||||||
})}
|
})}
|
||||||
style={style}
|
style={style}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
@@ -91,6 +90,7 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
size={avatarSize}
|
size={avatarSize}
|
||||||
src={member?.getMxcAvatarUrl()}
|
src={member?.getMxcAvatarUrl()}
|
||||||
className={styles.avatar}
|
className={styles.avatar}
|
||||||
|
style={{ display: videoEnabled ? "none" : "initial" }}
|
||||||
/>
|
/>
|
||||||
{video.publication !== undefined && (
|
{video.publication !== undefined && (
|
||||||
<VideoTrack
|
<VideoTrack
|
||||||
@@ -98,11 +98,13 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
// There's no reason for this to be focusable
|
// There's no reason for this to be focusable
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
disablePictureInPicture
|
disablePictureInPicture
|
||||||
|
style={{ display: videoEnabled ? "block" : "none" }}
|
||||||
|
data-testid="video"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.fg}>
|
<div className={styles.fg}>
|
||||||
<div style={{ display: "flex" }}>
|
<div style={{ display: "flex", gap: "var(--cpd-space-1x)" }}>
|
||||||
<RaisedHandIndicator
|
<RaisedHandIndicator
|
||||||
raisedHandTime={raisedHandTime}
|
raisedHandTime={raisedHandTime}
|
||||||
miniature={avatarSize < 96}
|
miniature={avatarSize < 96}
|
||||||
@@ -133,7 +135,13 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
)*/}
|
)*/}
|
||||||
<div className={styles.nameTag}>
|
<div className={styles.nameTag}>
|
||||||
{nameTagLeadingIcon}
|
{nameTagLeadingIcon}
|
||||||
<Text as="span" size="sm" weight="medium" className={styles.name}>
|
<Text
|
||||||
|
as="span"
|
||||||
|
size="sm"
|
||||||
|
weight="medium"
|
||||||
|
className={styles.name}
|
||||||
|
data-testid="name_tag"
|
||||||
|
>
|
||||||
{displayName}
|
{displayName}
|
||||||
</Text>
|
</Text>
|
||||||
{unencryptedWarning && (
|
{unencryptedWarning && (
|
||||||
@@ -146,6 +154,8 @@ export const MediaView = forwardRef<HTMLDivElement, Props>(
|
|||||||
width={20}
|
width={20}
|
||||||
height={20}
|
height={20}
|
||||||
className={styles.errorIcon}
|
className={styles.errorIcon}
|
||||||
|
role="img"
|
||||||
|
aria-label={t("common.unencrypted")}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user