## Description Notion Issues: 1. Issues with link component: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=4121a76714cb49f2ba76d20fbeab9766&pm=s 2. GraphQL code editor heading color: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=82bbeaa2749642268eada28fcf5ec6a6&pm=s 3. tooltip on long JS Object names: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=353552b086de45329390bd4dfae98ee4&pm=s 4. Multiple scroll bars on response tab: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=111515d90ec5447687b1b573d64bd6eb&pm=s 5. Save and delete buttons: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=1ac1fed293994b51b4c31bc44dd2d736&pm=s 6. Js Objects always on tooltip: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=59f3e5b452d24ab9aa05e9fdd169113f&pm=s 7. Error message alignment: https://www.notion.so/appsmith/f353d8c6bd664f79ad858a42010cdfc8?v=f04cde23f6424aeb9d5a6e389cd172bd&p=a6f2cc4e79994b77894c0293d50be3b9&pm=s 8. Max width of field on Admin settings page: https://www.notion.so/appsmith/Text-boxes-too-small-in-Auth-Pages-ef2d0fb97f8247848113f9a419e3da09?pvs=4 Other issues: 1. Added data testid for branch create spinner. 7. Fix: branch name button have a fixed width even if text length is small. #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed --------- Co-authored-by: Parthvi Goswami <parthvigoswami@Parthvis-MacBook-Pro.local> Co-authored-by: akash-codemonk <67054171+akash-codemonk@users.noreply.github.com> Co-authored-by: Preet Sidhu <preetsidhu.bits@gmail.com> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: rahulramesha <rahul@appsmith.com> Co-authored-by: Aishwarya UR <aishwarya@appsmith.com> Co-authored-by: Vijetha-Kaja <vijetha@appsmith.com> Co-authored-by: Apple <nandan@thinkify.io> Co-authored-by: Arsalan Yaldram <arsalanyaldram0211@outlook.com> Co-authored-by: albinAppsmith <87797149+albinAppsmith@users.noreply.github.com> Co-authored-by: Aswath K <aswath.sana@gmail.com> Co-authored-by: Ankita Kinger <ankita@appsmith.com> Co-authored-by: Aman Agarwal <aman@appsmith.com> Co-authored-by: Sangeeth Sivan <74818788+berzerkeer@users.noreply.github.com> Co-authored-by: Saroj <43822041+sarojsarab@users.noreply.github.com> Co-authored-by: Aishwarya-U-R <91450662+Aishwarya-U-R@users.noreply.github.com> Co-authored-by: Parthvi <80334441+Parthvi12@users.noreply.github.com> Co-authored-by: Vijetha-Kaja <119562824+Vijetha-Kaja@users.noreply.github.com> Co-authored-by: Ayush Pahwa <ayushpahwa96@gmail.com> Co-authored-by: Rohit Agarwal <rohit_agarwal@live.in>
186 lines
5.8 KiB
TypeScript
186 lines
5.8 KiB
TypeScript
import { layoutConfigurations } from "constants/WidgetConstants";
|
|
import React, { useEffect, useRef } from "react";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { AppPositioningTypes } from "reducers/entityReducers/pageListReducer";
|
|
import {
|
|
getCurrentApplicationLayout,
|
|
getCurrentAppPositioningType,
|
|
getCurrentPageId,
|
|
previewModeSelector,
|
|
} from "selectors/editorSelectors";
|
|
import { setAutoCanvasResizing } from "actions/autoLayoutActions";
|
|
import styled from "styled-components";
|
|
import { AUTOLAYOUT_RESIZER_WIDTH_BUFFER } from "utils/hooks/useDynamicAppLayout";
|
|
import { importSvg } from "design-system-old";
|
|
|
|
const CanvasResizerIcon = importSvg(
|
|
() => import("assets/icons/ads/app-icons/canvas-resizer.svg"),
|
|
);
|
|
|
|
const AutoLayoutCanvasResizer = styled.div`
|
|
position: sticky;
|
|
cursor: col-resize;
|
|
width: 2px;
|
|
height: 100%;
|
|
display: flex;
|
|
background: var(--ads-v2-color-border);
|
|
align-items: center;
|
|
justify-content: flex-start;
|
|
margin-left: 2px;
|
|
transition: width 300ms ease;
|
|
transition: background 300ms ease;
|
|
.canvas-resizer-icon {
|
|
border-left: 2px solid;
|
|
border-color: var(--ads-v2-color-border);
|
|
transition: border 300ms ease;
|
|
margin-left: 2px;
|
|
& > svg {
|
|
fill: var(--ads-v2-color-border);
|
|
transition: fill 300ms ease;
|
|
}
|
|
}
|
|
&:hover,
|
|
&:active {
|
|
width: 3px;
|
|
transition: width 300ms ease;
|
|
background: #ff9b4e;
|
|
transition: background 300ms ease;
|
|
.canvas-resizer-icon {
|
|
border-color: #ff9b4e;
|
|
transition: border 300ms ease;
|
|
& > svg {
|
|
fill: #ff9b4e;
|
|
transition: fill 300ms ease;
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
export function CanvasResizer({
|
|
heightWithTopMargin,
|
|
isPageInitiated,
|
|
shouldHaveTopMargin,
|
|
}: {
|
|
heightWithTopMargin: string;
|
|
isPageInitiated: boolean;
|
|
shouldHaveTopMargin: boolean;
|
|
}) {
|
|
const isPreviewMode = useSelector(previewModeSelector);
|
|
const currentPageId = useSelector(getCurrentPageId);
|
|
const appLayout = useSelector(getCurrentApplicationLayout);
|
|
const appPositioningType = useSelector(getCurrentAppPositioningType);
|
|
const ref = useRef(null);
|
|
const dispatch = useDispatch();
|
|
useEffect(() => {
|
|
const ele: any = document.getElementById("canvas-viewport");
|
|
|
|
if (isPageInitiated && appPositioningType === AppPositioningTypes.AUTO) {
|
|
const buffer = isPreviewMode ? AUTOLAYOUT_RESIZER_WIDTH_BUFFER : 0;
|
|
const fullWidthCSS = `calc(100% - ${AUTOLAYOUT_RESIZER_WIDTH_BUFFER}px)`;
|
|
const wrapperElement: any = document.getElementById("widgets-editor");
|
|
|
|
let maxWidth =
|
|
wrapperElement.offsetWidth - AUTOLAYOUT_RESIZER_WIDTH_BUFFER;
|
|
|
|
if (ele && ele.offsetWidth >= maxWidth) {
|
|
ele.style.width = fullWidthCSS;
|
|
}
|
|
|
|
if (appLayout?.type === "FLUID") {
|
|
const smallestWidth = layoutConfigurations.MOBILE.minWidth;
|
|
// The current position of mouse
|
|
let x = 0;
|
|
// let y = 0;
|
|
|
|
// The dimension of the element
|
|
let w = 0;
|
|
// let h = 0;
|
|
let events: any = [];
|
|
|
|
// Handle the mousedown event
|
|
// that's triggered when user drags the resizer
|
|
const mouseDownHandler = function (e: any) {
|
|
maxWidth =
|
|
wrapperElement.offsetWidth - AUTOLAYOUT_RESIZER_WIDTH_BUFFER;
|
|
// Get the current mouse position
|
|
x = e.clientX;
|
|
// y = e.clientY;
|
|
|
|
// Calculate the dimension of element
|
|
const styles = window.getComputedStyle(ele);
|
|
dispatch(setAutoCanvasResizing(true));
|
|
w = parseInt(styles.width, 10) + buffer;
|
|
// h = parseInt(styles.height, 10);
|
|
const mouseMove = (e: any) => mouseMoveHandler(e);
|
|
events.push(mouseMove);
|
|
// Attach the listeners to `document`
|
|
document.addEventListener("mousemove", mouseMove);
|
|
document.addEventListener("mouseup", mouseUpHandler);
|
|
// e.stopPropagation();
|
|
};
|
|
|
|
const mouseMoveHandler = function (e: any) {
|
|
// How far the mouse has been moved
|
|
// const multiplier = rightHandle ? 2 : -2;
|
|
const multiplier = 2;
|
|
const dx = (e.clientX - x) * multiplier;
|
|
if (maxWidth >= w + dx && smallestWidth <= w + dx) {
|
|
// Adjust the dimension of element
|
|
ele.style.width = `${w + dx}px`;
|
|
}
|
|
if (maxWidth < w + dx) {
|
|
ele.style.width = fullWidthCSS;
|
|
}
|
|
if (smallestWidth > w + dx) {
|
|
ele.style.width = `${smallestWidth}px`;
|
|
}
|
|
// e.stopPropagation();
|
|
};
|
|
|
|
const mouseUpHandler = function (e: any) {
|
|
// Remove the handlers of `mousemove` and `mouseup`
|
|
mouseMoveHandler(e);
|
|
dispatch(setAutoCanvasResizing(false));
|
|
document.removeEventListener("mousemove", events[0] as any);
|
|
document.removeEventListener("mouseup", mouseUpHandler);
|
|
events = [];
|
|
};
|
|
const rightResizer: any = ref.current;
|
|
const rightMove = (e: any) => mouseDownHandler(e);
|
|
rightResizer && rightResizer.addEventListener("mousedown", rightMove);
|
|
|
|
return () => {
|
|
rightResizer &&
|
|
rightResizer.removeEventListener("mousedown", rightMove);
|
|
};
|
|
}
|
|
} else {
|
|
ele.style.removeProperty("width");
|
|
}
|
|
}, [
|
|
appLayout,
|
|
isPreviewMode,
|
|
currentPageId,
|
|
appPositioningType,
|
|
isPageInitiated,
|
|
]);
|
|
return appPositioningType === AppPositioningTypes.AUTO ? (
|
|
<AutoLayoutCanvasResizer
|
|
className="resizer-right"
|
|
draggable
|
|
onDragStart={(e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
}}
|
|
ref={ref}
|
|
style={{
|
|
top: "100%",
|
|
height: shouldHaveTopMargin ? heightWithTopMargin : "100vh",
|
|
}}
|
|
>
|
|
<div className="canvas-resizer-icon">
|
|
<CanvasResizerIcon />
|
|
</div>
|
|
</AutoLayoutCanvasResizer>
|
|
) : null;
|
|
}
|