Skip to content

Commit 66f752a

Browse files
Merge pull request #124 from devtron-labs/demo/resource-browser
demo: resource browser
2 parents b70e3be + 55e2aaf commit 66f752a

37 files changed

+571
-70
lines changed

package-lock.json

Lines changed: 34 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: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.80",
3+
"version": "0.0.81",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",
@@ -79,9 +79,11 @@
7979
"react-router": "^5.3.0",
8080
"react-router-dom": "^5.3.0",
8181
"react-draggable": "^4.4.5",
82+
"yaml": "^2.4.1",
83+
"marked": "4.3.0",
84+
"dompurify": "^3.0.2",
8285
"react-ga4": "^1.4.1",
83-
"@typeform/embed-react": "2.20.0",
84-
"yaml": "^2.4.1"
86+
"@typeform/embed-react": "2.20.0"
8587
},
8688
"dependencies": {
8789
"react-monaco-editor": "^0.54.0",

src/Common/ClipboardButton/ClipboardButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default function ClipboardButton({
5555
content={copied ? copiedTippyText : 'Copy'}
5656
placement="bottom"
5757
visible={copied || enableTippy}
58+
arrow={false}
5859
>
5960
<button
6061
type="button"

src/Common/Helper.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,5 @@ export const handleRelativeDateSorting = (dateStringA, dateStringB, sortOrder) =
729729
* Returns a stringified YAML with default indentation & line width
730730
*/
731731

732-
export const YAMLStringify = (obj: object | unknown, option?: object) => (
733-
YAML.stringify(obj, { indent: 2, lineWidth: 0, ...option })
734-
)
732+
export const YAMLStringify = (obj: object | unknown, option?: object) =>
733+
YAML.stringify(obj, { indent: 2, lineWidth: 0, ...option })
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { useContext } from 'react'
2+
import { context } from './UseRegisterShortcutContext'
3+
4+
const useRegisterShortcut = () => useContext(context)
5+
6+
export default useRegisterShortcut
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createContext } from 'react'
2+
import { UseRegisterShortcutContextType } from './types'
3+
4+
export const context = createContext<UseRegisterShortcutContextType>(null)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { useMemo, useState } from 'react'
2+
import { context } from './UseRegisterShortcutContext'
3+
import { UseRegisterShortcutProviderType } from './types'
4+
5+
const UseRegisterShortcutProvider = ({ children }: UseRegisterShortcutProviderType) => {
6+
const [registerShortcut, setRegisterShortcut] = useState(true)
7+
8+
const providerValue = useMemo(
9+
() => ({
10+
registerShortcut,
11+
setRegisterShortcut: (allowShortcut: boolean) => setRegisterShortcut(allowShortcut),
12+
}),
13+
[registerShortcut],
14+
)
15+
16+
return <context.Provider value={providerValue}>{children}</context.Provider>
17+
}
18+
19+
export default UseRegisterShortcutProvider
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as useRegisterShortcut } from './UseRegisterShortcut'
2+
export { default as UseRegisterShortcutProvider } from './UseRegisterShortcutProvider'
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface UseRegisterShortcutContextType {
2+
registerShortcut: boolean
3+
setRegisterShortcut: (allowShortcut: boolean) => void
4+
}
5+
6+
export interface UseRegisterShortcutProviderType {
7+
children: React.ReactElement
8+
}

src/Common/Hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export { useSuperAdmin } from './UseSuperAdmin/UseSuperAdmin'
22
export { useClickOutside } from './UseClickOutside/UseClickOutside'
33
export { useWindowSize } from './UseWindowSize/UseWindowSize'
44
export * from './useUrlFilters'
5+
export * from './UseRegisterShortcut'

0 commit comments

Comments
 (0)