@weavy/uikit-react 11.1.0 → 13.0.0
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/.github/workflows/publish.yml +1 -1
- package/README.md +3 -4
- package/changelog.md +57 -0
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/client/WeavyClient.d.ts +8 -1
- package/dist/cjs/types/components/Attachment.d.ts +2 -1
- package/dist/cjs/types/components/Chat.d.ts +1 -1
- package/dist/cjs/types/components/Image.d.ts +2 -0
- package/dist/cjs/types/components/PdfViewer.d.ts +8 -0
- package/dist/cjs/types/components/Preview.d.ts +56 -0
- package/dist/cjs/types/contexts/MessengerContext.d.ts +1 -2
- package/dist/cjs/types/contexts/PreviewContext.d.ts +2 -1
- package/dist/cjs/types/contexts/WeavyContext.d.ts +2 -3
- package/dist/cjs/types/types/Chat.d.ts +1 -1
- package/dist/cjs/types/types/Messenger.d.ts +0 -1
- package/dist/cjs/types/types/types.d.ts +18 -8
- package/dist/cjs/types/ui/Spinner.d.ts +9 -0
- package/dist/cjs/types/utils/fileUtilities.d.ts +13 -1
- package/dist/css/weavy-chat.css +2860 -0
- package/dist/css/weavy-messenger.css +3217 -0
- package/dist/css/weavy.css +3217 -0
- package/dist/esm/index.js +28 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/client/WeavyClient.d.ts +8 -1
- package/dist/esm/types/components/Attachment.d.ts +2 -1
- package/dist/esm/types/components/Chat.d.ts +1 -1
- package/dist/esm/types/components/Image.d.ts +2 -0
- package/dist/esm/types/components/PdfViewer.d.ts +8 -0
- package/dist/esm/types/components/Preview.d.ts +56 -0
- package/dist/esm/types/contexts/MessengerContext.d.ts +1 -2
- package/dist/esm/types/contexts/PreviewContext.d.ts +2 -1
- package/dist/esm/types/contexts/WeavyContext.d.ts +2 -3
- package/dist/esm/types/types/Chat.d.ts +1 -1
- package/dist/esm/types/types/Messenger.d.ts +0 -1
- package/dist/esm/types/types/types.d.ts +18 -8
- package/dist/esm/types/ui/Spinner.d.ts +9 -0
- package/dist/esm/types/utils/fileUtilities.d.ts +13 -1
- package/dist/index.d.ts +15 -9
- package/package.json +14 -4
- package/rollup.config.js +3 -3
- package/src/client/WeavyClient.ts +105 -24
- package/src/components/Attachment.tsx +8 -8
- package/src/components/Avatar.tsx +2 -3
- package/src/components/Chat.tsx +13 -17
- package/src/components/Conversation.tsx +23 -32
- package/src/components/ConversationBadge.tsx +1 -2
- package/src/components/ConversationForm.tsx +11 -18
- package/src/components/ConversationList.tsx +4 -5
- package/src/components/ConversationListItem.tsx +11 -13
- package/src/components/FileBrowser.tsx +2 -3
- package/src/components/Image.tsx +39 -7
- package/src/components/MeetingCard.tsx +7 -8
- package/src/components/Message.tsx +13 -14
- package/src/components/Messages.tsx +7 -8
- package/src/components/Messenger.tsx +5 -6
- package/src/components/NewConversation.tsx +5 -7
- package/src/components/PdfViewer.tsx +276 -0
- package/src/components/Presence.tsx +2 -2
- package/src/components/Preview.tsx +355 -0
- package/src/components/Reactions.tsx +8 -8
- package/src/components/SearchUsers.tsx +19 -18
- package/src/components/SeenBy.tsx +1 -2
- package/src/contexts/MessengerContext.tsx +4 -12
- package/src/contexts/PreviewContext.tsx +89 -17
- package/src/contexts/WeavyContext.tsx +15 -5
- package/src/hooks/useBadge.ts +2 -6
- package/src/hooks/useChat.ts +3 -14
- package/src/hooks/useConversation.ts +1 -8
- package/src/hooks/useConversations.ts +1 -7
- package/src/hooks/useFileUploader.ts +6 -8
- package/src/hooks/useMembers.ts +1 -7
- package/src/hooks/useMessages.ts +1 -7
- package/src/hooks/useMutateChat.ts +6 -11
- package/src/hooks/useMutateConversation.ts +7 -10
- package/src/hooks/useMutateConversationName.ts +10 -12
- package/src/hooks/useMutateDeleteReaction.ts +3 -8
- package/src/hooks/useMutateExternalBlobs.ts +6 -11
- package/src/hooks/useMutateMeeting.ts +6 -11
- package/src/hooks/useMutateMembers.ts +8 -13
- package/src/hooks/useMutateMessage.ts +10 -15
- package/src/hooks/useMutatePinned.ts +3 -8
- package/src/hooks/useMutateReaction.ts +6 -12
- package/src/hooks/useMutateRead.ts +1 -10
- package/src/hooks/useMutateRemoveMembers.ts +7 -12
- package/src/hooks/useMutateTyping.ts +6 -11
- package/src/hooks/usePresence.ts +4 -5
- package/src/hooks/useReactions.ts +0 -1
- package/src/hooks/useSearchUsers.ts +1 -6
- package/src/hooks/useUser.ts +3 -14
- package/src/index.ts +2 -2
- package/src/scss/theme/_alert.scss +73 -0
- package/src/scss/theme/_appbar.scss +114 -0
- package/src/scss/theme/_attachments.scss +74 -0
- package/src/scss/theme/_avatar.scss +54 -0
- package/src/scss/theme/_badge.scss +47 -0
- package/src/scss/theme/_buttons.scss +96 -0
- package/src/scss/theme/_card.scss +7 -0
- package/src/scss/theme/_checkbox.scss +56 -0
- package/src/scss/theme/_cm-editor.scss +42 -0
- package/src/scss/theme/_code-vscode-dark.scss +184 -0
- package/src/scss/theme/_code-vscode-light.scss +179 -0
- package/src/scss/theme/_code.scss +12 -0
- package/src/scss/theme/_colors.scss +520 -0
- package/src/scss/theme/_config.scss +6 -0
- package/src/scss/theme/_content.scss +15 -0
- package/src/scss/theme/_conversations.scss +91 -0
- package/src/scss/theme/_dropdown.scss +86 -0
- package/src/scss/theme/_emoji.scss +5 -0
- package/src/scss/theme/_filebrowser.scss +26 -0
- package/src/scss/theme/_files.scss +140 -0
- package/src/scss/theme/_icons.scss +62 -0
- package/src/scss/theme/_image-grid.scss +63 -0
- package/src/scss/theme/_inputs.scss +28 -0
- package/src/scss/theme/_message-editor.scss +90 -0
- package/src/scss/theme/_messages.scss +238 -0
- package/src/scss/theme/_nav.scss +52 -0
- package/src/scss/theme/_overlays.scss +157 -0
- package/src/scss/theme/_pager.scss +19 -0
- package/src/scss/theme/_palette.scss +165 -0
- package/src/scss/theme/_pane.scss +16 -0
- package/src/scss/theme/_panels.scss +141 -0
- package/src/scss/theme/_picker-list.scss +37 -0
- package/src/scss/theme/_preview-code.scss +5 -0
- package/src/scss/theme/_preview-embed.scss +38 -0
- package/src/scss/theme/_preview-html.scss +7 -0
- package/src/scss/theme/_preview-icon.scss +41 -0
- package/src/scss/theme/_preview-image.scss +86 -0
- package/src/scss/theme/_preview-media.scss +28 -0
- package/src/scss/theme/_preview-pdf.scss +838 -0
- package/src/scss/theme/_preview-text.scss +5 -0
- package/src/scss/theme/_preview.scss +110 -0
- package/src/scss/theme/_reactions.scss +58 -0
- package/src/scss/theme/_reboot.scss +41 -0
- package/src/scss/theme/_root.scss +2 -0
- package/src/scss/theme/_scroll.scss +55 -0
- package/src/scss/theme/_search.scss +68 -0
- package/src/scss/theme/_spinner.scss +63 -0
- package/src/scss/theme/_tables.scss +53 -0
- package/src/scss/theme/_toasts.scss +47 -0
- package/src/scss/theme/_turbo.scss +17 -0
- package/src/scss/theme/_typing.scss +26 -0
- package/src/scss/theme/_variables.scss +139 -0
- package/src/scss/theme/bootstrap/_accordion.scss +146 -0
- package/src/scss/theme/bootstrap/_alert.scss +71 -0
- package/src/scss/theme/bootstrap/_badge.scss +38 -0
- package/src/scss/theme/bootstrap/_breadcrumb.scss +40 -0
- package/src/scss/theme/bootstrap/_button-group.scss +142 -0
- package/src/scss/theme/bootstrap/_buttons.scss +186 -0
- package/src/scss/theme/bootstrap/_card.scss +234 -0
- package/src/scss/theme/bootstrap/_carousel.scss +229 -0
- package/src/scss/theme/bootstrap/_close.scss +40 -0
- package/src/scss/theme/bootstrap/_containers.scss +41 -0
- package/src/scss/theme/bootstrap/_dropdown.scss +248 -0
- package/src/scss/theme/bootstrap/_forms.scss +9 -0
- package/src/scss/theme/bootstrap/_functions.scss +302 -0
- package/src/scss/theme/bootstrap/_grid.scss +33 -0
- package/src/scss/theme/bootstrap/_helpers.scss +10 -0
- package/src/scss/theme/bootstrap/_images.scss +42 -0
- package/src/scss/theme/bootstrap/_list-group.scss +191 -0
- package/src/scss/theme/bootstrap/_maps.scss +54 -0
- package/src/scss/theme/bootstrap/_mixins.scss +43 -0
- package/src/scss/theme/bootstrap/_modal.scss +237 -0
- package/src/scss/theme/bootstrap/_nav.scss +172 -0
- package/src/scss/theme/bootstrap/_navbar.scss +276 -0
- package/src/scss/theme/bootstrap/_offcanvas.scss +143 -0
- package/src/scss/theme/bootstrap/_pagination.scss +109 -0
- package/src/scss/theme/bootstrap/_placeholders.scss +51 -0
- package/src/scss/theme/bootstrap/_popover.scss +196 -0
- package/src/scss/theme/bootstrap/_progress.scss +59 -0
- package/src/scss/theme/bootstrap/_reboot.scss +610 -0
- package/src/scss/theme/bootstrap/_root.scss +73 -0
- package/src/scss/theme/bootstrap/_spinners.scss +85 -0
- package/src/scss/theme/bootstrap/_tables.scss +164 -0
- package/src/scss/theme/bootstrap/_toasts.scss +70 -0
- package/src/scss/theme/bootstrap/_tooltip.scss +120 -0
- package/src/scss/theme/bootstrap/_transitions.scss +27 -0
- package/src/scss/theme/bootstrap/_type.scss +106 -0
- package/src/scss/theme/bootstrap/_utilities.scss +647 -0
- package/src/scss/theme/bootstrap/_variables.scss +1633 -0
- package/src/scss/theme/bootstrap/forms/_floating-labels.scss +74 -0
- package/src/scss/theme/bootstrap/forms/_form-check.scss +175 -0
- package/src/scss/theme/bootstrap/forms/_form-control.scss +194 -0
- package/src/scss/theme/bootstrap/forms/_form-range.scss +91 -0
- package/src/scss/theme/bootstrap/forms/_form-select.scss +71 -0
- package/src/scss/theme/bootstrap/forms/_form-text.scss +11 -0
- package/src/scss/theme/bootstrap/forms/_input-group.scss +129 -0
- package/src/scss/theme/bootstrap/forms/_labels.scss +36 -0
- package/src/scss/theme/bootstrap/forms/_validation.scss +12 -0
- package/src/scss/theme/bootstrap/helpers/_clearfix.scss +3 -0
- package/src/scss/theme/bootstrap/helpers/_color-bg.scss +10 -0
- package/src/scss/theme/bootstrap/helpers/_colored-links.scss +12 -0
- package/src/scss/theme/bootstrap/helpers/_position.scss +36 -0
- package/src/scss/theme/bootstrap/helpers/_ratio.scss +26 -0
- package/src/scss/theme/bootstrap/helpers/_stacks.scss +15 -0
- package/src/scss/theme/bootstrap/helpers/_stretched-link.scss +15 -0
- package/src/scss/theme/bootstrap/helpers/_text-truncation.scss +7 -0
- package/src/scss/theme/bootstrap/helpers/_visually-hidden.scss +8 -0
- package/src/scss/theme/bootstrap/helpers/_vr.scss +8 -0
- package/src/scss/theme/bootstrap/mixins/_alert.scss +15 -0
- package/src/scss/theme/bootstrap/mixins/_backdrop.scss +14 -0
- package/src/scss/theme/bootstrap/mixins/_banner.scss +9 -0
- package/src/scss/theme/bootstrap/mixins/_border-radius.scss +78 -0
- package/src/scss/theme/bootstrap/mixins/_box-shadow.scss +18 -0
- package/src/scss/theme/bootstrap/mixins/_breakpoints.scss +127 -0
- package/src/scss/theme/bootstrap/mixins/_buttons.scss +70 -0
- package/src/scss/theme/bootstrap/mixins/_caret.scss +64 -0
- package/src/scss/theme/bootstrap/mixins/_clearfix.scss +9 -0
- package/src/scss/theme/bootstrap/mixins/_color-scheme.scss +7 -0
- package/src/scss/theme/bootstrap/mixins/_container.scss +11 -0
- package/src/scss/theme/bootstrap/mixins/_deprecate.scss +10 -0
- package/src/scss/theme/bootstrap/mixins/_forms.scss +152 -0
- package/src/scss/theme/bootstrap/mixins/_gradients.scss +47 -0
- package/src/scss/theme/bootstrap/mixins/_grid.scss +151 -0
- package/src/scss/theme/bootstrap/mixins/_image.scss +16 -0
- package/src/scss/theme/bootstrap/mixins/_list-group.scss +24 -0
- package/src/scss/theme/bootstrap/mixins/_lists.scss +7 -0
- package/src/scss/theme/bootstrap/mixins/_pagination.scss +10 -0
- package/src/scss/theme/bootstrap/mixins/_reset-text.scss +17 -0
- package/src/scss/theme/bootstrap/mixins/_resize.scss +6 -0
- package/src/scss/theme/bootstrap/mixins/_table-variants.scss +24 -0
- package/src/scss/theme/bootstrap/mixins/_text-truncate.scss +8 -0
- package/src/scss/theme/bootstrap/mixins/_transition.scss +26 -0
- package/src/scss/theme/bootstrap/mixins/_utilities.scss +97 -0
- package/src/scss/theme/bootstrap/mixins/_visually-hidden.scss +29 -0
- package/src/scss/theme/bootstrap/utilities/_api.scss +47 -0
- package/src/scss/theme/bootstrap/vendor/_rfs.scss +354 -0
- package/src/scss/theme/bs/_badge.scss +20 -0
- package/src/scss/theme/bs/_buttons.scss +185 -0
- package/src/scss/theme/bs/_dropdown.scss +86 -0
- package/src/scss/theme/bs/_forms.scss +161 -0
- package/src/scss/theme/bs/_list-group.scss +73 -0
- package/src/scss/theme/bs/_tables.scss +46 -0
- package/src/scss/theme/fonts/_fontmapping-roboto.scss +129 -0
- package/src/scss/theme/fonts/_fontmapping-segoe-ui.scss +127 -0
- package/src/scss/theme/fonts/_index.scss +2 -0
- package/src/scss/theme/mixins/_backdrop.scss +13 -0
- package/src/scss/theme/mixins/_palette.scss +165 -0
- package/src/scss/theme/mixins/_position.scss +33 -0
- package/src/scss/theme/mixins/_scrollbar.scss +110 -0
- package/src/scss/weavy-chat.scss +32 -0
- package/src/scss/weavy-messenger.scss +61 -0
- package/src/scss/weavy.scss +2 -0
- package/src/types/Chat.ts +1 -1
- package/src/types/Messenger.ts +1 -1
- package/src/types/types.ts +20 -11
- package/src/ui/Button.tsx +3 -4
- package/src/ui/Dropdown.tsx +4 -5
- package/src/ui/Icon.tsx +75 -39
- package/src/ui/Overlay.tsx +2 -3
- package/src/ui/Spinner.tsx +18 -0
- package/src/utils/fileUtilities.ts +166 -72
- package/src/utils/scrollbarDetection.js +48 -0
- package/dist/cjs/types/utils/styles.d.ts +0 -17
- package/dist/esm/types/utils/styles.d.ts +0 -17
- package/src/utils/styles.ts +0 -42
|
@@ -16,20 +16,14 @@ export default function useMutateReaction() {
|
|
|
16
16
|
|
|
17
17
|
type MutateProps = {
|
|
18
18
|
id: number | null,
|
|
19
|
-
reaction: string
|
|
19
|
+
reaction: string
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const mutateReaction = async ({id, reaction }: MutateProps) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
body: JSON.stringify({ content: reaction}),
|
|
28
|
-
headers: {
|
|
29
|
-
"content-type": "application/json",
|
|
30
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
31
|
-
}
|
|
32
|
-
});
|
|
22
|
+
const mutateReaction = async ({ id, reaction }: MutateProps) => {
|
|
23
|
+
|
|
24
|
+
const response = await client.post("/api/messages/" + id + "/reactions/",
|
|
25
|
+
"POST",
|
|
26
|
+
JSON.stringify({ content: reaction }));
|
|
33
27
|
|
|
34
28
|
return response;
|
|
35
29
|
};
|
|
@@ -19,16 +19,7 @@ export default function useMutateRead() {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const mutateRead = async ({ id, read }: MutateProps) => {
|
|
22
|
-
|
|
23
|
-
const response = await fetch(client.url + "/api/conversations/" + id + "/read", {
|
|
24
|
-
method: !read ? "DELETE": "PUT",
|
|
25
|
-
body: "",
|
|
26
|
-
headers: {
|
|
27
|
-
"content-type": "application/json",
|
|
28
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
22
|
+
const response = await client.post("/api/conversations/" + id + "/read", !read ? "DELETE": "PUT", "")
|
|
32
23
|
return response.json();
|
|
33
24
|
};
|
|
34
25
|
|
|
@@ -16,28 +16,23 @@ export default function useMutateRemoveMembers() {
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
type MutateProps = {
|
|
19
|
-
id:
|
|
19
|
+
id: number | null,
|
|
20
20
|
members: number[]
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const mutateRemove = async ({ id, members }: MutateProps) => {
|
|
24
24
|
|
|
25
|
-
const response = await
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
headers: {
|
|
29
|
-
"content-type": "application/json",
|
|
30
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
31
|
-
}
|
|
32
|
-
});
|
|
25
|
+
const response = await client.post("/api/apps/" + id + "/members/" + members.join(","),
|
|
26
|
+
"DELETE",
|
|
27
|
+
JSON.stringify(members));
|
|
33
28
|
|
|
34
29
|
return response;
|
|
35
30
|
};
|
|
36
31
|
|
|
37
32
|
return useMutation(mutateRemove, {
|
|
38
33
|
onSuccess: () => {
|
|
39
|
-
queryClient.invalidateQueries("conversations");
|
|
40
|
-
setSelectedConversationId(null);
|
|
41
|
-
}
|
|
34
|
+
queryClient.invalidateQueries("conversations");
|
|
35
|
+
setSelectedConversationId(null);
|
|
36
|
+
}
|
|
42
37
|
});
|
|
43
38
|
}
|
|
@@ -6,29 +6,24 @@ import { WeavyContext } from "../contexts/WeavyContext";
|
|
|
6
6
|
export default function useMutateTyping() {
|
|
7
7
|
|
|
8
8
|
const { client } = useContext(WeavyContext);
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
if (!client) {
|
|
11
11
|
throw new Error('useMutateTyping must be used within an WeavyProvider');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
type MutateProps = {
|
|
16
|
-
id: number | null
|
|
16
|
+
id: number | null
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
const mutateTyping = async ({ id }: MutateProps) => {
|
|
20
20
|
|
|
21
|
-
const response = await
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
headers: {
|
|
25
|
-
"content-type": "application/json",
|
|
26
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
27
|
-
}
|
|
28
|
-
});
|
|
21
|
+
const response = await client.post("/api/conversations/" + id + "/typing",
|
|
22
|
+
"PUT",
|
|
23
|
+
JSON.stringify({}));
|
|
29
24
|
|
|
30
25
|
return response;
|
|
31
26
|
};
|
|
32
27
|
|
|
33
|
-
return useMutation(mutateTyping, {
|
|
28
|
+
return useMutation(mutateTyping, {});
|
|
34
29
|
}
|
package/src/hooks/usePresence.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useContext, useEffect } from "react";
|
|
2
2
|
import { WeavyContext } from "../contexts/WeavyContext";
|
|
3
|
-
import { prefix as wy } from "../utils/styles";
|
|
4
3
|
|
|
5
4
|
export default function usePresence() {
|
|
6
5
|
|
|
@@ -17,18 +16,18 @@ export default function usePresence() {
|
|
|
17
16
|
const handlePresenceChange = (data: any) => {
|
|
18
17
|
|
|
19
18
|
if (Array.isArray(data)) {
|
|
20
|
-
document.querySelectorAll(
|
|
21
|
-
item.classList.remove(wy
|
|
19
|
+
document.querySelectorAll(".wy-presence").forEach(function (item) {
|
|
20
|
+
item.classList.remove("wy-presence-active");
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
data.forEach(function (id) {
|
|
25
24
|
document.querySelectorAll("[data-presence-id='" + id + "']").forEach(function (item) {
|
|
26
|
-
item.classList.add(wy
|
|
25
|
+
item.classList.add("wy-presence-active");
|
|
27
26
|
});
|
|
28
27
|
});
|
|
29
28
|
} else {
|
|
30
29
|
document.querySelectorAll("[data-presence-id='" + data + "']").forEach(function (item) {
|
|
31
|
-
item.classList.add(wy
|
|
30
|
+
item.classList.add("wy-presence-active");
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
}
|
|
@@ -2,7 +2,6 @@ import { useCallback, useContext, useEffect, useLayoutEffect, useState } from "r
|
|
|
2
2
|
import { UserContext } from "../contexts/UserContext";
|
|
3
3
|
import useEvents from "./useEvents";
|
|
4
4
|
|
|
5
|
-
|
|
6
5
|
export default function useReactions(id: number, reactions: ReactableType[]) {
|
|
7
6
|
const { on, off } = useEvents();
|
|
8
7
|
const { user } = useContext(UserContext);
|
|
@@ -12,12 +12,7 @@ export default function useSearchUsers(text: string, options: any) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const getUsers = async () => {
|
|
15
|
-
const response = await
|
|
16
|
-
headers: {
|
|
17
|
-
"content-type": "application/json",
|
|
18
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
19
|
-
}
|
|
20
|
-
});
|
|
15
|
+
const response = await client.get("/api/users?q=" + text + "&skip=0&top=" + PAGE_SIZE);
|
|
21
16
|
const data = await response.json();
|
|
22
17
|
return data;
|
|
23
18
|
};
|
package/src/hooks/useUser.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
//import { useContext } from "react";
|
|
2
1
|
import { useQuery } from "react-query";
|
|
3
2
|
import WeavyClient from "../client/WeavyClient";
|
|
4
|
-
//import { WeavyContext } from "../contexts/WeavyContext";
|
|
5
3
|
|
|
6
4
|
/// GET current user
|
|
7
|
-
export default function useUser(client: WeavyClient) {
|
|
8
|
-
//const { client } = useContext(WeavyContext);
|
|
9
|
-
|
|
5
|
+
export default function useUser(client: WeavyClient) {
|
|
10
6
|
if (!client) {
|
|
11
7
|
throw new Error('useUser must be used within an WeavyProvider');
|
|
12
8
|
}
|
|
@@ -14,17 +10,10 @@ export default function useUser(client: WeavyClient) {
|
|
|
14
10
|
const getUser = async () => {
|
|
15
11
|
|
|
16
12
|
try {
|
|
17
|
-
const response = await
|
|
18
|
-
headers: {
|
|
19
|
-
"content-type": "application/json",
|
|
20
|
-
"Authorization": "Bearer " + await client.tokenFactory()
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
13
|
+
const response = await client.get("/api/user");
|
|
24
14
|
if(response.ok){
|
|
25
15
|
return await response.json();
|
|
26
|
-
}
|
|
27
|
-
|
|
16
|
+
}
|
|
28
17
|
console.error("Could not load Weavy user data...")
|
|
29
18
|
return null;
|
|
30
19
|
} catch(err: any){
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import WeavyClient from './client/WeavyClient';
|
|
2
2
|
import WeavyProvider from './contexts/WeavyContext';
|
|
3
|
-
import
|
|
3
|
+
import { WeavyContext } from './contexts/WeavyContext';
|
|
4
4
|
import MessengerProvider from './contexts/MessengerContext';
|
|
5
|
-
import
|
|
5
|
+
import { MessengerContext } from './contexts/MessengerContext';
|
|
6
6
|
import Messenger from './components/Messenger';
|
|
7
7
|
import ConversationBadge from './components/ConversationBadge';
|
|
8
8
|
import ConversationList from './components/ConversationList';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
|
|
3
|
+
// Global alerts
|
|
4
|
+
|
|
5
|
+
.wy-alert-message {
|
|
6
|
+
padding: .25rem .5rem;
|
|
7
|
+
background-color: $client-alert-background;
|
|
8
|
+
text-align: center;
|
|
9
|
+
width: $client-panel-width;
|
|
10
|
+
color: $client-alert-color;
|
|
11
|
+
border-radius: .1875rem;
|
|
12
|
+
margin: 0 auto;
|
|
13
|
+
margin-top: 1rem;
|
|
14
|
+
font-family: $font-family-base;
|
|
15
|
+
position: relative;
|
|
16
|
+
z-index: 10;
|
|
17
|
+
box-shadow: $md-shadow-8dp;
|
|
18
|
+
max-width: calc(100% - 3rem);
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
user-select: none;
|
|
21
|
+
|
|
22
|
+
a {
|
|
23
|
+
color: darken($client-alert-color, 10%);
|
|
24
|
+
text-decoration: $link-decoration;
|
|
25
|
+
font-weight: $alert-link-font-weight;
|
|
26
|
+
pointer-events: auto;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&.wy-fade {
|
|
30
|
+
transition: all $md-animation-duration $md-animation-curve-default;
|
|
31
|
+
opacity: 0;
|
|
32
|
+
height: 0;
|
|
33
|
+
padding-top: 0;
|
|
34
|
+
padding-bottom: 0;
|
|
35
|
+
margin-top: 0;
|
|
36
|
+
|
|
37
|
+
&.wy-in {
|
|
38
|
+
transition: opacity $md-animation-duration $md-animation-curve-default;
|
|
39
|
+
opacity: 1;
|
|
40
|
+
height: auto;
|
|
41
|
+
padding-top: .5rem;
|
|
42
|
+
padding-bottom: .5rem;
|
|
43
|
+
margin-top: 1rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wy-button {
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
flex-grow: 0;
|
|
52
|
+
|
|
53
|
+
> * {
|
|
54
|
+
display: inline-flex;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
font-weight: 400;
|
|
58
|
+
text-align: center;
|
|
59
|
+
white-space: nowrap;
|
|
60
|
+
vertical-align: middle;
|
|
61
|
+
user-select: none;
|
|
62
|
+
border: 1px solid transparent;
|
|
63
|
+
padding: .3125rem .75rem;
|
|
64
|
+
font-size: 1rem;
|
|
65
|
+
line-height: 1.5;
|
|
66
|
+
border-radius: .1875rem;
|
|
67
|
+
color: $white;
|
|
68
|
+
background-color: $primary;
|
|
69
|
+
border-color: $primary;
|
|
70
|
+
box-shadow: $btn-box-shadow;
|
|
71
|
+
margin-top: .5rem;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
@use "mixins/backdrop";
|
|
3
|
+
@use "mixins/position";
|
|
4
|
+
|
|
5
|
+
.wy-appbars {
|
|
6
|
+
@include position.sticky-top;
|
|
7
|
+
|
|
8
|
+
@include backdrop.filter {
|
|
9
|
+
> .wy-appbar {
|
|
10
|
+
backdrop-filter: none;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.wy-appbar {
|
|
16
|
+
display: grid;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
height: $appbar-height;
|
|
20
|
+
padding: $navbar-padding-y $navbar-padding-x;
|
|
21
|
+
flex: 0 0 $appbar-height;
|
|
22
|
+
grid-template-columns: minmax(2rem, max-content) minmax(0, max-content) minmax(2rem, max-content);
|
|
23
|
+
column-gap: .5rem;
|
|
24
|
+
font-family: $font-family-base;
|
|
25
|
+
line-height: $line-height-base;
|
|
26
|
+
|
|
27
|
+
@include backdrop.filter;
|
|
28
|
+
|
|
29
|
+
.wy-badge {
|
|
30
|
+
align-self: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.wy-button {
|
|
34
|
+
max-height: 2rem;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.wy-appbar-buttons {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex: 0 0 1rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.wy-appbar-text {
|
|
44
|
+
@include text-truncate();
|
|
45
|
+
color: inherit !important;
|
|
46
|
+
user-select: none;
|
|
47
|
+
|
|
48
|
+
a {
|
|
49
|
+
color: inherit;
|
|
50
|
+
|
|
51
|
+
&:hover {
|
|
52
|
+
color: inherit;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.wy-appbar {
|
|
58
|
+
// light theme (default)
|
|
59
|
+
&, .wy-light &, &.wy-light {
|
|
60
|
+
background-color: rgba($gray-50, $opacity-backdrop);
|
|
61
|
+
color: $navbar-light-color;
|
|
62
|
+
box-shadow: rgba($gray-200, $opacity-backdrop) 0px -1px 0px 0px inset;
|
|
63
|
+
}
|
|
64
|
+
// dark theme
|
|
65
|
+
.wy-dark &, &.wy-dark {
|
|
66
|
+
background-color: rgba($dark, $opacity-backdrop);
|
|
67
|
+
color: $navbar-dark-color;
|
|
68
|
+
box-shadow: rgba($gray-800, $opacity-backdrop) 0px -1px 0px 0px inset;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.wy-footerbars {
|
|
73
|
+
padding-bottom: $footerbar-height;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.wy-footerbar {
|
|
77
|
+
position: absolute;
|
|
78
|
+
bottom: 0;
|
|
79
|
+
left: 0;
|
|
80
|
+
right: 0;
|
|
81
|
+
z-index: $zindex-sticky;
|
|
82
|
+
|
|
83
|
+
&::after {
|
|
84
|
+
content: "";
|
|
85
|
+
position: absolute;
|
|
86
|
+
width: 100vw;
|
|
87
|
+
left: 0;
|
|
88
|
+
bottom: 0;
|
|
89
|
+
height: $footerbar-height;
|
|
90
|
+
border-top: $border-width solid rgba($gray-200, $opacity-backdrop);
|
|
91
|
+
background: rgba($gray-50, $opacity-backdrop);
|
|
92
|
+
z-index: -1;
|
|
93
|
+
|
|
94
|
+
@include backdrop.filter;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.wy-buttons {
|
|
98
|
+
flex-direction: row-reverse;
|
|
99
|
+
|
|
100
|
+
> :not(:last-child) {
|
|
101
|
+
margin: 0 0 0 .5rem;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.wy-footerbars-fixed {
|
|
107
|
+
.wy-footerbar {
|
|
108
|
+
position: fixed;
|
|
109
|
+
|
|
110
|
+
&::after {
|
|
111
|
+
position: fixed;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
@use "bs/list-group";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
.wy-attachments,
|
|
6
|
+
.wy-meetings {
|
|
7
|
+
border: none;
|
|
8
|
+
border-radius: $border-radius-sm;
|
|
9
|
+
flex: 1 1 100%;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
|
|
12
|
+
.wy-attachment,
|
|
13
|
+
.wy-meeting {
|
|
14
|
+
border-left: none;
|
|
15
|
+
border-right: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
> * {
|
|
19
|
+
padding: .25rem .5rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> :first-child {
|
|
23
|
+
border-top: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
> :last-child {
|
|
27
|
+
//border-top: variables.$border-width solid variables.$border-color;
|
|
28
|
+
border-bottom: none;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.wy-attachment,
|
|
33
|
+
.wy-meeting {
|
|
34
|
+
@extend
|
|
35
|
+
%list-group-item,
|
|
36
|
+
%list-group-item-action;
|
|
37
|
+
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.wy-attachment-icon {
|
|
44
|
+
flex: 0 0 auto;
|
|
45
|
+
display: flex;
|
|
46
|
+
|
|
47
|
+
.wy-icon, .wy-icon-stack {
|
|
48
|
+
width: 3rem;
|
|
49
|
+
height: 3rem;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.wy-attachment-content {
|
|
54
|
+
flex: 1 1 100%;
|
|
55
|
+
min-width: 0;
|
|
56
|
+
margin-left: .5rem;
|
|
57
|
+
margin-right: .5rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.wy-attachment-title {
|
|
61
|
+
font-family: $headings-font-family;
|
|
62
|
+
font-style: $headings-font-style;
|
|
63
|
+
font-weight: $headings-font-weight;
|
|
64
|
+
color: $headings-color;
|
|
65
|
+
@include text-truncate();
|
|
66
|
+
@include font-size($h6-font-size);
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.wy-attachment-meta {
|
|
71
|
+
@include text-truncate();
|
|
72
|
+
@include font-size($small-font-size);
|
|
73
|
+
color: $text-muted;
|
|
74
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
@use "bs/forms";
|
|
3
|
+
|
|
4
|
+
.wy-avatar {
|
|
5
|
+
border-radius: 50%;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wy-avatar-header {
|
|
9
|
+
padding: 1.5rem;
|
|
10
|
+
margin-left: auto;
|
|
11
|
+
margin-right: auto;
|
|
12
|
+
text-align: center;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.wy-avatar-input {
|
|
16
|
+
@extend %form-control, %form-control-sm;
|
|
17
|
+
background: $light;
|
|
18
|
+
border-color: transparent;
|
|
19
|
+
text-align: center;
|
|
20
|
+
margin-left: auto;
|
|
21
|
+
margin-right: auto;
|
|
22
|
+
margin-bottom: 1.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wy-avatar-presence {
|
|
26
|
+
position: relative;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.wy-avatar-display-name {
|
|
30
|
+
font-size: $h4-font-size;
|
|
31
|
+
font-weight: $display-font-weight;
|
|
32
|
+
line-height: $display-line-height;
|
|
33
|
+
text-align: center;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// presence indicator
|
|
38
|
+
.wy-presence {
|
|
39
|
+
display: none; // initially hidden
|
|
40
|
+
background-color: $gray-100;
|
|
41
|
+
width: .75rem;
|
|
42
|
+
height: .75rem;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
outline: .125rem solid $white;
|
|
45
|
+
position: absolute;
|
|
46
|
+
bottom: 0;
|
|
47
|
+
right: -5%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// online
|
|
51
|
+
.wy-presence-active {
|
|
52
|
+
background-color: $green-400;
|
|
53
|
+
display: block;
|
|
54
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
@use "bs/badge";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
.wy-badge {
|
|
6
|
+
@extend %badge;
|
|
7
|
+
border-radius: 50rem;
|
|
8
|
+
background-color: $primary;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.wy-badge-success {
|
|
12
|
+
background-color: $success;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.wy-badge-warning {
|
|
16
|
+
background-color: $warning;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.wy-badge-danger {
|
|
20
|
+
background-color: $danger;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.wy-button {
|
|
24
|
+
position: relative; // so that we can position .badge
|
|
25
|
+
|
|
26
|
+
// badge, e.g. notification count
|
|
27
|
+
.wy-badge {
|
|
28
|
+
font-size: $font-size-xs;
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: 0;
|
|
31
|
+
top: 0;
|
|
32
|
+
border-radius: 1rem;
|
|
33
|
+
margin: 0;
|
|
34
|
+
padding: .25rem;
|
|
35
|
+
min-width: 1rem;
|
|
36
|
+
max-width: 2rem;
|
|
37
|
+
height: 1rem;
|
|
38
|
+
line-height: .5rem;
|
|
39
|
+
display: block;
|
|
40
|
+
text-align: center;
|
|
41
|
+
@include text-truncate();
|
|
42
|
+
|
|
43
|
+
&:empty {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
@use "config" as *;
|
|
2
|
+
@use "bs/buttons";
|
|
3
|
+
|
|
4
|
+
// basic unstyled button with support for icon and text
|
|
5
|
+
.wy-button {
|
|
6
|
+
@extend %btn;
|
|
7
|
+
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
gap: .25rem;
|
|
12
|
+
|
|
13
|
+
// align icons
|
|
14
|
+
&:not(.wy-button-icon) {
|
|
15
|
+
.wy-icon {
|
|
16
|
+
&:first-child {
|
|
17
|
+
margin-left: -.25rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&:last-child {
|
|
21
|
+
margin-right: -.25rem;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// default button
|
|
29
|
+
.wy-button:not(.wy-button-link, .wy-button-primary) {
|
|
30
|
+
--#{$prefix}btn-hover-border-color: transparent;
|
|
31
|
+
--#{$prefix}btn-active-border-color: transparent;
|
|
32
|
+
--#{$prefix}btn-hover-color: var(--#{$prefix}btn-color);
|
|
33
|
+
--#{$prefix}btn-hover-bg: #{$btn-hover-bg};
|
|
34
|
+
--#{$prefix}btn-focus-bg: #{$btn-hover-bg};
|
|
35
|
+
--#{$prefix}btn-active-color: var(--#{$prefix}btn-color);
|
|
36
|
+
--#{$prefix}btn-active-bg: #{$btn-active-bg};
|
|
37
|
+
|
|
38
|
+
// dark mode
|
|
39
|
+
.wy-dark & {
|
|
40
|
+
color: var(--#{$prefix}white);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// button with only icon (no text)
|
|
45
|
+
.wy-button-icon {
|
|
46
|
+
width: 2rem;
|
|
47
|
+
height: 2rem;
|
|
48
|
+
padding: .25rem;
|
|
49
|
+
line-height: 1;
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
border-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// default icon button
|
|
55
|
+
.wy-button-icon:not(.wy-button-primary) {
|
|
56
|
+
color: $icon-color;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
.wy-icon {
|
|
60
|
+
color: $icon-hover-color;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// dark mode
|
|
65
|
+
.wy-dark & {
|
|
66
|
+
color: $icon-light-color;
|
|
67
|
+
.wy-icon {
|
|
68
|
+
color: $icon-light-color;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:hover {
|
|
72
|
+
color: $icon-light-hover-color;
|
|
73
|
+
.wy-icon {
|
|
74
|
+
color: $icon-light-hover-color;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// primary button
|
|
81
|
+
.wy-button-primary {
|
|
82
|
+
@extend %btn-primary;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// button that looks and behaves like a link
|
|
86
|
+
.wy-button-link {
|
|
87
|
+
@extend %btn-link;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// container for proper spacing and alignment of buttons
|
|
91
|
+
.wy-buttons {
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
flex-wrap: wrap;
|
|
95
|
+
gap: .5rem;
|
|
96
|
+
}
|