@equinor/fusion-framework-react-components-bookmark 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +234 -215
- package/dist/esm/components/Bookmark.js.map +1 -1
- package/dist/esm/components/BookmarkProvider.js.map +1 -1
- package/dist/esm/components/create-bookmark/CreateBookmark.js.map +1 -1
- package/dist/esm/components/edit-bookmark/EditBookmark.js +1 -3
- package/dist/esm/components/edit-bookmark/EditBookmark.js.map +1 -1
- package/dist/esm/components/filter/Filter.js +2 -5
- package/dist/esm/components/filter/Filter.js.map +1 -1
- package/dist/esm/components/import-bookmark/ImportBookmark.js.map +1 -1
- package/dist/esm/components/loading/Loading.js.map +1 -1
- package/dist/esm/components/messages/Message.js.map +1 -1
- package/dist/esm/components/row/MoreMenu.js.map +1 -1
- package/dist/esm/components/row/Row.js.map +1 -1
- package/dist/esm/components/section/Section.js.map +1 -1
- package/dist/esm/components/sectionList/SectionList.js.map +1 -1
- package/dist/esm/components/shared/SharedIcon.js.map +1 -1
- package/dist/esm/hooks/useBookmarkGrouping.js.map +1 -1
- package/dist/esm/utils/append-bookmark-to-uri.js.map +1 -1
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/BookmarkProvider.d.ts +1 -1
- package/dist/types/components/filter/Filter.d.ts +1 -1
- package/dist/types/components/messages/Message.d.ts +1 -1
- package/dist/types/components/row/MoreMenu.d.ts +2 -2
- package/dist/types/components/row/Row.d.ts +1 -1
- package/dist/types/components/section/Section.d.ts +1 -1
- package/dist/types/components/sectionList/SectionList.d.ts +1 -1
- package/dist/types/hooks/useBookmarkGrouping.d.ts +1 -1
- package/dist/types/utils/utils.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +8 -8
- package/src/components/Bookmark.tsx +46 -47
- package/src/components/BookmarkProvider.tsx +78 -78
- package/src/components/create-bookmark/CreateBookmark.tsx +96 -96
- package/src/components/edit-bookmark/EditBookmark.tsx +149 -152
- package/src/components/filter/Filter.tsx +21 -41
- package/src/components/import-bookmark/ImportBookmark.tsx +61 -65
- package/src/components/loading/Loading.tsx +11 -11
- package/src/components/messages/Message.tsx +47 -47
- package/src/components/row/MoreMenu.tsx +27 -27
- package/src/components/row/Row.tsx +56 -56
- package/src/components/section/Section.tsx +17 -17
- package/src/components/sectionList/SectionList.tsx +137 -143
- package/src/components/shared/SharedIcon.tsx +19 -19
- package/src/hooks/useBookmarkGrouping.ts +37 -37
- package/src/utils/append-bookmark-to-uri.ts +3 -3
- package/src/utils/utils.ts +6 -6
- package/src/version.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FrameworkEvent, FrameworkEventInit } from '@equinor/fusion-framework-module-event';
|
|
2
2
|
import { type PropsWithChildren } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import type { IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
|
|
4
4
|
type BookmarkApp = {
|
|
5
5
|
appKey: string;
|
|
6
6
|
name?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MutableRefObject } from 'react';
|
|
2
|
-
import { MenuOption } from './Row';
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { MenuOption } from './Row';
|
|
3
3
|
type MenuProps = {
|
|
4
4
|
readonly pRef: MutableRefObject<HTMLElement | null>;
|
|
5
5
|
readonly onClose: VoidFunction;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
1
|
+
import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
2
2
|
export type GroupingKeys = 'Group by app' | 'Created by' | 'Group by Context';
|
|
3
3
|
export declare const useBookmarkGrouping: (bookmarks?: Bookmarks) => {
|
|
4
4
|
setGroupBy: import("react").Dispatch<import("react").SetStateAction<GroupingKeys>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
1
|
+
import type { Bookmarks, BookmarkWithoutData } from '@equinor/fusion-framework-module-bookmark';
|
|
2
2
|
/** Helpers.. */
|
|
3
3
|
export declare const filterEmptyGroups: (i: {
|
|
4
4
|
values: Bookmarks;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
1
|
+
export declare const version = "1.0.10";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-react-components-bookmark",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"rxjs": "^7.8.1",
|
|
26
|
-
"@equinor/fusion-framework-react": "^7.4.
|
|
27
|
-
"@equinor/fusion-
|
|
28
|
-
"@equinor/fusion-
|
|
26
|
+
"@equinor/fusion-framework-react": "^7.4.2",
|
|
27
|
+
"@equinor/fusion-framework-react-module-bookmark": "^3.0.2",
|
|
28
|
+
"@equinor/fusion-observable": "^8.4.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@equinor/eds-core-react": "^0.43.0",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@types/react": "^18.2.50",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"styled-components": "^6.0.7",
|
|
38
|
-
"typescript": "^5.
|
|
39
|
-
"@equinor/fusion-framework-module-
|
|
40
|
-
"@equinor/fusion-framework-module-
|
|
41
|
-
"@equinor/fusion-framework-module-
|
|
38
|
+
"typescript": "^5.7.3",
|
|
39
|
+
"@equinor/fusion-framework-module-app": "^6.1.5",
|
|
40
|
+
"@equinor/fusion-framework-module-event": "^4.3.1",
|
|
41
|
+
"@equinor/fusion-framework-module-bookmark": "^2.1.2"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@equinor/eds-core-react": "^0.37.0",
|
|
@@ -14,26 +14,26 @@ import { useBookmarkComponentContext } from './BookmarkProvider';
|
|
|
14
14
|
import { useObservableState } from '@equinor/fusion-observable/react';
|
|
15
15
|
|
|
16
16
|
Icon.add({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
chevron_down,
|
|
18
|
+
chevron_right,
|
|
19
|
+
share,
|
|
20
|
+
more_vertical,
|
|
21
|
+
add,
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
const Styled = {
|
|
25
|
-
|
|
25
|
+
Wrapper: styled.div`
|
|
26
26
|
padding-right: 1rem;
|
|
27
27
|
display: flex;
|
|
28
28
|
flex-direction: column;
|
|
29
29
|
gap: 1rem;
|
|
30
30
|
`,
|
|
31
|
-
|
|
31
|
+
List: styled.div`
|
|
32
32
|
overflow-y: auto;
|
|
33
33
|
overflow-x: hidden;
|
|
34
34
|
height: calc((100vh - 85px) - 3rem);
|
|
35
35
|
`,
|
|
36
|
-
|
|
36
|
+
NoContentWrapper: styled.div`
|
|
37
37
|
position: absolute;
|
|
38
38
|
top: 150px;
|
|
39
39
|
bottom: 200px;
|
|
@@ -43,50 +43,49 @@ const Styled = {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export const Bookmark = () => {
|
|
46
|
-
|
|
46
|
+
const { provider } = useBookmarkComponentContext();
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
const { value: bookmarks } = useObservableState(
|
|
49
|
+
useMemo(() => provider?.bookmarks$ || EMPTY, [provider]),
|
|
50
|
+
);
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
52
|
+
const { value: isLoading } = useObservableState(
|
|
53
|
+
useMemo(
|
|
54
|
+
() => (provider?.status$ || EMPTY).pipe(map((status) => !!status.has('fetch_bookmarks'))),
|
|
55
|
+
[provider],
|
|
56
|
+
),
|
|
57
|
+
{ initial: true },
|
|
58
|
+
);
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const { bookmarkGroups, groupingModes, searchText, setGroupBy, setSearchText, groupByKey } =
|
|
61
|
+
useBookmarkGrouping(bookmarks);
|
|
63
62
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
const content = useMemo(() => {
|
|
64
|
+
if (isLoading) {
|
|
65
|
+
return <Loading />;
|
|
66
|
+
}
|
|
67
|
+
if (bookmarkGroups.length === 0) {
|
|
68
|
+
return (
|
|
69
|
+
<Message title="No Bookmarks" type="NoContent">
|
|
70
|
+
You have not created any bookmarks yet.
|
|
71
|
+
</Message>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return <SectionList bookmarkGroups={bookmarkGroups} />;
|
|
75
|
+
}, [isLoading, bookmarkGroups]);
|
|
77
76
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
77
|
+
return (
|
|
78
|
+
<Styled.Wrapper>
|
|
79
|
+
<BookmarkFilter
|
|
80
|
+
groupBy={groupByKey}
|
|
81
|
+
groupingModes={Object.keys(groupingModes)}
|
|
82
|
+
searchText={searchText ?? ''}
|
|
83
|
+
setGroupBy={setGroupBy}
|
|
84
|
+
setSearchText={setSearchText}
|
|
85
|
+
/>
|
|
86
|
+
<Styled.List>{content}</Styled.List>
|
|
87
|
+
</Styled.Wrapper>
|
|
88
|
+
);
|
|
90
89
|
};
|
|
91
90
|
|
|
92
91
|
export default Bookmark;
|
|
@@ -4,110 +4,110 @@ import { type PropsWithChildren, createContext, useCallback, useContext, useStat
|
|
|
4
4
|
import { CreateBookmarkModal } from './create-bookmark';
|
|
5
5
|
import { EditBookmarkModal } from './edit-bookmark';
|
|
6
6
|
import { ImportBookmarkModal } from './import-bookmark';
|
|
7
|
-
import {
|
|
7
|
+
import type { IBookmarkProvider } from '@equinor/fusion-framework-module-bookmark';
|
|
8
8
|
|
|
9
9
|
type BookmarkApp = {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
appKey: string;
|
|
11
|
+
name?: string;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
type BookmarkUser = {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
type ProviderState = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
provider?: IBookmarkProvider;
|
|
21
|
+
currentApp?: BookmarkApp | null;
|
|
22
|
+
currentUser?: BookmarkUser | null;
|
|
23
|
+
showCreateBookmark: () => void;
|
|
24
|
+
showEditBookmark: (bookmarkId: string) => void;
|
|
25
|
+
addBookmarkToClipboard: (bookmarkId: string) => void;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
const bookmarkProviderContext = createContext<ProviderState | null>(null);
|
|
29
29
|
|
|
30
30
|
type BookmarkProviderProps = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
readonly provider?: IBookmarkProvider;
|
|
32
|
+
readonly currentApp?: BookmarkApp;
|
|
33
|
+
readonly currentUser?: BookmarkUser;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const useBookmarkComponentContext = () =>
|
|
37
|
-
|
|
37
|
+
useContext(bookmarkProviderContext) as ProviderState;
|
|
38
38
|
|
|
39
39
|
export const BookmarkProvider = (props: PropsWithChildren<BookmarkProviderProps>) => {
|
|
40
|
-
|
|
40
|
+
const { provider, currentApp, currentUser, children } = props;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const [isCreateBookmarkOpen, setIsCreateBookmarkOpen] = useState(false);
|
|
43
|
+
const [editBookmarkId, setEditBookmarkId] = useState<string | undefined>();
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const showCreateBookmark = useCallback(() => {
|
|
46
|
+
setIsCreateBookmarkOpen(true);
|
|
47
|
+
}, []);
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
const [snackbarContent, setSnackbarContent] = useState('');
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!provider) {
|
|
59
|
-
return (
|
|
60
|
-
<bookmarkProviderContext.Provider
|
|
61
|
-
value={{
|
|
62
|
-
provider: undefined,
|
|
63
|
-
currentApp,
|
|
64
|
-
currentUser,
|
|
65
|
-
showCreateBookmark,
|
|
66
|
-
showEditBookmark: setEditBookmarkId,
|
|
67
|
-
addBookmarkToClipboard,
|
|
68
|
-
}}
|
|
69
|
-
>
|
|
70
|
-
{children}
|
|
71
|
-
</bookmarkProviderContext.Provider>
|
|
72
|
-
);
|
|
73
|
-
}
|
|
51
|
+
const addBookmarkToClipboard = useCallback((bookmarkId: string) => {
|
|
52
|
+
const url = new URL(window.location.toString());
|
|
53
|
+
url.searchParams.set('bookmarkId', bookmarkId);
|
|
54
|
+
navigator.clipboard.writeText(String(url));
|
|
55
|
+
setSnackbarContent('Bookmark url copied to clipboard');
|
|
56
|
+
}, []);
|
|
74
57
|
|
|
58
|
+
if (!provider) {
|
|
75
59
|
return (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<EditBookmarkModal
|
|
89
|
-
isOpen={!!editBookmarkId}
|
|
90
|
-
onClose={() => setEditBookmarkId(undefined)}
|
|
91
|
-
bookmarkId={editBookmarkId}
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
94
|
-
<ImportBookmarkModal />
|
|
95
|
-
<Snackbar
|
|
96
|
-
autoHideDuration={2000}
|
|
97
|
-
onClose={() => setSnackbarContent('')}
|
|
98
|
-
open={!!snackbarContent}
|
|
99
|
-
>
|
|
100
|
-
{snackbarContent}
|
|
101
|
-
</Snackbar>
|
|
102
|
-
{children}
|
|
103
|
-
</bookmarkProviderContext.Provider>
|
|
60
|
+
<bookmarkProviderContext.Provider
|
|
61
|
+
value={{
|
|
62
|
+
provider: undefined,
|
|
63
|
+
currentApp,
|
|
64
|
+
currentUser,
|
|
65
|
+
showCreateBookmark,
|
|
66
|
+
showEditBookmark: setEditBookmarkId,
|
|
67
|
+
addBookmarkToClipboard,
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
70
|
+
{children}
|
|
71
|
+
</bookmarkProviderContext.Provider>
|
|
104
72
|
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<bookmarkProviderContext.Provider
|
|
77
|
+
value={{
|
|
78
|
+
provider,
|
|
79
|
+
currentApp,
|
|
80
|
+
currentUser,
|
|
81
|
+
showCreateBookmark,
|
|
82
|
+
showEditBookmark: setEditBookmarkId,
|
|
83
|
+
addBookmarkToClipboard,
|
|
84
|
+
}}
|
|
85
|
+
>
|
|
86
|
+
<CreateBookmarkModal isOpen={isCreateBookmarkOpen} onClose={setIsCreateBookmarkOpen} />
|
|
87
|
+
{editBookmarkId && (
|
|
88
|
+
<EditBookmarkModal
|
|
89
|
+
isOpen={!!editBookmarkId}
|
|
90
|
+
onClose={() => setEditBookmarkId(undefined)}
|
|
91
|
+
bookmarkId={editBookmarkId}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
<ImportBookmarkModal />
|
|
95
|
+
<Snackbar
|
|
96
|
+
autoHideDuration={2000}
|
|
97
|
+
onClose={() => setSnackbarContent('')}
|
|
98
|
+
open={!!snackbarContent}
|
|
99
|
+
>
|
|
100
|
+
{snackbarContent}
|
|
101
|
+
</Snackbar>
|
|
102
|
+
{children}
|
|
103
|
+
</bookmarkProviderContext.Provider>
|
|
104
|
+
);
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
declare module '@equinor/fusion-framework-module-event' {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
interface FrameworkEventMap {
|
|
109
|
+
// onBookmarkOpen: FrameworkEvent<FrameworkEventInit<boolean, unknown>>;
|
|
110
|
+
onBookmarkEdit: FrameworkEvent<FrameworkEventInit<{ bookmarkId: string }, unknown>>;
|
|
111
|
+
onBookmarkUrlCopy: FrameworkEvent<FrameworkEventInit<{ url: string }, unknown>>;
|
|
112
|
+
}
|
|
113
113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ChangeEvent, useCallback, useEffect, useState } from 'react';
|
|
1
|
+
import { type ChangeEvent, useCallback, useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
import { BookmarkCreateArgs } from '@equinor/fusion-framework-module-bookmark';
|
|
3
|
+
import type { BookmarkCreateArgs } from '@equinor/fusion-framework-module-bookmark';
|
|
4
4
|
import { useBookmarkComponentContext } from '../BookmarkProvider';
|
|
5
5
|
|
|
6
6
|
import { Button, Checkbox, Dialog, Input, Label, TextField } from '@equinor/eds-core-react';
|
|
@@ -15,106 +15,106 @@ const StyledContent = styled(Dialog.Content)`
|
|
|
15
15
|
`;
|
|
16
16
|
|
|
17
17
|
export const CreateBookmarkModal = ({
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
isOpen,
|
|
19
|
+
onClose,
|
|
20
20
|
}: {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
readonly isOpen: boolean;
|
|
22
|
+
readonly onClose: (b: boolean) => void;
|
|
23
23
|
}) => {
|
|
24
|
-
|
|
24
|
+
const { provider, currentApp } = useBookmarkComponentContext();
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const [state, setState] = useState<BookmarkCreateArgs<never>>({
|
|
27
|
+
name: '',
|
|
28
|
+
description: '',
|
|
29
|
+
isShared: false,
|
|
30
|
+
});
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
setState((s) => ({ ...s, appKey: currentApp?.appKey || '' }));
|
|
34
|
+
}, [currentApp]);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
error: (error) => {
|
|
50
|
-
console.error('Failed to create bookmark', error);
|
|
51
|
-
},
|
|
52
|
-
complete() {
|
|
53
|
-
onClose(false);
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
return () => sub.unsubscribe();
|
|
36
|
+
const createBookmark = useCallback(
|
|
37
|
+
async (args: BookmarkCreateArgs<never>) => {
|
|
38
|
+
if (!provider) {
|
|
39
|
+
console.error('Provider not available');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// TODO: Show success message
|
|
43
|
+
// TODO: should this call onCreated, with the new bookmark?
|
|
44
|
+
// TODO: should current bookmark be updated?
|
|
45
|
+
const sub = from(provider.createBookmark(args)).subscribe({
|
|
46
|
+
next: (bookmark) => {
|
|
47
|
+
console.debug('Bookmark created', bookmark);
|
|
57
48
|
},
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
error: (error) => {
|
|
50
|
+
console.error('Failed to create bookmark', error);
|
|
51
|
+
},
|
|
52
|
+
complete() {
|
|
53
|
+
onClose(false);
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return () => sub.unsubscribe();
|
|
57
|
+
},
|
|
58
|
+
[onClose, provider],
|
|
59
|
+
);
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
61
|
+
return (
|
|
62
|
+
<Dialog style={{ width: '400px' }} open={isOpen}>
|
|
63
|
+
<Dialog.Header>Create bookmark</Dialog.Header>
|
|
64
|
+
<StyledContent>
|
|
65
|
+
<div>
|
|
66
|
+
<Label htmlFor="name" label="Name" />
|
|
67
|
+
<Input
|
|
68
|
+
id="name"
|
|
69
|
+
autoComplete="off"
|
|
70
|
+
value={state?.name}
|
|
71
|
+
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
72
|
+
setState((s) => ({ ...s, name: event.target.value }));
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
<div>
|
|
77
|
+
<TextField
|
|
78
|
+
id="storybook-multiline-three"
|
|
79
|
+
label="Description"
|
|
80
|
+
multiline
|
|
81
|
+
rows={3}
|
|
82
|
+
rowsMax={10}
|
|
83
|
+
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
84
|
+
setState((s) => ({ ...s, description: event.target.value }));
|
|
85
|
+
}}
|
|
86
|
+
/>
|
|
87
|
+
</div>
|
|
88
|
+
<div>
|
|
89
|
+
<Label htmlFor="app" label="App" />
|
|
90
|
+
<Input readOnly={true} value={currentApp?.name || currentApp?.appKey || ''} />
|
|
91
|
+
</div>
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
<div>
|
|
94
|
+
<Checkbox
|
|
95
|
+
label="Is Shared"
|
|
96
|
+
checked={state.isShared}
|
|
97
|
+
onChange={(event: ChangeEvent<HTMLInputElement>) => {
|
|
98
|
+
setState((s) => ({ ...s, isShared: event.target.checked }));
|
|
99
|
+
}}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</StyledContent>
|
|
103
|
+
<Dialog.Actions>
|
|
104
|
+
<div style={{ display: 'flex', gap: '0.2em' }}>
|
|
105
|
+
<Button onClick={() => onClose(false)} variant="ghost">
|
|
106
|
+
Cancel
|
|
107
|
+
</Button>
|
|
108
|
+
<Button
|
|
109
|
+
disabled={!currentApp || !state.name}
|
|
110
|
+
onClick={() => {
|
|
111
|
+
createBookmark(state);
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
Create
|
|
115
|
+
</Button>
|
|
116
|
+
</div>
|
|
117
|
+
</Dialog.Actions>
|
|
118
|
+
</Dialog>
|
|
119
|
+
);
|
|
120
120
|
};
|