Lock activity center (#183)
* Add input placeholder * Lock activity center without identity * Change cursor for disabled buttons Co-authored-by: Szymon Szlachtowicz <38212223+Szymx95@users.noreply.github.com>
This commit is contained in:
parent
eebda7e943
commit
97535066e9
|
@ -261,7 +261,12 @@ export function ChatInput({ reply, setReply }: ChatInputProps) {
|
||||||
onKeyUp={handleCursorChange}
|
onKeyUp={handleCursorChange}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
onClick={handleCursorChange}
|
onClick={handleCursorChange}
|
||||||
dangerouslySetInnerHTML={{ __html: clearComponent }}
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: disabled
|
||||||
|
? "You need to join this community to send messages"
|
||||||
|
: clearComponent,
|
||||||
|
}}
|
||||||
|
className={`${disabled && "disabled"} `}
|
||||||
/>
|
/>
|
||||||
{query && (
|
{query && (
|
||||||
<SearchBlock
|
<SearchBlock
|
||||||
|
@ -280,13 +285,14 @@ export function ChatInput({ reply, setReply }: ChatInputProps) {
|
||||||
setShowEmoji(!showEmoji);
|
setShowEmoji(!showEmoji);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
<EmojiIcon isActive={showEmoji} />
|
<EmojiIcon isActive={showEmoji} />
|
||||||
</ChatButton>
|
</ChatButton>
|
||||||
<ChatButton>
|
<ChatButton disabled={disabled}>
|
||||||
<StickerIcon />
|
<StickerIcon />
|
||||||
</ChatButton>
|
</ChatButton>
|
||||||
<ChatButton>
|
<ChatButton disabled={disabled}>
|
||||||
<GifIcon />
|
<GifIcon />
|
||||||
</ChatButton>
|
</ChatButton>
|
||||||
</InputButtons>
|
</InputButtons>
|
||||||
|
@ -363,12 +369,14 @@ const Input = styled.div`
|
||||||
color: ${({ theme }) => theme.primary};
|
color: ${({ theme }) => theme.primary};
|
||||||
border-radius: 16px 16px 4px 16px;
|
border-radius: 16px 16px 4px 16px;
|
||||||
outline: none;
|
outline: none;
|
||||||
font-family: "Inter";
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: normal;
|
|
||||||
|
|
||||||
${textMediumStyles};
|
${textMediumStyles};
|
||||||
|
|
||||||
|
&.disabled {
|
||||||
|
color: ${({ theme }) => theme.secondary};
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
outline: none;
|
outline: none;
|
||||||
caret-color: ${({ theme }) => theme.notificationColor};
|
caret-color: ${({ theme }) => theme.notificationColor};
|
||||||
|
@ -390,6 +398,7 @@ const Input = styled.div`
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: ${({ theme }) => theme.mentionBgHover};
|
background: ${({ theme }) => theme.mentionBgHover};
|
||||||
|
cursor: default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -416,6 +425,10 @@ const AddPictureInput = styled.input`
|
||||||
const ChatButton = styled.button`
|
const ChatButton = styled.button`
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const CloseButton = styled(ChatButton)`
|
const CloseButton = styled(ChatButton)`
|
||||||
|
@ -423,6 +436,7 @@ const CloseButton = styled(ChatButton)`
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const ReplyWrapper = styled.div`
|
const ReplyWrapper = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import React, { useState } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
import { useActivities } from "../../contexts/activityProvider";
|
import { useActivities } from "../../contexts/activityProvider";
|
||||||
|
import { useIdentity } from "../../contexts/identityProvider";
|
||||||
import { useMessengerContext } from "../../contexts/messengerProvider";
|
import { useMessengerContext } from "../../contexts/messengerProvider";
|
||||||
import { useNarrow } from "../../contexts/narrowProvider";
|
import { useNarrow } from "../../contexts/narrowProvider";
|
||||||
import { ActivityCenter } from "../ActivityCenter";
|
import { ActivityCenter } from "../ActivityCenter";
|
||||||
|
@ -36,7 +37,7 @@ export function ChatTopbarLoading() {
|
||||||
<MoreIcon />
|
<MoreIcon />
|
||||||
</TopBtn>
|
</TopBtn>
|
||||||
<ActivityWrapper>
|
<ActivityWrapper>
|
||||||
<TopBtn>
|
<TopBtn disabled>
|
||||||
<ActivityIcon />
|
<ActivityIcon />
|
||||||
</TopBtn>
|
</TopBtn>
|
||||||
</ActivityWrapper>
|
</ActivityWrapper>
|
||||||
|
@ -66,6 +67,8 @@ export function ChatTopbar({
|
||||||
const narrow = useNarrow();
|
const narrow = useNarrow();
|
||||||
const [showChannelMenu, setShowChannelMenu] = useState(false);
|
const [showChannelMenu, setShowChannelMenu] = useState(false);
|
||||||
const [showActivityCenter, setShowActivityCenter] = useState(false);
|
const [showActivityCenter, setShowActivityCenter] = useState(false);
|
||||||
|
const identity = useIdentity();
|
||||||
|
const disabled = useMemo(() => !identity, [identity]);
|
||||||
|
|
||||||
if (!activeChannel) {
|
if (!activeChannel) {
|
||||||
return <ChatTopbarLoading />;
|
return <ChatTopbarLoading />;
|
||||||
|
@ -108,7 +111,10 @@ export function ChatTopbar({
|
||||||
<MoreIcon />
|
<MoreIcon />
|
||||||
</TopBtn>
|
</TopBtn>
|
||||||
<ActivityWrapper>
|
<ActivityWrapper>
|
||||||
<TopBtn onClick={() => setShowActivityCenter(!showActivityCenter)}>
|
<TopBtn
|
||||||
|
onClick={() => setShowActivityCenter(!showActivityCenter)}
|
||||||
|
disabled={disabled}
|
||||||
|
>
|
||||||
<ActivityIcon />
|
<ActivityIcon />
|
||||||
{activities.length > 0 && (
|
{activities.length > 0 && (
|
||||||
<NotificationBagde
|
<NotificationBagde
|
||||||
|
@ -229,6 +235,10 @@ export const TopBtn = styled.button`
|
||||||
&:active {
|
&:active {
|
||||||
background: ${({ theme }) => theme.sectionBackgroundColor};
|
background: ${({ theme }) => theme.sectionBackgroundColor};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const NotificationBagde = styled.div`
|
const NotificationBagde = styled.div`
|
||||||
|
|
Loading…
Reference in New Issue