Skip to content

Commit 46e5186

Browse files
authored
Merge pull request #389 from devtron-labs/feat/events-ai-widget
feat: add support for screen bottom right in draggable wrapper
2 parents 875d451 + 3d9e4a0 commit 46e5186

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.6.0-patch-1-beta-12",
3+
"version": "0.6.0-patch-1-beta-13",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/DraggableWrapper/DraggableWrapper.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
import React, { useEffect, useRef, useState } from 'react'
17+
import { useEffect, useRef, useState } from 'react'
1818
import Draggable, { ControlPosition, DraggableData } from 'react-draggable'
1919
import { DraggableWrapperProps, DraggablePositionVariant } from './types'
2020
import { useWindowSize } from '../Hooks'
@@ -71,6 +71,12 @@ export default function DraggableWrapper({
7171
const y = baseY - nodeRefHeight - boundaryGap
7272
return { x, y }
7373
}
74+
case DraggablePositionVariant.SCREEN_BOTTOM_RIGHT: {
75+
const x = windowSize.width - parentRect.left - nodeRefWidth - boundaryGap
76+
const y = windowSize.height - parentRect.top - nodeRefHeight - boundaryGap
77+
78+
return { x, y }
79+
}
7480
// Add more cases for other variants if needed
7581
default: {
7682
// Since need node to be in center of screen so subtracting width/2 by left of parentRect it will start the node from center but want node's midpoint at center so subtracting node's width from it.

src/Common/DraggableWrapper/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { HTMLAttributes, ReactNode, RefObject } from 'react'
1919
export enum DraggablePositionVariant {
2020
PARENT_BOTTOM_CENTER = 'PARENT_BOTTOM_CENTER',
2121
SCREEN_BOTTOM_CENTER = 'SCREEN_BOTTOM_CENTER',
22+
SCREEN_BOTTOM_RIGHT = 'SCREEN_BOTTOM_RIGHT',
2223
// Can add more based on requirement
2324
}
2425

src/Common/Types.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,3 +993,13 @@ export interface EnvironmentHelmResult {
993993
}
994994

995995
export type EnvironmentListHelmResponse = ResponseType<EnvironmentListHelmResult[]>
996+
997+
export interface WidgetEventDetails {
998+
message: string
999+
namespace: string
1000+
object: string
1001+
source: string
1002+
count: number
1003+
age: string
1004+
lastSeen: string
1005+
}

0 commit comments

Comments
 (0)