Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge Staging to Production #2699

Merged
merged 98 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
3d5e890
enable advanced settings for spaces editing
andreymikhadyuk Apr 9, 2024
b889c38
add feature flag for updating roles
andreymikhadyuk Apr 9, 2024
470912c
create basic advanced settings confirmation modal
andreymikhadyuk Apr 9, 2024
fea2bf6
image gallery improvments
roienatan Apr 10, 2024
fbee94e
.
roienatan Apr 10, 2024
a6c018e
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk Apr 11, 2024
f0e6f82
create types for preview circles update request
andreymikhadyuk Apr 11, 2024
f64a249
add the logic to form payload for circle update preview request
andreymikhadyuk Apr 11, 2024
88c4595
add changes displaying
andreymikhadyuk Apr 11, 2024
3b40c48
create utils for payload and circle changes generation
andreymikhadyuk Apr 11, 2024
eb28dc1
add circles update logic
andreymikhadyuk Apr 11, 2024
b641a83
add confirmation checkbox
andreymikhadyuk Apr 11, 2024
b34455c
add correct check for circle type
andreymikhadyuk Apr 11, 2024
c743052
updates
roienatan Apr 11, 2024
90f8324
update generation of circle changes
andreymikhadyuk Apr 15, 2024
533c38e
pass initial circles to preview generation function
andreymikhadyuk Apr 15, 2024
465f537
link preview implementation
budnik9 Apr 15, 2024
18dab7d
remove modal padding in mobile
roienatan Apr 16, 2024
c6115f0
.
roienatan Apr 16, 2024
e6460ea
.
roienatan Apr 16, 2024
5366fd1
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk Apr 22, 2024
ed6b806
remove circle type
andreymikhadyuk Apr 22, 2024
e9402f1
move project governance fetch to ProjectCreation component
andreymikhadyuk Apr 22, 2024
6f831df
remove rest circle type logic
andreymikhadyuk Apr 22, 2024
f366892
remove advancedSettings field from Project model
andreymikhadyuk Apr 22, 2024
022957f
update initial "selected" circle state
andreymikhadyuk Apr 22, 2024
68c4821
use correct circles to calculate existing circles
andreymikhadyuk Apr 22, 2024
a2d668c
use different advanced circles synced field logic during editing
andreymikhadyuk Apr 22, 2024
ca0f105
fix memoization of roles
andreymikhadyuk Apr 22, 2024
08c5421
update parent roles usage for advanced settings
andreymikhadyuk Apr 22, 2024
f47de4d
display correct text for empty changes list
andreymikhadyuk Apr 22, 2024
bb5fe3b
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk Apr 22, 2024
7c29eb5
update inherit circle id field usage
andreymikhadyuk Apr 25, 2024
a7c2f22
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk Apr 25, 2024
dac958f
create cache for chat channel messages
andreymikhadyuk Apr 25, 2024
5e60b48
refactor update and remove chat channel messages logic
andreymikhadyuk Apr 25, 2024
81fefda
fix chat channel messages subscription
andreymikhadyuk Apr 25, 2024
d86478c
pass chat channel id to useChatMessages
andreymikhadyuk Apr 25, 2024
05367f2
save only 20 last chat messages through redux persist
andreymikhadyuk Apr 25, 2024
88d907e
add isBatchLoading field to chat messages data
andreymikhadyuk Apr 25, 2024
9666d16
Merge pull request #2689 from daostack/feature/optimize-chat-channels…
andreymikhadyuk Apr 29, 2024
ee45b76
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk Apr 29, 2024
e194056
update displaying of preview link
andreymikhadyuk Apr 29, 2024
a8e4515
hide link preview when files are attached
andreymikhadyuk Apr 29, 2024
9ebd06f
add basic logic for preview data loading
andreymikhadyuk Apr 29, 2024
1980260
create useLinkPreviewData hook
andreymikhadyuk Apr 29, 2024
aa56018
add link preview data state to ChatComponent
andreymikhadyuk Apr 29, 2024
a71a38c
reset link preview even in loading state
andreymikhadyuk Apr 29, 2024
3bae93b
create link preview for sent messages
andreymikhadyuk Apr 29, 2024
a2baf71
import firebase performance
andreymikhadyuk Apr 30, 2024
bd3ec3d
fix redirect after space creation
andreymikhadyuk Apr 30, 2024
18406c2
make link preview in message with full container width
andreymikhadyuk Apr 30, 2024
7a99928
fix width of link preview during creation
andreymikhadyuk Apr 30, 2024
9159f2c
make link preview clickable
andreymikhadyuk Apr 30, 2024
298d572
add basic logic for ai mention
andreymikhadyuk Apr 30, 2024
70ef18c
disable ai user clicks
andreymikhadyuk Apr 30, 2024
b960ed5
display correct avatar and name for bot message
andreymikhadyuk Apr 30, 2024
33d6a4d
add bot photo url to constants
andreymikhadyuk Apr 30, 2024
27df097
Merge pull request #2691 from daostack/feature/ai-chat
andreymikhadyuk Apr 30, 2024
1c78266
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk May 2, 2024
573b116
remove space from ReactWithEmoji components
andreymikhadyuk May 2, 2024
9b23e72
Merge branch 'dev' into feature/link-previews
andreymikhadyuk May 9, 2024
d664fef
fix link preview data fetch
andreymikhadyuk May 9, 2024
db4596a
fix displaying of link preview data
andreymikhadyuk May 9, 2024
41e3dcb
add linkPreviews field to discussion and chat message types
andreymikhadyuk May 9, 2024
52d566a
send link preview during message creation
andreymikhadyuk May 9, 2024
6747f9c
display correct message link preview
andreymikhadyuk May 9, 2024
dd99fa2
fix preview image width
andreymikhadyuk May 9, 2024
4da90f2
add link previews to pending message data
andreymikhadyuk May 9, 2024
97e2e2a
display link preview for chat messages
andreymikhadyuk May 9, 2024
bf4d2da
add error check to isRequestError
andreymikhadyuk May 14, 2024
92240e0
fix memberships removal on common leave
andreymikhadyuk May 14, 2024
4074e03
re-fetch projects on common joining
andreymikhadyuk May 14, 2024
86accac
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk May 14, 2024
5c17a06
use `new` type when changing from unsynced to synced
andreymikhadyuk May 14, 2024
c43cc50
update logic of projects data change on leave or join
andreymikhadyuk May 14, 2024
e0fa22f
leave items without permissions for all users
andreymikhadyuk May 14, 2024
bb80506
add subscription to common member in ProjectFeedItem
andreymikhadyuk May 15, 2024
916d68a
use common member from cache as default value
andreymikhadyuk May 15, 2024
5c140bc
Merge pull request #2686 from daostack/feature/link-previews
andreymikhadyuk May 15, 2024
77b2d1f
Merge branch 'dev' into bugfix/secret-spaces-appearance
andreymikhadyuk May 15, 2024
5808b7c
Merge branch 'dev' into feature/edit-governance-roles
andreymikhadyuk May 15, 2024
4de72cf
Merge pull request #2683 from daostack/image-gallery-improvments
andreymikhadyuk May 20, 2024
a7e385f
Merge branch 'dev' into bugfix/secret-spaces-appearance
andreymikhadyuk May 20, 2024
ba33d88
ignore circle visibility check for project feed items
andreymikhadyuk May 20, 2024
f88733d
allow null as common member subscription data
andreymikhadyuk May 20, 2024
7fba4b9
Merge pull request #2684 from daostack/feature/edit-governance-roles
elatif2020 May 20, 2024
c981198
Merge branch 'dev' into bugfix/secret-spaces-appearance
andreymikhadyuk May 20, 2024
d8f0c44
Merge pull request #2692 from daostack/bugfix/secret-spaces-appearance
andreymikhadyuk May 20, 2024
98d5fcb
Merge pull request #2693 from daostack/dev
elatif2020 May 21, 2024
77950f0
CW-Hotfix-feature-flag Remove usage feature flag hook in non-componen…
MeyerPV May 27, 2024
2ce4420
Merge pull request #2694 from daostack/CW-Hotfix-feature-flag-configu…
MeyerPV May 27, 2024
836e6fb
Merge pull request #2695 from daostack/dev
MeyerPV May 27, 2024
075a410
CW-Message-performance Increase message performance
MeyerPV Jun 3, 2024
358c128
reverted the removal of the overflow-y line
elatif2020 Jun 10, 2024
d079665
Merge pull request #2697 from daostack/CW_fix_chat_scroll_issue
MeyerPV Jun 10, 2024
35cdb79
Merge pull request #2696 from daostack/CW-Message-performance
MeyerPV Jun 10, 2024
fa455b0
Merge pull request #2698 from daostack/dev
MeyerPV Jun 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ $success-300: #6ee569;
$c-input-100: #f9fafa;
$c-light-gray: #f4f5f5;
$c-light-gray-2: #f8f8f8;
$c-light-gray-3: #f4f5f5;
$c-sidebar-shadow: rgba(0, 26, 54, 0.08);
$c-sidebar-user-menu-shadow: rgba(0, 0, 0, 0.15259);
$c-common-card-shadow: rgba(0, 26, 54, 0.08);
Expand All @@ -175,6 +176,8 @@ $split-view-resizer-border-hover-color: rgba(0, 0, 0, 0.5);
$editor-checkbox-inactive: #99999d;
$editor-checkbox-active: #d84ca0;
$chat-checkbox-inactive: #cecece;
$link-my-reply-bg: #943367;
$link-my-reply: #ffa2ea;

/* breakpoints */
$small-laptop: 1366px;
Expand Down
1 change: 1 addition & 0 deletions src/pages/Auth/store/saga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ const resetGlobalData = (fullReset: boolean) => {
store.dispatch(inboxActions.resetInbox());
store.dispatch(cacheActions.resetFeedStates());
store.dispatch(cacheActions.resetDiscussionMessagesStates());
store.dispatch(cacheActions.resetChatChannelMessagesStates());
store.dispatch(commonActions.resetCommon());
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useSelector } from "react-redux";
import classNames from "classnames";
import { selectGovernance } from "@/pages/OldCommon/store/selectors";
import { ProposalsTypes } from "@/shared/constants";
import { AllowedActions, AllowedProposals, CircleType } from "@/shared/models";
import { AllowedActions, AllowedProposals } from "@/shared/models";
import { getTextForProposalType } from "@/shared/utils";
import { generateCirclesBinaryNumber } from "../../utils";
import { getTextForAction, checkShouldRemoveAction } from "./helpers";
Expand All @@ -22,20 +22,17 @@ export default function WhitepaperMembers({ isSubCommon }: Props) {

const members = Object.values(governance?.circles || {})
.slice(0, 5)
.map((circle, index) => {
if (circle?.type !== CircleType.Project)
return (
<li
key={index}
onClick={() => setSelectedMember({ ...circle, index })}
className={classNames({
active: selectedMember?.name === circle.name,
})}
>
{circle.name}
</li>
);
});
.map((circle, index) => (
<li
key={index}
onClick={() => setSelectedMember({ ...circle, index })}
className={classNames({
active: selectedMember?.name === circle.name,
})}
>
{circle.name}
</li>
));

const renderContent = () => {
const circle = Object.values(governance?.circles || {}).filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
getCirclesWithHighestTier,
getFilteredByIdCircles,
getUserName,
removeProjectCircles,
} from "@/shared/utils";
import { selectRecentAssignedCircle } from "@/store/states";
import { UserAvatar, UserInfoPopup } from "../../../../../shared/components";
Expand Down Expand Up @@ -92,10 +91,8 @@ const CommonMember: FC<CommonMemberProps> = ({
}
});

const notMemberCircles = removeProjectCircles(
governanceCircles.filter(
({ id }) => !memberCircles.map((circle) => circle.id).includes(id),
),
const notMemberCircles = governanceCircles.filter(
({ id }) => !memberCircles.map((circle) => circle.id).includes(id),
);

const circlesString = getCirclesWithHighestTier(memberCircles)
Expand Down
43 changes: 23 additions & 20 deletions src/pages/OldCommon/hooks/useCommonMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ export const useCommonMember = (options: Options = {}): Return => {
const dispatch = useDispatch();
const currentLoadingIdRef = useRef("");
const isMounted = useIsMounted();
const [state, setState] = useState<State>({
loading: false,
fetched: false,
data: null,
});
const [missingCirclesError, setMissingCirclesError] = useState(false);
const user = useSelector(selectUser());
const userId = options.userId || user?.uid;
Expand All @@ -94,6 +89,7 @@ export const useCommonMember = (options: Options = {}): Return => {
identificationInfo || { userId: "", commonId: "" },
),
) || DEFAULT_STATE;
const [state, setState] = useState<State>(commonMemberState);
const commonMemberId = state.data?.id;

const fetchCommonMember = useCallback(
Expand Down Expand Up @@ -264,24 +260,31 @@ export const useCommonMember = (options: Options = {}): Return => {
CommonService.subscribeToCommonMemberByCommonIdAndUserId(
commonId,
userId,
(commonMember, { isAdded, isRemoved }) => {
(subscriptionData) => {
try {
let data: State["data"] = null;

if (isAdded) {
CommonEventEmitter.emit(CommonEvent.ProjectUpdated, {
commonId,
hasMembership: true,
});
}
if (!isRemoved) {
data = {
...commonMember,
...generateCirclesDataForCommonMember(
governanceCircles,
commonMember.circleIds,
),
};
if (subscriptionData) {
const {
commonMember,
statuses: { isAdded, isRemoved },
} = subscriptionData;

if (isAdded) {
CommonEventEmitter.emit(CommonEvent.ProjectUpdated, {
commonId,
hasMembership: true,
});
}
if (!isRemoved) {
data = {
...commonMember,
...generateCirclesDataForCommonMember(
governanceCircles,
commonMember.circleIds,
),
};
}
}

const finalState = {
Expand Down
78 changes: 74 additions & 4 deletions src/pages/common/components/ChatComponent/ChatComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@ import { debounce, delay, omit } from "lodash";
import { v4 as uuidv4 } from "uuid";
import { selectUser } from "@/pages/Auth/store/selectors";
import { ChatService, DiscussionMessageService, FileService } from "@/services";
import { Separator } from "@/shared/components";
import {
ChatType,
DiscussionMessageOwnerType,
GovernanceActions,
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 } from "@/shared/hooks";
import {
useZoomDisabling,
useImageSizeCheck,
useQueryParams,
} from "@/shared/hooks";
import { ArrowInCircleIcon, PlusIcon, SendIcon } from "@/shared/icons";
import { LinkPreviewData } from "@/shared/interfaces";
import { CreateDiscussionMessageDto } from "@/shared/interfaces/api/discussionMessages";
import {
ChatChannel,
Expand Down Expand Up @@ -69,9 +76,12 @@ import { ChatContentContext, ChatContentData } from "../CommonContent/context";
import {
ChatContent,
ChatContentRef,
MessageLinkPreview,
MessageReply,
ChatFilePreview,
MessageInfoWithDateList,
} from "./components";
import { checkIsLastSeenInPreviousDay } from "./components/ChatContent/utils";
import { useChatChannelChatAdapter, useDiscussionChatAdapter } from "./hooks";
import { getLastNonUserMessage } from "./utils";
import styles from "./ChatComponent.module.scss";
Expand Down Expand Up @@ -150,6 +160,9 @@ export default function ChatComponent({
onInternalLinkClick,
}: ChatComponentInterface) {
const dispatch = useDispatch();
const queryParams = useQueryParams();
const shouldDisplayMessagesOnlyWithUncheckedItems =
queryParams[QueryParamKey.Unchecked] === "true";
const { checkImageSize } = useImageSizeCheck();
useZoomDisabling();
const editorRef = useRef<HTMLElement>(null);
Expand Down Expand Up @@ -197,7 +210,10 @@ export default function ChatComponent({
markChatChannelAsSeen,
chatUsers,
fetchChatUsers,
} = useChatChannelChatAdapter({ participants: chatChannel?.participants });
} = useChatChannelChatAdapter({
chatChannelId: chatChannel?.id || "",
participants: chatChannel?.participants,
});
const users = chatChannel ? chatUsers : discussionUsers;
const discussionMessages = chatChannel
? chatMessagesData.data
Expand All @@ -207,13 +223,18 @@ export default function ChatComponent({
const areInitialMessagesLoading = isChatChannel
? chatMessagesData.loading
: discussionMessagesData.loading;
const areMessagesLoading = discussionMessagesData.isBatchLoading;
const areMessagesLoading = chatChannel
? chatMessagesData.isBatchLoading
: discussionMessagesData.isBatchLoading;
const currentFilesPreview = useSelector(selectFilesPreview());
const chatContentRef = useRef<ChatContentRef>(null);
const chatWrapperId = useMemo(() => `chat-wrapper-${uuidv4()}`, []);
const chatInputWrapperRef = useRef<HTMLDivElement>(null);
const chatContainerRef = useRef<HTMLDivElement>(null);
const [isScrolling, setIsScrolling] = useState(false);
const [linkPreviewData, setLinkPreviewData] = useState<
LinkPreviewData | null | undefined
>();
const chatContentContextValue: ChatContentData = useMemo(
() => ({
isScrolling,
Expand Down Expand Up @@ -279,7 +300,43 @@ export default function ChatComponent({
),
[discussionMessages],
);
const dateList = useMemo(() => Object.keys(messages), [messages]);

const dateList: MessageInfoWithDateList = useMemo(() => {
const messagesDates = Object.keys(messages);
const messagesWithInfo = messagesDates.map((day, dayIndex) => {
const date = new Date(Number(day));
const currentMessages = shouldDisplayMessagesOnlyWithUncheckedItems
? messages[Number(day)].filter((message) => message.hasUncheckedItems)
: messages[Number(day)];
const previousDayMessages =
messages[Number(messagesDates[dayIndex + 1])] || [];
const isLastSeenInPreviousDay = checkIsLastSeenInPreviousDay(
previousDayMessages,
lastSeenItem?.id,
);
const isMyMessageFirst =
checkIsUserDiscussionMessage(currentMessages[0]) &&
currentMessages[0].ownerId === userId;
const newSeparatorEl = (
<li>
<Separator>New</Separator>
</li>
);

return {
day,
date,
currentMessages,
isLastSeenInPreviousDay,
isMyMessageFirst,
newSeparatorEl,
};
});

return messagesWithInfo;
}, [messages]);

// const dateListWith

const [newMessages, setMessages] = useState<
CreateDiscussionMessageDtoWithFilesPreview[]
Expand Down Expand Up @@ -338,6 +395,7 @@ export default function ChatComponent({
hasUncheckedItems: checkUncheckedItemsInTextEditorValue(
parseStringToTextEditorValue(payload.text),
),
linkPreviews: payload.linkPreviews,
});
chatMessagesData.updateChatMessage(response);

Expand Down Expand Up @@ -442,6 +500,12 @@ export default function ChatComponent({
tags: mentionTags,
mentions: mentionTags.map((tag) => tag.value),
hasUncheckedItems: checkUncheckedItemsInTextEditorValue(message),
linkPreviews:
typeof linkPreviewData === "undefined"
? undefined
: linkPreviewData
? [linkPreviewData]
: [],
};

const filePreviewPayload: CreateDiscussionMessageDtoWithFilesPreview[] =
Expand Down Expand Up @@ -512,6 +576,7 @@ export default function ChatComponent({
),
tags: mentionTags,
hasUncheckedItems: checkUncheckedItemsInTextEditorValue(message),
linkPreviews: payload.linkPreviews,
});
}

Expand Down Expand Up @@ -557,6 +622,7 @@ export default function ChatComponent({
discussionId,
discussionMessages,
isChatChannel,
linkPreviewData,
],
);

Expand Down Expand Up @@ -847,6 +913,10 @@ export default function ChatComponent({
</div>
)}
<MessageReply users={users} />
<MessageLinkPreview
message={message}
onLinkPreviewDataChange={setLinkPreviewData}
/>
<ChatFilePreview />
<div
ref={chatInputWrapperRef}
Expand Down
Loading
Loading