Add buttons bar

This commit is contained in:
2025-11-28 09:55:21 +01:00
parent 9f83a6fb66
commit 94ce9c3c95
2 changed files with 39 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ export default function DashboardSidebar({
const hasDrawerTransitions = isOverSmViewport && isOverMdViewport; const hasDrawerTransitions = isOverSmViewport && isOverMdViewport;
const getDrawerContent = React.useCallback( const getDrawerContent = React.useCallback(
(viewport: "phone" | "tablet" | "desktop") => ( (viewport: "phone" | "desktop") => (
<React.Fragment> <React.Fragment>
<Box <Box
component="nav" component="nav"
@@ -194,20 +194,7 @@ export default function DashboardSidebar({
<Drawer <Drawer
variant="permanent" variant="permanent"
sx={{ sx={{
display: { display: { xs: "none", sm: "block", md: "block" },
xs: "none",
sm: "block",
md: "none",
},
...getDrawerSharedSx(false),
}}
>
{getDrawerContent("tablet")}
</Drawer>
<Drawer
variant="permanent"
sx={{
display: { xs: "none", md: "block" },
...getDrawerSharedSx(false, true), ...getDrawerSharedSx(false, true),
}} }}
> >

View File

@@ -1,10 +1,12 @@
import { Dialog, Typography } from "@mui/material"; import { Box, Button, ButtonGroup, Dialog, Typography } from "@mui/material";
import { MatrixApiEvent } from "../../api/matrix/MatrixApiEvent"; import { MatrixApiEvent } from "../../api/matrix/MatrixApiEvent";
import type { UsersMap } from "../../api/matrix/MatrixApiProfile"; import type { UsersMap } from "../../api/matrix/MatrixApiProfile";
import type { Room } from "../../api/matrix/MatrixApiRoom"; import type { Room } from "../../api/matrix/MatrixApiRoom";
import type { Message, RoomEventsManager } from "../../utils/RoomEventsManager"; import type { Message, RoomEventsManager } from "../../utils/RoomEventsManager";
import { AccountIcon } from "./AccountIcon"; import { AccountIcon } from "./AccountIcon";
import React from "react"; import React from "react";
import EditIcon from "@mui/icons-material/Edit";
import DeleteIcon from "@mui/icons-material/Delete";
export function RoomMessagesList(p: { export function RoomMessagesList(p: {
room: Room; room: Room;
@@ -67,6 +69,7 @@ function RoomMessage(p: {
return ( return (
<> <>
{/* Print date if required */}
{p.firstMessageOfDay && ( {p.firstMessageOfDay && (
<Typography <Typography
variant="caption" variant="caption"
@@ -76,6 +79,8 @@ function RoomMessage(p: {
{p.message.time_sent_dayjs.format("DD/MM/YYYY")} {p.message.time_sent_dayjs.format("DD/MM/YYYY")}
</Typography> </Typography>
)} )}
{/* Give person name if required */}
{(!p.previousFromSamePerson || p.firstMessageOfDay) && user && ( {(!p.previousFromSamePerson || p.firstMessageOfDay) && user && (
<div <div
style={{ style={{
@@ -91,11 +96,21 @@ function RoomMessage(p: {
</div> </div>
)} )}
<div {/* Message content */}
<Box
style={{ style={{
wordBreak: "break-all", wordBreak: "break-all",
wordWrap: "break-word", wordWrap: "break-word",
maxWidth: "100%", maxWidth: "100%",
transition: "all 0.01s ease-in",
position: "relative",
}}
component="div"
sx={{
"&:hover": {
backgroundColor: "#ffffff2b",
},
"&:hover *": { visibility: "visible" },
}} }}
> >
<Typography variant="caption"> <Typography variant="caption">
@@ -117,7 +132,26 @@ function RoomMessage(p: {
) : ( ) : (
p.message.content p.message.content
)} )}
</div> <ButtonGroup
className="buttons"
size="small"
style={{
position: "absolute",
visibility: "hidden",
display: "block",
top: "-34px",
right: "0px",
}}
sx={{ "parent:hover": { visibility: "visible" } }}
>
<Button>
<EditIcon />
</Button>
<Button>
<DeleteIcon />
</Button>
</ButtonGroup>
</Box>
<Dialog open={showImageFullScreen} onClose={closeImageFullScreen}> <Dialog open={showImageFullScreen} onClose={closeImageFullScreen}>
<img <img