Skip to content

Commit

Permalink
Merge tag 'tags/v3.1.0' into release/v3.1.0
Browse files Browse the repository at this point in the history
chore(release): 3.1.0

# Conflicts:
#	.eslintignore
#	.github/workflows/dev.yaml
#	.github/workflows/production.yaml
#	.github/workflows/staging.yaml
#	.github/workflows/teardown.yaml
#	.github/workflows/testing.yaml
#	.husky/pre-commit
#	.npmrc
#	CHANGELOG.md
#	code-of-conduct.md
#	package.json
#	pnpm-lock.yaml
#	readme.md
#	security.md
#	src/chat/components/Chat/index.tsx
#	src/chat/components/ChatDetails/ChatDetailsControls/styles.tsx
#	src/chat/components/ChatDetails/ChatDetailsMembers/styles.tsx
#	src/chat/components/ChatDetails/styles.tsx
#	src/chat/components/ChatHeader/styles.tsx
#	src/chat/components/Message/styles.tsx
#	src/chat/components/MessageComposeBar/styles.tsx
#	src/chat/components/RecentChat/styles.tsx
#	src/chat/pages/Application/index.tsx
#	src/core/components/Avatar/AvatarUpload.tsx
#	src/core/components/Dropdown/index.tsx
#	src/core/components/Files/File.tsx
#	src/core/components/Files/styles.tsx
#	src/core/components/InputCounter/styles.tsx
#	src/core/components/Layout/styles.tsx
#	src/core/components/Modal/styles.tsx
#	src/core/components/Notification/styles.tsx
#	src/core/components/OptionMenu/styles.tsx
#	src/core/components/Select/index.tsx
#	src/core/components/Uploaders/File/StyledFile.tsx
#	src/core/components/Uploaders/File/styles.tsx
#	src/core/components/Uploaders/Image/styles.tsx
#	src/core/components/Uploaders/Video/styles.tsx
#	src/core/components/UserChip/styles.tsx
#	src/social/components/Comment/styles.tsx
#	src/social/components/CommentLikeButton/styles.tsx
#	src/social/components/CommunityForm/AvatarUploader.tsx
#	src/social/components/CommunityForm/styles.tsx
#	src/social/components/CommunityInfo/styles.tsx
#	src/social/components/EmptyFeed/index.tsx
#	src/social/components/EngagementBar/styles.tsx
#	src/social/components/Feed/styles.tsx
#	src/social/components/ImageGallery/styles.tsx
#	src/social/components/Images/styles.tsx
#	src/social/components/LoadMore/styles.jsx
#	src/social/components/LoadMoreWrapper/styles.tsx
#	src/social/components/MediaGallery/index.tsx
#	src/social/components/PrivateFeed/styles.tsx
#	src/social/components/ProfileSettings/styles.tsx
#	src/social/components/SideSectionCommunity/index.tsx
#	src/social/components/SocialSearch/styles.tsx
#	src/social/components/UserInfo/styles.tsx
#	src/social/components/category/CategoryChip/UICategoryChip.tsx
#	src/social/components/category/CategoryChip/styles.tsx
#	src/social/components/community/Name/styles.tsx
#	src/social/components/post/Creator/components/PostTargetSelector.tsx
#	src/social/components/post/Editor/usePostEditor.ts
#	src/social/components/post/GalleryContent/StyledStreamItem.tsx
#	src/social/components/post/GalleryContent/VideoItem.tsx
#	src/social/components/post/LikeButton/styles.tsx
#	src/social/hooks/useReport.ts
#	src/social/pages/CommunityEdit/styles.tsx
  • Loading branch information
bonanaaaaaa committed Jan 26, 2024
2 parents de1163e + d3444d9 commit a2a94bf
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@fortawesome:registry=https://registry.npmjs.org
@fortawesome:registry=https://registry.npmjs.org
23 changes: 18 additions & 5 deletions src/chat/components/Chat/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import React, { useEffect } from 'react';
import { MessageRepository, ChannelRepository, SubChannelRepository } from '@amityco/ts-sdk';
import {
MessageRepository,
ChannelRepository,
SubChannelRepository,
CommunityRepository,
} from '@amityco/ts-sdk';

import MessageList from '~/chat/components/MessageList';
import MessageComposeBar from '~/chat/components/MessageComposeBar';
Expand All @@ -8,6 +13,8 @@ import ChatHeader from '~/chat/components/ChatHeader';

import { ChannelContainer } from './styles';
import { useCustomComponent } from '~/core/providers/CustomComponentsProvider';
import useChannel from '~/chat/hooks/useChannel';
import useChannelMembers from '~/chat/hooks/useChannelMembers';

interface ChatProps {
channelId: string;
Expand All @@ -16,17 +23,23 @@ interface ChatProps {
}

const Chat = ({ channelId, onChatDetailsClick, shouldShowChatDetails }: ChatProps) => {
const channel = useChannel(channelId);
useEffect(() => {
async function run() {
await ChannelRepository.joinChannel(channelId);
if (channel == null) return;

await SubChannelRepository.startReading(channelId);
if (channel.type !== 'conversation') {
await ChannelRepository.joinChannel(channel?.channelId);
}

await SubChannelRepository.startReading(channel?.channelId);
}
run();
return () => {
SubChannelRepository.stopReading(channelId);
if (channel == null) return;
SubChannelRepository.stopReading(channel?.channelId);
};
}, [channelId]);
}, [channel]);

const sendMessage = async (text: string) => {
return MessageRepository.createMessage({
Expand Down
4 changes: 4 additions & 0 deletions src/chat/pages/Application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ const ChatApplication = ({
}

startUnreadSync();

return () => {
ASCClient.stopUnreadSync();
};
}, []);

useEffect(() => {
Expand Down
6 changes: 3 additions & 3 deletions src/social/components/MediaGallery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ const MediaGallery = ({ targetId, targetType }: MediaGalleryProps) => {
loading={isLoading}
loadingMore={loadMoreHasBeenCalled}
renderVideoThumbnail={(item) => (
<VideoItem.Thumbnail {...item} showPlayIcon showVideoDuration />
<VideoItem.Thumbnail item={item} showPlayIcon showVideoDuration />
)}
renderLiveStreamThumbnail={(item) => (
<StreamItem.Thumbnail
{...item}
item={item}
showPlayIcon
showLivestreamTitle
showVideoDuration
showLivestreamRecordedBadge
/>
)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/social/components/post/Editor/usePostEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const usePostEditor = ({ postId, onSave }: { postId?: string; onSave: ()
onSave();
};

const isEmpty = useMemo(() => text?.trim() === '' && !childrenPosts.length, [text]);
const isEmpty = text?.trim() === '' && !childrenPosts.length;

const childFilePosts = useMemo(
() => childrenPosts.filter((childPost) => childPost.dataType === 'file'),
Expand Down
6 changes: 3 additions & 3 deletions src/social/components/post/GalleryContent/VideoItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ interface ItemProps {
}

export const Item = ({ item }: ItemProps) => {
const fileId =
const videoFileId =
item?.data.videoFileId.high ||
item?.data.videoFileId.medium ||
item?.data.videoFileId.low ||
item?.data.videoFileId.original;

if (!fileId) {
if (!videoFileId) {
return (
<VideoContainer>
<VideoPlayer>
Expand All @@ -43,5 +43,5 @@ export const Item = ({ item }: ItemProps) => {
);
}

return <Video fileId={fileId} mediaFit="contain" noBorder />;
return <Video fileId={videoFileId} mediaFit="contain" noBorder />;
};

0 comments on commit a2a94bf

Please sign in to comment.