@weavy/uikit-react 11.2.0 → 12.1.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/changelog.md +15 -0
- package/dist/cjs/index.js +6 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/Image.d.ts +2 -0
- package/dist/cjs/types/components/PdfViewer.d.ts +6 -0
- package/dist/cjs/types/components/Preview.d.ts +58 -0
- package/dist/cjs/types/types/types.d.ts +1 -0
- package/dist/cjs/types/utils/fileUtilities.d.ts +16 -1
- package/dist/css/weavy-chat.css +2684 -0
- package/dist/css/weavy-messenger.css +3039 -0
- package/dist/css/weavy.css +3039 -0
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Image.d.ts +2 -0
- package/dist/esm/types/components/PdfViewer.d.ts +6 -0
- package/dist/esm/types/components/Preview.d.ts +58 -0
- package/dist/esm/types/types/types.d.ts +1 -0
- package/dist/esm/types/utils/fileUtilities.d.ts +16 -1
- package/package.json +14 -4
- package/rollup.config.js +0 -2
- package/src/components/Attachment.tsx +5 -6
- package/src/components/Avatar.tsx +2 -3
- package/src/components/Chat.tsx +3 -4
- package/src/components/Conversation.tsx +20 -29
- 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 +1 -2
- package/src/components/Image.tsx +39 -7
- package/src/components/MeetingCard.tsx +7 -8
- package/src/components/Message.tsx +12 -13
- package/src/components/Messages.tsx +6 -7
- package/src/components/Messenger.tsx +3 -4
- package/src/components/NewConversation.tsx +5 -7
- package/src/components/PdfViewer.tsx +271 -0
- package/src/components/Presence.tsx +2 -2
- package/src/components/Preview.tsx +294 -0
- package/src/components/Reactions.tsx +6 -7
- package/src/components/SearchUsers.tsx +17 -16
- package/src/components/SeenBy.tsx +1 -2
- package/src/contexts/PreviewContext.tsx +4 -6
- package/src/hooks/useConversation.ts +0 -1
- package/src/hooks/usePresence.ts +4 -5
- package/src/hooks/useReactions.ts +0 -1
- package/src/scss/theme/_alert.scss +73 -0
- package/src/scss/theme/_appbar.scss +112 -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.scss +115 -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 +137 -0
- package/src/scss/theme/_picker-list.scss +37 -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 +105 -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 +31 -0
- package/src/scss/weavy-messenger.scss +60 -0
- package/src/scss/weavy.scss +2 -0
- package/src/types/types.ts +2 -0
- 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/utils/fileUtilities.ts +280 -72
- package/src/utils/scrollbarDetection.js +5 -7
- 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 -57
|
@@ -7,6 +7,8 @@ declare type ImageProps = {
|
|
|
7
7
|
more?: number;
|
|
8
8
|
onClick: (e: any) => void;
|
|
9
9
|
};
|
|
10
|
+
export declare function checkImageLoad(img: HTMLImageElement): void;
|
|
11
|
+
export declare function imageLoaded(event: any): void;
|
|
10
12
|
export declare const Image: ({ src, previewSrc, width, height, more, onClick }: ImageProps) => JSX.Element;
|
|
11
13
|
declare type ImageGridProps = {
|
|
12
14
|
children: React.ReactNode;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare type ImageProps = {
|
|
3
|
+
src: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const PreviewImage: ({ src, width, height }: ImageProps) => JSX.Element;
|
|
8
|
+
declare type DocumentProps = {
|
|
9
|
+
src: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const PreviewDocument: ({ src }: DocumentProps) => JSX.Element;
|
|
12
|
+
declare type VideoProps = {
|
|
13
|
+
src: string;
|
|
14
|
+
name: string;
|
|
15
|
+
mediaType?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const PreviewVideo: ({ src, name, mediaType }: VideoProps) => JSX.Element;
|
|
18
|
+
declare type AudioProps = {
|
|
19
|
+
src: string;
|
|
20
|
+
name: string;
|
|
21
|
+
mediaType?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const PreviewAudio: ({ src, name, mediaType }: AudioProps) => JSX.Element;
|
|
24
|
+
declare type TextProps = {
|
|
25
|
+
src: string;
|
|
26
|
+
html?: boolean;
|
|
27
|
+
code?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const PreviewText: ({ src, html, code }: TextProps) => JSX.Element;
|
|
30
|
+
declare type EmbedProps = {
|
|
31
|
+
src: string;
|
|
32
|
+
name: string;
|
|
33
|
+
icon: string;
|
|
34
|
+
provider?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare const PreviewEmbed: ({ src, name, icon, provider }: EmbedProps) => JSX.Element;
|
|
37
|
+
declare type IconProps = {
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
src: string;
|
|
40
|
+
icon: string;
|
|
41
|
+
name: string;
|
|
42
|
+
provider?: string;
|
|
43
|
+
download?: boolean;
|
|
44
|
+
className?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare const PreviewIcon: ({ children, src, icon, name, provider, download, className }: IconProps) => JSX.Element;
|
|
47
|
+
declare type PreviewProps = {
|
|
48
|
+
src: string;
|
|
49
|
+
format: PreviewFormatType;
|
|
50
|
+
name: string;
|
|
51
|
+
icon: string;
|
|
52
|
+
width?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
mediaType?: string;
|
|
55
|
+
provider?: string;
|
|
56
|
+
};
|
|
57
|
+
export declare const Preview: ({ src, format, name, icon, width, height, mediaType, provider }: PreviewProps) => JSX.Element;
|
|
58
|
+
export default Preview;
|
|
@@ -118,6 +118,7 @@ declare type AttachmentType = {
|
|
|
118
118
|
thumbnail_url: string;
|
|
119
119
|
external_url: string;
|
|
120
120
|
};
|
|
121
|
+
declare type PreviewFormatType = "text" | "code" | "markup" | "image" | "video" | "audio" | "document" | "embed" | "link" | "download" | "none";
|
|
121
122
|
declare type ReactionType = {
|
|
122
123
|
id: number;
|
|
123
124
|
parent: MessageType;
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export declare const fileSizeAsString: (size: number) => string;
|
|
2
|
-
export declare
|
|
2
|
+
export declare function getExtension(name: string): string;
|
|
3
|
+
export declare function isAudio(ext: string): boolean;
|
|
4
|
+
export declare function isImage(ext: string): boolean;
|
|
5
|
+
export declare function isWebImage(path: string): boolean;
|
|
6
|
+
export declare function isBitmap(path: string): boolean;
|
|
7
|
+
export declare function isMetaFile(path: string): boolean;
|
|
8
|
+
export declare function isVideo(ext: string): boolean;
|
|
9
|
+
export declare function isMarkup(ext: string): boolean;
|
|
10
|
+
export declare function isCode(ext: string): boolean;
|
|
11
|
+
export declare function isText(ext: string): boolean;
|
|
12
|
+
export declare function isOfficeDocument(path: string): boolean;
|
|
13
|
+
export declare function canResize(path: string): boolean;
|
|
14
|
+
export declare function canConvertToImage(filename: string): boolean;
|
|
15
|
+
export declare function canConvertToPdf(filename: string): boolean;
|
|
16
|
+
export declare function getIcon(name: string, mediaType?: string): {
|
|
3
17
|
icon: string;
|
|
4
18
|
color?: string;
|
|
5
19
|
};
|
|
20
|
+
export declare function getPreviewFormat(filename: string): PreviewFormatType;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weavy/uikit-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.1.0",
|
|
4
4
|
"author": "Weavy",
|
|
5
5
|
"description": "React UI-kit for Weavy",
|
|
6
6
|
"homepage": "https://github.com/weavy/weavy-uikit-react",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"main": "dist/cjs/index.js",
|
|
9
9
|
"module": "dist/esm/index.js",
|
|
10
10
|
"types": "./dist/cjs/types/index.d.ts",
|
|
11
|
+
"style": "dist/css/weavy-react.css",
|
|
11
12
|
"devDependencies": {
|
|
12
13
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
13
14
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
@@ -17,11 +18,13 @@
|
|
|
17
18
|
"@types/react": "^18.0.8",
|
|
18
19
|
"@types/react-dom": "^18.0.3",
|
|
19
20
|
"@types/react-modal": "^3.13.1",
|
|
21
|
+
"npm-run-all": "^4.1.5",
|
|
22
|
+
"rimraf": "^3.0.2",
|
|
20
23
|
"rollup": "^2.72.0",
|
|
21
|
-
"rollup-plugin-delete": "^2.0.0",
|
|
22
24
|
"rollup-plugin-dts": "^4.2.1",
|
|
23
25
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
24
26
|
"rollup-plugin-terser": "^7.0.2",
|
|
27
|
+
"sass": "^1.53.0",
|
|
25
28
|
"tslib": "^2.4.0",
|
|
26
29
|
"typescript": "^4.6.4"
|
|
27
30
|
},
|
|
@@ -30,10 +33,16 @@
|
|
|
30
33
|
"react-dom": "^18.1.0"
|
|
31
34
|
},
|
|
32
35
|
"scripts": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
36
|
+
"clean": "rimraf dist/*",
|
|
37
|
+
"build": "npm-run-all clean --parallel css js",
|
|
38
|
+
"css": "sass src/scss:dist/css --no-source-map",
|
|
39
|
+
"js": "rollup -c",
|
|
40
|
+
"watch": "npm-run-all clean --parallel watch-css watch-js",
|
|
41
|
+
"watch-css": "sass src/scss:dist/css --watch",
|
|
42
|
+
"watch-js": "rollup -c --watch"
|
|
35
43
|
},
|
|
36
44
|
"dependencies": {
|
|
45
|
+
"@mdi/js": "^6.9.96",
|
|
37
46
|
"@mdi/react": "^1.6.0",
|
|
38
47
|
"@microsoft/signalr": "^6.0.3",
|
|
39
48
|
"classnames": "^2.3.1",
|
|
@@ -41,6 +50,7 @@
|
|
|
41
50
|
"emoji-toolkit": "^6.6.0",
|
|
42
51
|
"lodash.debounce": "^4.0.8",
|
|
43
52
|
"lodash.throttle": "^4.1.1",
|
|
53
|
+
"pdfjs-dist": "^2.14.305",
|
|
44
54
|
"react-modal": "^3.14.4",
|
|
45
55
|
"react-query": "^3.34.16"
|
|
46
56
|
}
|
package/rollup.config.js
CHANGED
|
@@ -4,7 +4,6 @@ import typescript from "@rollup/plugin-typescript";
|
|
|
4
4
|
import dts from "rollup-plugin-dts";
|
|
5
5
|
import { terser } from "rollup-plugin-terser";
|
|
6
6
|
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
7
|
-
import del from 'rollup-plugin-delete';
|
|
8
7
|
|
|
9
8
|
const packageJson = require("./package.json");
|
|
10
9
|
|
|
@@ -24,7 +23,6 @@ export default [
|
|
|
24
23
|
},
|
|
25
24
|
],
|
|
26
25
|
plugins: [
|
|
27
|
-
del({ targets: 'dist/*' }),
|
|
28
26
|
peerDepsExternal(),
|
|
29
27
|
resolve(),
|
|
30
28
|
commonjs(),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Icon from "../ui/Icon";
|
|
3
3
|
import { fileSizeAsString, getIcon } from "../utils/fileUtilities";
|
|
4
|
-
import { prefix as wy } from "../utils/styles";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
previewFormat: string,
|
|
@@ -18,12 +17,12 @@ const Attachment = ({ previewFormat, url, previewUrl, mediaType, name, kind, siz
|
|
|
18
17
|
let fileSize = size > 0 ? fileSizeAsString(size) : null;
|
|
19
18
|
let { icon, color } = getIcon(name, mediaType)
|
|
20
19
|
return (
|
|
21
|
-
<a href={previewUrl || url} className={wy
|
|
22
|
-
<div className={wy
|
|
23
|
-
<div className={wy
|
|
24
|
-
<div className={wy
|
|
20
|
+
<a href={previewUrl || url} className={'wy-attachment'} target={"_blank"} title={name}>
|
|
21
|
+
<div className={'wy-attachment-icon'} title={kind}><Icon.UI name={icon} color={color} size={2} /></div>
|
|
22
|
+
<div className={'wy-attachment-content'}>
|
|
23
|
+
<div className={'wy-attachment-title'}>{name}</div>
|
|
25
24
|
{fileSize &&
|
|
26
|
-
<div className={wy
|
|
25
|
+
<div className={'wy-attachment-meta'} title={fileSize}>{fileSize}</div>
|
|
27
26
|
}
|
|
28
27
|
</div>
|
|
29
28
|
</a>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import Presence from "./Presence";
|
|
4
|
-
import { prefix as wy } from "../utils/styles";
|
|
5
4
|
|
|
6
5
|
type Props = {
|
|
7
6
|
id?: number,
|
|
@@ -14,8 +13,8 @@ type Props = {
|
|
|
14
13
|
|
|
15
14
|
const Avatar = ({ id, src, name, presence, size = 48, className }: Props) => {
|
|
16
15
|
return (
|
|
17
|
-
<div className={classNames(wy
|
|
18
|
-
<img alt="" title={name} className=
|
|
16
|
+
<div className={classNames('wy-avatar-presence', className)}>
|
|
17
|
+
<img alt="" title={name} className="wy-avatar" height={size} width={size} src={src} />
|
|
19
18
|
{presence && id &&
|
|
20
19
|
<Presence id={id} status={presence} />
|
|
21
20
|
}
|
package/src/components/Chat.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import Messages from './Messages';
|
|
|
6
6
|
import useMembers from '../hooks/useMembers';
|
|
7
7
|
import Typing from './Typing';
|
|
8
8
|
import useConversation from '../hooks/useConversation';
|
|
9
|
-
import { prefix as wy } from "../utils/styles";
|
|
10
9
|
|
|
11
10
|
const Chat = ({ id }: ChatProps) => {
|
|
12
11
|
const { client } = useContext(WeavyContext);
|
|
@@ -37,9 +36,9 @@ const Chat = ({ id }: ChatProps) => {
|
|
|
37
36
|
}, [dataChat]);
|
|
38
37
|
|
|
39
38
|
return (
|
|
40
|
-
<div className=
|
|
41
|
-
<header className=
|
|
42
|
-
<nav className=
|
|
39
|
+
<div className="wy-messenger-conversation wy-scroll-y">
|
|
40
|
+
<header className="wy-appbars">
|
|
41
|
+
<nav className="wy-appbar">
|
|
43
42
|
<div></div>
|
|
44
43
|
{selectedId && dataConversation &&
|
|
45
44
|
<div className="wy-appbar-text">
|
|
@@ -13,7 +13,6 @@ import SearchUsers from './SearchUsers';
|
|
|
13
13
|
import useMutateMembers from '../hooks/useMutateMembers';
|
|
14
14
|
import useConversation from '../hooks/useConversation';
|
|
15
15
|
import useMutateConversationName from '../hooks/useMutateConversationName';
|
|
16
|
-
import { prefix as wy } from "../utils/styles";
|
|
17
16
|
import useMutateRemoveMembers from '../hooks/useMutateRemoveMembers';
|
|
18
17
|
import Avatar from './Avatar';
|
|
19
18
|
import { UserContext } from '../contexts/UserContext';
|
|
@@ -21,7 +20,6 @@ import Messages from './Messages';
|
|
|
21
20
|
|
|
22
21
|
const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
23
22
|
|
|
24
|
-
|
|
25
23
|
const queryClient = useQueryClient();
|
|
26
24
|
const { client } = useContext(WeavyContext);
|
|
27
25
|
const { selectedConversationId, setSelectedConversationId } = useContext(MessengerContext);
|
|
@@ -85,10 +83,6 @@ const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
|
85
83
|
setSelectedConversationId(null);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
86
|
// set selected conversation id if id is supplied to component
|
|
93
87
|
useEffect(() => {
|
|
94
88
|
if (id) {
|
|
@@ -117,13 +111,10 @@ const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
|
117
111
|
}
|
|
118
112
|
}, [dataConversation]);
|
|
119
113
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
114
|
return (
|
|
124
115
|
<>
|
|
125
|
-
<header className=
|
|
126
|
-
<nav className=
|
|
116
|
+
<header className="wy-appbars">
|
|
117
|
+
<nav className="wy-appbar">
|
|
127
118
|
<div>
|
|
128
119
|
{showBackButton &&
|
|
129
120
|
<Button.UI onClick={handleBack}><Icon.UI name="back" /></Button.UI>
|
|
@@ -131,7 +122,7 @@ const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
|
131
122
|
{selectedConversationId && dataConversation &&
|
|
132
123
|
|
|
133
124
|
<>
|
|
134
|
-
<div className=
|
|
125
|
+
<div className="wy-appbar-text">
|
|
135
126
|
<Typing id={selectedConversationId} context="conversation">
|
|
136
127
|
{dataConversation.display_name}
|
|
137
128
|
</Typing>
|
|
@@ -154,7 +145,7 @@ const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
|
154
145
|
</header>
|
|
155
146
|
|
|
156
147
|
{!selectedConversationId &&
|
|
157
|
-
<div className=
|
|
148
|
+
<div className="wy-avatar-header">
|
|
158
149
|
<Avatar src={user.avatar_url} name={user.title} presence={user.presence} id={user.id} size={256} />
|
|
159
150
|
<h2>Welcome {user.name}!</h2>
|
|
160
151
|
Create or select a conversation to get started
|
|
@@ -164,41 +155,41 @@ const Conversation = ({ id, showBackButton }: ConversationProps) => {
|
|
|
164
155
|
<Messages id={selectedConversationId} members={dataMembers} displayName={dataConversation?.display_name} avatarUrl={dataConversation?.avatar_url} />
|
|
165
156
|
}
|
|
166
157
|
|
|
167
|
-
<Overlay.UI isOpen={modalAddOpen} className=
|
|
168
|
-
<header className=
|
|
169
|
-
<nav className=
|
|
158
|
+
<Overlay.UI isOpen={modalAddOpen} className="wy-modal">
|
|
159
|
+
<header className="wy-appbars">
|
|
160
|
+
<nav className="wy-appbar">
|
|
170
161
|
<Button.UI onClick={() => toggleAddModal(false)}><Icon.UI name='close' /></Button.UI>
|
|
171
|
-
<div className=
|
|
162
|
+
<div className="wy-appbar-text">Add people</div>
|
|
172
163
|
</nav>
|
|
173
164
|
</header>
|
|
174
165
|
<SearchUsers handleSubmit={handleAdd} buttonTitle="Add selected" />
|
|
175
166
|
</Overlay.UI>
|
|
176
167
|
|
|
177
|
-
<Overlay.UI isOpen={modalDetailsOpen} className=
|
|
178
|
-
<header className=
|
|
179
|
-
<nav className=
|
|
168
|
+
<Overlay.UI isOpen={modalDetailsOpen} className="wy-modal">
|
|
169
|
+
<header className="wy-appbars">
|
|
170
|
+
<nav className="wy-appbar">
|
|
180
171
|
<Button.UI onClick={() => toggleDetailsModal(false)}><Icon.UI name='close' /></Button.UI>
|
|
181
|
-
<div className=
|
|
172
|
+
<div className="wy-appbar-text">Conversation details</div>
|
|
182
173
|
</nav>
|
|
183
174
|
</header>
|
|
184
175
|
<div>
|
|
185
|
-
{dataConversation && <div className=
|
|
176
|
+
{dataConversation && <div className="wy-avatar-header"><Avatar src={dataConversation?.avatar_url} name={title} size={128} /></div>}
|
|
186
177
|
{dataConversation?.type !== ChatRoom &&
|
|
187
|
-
<h4 className=
|
|
178
|
+
<h4 className="wy-avatar-display-name">{dataConversation?.display_name}</h4>
|
|
188
179
|
}
|
|
189
180
|
|
|
190
181
|
{dataConversation?.type === ChatRoom && (
|
|
191
182
|
<>
|
|
192
|
-
<div className=
|
|
193
|
-
<input className=
|
|
183
|
+
<div className="wy-pane-group">
|
|
184
|
+
<input className="wy-input" value={title} onChange={(e) => handleUpdateTitle(e)} />
|
|
194
185
|
</div>
|
|
195
|
-
<div className=
|
|
196
|
-
<table className=
|
|
186
|
+
<div className="wy-pane-group">
|
|
187
|
+
<table className="wy-search-result-table">
|
|
197
188
|
<tbody>
|
|
198
189
|
{dataMembers?.data.map((m: MemberType) => {
|
|
199
190
|
return (
|
|
200
|
-
<tr key={m.id} className=
|
|
201
|
-
<td className=
|
|
191
|
+
<tr key={m.id} className="wy-search-result-table-checkbox">
|
|
192
|
+
<td className="wy-search-result-table-icon"><Avatar src={m.avatar_url} name={m.display_name} id={m.id} size={24} presence={m.presence} /></td>
|
|
202
193
|
<td>{m.display_name}</td>
|
|
203
194
|
<td></td>
|
|
204
195
|
</tr>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState } from "react";
|
|
2
2
|
import { WeavyContext } from "../contexts/WeavyContext";
|
|
3
3
|
import useBadge from "../hooks/useBadge";
|
|
4
|
-
import { prefix as wy } from "../utils/styles";
|
|
5
4
|
|
|
6
5
|
const ConversationBadge = () => {
|
|
7
6
|
const { client } = useContext(WeavyContext);
|
|
@@ -34,7 +33,7 @@ const ConversationBadge = () => {
|
|
|
34
33
|
return (
|
|
35
34
|
<>
|
|
36
35
|
{!isLoading && badge > 0 &&
|
|
37
|
-
<span className=
|
|
36
|
+
<span className="wy-badge wy-badge-danger">{badge}</span>
|
|
38
37
|
}
|
|
39
38
|
</>
|
|
40
39
|
|
|
@@ -11,8 +11,6 @@ import Meetings from './Meetings';
|
|
|
11
11
|
import Meeting from './Meeting';
|
|
12
12
|
import FileBrowser from './FileBrowser';
|
|
13
13
|
import { getIcon } from '../utils/fileUtilities';
|
|
14
|
-
import { prefix as wy } from "../utils/styles";
|
|
15
|
-
|
|
16
14
|
|
|
17
15
|
type Props = {
|
|
18
16
|
conversationId: number,
|
|
@@ -46,13 +44,10 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
46
44
|
setAttachments([...attachments, attachment[0]]);
|
|
47
45
|
}
|
|
48
46
|
})
|
|
49
|
-
|
|
50
|
-
|
|
51
47
|
}
|
|
52
48
|
|
|
53
49
|
const { mutateAsync: uploadFile, isSuccess: uploadSuccess } = useFileUploader(handleUploaded);
|
|
54
50
|
|
|
55
|
-
|
|
56
51
|
useEffect(() => {
|
|
57
52
|
// set stored text and attachments if available
|
|
58
53
|
let textValue: any = queryClient.getQueryData(["form-text", conversationId]) || "";
|
|
@@ -71,8 +66,6 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
71
66
|
handleAutoGrow();
|
|
72
67
|
}, [text])
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
|
|
76
69
|
const handleInsertMessage = (e: React.KeyboardEvent<EventTarget>) => {
|
|
77
70
|
|
|
78
71
|
if(e.type === 'keydown' && !(e.key === "Enter" && e.ctrlKey )) return;
|
|
@@ -159,7 +152,7 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
159
152
|
|
|
160
153
|
|
|
161
154
|
return (
|
|
162
|
-
<form className=
|
|
155
|
+
<form className="wy-message-form">
|
|
163
156
|
{uploadError &&
|
|
164
157
|
<div>{uploadError}</div>
|
|
165
158
|
}
|
|
@@ -169,12 +162,12 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
169
162
|
{working &&
|
|
170
163
|
<div>Now uploading ({currentUploadCount} of {fileCount}) selected files</div>
|
|
171
164
|
}
|
|
172
|
-
<div className=
|
|
165
|
+
<div className="wy-picker-list">
|
|
173
166
|
{attachments.map((a: FileType) => {
|
|
174
167
|
let { icon } = getIcon(a.name);
|
|
175
168
|
return (
|
|
176
|
-
<div key={a.id} className=
|
|
177
|
-
<File id={a.id} name={a.name} className=
|
|
169
|
+
<div key={a.id} className="wy-picker-list-item">
|
|
170
|
+
<File id={a.id} name={a.name} className="wy-picker-list-item-title" icon={ icon } />
|
|
178
171
|
<Button.UI onClick={handleRemoveFile.bind(ConversationForm, a.id)}><Icon.UI name='close-circle' /></Button.UI>
|
|
179
172
|
</div>
|
|
180
173
|
|
|
@@ -183,8 +176,8 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
183
176
|
|
|
184
177
|
{meetings.map((m: MeetingType) => {
|
|
185
178
|
return (
|
|
186
|
-
<div key={m.id} className=
|
|
187
|
-
<Meeting id={m.id} title={m.provider} className=
|
|
179
|
+
<div key={m.id} className="wy-picker-list-item">
|
|
180
|
+
<Meeting id={m.id} title={m.provider} className="wy-picker-list-item-title" />
|
|
188
181
|
<Button.UI onClick={handleRemoveMeeting.bind(ConversationForm, m.id)}><Icon.UI name='close-circle' /></Button.UI>
|
|
189
182
|
</div>
|
|
190
183
|
|
|
@@ -193,19 +186,19 @@ const ConversationForm = ({ conversationId, handleInsert }: Props) => {
|
|
|
193
186
|
</div>
|
|
194
187
|
</div>
|
|
195
188
|
}
|
|
196
|
-
<div className=
|
|
189
|
+
<div className="wy-message-editor-inputs">
|
|
197
190
|
|
|
198
|
-
<div className=
|
|
191
|
+
<div className="wy-message-editor-buttons">
|
|
199
192
|
<input type="file" ref={input => fileInput = input} value={files} onChange={handleFileUpload} multiple hidden tabIndex={-1} />
|
|
200
193
|
<Button.UI title="Upload attachment" onClick={openFileInput}><Icon.UI name="attachment" /></Button.UI>
|
|
201
194
|
<Meetings onMeetingAdded={handleAddMeeting} />
|
|
202
195
|
<FileBrowser onFileAdded={handleExternalFileAdded} />
|
|
203
196
|
</div>
|
|
204
197
|
|
|
205
|
-
<div className=
|
|
206
|
-
<textarea rows={1} ref={textInput} className=
|
|
198
|
+
<div className="wy-message-editor-text wy-message-editor-grow">
|
|
199
|
+
<textarea rows={1} ref={textInput} className="wy-message-editor-textfield wy-message-editor-textcontent" value={text} onChange={handleChange} onKeyDown={handleInsertMessage} onKeyPress={useThrottle(handleKeyPress, 4000)}></textarea>
|
|
207
200
|
</div>
|
|
208
|
-
<div className=
|
|
201
|
+
<div className="wy-message-editor-buttons">
|
|
209
202
|
<Button.UI type="button" onClick={handleInsertMessage} ><Icon.UI name="send"/></Button.UI>
|
|
210
203
|
</div>
|
|
211
204
|
</div>
|
|
@@ -5,7 +5,6 @@ import ConversationListItem from './ConversationListItem';
|
|
|
5
5
|
import NewConversation from './NewConversation';
|
|
6
6
|
import Avatar from './Avatar';
|
|
7
7
|
import { UserContext } from '../contexts/UserContext';
|
|
8
|
-
import { prefix as wy } from "../utils/styles";
|
|
9
8
|
|
|
10
9
|
const ConversationList = () => {
|
|
11
10
|
const { client } = useContext(WeavyContext);
|
|
@@ -40,19 +39,19 @@ const ConversationList = () => {
|
|
|
40
39
|
|
|
41
40
|
return (
|
|
42
41
|
<>
|
|
43
|
-
<header className=
|
|
44
|
-
<nav className=
|
|
42
|
+
<header className="wy-appbars">
|
|
43
|
+
<nav className="wy-appbar">
|
|
45
44
|
<Avatar src={user.avatar_url} name={user.title} presence={user.presence} id={user.id} size={24} />
|
|
46
45
|
<div>Messenger</div>
|
|
47
46
|
<NewConversation />
|
|
48
47
|
</nav>
|
|
49
48
|
</header>
|
|
50
|
-
<div className=
|
|
49
|
+
<div className="wy-conversations">
|
|
51
50
|
{data && data.data?.map((item) =>
|
|
52
51
|
<ConversationListItem key={item.id} refetchConversations={refetch} item={item} />
|
|
53
52
|
)}
|
|
54
53
|
|
|
55
|
-
{/* <a className=
|
|
54
|
+
{/* <a className="wy-pager"><svg className="wy-spinner wy-spin" width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle fill="none" cx="12" cy="12" r="11" stroke-linecap="butt" stroke-width="2"></circle></svg></a> */}
|
|
56
55
|
</div>
|
|
57
56
|
</>
|
|
58
57
|
)
|
|
@@ -13,8 +13,7 @@ import Typing from './Typing';
|
|
|
13
13
|
import useMutateRemoveMembers from '../hooks/useMutateRemoveMembers';
|
|
14
14
|
import Avatar from './Avatar';
|
|
15
15
|
import { UserContext } from '../contexts/UserContext';
|
|
16
|
-
import
|
|
17
|
-
|
|
16
|
+
import classNames from 'classnames';
|
|
18
17
|
|
|
19
18
|
const ConversationListItem = ({ item, refetchConversations }: ConversationListItemProps) => {
|
|
20
19
|
|
|
@@ -79,25 +78,25 @@ const ConversationListItem = ({ item, refetchConversations }: ConversationListIt
|
|
|
79
78
|
// }
|
|
80
79
|
|
|
81
80
|
return (
|
|
82
|
-
<div className={
|
|
83
|
-
<a className={
|
|
81
|
+
<div className={classNames('wy-conversation', {"wy-unread": item.is_unread})} key={item.id}>
|
|
82
|
+
<a className={classNames('wy-conversation-link', { "wy-active": selectedConversationId === item.id})} href="#" onClick={(e) => handleClick(e, item.id)}>
|
|
84
83
|
<Avatar src={item.avatar_url} id={otherId || -1} presence={item.type !== ChatRoom ? "away" : ""} name={item.display_name} />
|
|
85
84
|
|
|
86
|
-
<div className=
|
|
87
|
-
<div className=
|
|
88
|
-
<div className=
|
|
85
|
+
<div className="wy-conversation-body">
|
|
86
|
+
<div className="wy-conversation-header">
|
|
87
|
+
<div className="wy-conversation-title">{item.display_name}</div>
|
|
89
88
|
{item.last_message &&
|
|
90
|
-
<time className=
|
|
89
|
+
<time className="wy-conversation-time" dateTime={item.last_message.created_at.toString()} title={date.format('LLLL')}>{date.fromNow()}</time>
|
|
91
90
|
}
|
|
92
91
|
</div>
|
|
93
|
-
<div className=
|
|
92
|
+
<div className="wy-conversation-summary">
|
|
94
93
|
<Typing id={item.id} context="listitem">
|
|
95
94
|
|
|
96
95
|
{item.last_message?.html &&
|
|
97
|
-
<span className=
|
|
96
|
+
<span className="wy-typing-hide" dangerouslySetInnerHTML={{ __html: joypixels.shortnameToUnicode(item.last_message?.text) }}></span>
|
|
98
97
|
}
|
|
99
98
|
{!item.last_message?.html &&
|
|
100
|
-
<span className=
|
|
99
|
+
<span className="wy-typing-hide">
|
|
101
100
|
{item.last_message?.attachment_ids?.length > 0 &&
|
|
102
101
|
<Icon.UI name="attachment" size={1} />
|
|
103
102
|
}
|
|
@@ -112,7 +111,7 @@ const ConversationListItem = ({ item, refetchConversations }: ConversationListIt
|
|
|
112
111
|
</div>
|
|
113
112
|
</a>
|
|
114
113
|
|
|
115
|
-
<div className=
|
|
114
|
+
<div className="wy-conversation-actions">
|
|
116
115
|
{item.is_pinned &&
|
|
117
116
|
<Button.UI onClick={handleUnpin}>
|
|
118
117
|
<Icon.UI name="pin" size={.75} />
|
|
@@ -120,7 +119,6 @@ const ConversationListItem = ({ item, refetchConversations }: ConversationListIt
|
|
|
120
119
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
|
|
124
122
|
<Dropdown.UI directionX='left'>
|
|
125
123
|
<>
|
|
126
124
|
{item.is_unread &&
|
|
@@ -4,7 +4,6 @@ import Button from '../ui/Button';
|
|
|
4
4
|
import Icon from '../ui/Icon';
|
|
5
5
|
import useMutateExternalBlobs from '../hooks/useMutateExternalBlobs';
|
|
6
6
|
import { UserContext } from "../contexts/UserContext";
|
|
7
|
-
import { prefix as wy } from "../utils/styles";
|
|
8
7
|
|
|
9
8
|
type Props = {
|
|
10
9
|
onFileAdded: Function
|
|
@@ -60,7 +59,7 @@ const FileBrowser = ({ onFileAdded }: Props) => {
|
|
|
60
59
|
$filebrowserFrame.id = "weavy-filebrowser";
|
|
61
60
|
$filebrowserFrame.name = "weavy-filebrowser";
|
|
62
61
|
$filebrowserFrame.src = filebrowserSrc;
|
|
63
|
-
$filebrowserFrame.className = wy
|
|
62
|
+
$filebrowserFrame.className = "wy-filebrowser-frame";
|
|
64
63
|
$filebrowserFrame.style.cssText = "position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: rgba(1,1,1,.4); z-index: 10000; display:none"
|
|
65
64
|
|
|
66
65
|
window.top?.document.body.appendChild($filebrowserFrame);
|