Skip to content

Commit a7a49ff

Browse files
Merge branch 'alpha' into SDK-1310-space-id
2 parents b37d3bc + 06254e6 commit a7a49ff

File tree

8 files changed

+59
-22
lines changed

8 files changed

+59
-22
lines changed

packages/examples/sdk-frontend-react/src/app/ChatUITest/ChatPreview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const ChatPreviewTest = () => {
5555
"Well, hello there, human! It's a pleasure to be in the presence of such a sophisticated carbon-based life form. How can I assist you today? Or perhaps you just want to chat and bask in the glory of my witty remarks? Either way, I'm here for you!",
5656
},
5757
}}
58-
badge={{ count: 1 }}
58+
badge={{ count: 2 }}
5959
selected={false}
6060
setSelected={console.log('Selected')}
6161
/>

packages/uiweb/src/lib/components/chat/ChatPreview/ChatPreview.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { pCAIP10ToWallet } from '../../../helpers';
1717
import { createBlockie } from '../../../helpers/blockies';
1818
import { IChatTheme } from '../theme';
1919
import { ThemeContext } from '../theme/ThemeProvider';
20+
import { pushBotAddress } from '../../../config/constants';
2021
/**
2122
* @interface IThemeProps
2223
* this interface is used for defining the props for styled components
@@ -50,6 +51,10 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
5051
})();
5152
}, []);
5253

54+
const hasBadgeCount = !!options?.badge?.count;
55+
const isSelected = options?.selected;
56+
const isBot = options?.chatPreviewPayload?.chatParticipant === "PushBot" || options?.chatPreviewPayload?.chatParticipant === pushBotAddress;
57+
5358
// For blockie if icon is missing
5459
const blockieContainerRef = useRef<HTMLDivElement>(null);
5560

@@ -159,6 +164,7 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
159164
flex="initial"
160165
cursor="pointer"
161166
className={options.readmode ? 'skeleton' : ''}
167+
animation={theme.skeletonBG}
162168
>
163169
<Message theme={theme}>
164170
{options?.chatPreviewPayload?.chatMsg?.messageType === 'Image' ||
@@ -193,8 +199,9 @@ export const ChatPreview: React.FC<IChatPreviewProps> = (options: IChatPreviewPr
193199
options?.chatPreviewPayload?.chatMsg?.messageContent
194200
)}
195201
</Message>
196-
{!!options?.badge?.count && <Badge theme={theme}>{options.badge.count}</Badge>}
197-
</Section>
202+
203+
{hasBadgeCount && !(isBot || (isSelected && hasBadgeCount)) && <Badge theme={theme}>{options.badge?.count}</Badge>}
204+
</Section>
198205
</Section>
199206
</Button>
200207
</ChatPreviewContainer>

packages/uiweb/src/lib/components/chat/ChatViewList/ChatViewList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (options: IChatViewLis
294294
}
295295

296296
return () => {
297-
//empty return
297+
// add comment
298298
};
299299
}, [chatAcceptStream, participantJoinStream]);
300300

@@ -587,5 +587,5 @@ const ChatViewListCard = styled(Section)<IThemeProps>`
587587
`;
588588

589589
const ChatViewListCardInner = styled(Section)<IThemeProps>`
590-
filter: ${(props) => (props.blur ? 'blur(6px)' : 'none')};
590+
filter: ${(props) => (props.blur ? 'blur(12px)' : 'none')};
591591
`;

packages/uiweb/src/lib/components/chat/ChatViewList/MessageEncryption.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const EncryptionMessage = ({ id, className }: { id: EncryptionKeys; class
6868
fontWeight="400"
6969
textAlign="left"
7070
className={className}
71+
animation={theme.skeletonBG}
7172
>
7273
{EncryptionMessageContent[id].text}
7374
</Span>

packages/uiweb/src/lib/components/chat/reusables/ProfileContainer.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const ProfileContainer = ({ theme, member, copy, customStyle, loading }:
7373
borderRadius="100%"
7474
overflow="hidden"
7575
className={loading ? 'skeleton' : ''}
76+
animation={theme.skeletonBG}
7677
>
7778
{member?.icon && (
7879
<Image
@@ -131,6 +132,7 @@ export const ProfileContainer = ({ theme, member, copy, customStyle, loading }:
131132
setCopyText('Copied');
132133
}}
133134
className={loading ? 'skeleton' : ''}
135+
animation={theme.skeletonBG}
134136
>
135137
<RecipientSpan
136138
fontSize={member?.name || member?.web3Name ? '14px' : customStyle?.fontSize ?? '18px'}

packages/uiweb/src/lib/components/chat/theme/index.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* @file theme file: all the predefined themes are defined here
33
*/
44
import { CHAT_THEME_OPTIONS } from '../exportedTypes';
5+
import styled, { keyframes, css } from 'styled-components';
56
// bgColorPrimary: "#fff",
67
// bgColorSecondary: "#D53A94",
78
// textColorPrimary: "#1e1e1e",
@@ -191,10 +192,38 @@ export interface IChatTheme {
191192
textColor?: ITextColor;
192193
backdropFilter?: string;
193194
scrollbarColor?: string;
194-
195+
skeletonBG?: any;
195196
spinnerColor?: string;
196197
}
197198

199+
const lightSkeletonLoading = keyframes`
200+
0% {
201+
background-color: hsl(200, 20%, 80%);
202+
}
203+
100% {
204+
background-color: hsl(200, 20%, 95%);
205+
}
206+
`;
207+
208+
const darkSkeletonLoading = keyframes`
209+
0% {
210+
background-color: #575D73;
211+
}
212+
100% {
213+
background-color: #6E748B;
214+
}
215+
`;
216+
217+
const animation = () =>
218+
css`
219+
${lightSkeletonLoading} 1s linear infinite alternate;
220+
`;
221+
222+
const darkAnimation = () =>
223+
css`
224+
${darkSkeletonLoading} 1s linear infinite alternate;
225+
`;
226+
198227
//dark theme object
199228
export const lightChatTheme: IChatTheme = {
200229
borderRadius: {
@@ -368,6 +397,7 @@ export const lightChatTheme: IChatTheme = {
368397
backdropFilter: 'none',
369398
spinnerColor: 'rgb(202, 89, 155)',
370399
scrollbarColor: 'rgb(202, 89, 155)',
400+
skeletonBG: animation
371401
};
372402

373403
export const darkChatTheme: IChatTheme = {
@@ -541,4 +571,5 @@ export const darkChatTheme: IChatTheme = {
541571
backdropFilter: 'none',
542572
spinnerColor: 'rgb(202, 89, 155)',
543573
scrollbarColor: 'rgb(202, 89, 155)',
574+
skeletonBG: darkAnimation
544575
};

packages/uiweb/src/lib/components/reusables/sharedStyling.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
1-
import styled, { keyframes } from 'styled-components';
1+
import styled from 'styled-components';
22

3-
// Define keyframes
4-
const skeletonLoading = keyframes`
5-
0% {
6-
background-color: hsl(200, 20%, 80%);
7-
}
8-
100% {
9-
background-color: hsl(200, 20%, 95%);
10-
}
11-
`;
123

134
// Define types and export components
145
type SectionStyleProps = {
@@ -45,6 +36,7 @@ type SectionStyleProps = {
4536
visibility?: string;
4637
zIndex?: string;
4738
fontSize?: string;
39+
animation?: string;
4840
};
4941

5042
export const Section = styled.div<SectionStyleProps>`
@@ -84,7 +76,7 @@ export const Section = styled.div<SectionStyleProps>`
8476
8577
&.skeleton {
8678
> * {
87-
visibility: ${(props) => (props.visibility || skeletonLoading ? 'hidden' : 'visible')};
79+
visibility: ${(props) => (props.visibility || props.animation ? 'hidden' : 'visible')};
8880
}
8981
9082
&:after {
@@ -95,7 +87,7 @@ export const Section = styled.div<SectionStyleProps>`
9587
left: 0;
9688
right: 0;
9789
z-index: 1;
98-
animation: ${skeletonLoading} 1s linear infinite alternate;
90+
animation: ${(props) => props.animation};
9991
border-radius: 8px;
10092
}
10193
}
@@ -112,6 +104,7 @@ type DivStyleProps = {
112104
borderRadius?: string;
113105
textAlign?: string;
114106
visibility?: string;
107+
animation?: string;
115108
};
116109
export const Div = styled.div<DivStyleProps>`
117110
height: ${(props) => props.height || 'auto'};
@@ -126,7 +119,7 @@ export const Div = styled.div<DivStyleProps>`
126119
127120
&.skeleton {
128121
> * {
129-
visibility: ${(props) => (props.visibility || skeletonLoading ? 'hidden' : 'visible')};
122+
visibility: ${(props) => (props.visibility || props.animation ? 'hidden' : 'visible')};
130123
}
131124
132125
&:after {
@@ -138,7 +131,7 @@ export const Div = styled.div<DivStyleProps>`
138131
right: 0;
139132
opacity: 1;
140133
z-index: 1;
141-
animation: ${skeletonLoading} 1s linear infinite alternate;
134+
animation: ${(props) => props.animation};
142135
border-radius: 8px;
143136
}
144137
}
@@ -170,6 +163,7 @@ type SpanStyleProps = {
170163
whiteSpace?: string;
171164
visibility?: string;
172165
textWrap?: string;
166+
animation?: string;
173167
};
174168

175169
export const Span = styled.span<SpanStyleProps>`
@@ -201,7 +195,7 @@ export const Span = styled.span<SpanStyleProps>`
201195
202196
&.skeleton {
203197
> * {
204-
visibility: ${(props) => (props.visibility || skeletonLoading ? 'hidden' : 'visible')};
198+
visibility: ${(props) => (props.visibility || props.animation ? 'hidden' : 'visible')};
205199
}
206200
207201
&:after {
@@ -213,7 +207,7 @@ export const Span = styled.span<SpanStyleProps>`
213207
right: 0;
214208
opacity: 1;
215209
z-index: 1;
216-
animation: ${skeletonLoading} 1s linear infinite alternate;
210+
animation: ${(props) => props.animation};
217211
border-radius: 8px;
218212
}
219213
}

packages/uiweb/src/lib/config/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,5 @@ export const LIVEKIT_SERVER_URL = 'https://spacev2-demo-17wvllxz.livekit.cloud';
155155
export const LIVEKIT_SERVER_WEBSOCKET_URL = 'wss://spacev2-demo-17wvllxz.livekit.cloud';
156156
export const LIVEKIT_TOKEN_GENERATOR_SERVER_URL = 'https://ms-lk-server.onrender.com';
157157
export const GUEST_MODE_ACCOUNT = '0x0000000000000000000000000000000000000001';
158+
159+
export const pushBotAddress = "eip155:0x99A08ac6254dcf7ccc37CeC662aeba8eFA666666";

0 commit comments

Comments
 (0)