diff --git a/src/components/Avatar.tsx b/src/components/Avatar.tsx index 4f00c6b..6905145 100644 --- a/src/components/Avatar.tsx +++ b/src/components/Avatar.tsx @@ -7,8 +7,6 @@ import { useAppStore } from "../stores/AppStore"; import Presence from "../stores/objects/Presence"; import User from "../stores/objects/User"; import Container from "./Container"; -import Floating from "./floating/Floating"; -import FloatingTrigger from "./floating/FloatingTrigger"; const Wrapper = styled(Container)<{ size: number; hasClick?: boolean }>` background-color: transparent; @@ -16,43 +14,19 @@ const Wrapper = styled(Container)<{ size: number; hasClick?: boolean }>` flex-direction: column; `; -const StatusDot = styled.i<{ color: string; size?: number; left?: number; bottom?: number }>` - border-radius: 50%; - border: 0.3rem solid var(--background-secondary); - background-color: ${(props) => props.color}; - height: ${(props) => props.size ?? 16}px; - width: ${(props) => props.size ?? 16}px; - position: relative; - bottom: ${(props) => props.bottom ?? 16}px; - left: ${(props) => props.left ?? 20}px; - display: block; -`; - -const InnerWrapper = styled.div<{ width?: number; height?: number }>` - height: ${(props) => props.height ?? 40}px; - width: ${(props) => props.width ?? 40}px; -`; - -function Yes(onClick: React.MouseEventHandler) { - return ({ children }: { children: React.ReactNode }) => { - return
{children}
; - }; -} - interface Props { user?: User | AccountStore; - size?: number; + size: 32 | 80; style?: React.CSSProperties; onClick?: React.MouseEventHandler | null; popoutPlacement?: "left" | "right" | "top" | "bottom"; presence?: Presence; statusDotStyle?: { size?: number; - left?: number; - bottom?: number; + borderThickness?: number; }; showPresence?: boolean; - innerWrapperSize?: number; + isFloating?: boolean; } function Avatar(props: Props) { @@ -63,40 +37,79 @@ function Avatar(props: Props) { const user = props.user ?? app.account; if (!user) return null; - // if onClick is null, use a div. if we pass a function, use yes. otherwise use FloatingTrigger - const Base = props.onClick === null ? "div" : props.onClick ? Yes(props.onClick) : FloatingTrigger; + const presenceRingsTreatment = app.experiments.getTreatment("presence_rings"); + const ringsEnabled = presenceRingsTreatment && presenceRingsTreatment.id === 2; - return ( - - - - + const children = ( + + {props.showPresence && props.presence ? ( + !ringsEnabled ? ( +
- {props.showPresence && ( - - )} - - - - +
+
+ ) : ( + + ) + ) : ( + + )} +
); + + return children; } export default observer(Avatar); diff --git a/src/components/UserPanel.tsx b/src/components/UserPanel.tsx index 1811021..81f26ce 100644 --- a/src/components/UserPanel.tsx +++ b/src/components/UserPanel.tsx @@ -1,7 +1,7 @@ +import { observer } from "mobx-react-lite"; import styled from "styled-components"; import { modalController } from "../controllers/modals"; import { useAppStore } from "../stores/AppStore"; -import User from "../stores/objects/User"; import Avatar from "./Avatar"; import Icon from "./Icon"; import IconButton from "./IconButton"; @@ -22,7 +22,7 @@ const Container = styled.div` background-color: var(--background-secondary-alt); `; -const AvatarWrapper = styled(FloatingTrigger)` +const AvatarWrapper = styled.div` display: flex; align-items: center; min-width: 120px; @@ -30,10 +30,6 @@ const AvatarWrapper = styled(FloatingTrigger)` margin-right: 8px; border-radius: 4px; cursor: default; - - &:hover { - background-color: var(--background-primary-alt); - } `; const Name = styled.div` @@ -68,6 +64,12 @@ const ActionsWrapper = styled.div` display: flex; `; +const SettingsButton = styled(IconButton)` + &:hover { + opacity: 0.8; + } +`; + function UserPanel() { const app = useAppStore(); const presence = app.presences.get(app.account!.id); @@ -79,43 +81,35 @@ function UserPanel() { }; return ( - -
- - - - - {app.account?.username} - #{app.account?.discriminator} - - +
+ + + + + {app.account?.username} + #{app.account?.discriminator} + + - - Settings, - }} - > - - - - - - - - -
- + + Settings, + }} + > + + + + + + + +
+
); } -export default UserPanel; +export default observer(UserPanel); diff --git a/src/components/floating/UserProfilePopout.tsx b/src/components/floating/UserProfilePopout.tsx index df3c6fa..c563025 100644 --- a/src/components/floating/UserProfilePopout.tsx +++ b/src/components/floating/UserProfilePopout.tsx @@ -184,11 +184,10 @@ function UserProfilePopout({ user, member }: Props) { presence={presence} statusDotStyle={{ size: 25, - left: 55, - bottom: 28, + borderThickness: 0.3, }} showPresence - innerWrapperSize={92} + isFloating /> diff --git a/src/components/messaging/Message.tsx b/src/components/messaging/Message.tsx index 666abc4..0b5ae9f 100644 --- a/src/components/messaging/Message.tsx +++ b/src/components/messaging/Message.tsx @@ -42,7 +42,7 @@ function Message({ message, header }: Props) { > {header ? ( - + ) : ( )}