Skip to content

Commit

Permalink
Merge pull request #2714 from daostack/staging
Browse files Browse the repository at this point in the history
Sprint 38 to Production
  • Loading branch information
MeyerPV authored Jul 10, 2024
2 parents 6e54820 + 98aab31 commit 335286b
Show file tree
Hide file tree
Showing 35 changed files with 874 additions and 547 deletions.
12 changes: 12 additions & 0 deletions craco.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
const CracoAlias = require("craco-alias");

module.exports = {
webpack: {
configure: (webpackConfig, { env, paths }) => {
const reactAppEnv = process.env.REACT_APP_ENV;
if (reactAppEnv === "dev" || reactAppEnv === "stage") {
webpackConfig.optimization.minimize = false;
webpackConfig.devtool = "source-map";
} else {
webpackConfig.devtool = false;
}
return webpackConfig;
},
},
style: {
css: {
loaderOptions: () => ({
Expand Down
6 changes: 3 additions & 3 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"short_name": "Common.io",
"name": "Common.io",
"icons": [
{
"src": "favicon.ico",
Expand Down Expand Up @@ -38,7 +38,7 @@
"sizes": "512x512"
}
],
"start_url": ".",
"start_url": "./inbox",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
Expand Down
5 changes: 3 additions & 2 deletions src/pages/OldCommon/hooks/useCommonMembers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback, useRef, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { CommonService, Logger, UserService } from "@/services";
import { store } from "@/shared/appConfig";
Expand All @@ -9,6 +9,7 @@ import {
selectCommonMembersStateByCommonId,
selectUserStates,
} from "@/store/states";
import { useDeepCompareEffect } from "react-use";

interface Options {
commonId?: string;
Expand Down Expand Up @@ -93,7 +94,7 @@ export const useCommonMembers = ({ commonId }: Options): Return => {
[dispatch, commonId],
);

useEffect(() => {
useDeepCompareEffect(() => {
const commonMembers = commonMembersState.data;

if (!commonMembers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,59 +50,6 @@
align-items: flex-end;
}

.messageInput {
width: 100%;
min-height: 2.625rem;
line-height: 1.5rem;
border-radius: 1.25rem;
background-color: var(--secondary-background);
border: 0.0625rem solid var(--gentle-stroke);
outline: none;
resize: none;
font-size: 0.875rem;
color: var(--primary-text);
box-sizing: border-box;
text-align: left;
display: flex;
flex-direction: column;
justify-content: center;
word-break: break-word;
padding: 0.125rem 2.5rem 0.125rem 0.75rem;
margin: 0.3rem 0;
overflow-x: hidden;
min-height: 2.625rem !important;
}

.messageInputRtl {
padding: 0.125rem 2.5rem 0.125rem 0.75rem;
}

.messageInputEmpty {
padding-left: 0.75rem;
overflow-x: hidden;
}

.addFilesIcon {
margin-bottom: 0.8rem;
margin-right: 0.5rem;
height: 1.5rem;
color: var(--primary-text);
}

.sendIcon {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 0.8rem;
border: none;
outline: none;
background: transparent;

&:disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
$phone-breakpoint: 415px;

.container {
Expand Down
104 changes: 23 additions & 81 deletions src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ import {
LastSeenEntity,
QueryParamKey,
} from "@/shared/constants";
import { FILES_ACCEPTED_EXTENSIONS } from "@/shared/constants";
import { HotKeys } from "@/shared/constants/keyboardKeys";
import { ChatMessageToUserDiscussionMessageConverter } from "@/shared/converters";
import {
useZoomDisabling,
useImageSizeCheck,
useQueryParams,
} from "@/shared/hooks";
import { ArrowInCircleIcon, PlusIcon, SendIcon } from "@/shared/icons";
import { ArrowInCircleIcon } from "@/shared/icons";
import { LinkPreviewData } from "@/shared/interfaces";
import { CreateDiscussionMessageDto } from "@/shared/interfaces/api/discussionMessages";
import {
Expand All @@ -47,24 +46,16 @@ import {
UserDiscussionMessage,
} from "@/shared/models";
import {
BaseTextEditor,
TextEditorValue,
getMentionTags,
parseStringToTextEditorValue,
ButtonIcon,
checkIsTextEditorValueEmpty,
TextEditorSize,
removeTextEditorEmptyEndLinesValues,
countTextEditorEmojiElements,
} from "@/shared/ui-kit";
import { checkUncheckedItemsInTextEditorValue } from "@/shared/ui-kit/TextEditor/utils";
import { InternalLinkData, notEmpty } from "@/shared/utils";
import {
emptyFunction,
getUserName,
hasPermission,
isMobile,
} from "@/shared/utils";
import { getUserName, hasPermission, isMobile } from "@/shared/utils";
import {
cacheActions,
chatActions,
Expand All @@ -80,6 +71,7 @@ import {
MessageReply,
ChatFilePreview,
MessageInfoWithDateList,
ChatInput,
} from "./components";
import { checkIsLastSeenInPreviousDay } from "./components/ChatContent/utils";
import { useChatChannelChatAdapter, useDiscussionChatAdapter } from "./hooks";
Expand Down Expand Up @@ -336,8 +328,6 @@ export default function ChatComponent({
return messagesWithInfo;
}, [messages]);

// const dateListWith

const [newMessages, setMessages] = useState<
CreateDiscussionMessageDtoWithFilesPreview[]
>([]);
Expand Down Expand Up @@ -761,73 +751,6 @@ export default function ChatComponent({
};
}, []);

const renderChatInput = (): ReactNode => {
if (shouldHideChatInput) {
return null;
}
if (!isChatChannel) {
const chatInputEl = renderChatInputOuter?.();

if (chatInputEl || chatInputEl === null) {
return chatInputEl;
}
}
if (!isAuthorized) {
return null;
}

return (
<>
<ButtonIcon
className={styles.addFilesIcon}
onClick={() => {
document.getElementById("file")?.click();
}}
>
<PlusIcon />
</ButtonIcon>
<input
id="file"
type="file"
onChange={uploadFiles}
style={{ display: "none" }}
multiple
accept={FILES_ACCEPTED_EXTENSIONS}
/>
<BaseTextEditor
inputContainerRef={inputContainerRef}
size={TextEditorSize.Auto}
editorRef={editorRef}
className={classNames(styles.messageInput, {
[styles.messageInputEmpty]: checkIsTextEditorValueEmpty(message),
})}
classNameRtl={styles.messageInputRtl}
elementStyles={{
emoji: classNames({
[styles.singleEmojiText]: emojiCount.isSingleEmoji,
[styles.multipleEmojiText]: emojiCount.isMultipleEmoji,
}),
}}
value={message}
onChange={setMessage}
placeholder="Message"
onKeyDown={onEnterKeyDown}
users={users}
shouldReinitializeEditor={shouldReinitializeEditor}
onClearFinished={onClearFinished}
scrollSelectionIntoView={emptyFunction}
/>
<button
className={styles.sendIcon}
onClick={sendChatMessage}
disabled={!canSendMessage}
>
<SendIcon />
</button>
</>
);
};

const { y } = useScroll(chatContainerRef);
const isScrolledToTop = Boolean(chatContainerRef.current && Math.abs(y) > 20);

Expand Down Expand Up @@ -924,7 +847,26 @@ export default function ChatComponent({
[styles.chatInputWrapperMultiLine]: isMultiLineInput,
})}
>
{renderChatInput()}
<ChatInput
onClearFinished={onClearFinished}
shouldReinitializeEditor={shouldReinitializeEditor}
users={users}
onEnterKeyDown={onEnterKeyDown}
emojiCount={emojiCount}
setMessage={setMessage}
message={message}
uploadFiles={uploadFiles}
isAuthorized={isAuthorized}
renderChatInputOuter={
renderChatInputOuter as () => React.ReactElement
}
isChatChannel={isChatChannel}
shouldHideChatInput={shouldHideChatInput}
sendChatMessage={sendChatMessage}
canSendMessage={Boolean(canSendMessage)}
inputContainerRef={inputContainerRef}
editorRef={editorRef}
/>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
@import "../../../../../../constants.scss";
@import "../../../../../../styles/sizes";

.messageInput {
width: 100%;
min-height: 2.625rem;
line-height: 1.5rem;
border-radius: 1.25rem;
background-color: var(--secondary-background);
border: 0.0625rem solid var(--gentle-stroke);
outline: none;
resize: none;
font-size: 0.875rem;
color: var(--primary-text);
box-sizing: border-box;
text-align: left;
display: flex;
flex-direction: column;
justify-content: center;
word-break: break-word;
padding: 0.125rem 2.5rem 0.125rem 0.75rem;
margin: 0.3rem 0;
overflow-x: hidden;
min-height: 2.625rem !important;
}

.messageInputRtl {
padding: 0.125rem 2.5rem 0.125rem 0.75rem;
}

.messageInputEmpty {
padding-left: 0.75rem;
overflow-x: hidden;
}

.addFilesIcon {
margin-bottom: 0.8rem;
margin-right: 0.5rem;
height: 1.5rem;
color: var(--primary-text);
}

.sendIcon {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 0.8rem;
border: none;
outline: none;
background: transparent;

&:disabled {
cursor: not-allowed;
opacity: 0.5;
}
}
$phone-breakpoint: 415px;

.singleEmojiText {
font-size: $xlarge;
line-height: 2.8125rem;
}

.multipleEmojiText {
font-size: $large;
line-height: 2.125rem;
}

.singleEmojiText {
font-size: $xlarge;
}

.multipleEmojiText {
font-size: $large;
}
Loading

0 comments on commit 335286b

Please sign in to comment.