Fix: Remove padding on user profile.

Modals: Allow all modals to be closed by ESC (permitting).
Fix: Handle closing DMs properly. Stop propagation too.
This commit is contained in:
Paul
2021-06-24 16:57:12 +01:00
parent b724b9aec2
commit 2d9d3c489c
7 changed files with 27 additions and 22 deletions

View File

@@ -22,17 +22,6 @@ export function ImageViewer({ attachment, embed, onClose }: Props) {
if (attachment && attachment.metadata.type !== "Image") return null;
const client = useContext(AppContext);
useEffect(() => {
function keyDown(e: KeyboardEvent) {
if (e.key === "Escape") {
onClose();
}
}
document.body.addEventListener("keydown", keyDown);
return () => document.body.removeEventListener("keydown", keyDown);
}, []);
return (
<Modal visible={true} onClose={onClose} noBackground>
<div className={styles.viewer}>

View File

@@ -116,12 +116,11 @@ export function UserProfile({ user_id, onClose, dummy, dummyProfile }: Props) {
const badges = (user.badges ?? 0) | (decodeTime(user._id) < 1623751765790 ? Badges.EarlyAdopter : 0);
return (
<Modal
visible
<Modal visible
border={dummy}
padding={false}
onClose={onClose}
dontModal={dummy}
>
dontModal={dummy}>
<div
className={styles.header}
data-force={