Skip to content

Commit 9b113bf

Browse files
committed
Merge branch 'release' into feature/4149-button-widget-style
2 parents 63b4c70 + c8928d3 commit 9b113bf

File tree

33 files changed

+418
-90
lines changed

33 files changed

+418
-90
lines changed

app/client/src/comments/CommentThread/CommentThread.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const ThreadContainer = styled(animated.div)<{
4242
max-height: ${(props) =>
4343
props.inline ? `calc(100vh - ${props.theme.smallHeaderHeight})` : "unset"};
4444
/* overflow: auto collapses the comment threads in the sidebar */
45-
overflow: ${(props) => (props.inline ? "visible" : "unset")};
45+
overflow: ${(props) => (props.inline ? "auto" : "unset")};
4646
`;
4747

4848
const CommentsContainer = styled.div<{ inline?: boolean }>`

app/client/src/comments/CommentsShowcaseCarousel/ProfileForm.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ function ProfileForm(props: any) {
5252
</div>
5353
<FormGroup label={createMessage(DISPLAY_NAME)}>
5454
<FormTextField
55+
autoFocus
5556
hideErrorMessage
5657
name={fieldNames.displayName}
57-
placeholder={createMessage(DISPLAY_NAME)}
58+
placeholder=""
5859
/>
5960
</FormGroup>
6061
<FormGroup label={createMessage(EMAIL_ADDRESS)}>

app/client/src/components/ads/ShowcaseCarousel.tsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Button, { Category, Size } from "components/ads/Button";
44
import styled from "styled-components";
55
import { createMessage, NEXT, BACK } from "constants/messages";
66
import { useTransition, animated } from "react-spring";
7+
import { useCallback } from "react";
78

89
const Container = styled.div`
910
box-shadow: 1px 0px 10px 5px rgba(0, 0, 0, 0.15);
@@ -77,8 +78,33 @@ export default function ShowcaseCarousel(props: Props) {
7778
config: { duration: 300 },
7879
});
7980

81+
const handleSubmit = useCallback(() => {
82+
if (!componentProps.isSubmitDisabled) {
83+
setCurrentIdx(Math.min(length - 1, activeIndex + 1));
84+
if (typeof componentProps.onSubmit === "function") {
85+
componentProps.onSubmit();
86+
}
87+
}
88+
}, [
89+
componentProps.isSubmitDisabled,
90+
componentProps.onSubmit,
91+
activeIndex,
92+
setCurrentIdx,
93+
length,
94+
]);
95+
96+
const handleKeyDown = useCallback(
97+
(e: React.KeyboardEvent<HTMLDivElement>) => {
98+
const isEnterKey = e.key === "Enter" || e.keyCode === 13;
99+
if (isEnterKey) {
100+
handleSubmit();
101+
}
102+
},
103+
[handleSubmit],
104+
);
105+
80106
return (
81-
<Container>
107+
<Container onKeyDown={handleKeyDown} tabIndex={0}>
82108
{transition.map(
83109
({ item, props: springProps }: { item: string; props: any }) => (
84110
<animated.div key={item} style={springProps}>
@@ -100,15 +126,11 @@ export default function ShowcaseCarousel(props: Props) {
100126
)}
101127
<Button
102128
disabled={componentProps.isSubmitDisabled}
103-
onClick={() => {
104-
setCurrentIdx(Math.min(length - 1, activeIndex + 1));
105-
if (typeof componentProps.onSubmit === "function") {
106-
componentProps.onSubmit();
107-
}
108-
}}
129+
onClick={handleSubmit}
109130
size={Size.large}
110131
tag="button"
111132
text={componentProps.nextBtnText || createMessage(NEXT)}
133+
type="submit"
112134
/>
113135
</Buttons>
114136
</Footer>

app/client/src/components/editorComponents/GlobalSearch/parseDocumentationContent.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,25 @@ export const htmlToElement = (html: string) => {
2020
*/
2121
const strip = (text: string) => text.replace(/{% .*?%}/gm, "");
2222

23-
export const YT_EMBEDDING_SELECTION_REGEX = /{% embed url="<a href="https:\/\/www.youtube.com\/watch\?v=(.*?)\&.*? %}/m;
23+
export const YT_EMBEDDING_SELECTION_REGEX = [
24+
/{% embed url="<a href="https:\/\/www.youtube.com\/watch\?v=(.*?)\&.*? %}/m,
25+
/{% embed url="<a href="https:\/\/youtu.be.*?>https:\/\/youtu.be\/(.*?)".*? %}/m,
26+
];
2427

25-
const updateYoutubeEmbedingsWithIframe = (text: string) => {
28+
const getYtIframe = (videoId: string) => {
29+
return `<iframe width="100%" height="280" src="https://www.youtube.com/embed/${videoId}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`;
30+
};
31+
const updateYoutubeEmbeddingsWithIframe = (text: string) => {
2632
let docString = text;
2733
let match;
28-
while ((match = YT_EMBEDDING_SELECTION_REGEX.exec(docString)) !== null) {
29-
// gitbook adds \\ in front of a _ char in an id. TO remove that we have to do this.
30-
const videoId = match[1].replaceAll("%5C", "");
31-
docString = docString.replace(
32-
YT_EMBEDDING_SELECTION_REGEX,
33-
`<iframe width="100%" height="280" src="https://www.youtube.com/embed/${videoId}" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`,
34-
);
35-
}
34+
YT_EMBEDDING_SELECTION_REGEX.forEach((ytRegex) => {
35+
while ((match = ytRegex.exec(docString)) !== null) {
36+
// gitbook adds \\ in front of a _ char in an id. TO remove that we have to do this.
37+
let videoId = match[1].replaceAll("%5C", "");
38+
videoId = videoId.replaceAll("\\", "");
39+
docString = docString.replace(ytRegex, getYtIframe(videoId));
40+
}
41+
});
3642
return docString;
3743
};
3844

@@ -223,7 +229,7 @@ const parseDocumentationContent = (item: any): string | undefined => {
223229

224230
// Remove highlight for nodes that don't match well
225231
removeBadHighlights(documentObj, query);
226-
let content = updateYoutubeEmbedingsWithIframe(documentObj.body.innerHTML);
232+
let content = updateYoutubeEmbeddingsWithIframe(documentObj.body.innerHTML);
227233
content = strip(content).trim();
228234
return content;
229235
} catch (e) {

app/client/src/components/editorComponents/Onboarding/Helper.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import useClipboard from "utils/hooks/useClipboard";
99
import TickIcon from "assets/images/tick.svg";
1010
import AnalyticsUtil from "utils/AnalyticsUtil";
1111
import { OnboardingStep } from "constants/OnboardingConstants";
12+
import { getIsOnboardingHelperVisible } from "selectors/onboardingSelectors";
1213

1314
const StyledContainer = styled.div`
1415
position: fixed;
@@ -182,9 +183,7 @@ const SubStepContainer = styled.div`
182183
`;
183184

184185
function Helper() {
185-
const showHelper = useSelector(
186-
(state: AppState) => state.ui.onBoarding.showHelper,
187-
);
186+
const showHelper = useSelector(getIsOnboardingHelperVisible);
188187
const helperConfig = useSelector(
189188
(state: AppState) => state.ui.onBoarding.helperStepConfig,
190189
);

app/client/src/constants/WidgetValidation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export enum ValidationTypes {
1313
DATE_ISO_STRING = "DATE_ISO_STRING",
1414
IMAGE_URL = "IMAGE_URL",
1515
FUNCTION = "FUNCTION",
16+
SAFE_URL = "SAFE_URL",
1617
}
1718

1819
export type ValidationResponse = {

app/client/src/entities/Comments/CommentsInterfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export type CommentThread = Omit<CreateCommentThreadRequest, "comments"> & {
7474
sequenceId?: string;
7575
updationTime?: string;
7676
creationTime?: string;
77+
viewedByUsers?: Array<string>;
7778
};
7879

7980
export type CommentEventPayload = {

app/client/src/reducers/uiReducers/commentsReducer/commentsReducer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const commentsReducer = createReducer(initialState, {
269269
action: ReduxAction<number>,
270270
) => ({
271271
...state,
272-
unreadCommentThreadsCount: action.payload || 0,
272+
unreadCommentThreadsCount: Math.max(action.payload, 0),
273273
}),
274274
});
275275

app/client/src/reducers/uiReducers/commentsReducer/handleUpdateCommentThreadEvent.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const handleUpdateCommentThreadEvent = (
2626
state.commentThreadsMap[id] = {
2727
...(commentThreadInStore || {}),
2828
...action.payload,
29-
isViewed: commentThreadInStore?.isViewed || action.payload.isViewed, // TODO refactor this
3029
comments: uniqBy([...existingComments, ...newComments], "id"),
3130
};
3231

app/client/src/sagas/WebsocketSagas/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const SOCKET_EVENTS = {
44
INSERT_COMMENT_THREAD: "insert:commentThread",
55
INSERT_COMMENT: "insert:comment",
66
UPDATE_COMMENT_THREAD: "update:commentThread",
7+
REPLACE_COMMENT_THREAD: "replace:commentThread",
78
UPDATE_COMMENT: "update:comment",
89

910
// notification events

0 commit comments

Comments
 (0)