Compare commits

...
Author SHA1 Message Date
Robin c3235a72e1 Create service interruptions component 2026-12-02 17:56:57 -05:00
4 changed files with 141 additions and 0 deletions
+11
View File
@@ -50,6 +50,7 @@
"encrypted": "Encrypted",
"home": "Home",
"loading": "Loading…",
"more_info": "More info",
"next": "Next",
"options": "Options",
"password": "Password",
@@ -207,6 +208,16 @@
"room_auth_view_continue_button": "Continue",
"room_auth_view_ssla_caption": "By clicking \"Join call now\", you agree to our <2>Software and Services License Agreement (SSLA)</2>",
"screenshare_button_label": "Share screen",
"service_interruptions": {
"description": "Some services are temporarily unavailable:",
"encryption_keys": "Encryption keys",
"local_media": "Your audio and video",
"reactions": "Emoji reactions",
"remote_media_one": "Other person's audio and video",
"remote_media_other": "Other people's audio and video",
"screen_sharing": "Screen sharing",
"title": "Service interruptions"
},
"settings": {
"advanced_camera_description": "Configure resolution, framerate, bitrate, and codec for camera video. Changes apply on next call join.",
"advanced_camera_label": "Advanced camera settings",
+16
View File
@@ -0,0 +1,16 @@
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
.services {
gap: var(--cpd-space-0-5x);
}
.service {
font: var(--cpd-font-body-sm-medium);
padding: var(--cpd-space-3x);
gap: var(--cpd-space-2x);
}
+36
View File
@@ -0,0 +1,36 @@
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import type { Meta, StoryObj } from "@storybook/react-vite";
import { ServiceInterruptions } from "./ServiceInterruptions";
import { screen, userEvent } from "storybook/test";
const meta = {
component: ServiceInterruptions,
} satisfies Meta<typeof ServiceInterruptions>;
export default meta;
type Story = StoryObj<typeof meta>;
export const Default: Story = {
args: {
vm: {
unavailable: [
{ name: "reactions" },
{ name: "encryption-keys" },
{ name: "screen-sharing" },
{ name: "local-media" },
{ name: "remote-media", count: 2 },
],
},
},
play: async () => {
await userEvent.click(
screen.getByRole("button", { name: /Service interruptions/ }),
);
},
};
+78
View File
@@ -0,0 +1,78 @@
/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { type TFunction } from "i18next";
import { type FC, useState } from "react";
import { useTranslation } from "react-i18next";
import { Toast, VisualList, VisualListItem } from "@vector-im/compound-web";
import {
CloseIcon,
InfoSolidIcon,
} from "@vector-im/compound-design-tokens/assets/web/icons";
import {
type Service,
type ServiceInterruptionsViewModel,
} from "./state/ServiceInterruptionsViewModel";
import { Popover } from "./Popover";
import styles from "./ServiceInterruptions.module.css";
export interface ServiceInterruptionsProps {
vm: ServiceInterruptionsViewModel;
}
export const ServiceInterruptions: FC<ServiceInterruptionsProps> = ({ vm }) => {
const { t } = useTranslation();
const [open, setOpen] = useState(false);
return (
<Popover
open={open}
onOpenChange={setOpen}
title={t("service_interruptions.title")}
trigger={
<Toast
Icon={InfoSolidIcon}
aria-live="polite"
aria-haspopup="dialog"
tooltip={t("common.more_info")}
>
{t("service_interruptions.title")}
</Toast>
}
>
<p>{t("service_interruptions.description")}</p>
<VisualList className={styles.services}>
{vm.unavailable.map((service) => (
<VisualListItem
key={service.name}
className={styles.service}
destructive
Icon={CloseIcon}
>
{serviceLabel(t, service)}
</VisualListItem>
))}
</VisualList>
</Popover>
);
};
function serviceLabel(t: TFunction, service: Service): string {
switch (service.name) {
case "encryption-keys":
return t("service_interruptions.encryption_keys");
case "reactions":
return t("service_interruptions.reactions");
case "screen-sharing":
return t("service_interruptions.screen_sharing");
case "local-media":
return t("service_interruptions.local_media");
case "remote-media":
return t("service_interruptions.remote_media", { count: service.count });
}
}