2022-04-20 10:14:24 +02:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-04-20 10:14:24 +02:00
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2022-04-20 10:14:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React from "react";
|
|
|
|
|
import { Beacon } from "matrix-js-sdk/src/matrix";
|
2024-10-02 11:06:17 +01:00
|
|
|
import CloseIcon from "@vector-im/compound-design-tokens/assets/web/icons/close";
|
2022-04-20 10:14:24 +02:00
|
|
|
|
|
|
|
|
import { _t } from "../../../languageHandler";
|
|
|
|
|
import AccessibleButton from "../elements/AccessibleButton";
|
|
|
|
|
import Heading from "../typography/Heading";
|
2022-04-20 13:57:50 +02:00
|
|
|
import BeaconListItem from "./BeaconListItem";
|
2022-04-20 10:14:24 +02:00
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
beacons: Beacon[];
|
|
|
|
|
requestClose: () => void;
|
2022-07-18 10:34:39 +02:00
|
|
|
onBeaconClick: (beacon: Beacon) => void;
|
2022-04-20 10:14:24 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-18 10:34:39 +02:00
|
|
|
const DialogSidebar: React.FC<Props> = ({ beacons, onBeaconClick, requestClose }) => {
|
2022-04-20 10:14:24 +02:00
|
|
|
return (
|
|
|
|
|
<div className="mx_DialogSidebar">
|
|
|
|
|
<div className="mx_DialogSidebar_header">
|
2023-10-03 19:17:26 +01:00
|
|
|
<Heading size="4">{_t("action|view_list")}</Heading>
|
2022-04-20 10:14:24 +02:00
|
|
|
<AccessibleButton
|
|
|
|
|
className="mx_DialogSidebar_closeButton"
|
|
|
|
|
onClick={requestClose}
|
2023-10-03 19:17:26 +01:00
|
|
|
title={_t("location_sharing|close_sidebar")}
|
2022-07-18 10:34:39 +02:00
|
|
|
data-testid="dialog-sidebar-close"
|
2022-04-20 10:14:24 +02:00
|
|
|
>
|
2024-10-02 11:06:17 +01:00
|
|
|
<CloseIcon className="mx_DialogSidebar_closeButtonIcon" height="24px" width="24px" />
|
2022-04-20 10:14:24 +02:00
|
|
|
</AccessibleButton>
|
2022-07-27 17:42:59 +02:00
|
|
|
</div>
|
|
|
|
|
{beacons?.length ? (
|
|
|
|
|
<ol className="mx_DialogSidebar_list">
|
|
|
|
|
{beacons.map((beacon) => (
|
|
|
|
|
<BeaconListItem key={beacon.identifier} beacon={beacon} onClick={() => onBeaconClick(beacon)} />
|
2022-12-12 12:24:14 +01:00
|
|
|
))}
|
|
|
|
|
</ol>
|
|
|
|
|
) : (
|
2023-10-03 19:17:26 +01:00
|
|
|
<div className="mx_DialogSidebar_noResults">{_t("location_sharing|live_locations_empty")}</div>
|
2022-12-12 12:24:14 +01:00
|
|
|
)}
|
|
|
|
|
</div>
|
2022-04-20 10:14:24 +02:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default DialogSidebar;
|