diff --git a/src/components/common/messaging/embed/EmbedInvite.tsx b/src/components/common/messaging/embed/EmbedInvite.tsx index f9e91697..830c5695 100644 --- a/src/components/common/messaging/embed/EmbedInvite.tsx +++ b/src/components/common/messaging/embed/EmbedInvite.tsx @@ -3,11 +3,12 @@ import { observer } from "mobx-react-lite"; import { useHistory } from "react-router-dom"; import { RetrievedInvite } from "revolt-api/types/Invites"; import { Message } from "revolt.js/dist/maps/Messages"; -import styled from "styled-components"; +import styled, { css } from "styled-components"; import { useContext, useEffect, useState } from "preact/hooks"; import { defer } from "../../../../lib/defer"; +import { isTouchscreenDevice } from "../../../../lib/isTouchscreenDevice"; import { dispatch } from "../../../../redux"; @@ -20,6 +21,7 @@ import { takeError } from "../../../../context/revoltjs/util"; import ServerIcon from "../../../../components/common/ServerIcon"; import Button from "../../../../components/ui/Button"; +import Overline from "../../../ui/Overline"; import Preloader from "../../../ui/Preloader"; const EmbedInviteBase = styled.div` @@ -31,15 +33,37 @@ const EmbedInviteBase = styled.div` align-items: center; padding: 0 12px; margin-top: 2px; + ${() => + isTouchscreenDevice && + css` + flex-wrap: wrap; + height: 130px; + padding-top: 8px; + padding-bottom: 10px; + width: 100%; + > button { + width: 100%; + } + ` + } `; const EmbedInviteDetails = styled.div` flex-grow: 1; padding-left: 12px; + ${() => + isTouchscreenDevice && + css` + width: calc(100% - 55px); + ` + } `; const EmbedInviteName = styled.div` font-weight: bold; + line-height: 1rem; + max-height: 2rem; + overflow: hidden; `; const EmbedInviteMemberCount = styled.div` @@ -57,6 +81,7 @@ export function EmbedInvite(props: Props) { const code = props.code; const [processing, setProcessing] = useState(false); const [error, setError] = useState(undefined); + const [joinError, setJoinError] = useState(undefined); const [invite, setInvite] = useState( undefined, ); @@ -89,68 +114,70 @@ export function EmbedInvite(props: Props) { } return ( - - - - {invite.server_name} - - {invite.member_count.toLocaleString()} members - - - {processing ? ( -
- -
- ) : ( - - )} -
+ }}> + {client.servers.get(invite.server_id) ? "Joined" : "Join"} + + )} + + {joinError && } + ); }