From edace3221384fa1d254d3d92d444177eb1813227 Mon Sep 17 00:00:00 2001
From: Ajay Bura <32841439+ajbura@users.noreply.github.com>
Date: Sat, 6 Aug 2022 09:04:23 +0530
Subject: [PATCH] Custom emoji & Sticker support (#686)
* Remove comments
* Show custom emoji first in suggestions
* Show global image packs in emoji picker
* Display emoji and sticker in room settings
* Fix some pack not visible in emojiboard
* WIP
* Add/delete/rename images to exisitng packs
* Change pack avatar, name & attribution
* Add checkbox to make pack global
* Bug fix
* Create or delete pack
* Add personal emoji in settings
* Show global pack selector in settings
* Show space emoji in emojiboard
* Send custom emoji reaction as mxc
* Render stickers as stickers
* Fix sticker jump bug
* Fix reaction width
* Fix stretched custom emoji
* Fix sending space emoji in message
* Remove unnessesary comments
* Send user pills
* Fix pill generating regex
* Add support for sending stickers
---
public/res/ic/outlined/sticker.svg | 4 +
src/app/atoms/button/Button.scss | 8 +-
src/app/molecules/image-pack/ImagePack.jsx | 469 ++++++++++++++++++
src/app/molecules/image-pack/ImagePack.scss | 47 ++
.../molecules/image-pack/ImagePackItem.jsx | 76 +++
.../molecules/image-pack/ImagePackItem.scss | 43 ++
.../molecules/image-pack/ImagePackProfile.jsx | 125 +++++
.../image-pack/ImagePackProfile.scss | 37 ++
.../molecules/image-pack/ImagePackUpload.jsx | 73 +++
.../molecules/image-pack/ImagePackUpload.scss | 43 ++
.../image-pack/ImagePackUsageSelector.jsx | 41 ++
.../molecules/image-upload/ImageUpload.jsx | 14 +-
src/app/molecules/media/Media.jsx | 46 +-
src/app/molecules/media/Media.scss | 9 +
src/app/molecules/message/Message.jsx | 54 +-
src/app/molecules/message/Message.scss | 1 -
src/app/molecules/room-emojis/RoomEmojis.jsx | 130 +++++
src/app/molecules/room-emojis/RoomEmojis.scss | 29 ++
src/app/organisms/emoji-board/EmojiBoard.jsx | 42 +-
src/app/organisms/emoji-board/EmojiBoard.scss | 2 +
src/app/organisms/emoji-board/custom-emoji.js | 286 +++++++----
src/app/organisms/room/RoomSettings.jsx | 14 +-
src/app/organisms/room/RoomViewCmdBar.jsx | 14 +-
src/app/organisms/room/RoomViewInput.jsx | 61 ++-
src/app/organisms/settings/Settings.jsx | 17 +
src/app/organisms/settings/Settings.scss | 3 +-
.../space-settings/SpaceSettings.jsx | 8 +
.../organisms/sticker-board/StickerBoard.jsx | 88 ++++
.../organisms/sticker-board/StickerBoard.scss | 60 +++
src/client/action/roomTimeline.js | 19 +-
src/client/initMatrix.js | 2 +-
src/client/state/RoomsInput.js | 60 +--
src/util/common.js | 59 +++
33 files changed, 1781 insertions(+), 203 deletions(-)
create mode 100644 public/res/ic/outlined/sticker.svg
create mode 100644 src/app/molecules/image-pack/ImagePack.jsx
create mode 100644 src/app/molecules/image-pack/ImagePack.scss
create mode 100644 src/app/molecules/image-pack/ImagePackItem.jsx
create mode 100644 src/app/molecules/image-pack/ImagePackItem.scss
create mode 100644 src/app/molecules/image-pack/ImagePackProfile.jsx
create mode 100644 src/app/molecules/image-pack/ImagePackProfile.scss
create mode 100644 src/app/molecules/image-pack/ImagePackUpload.jsx
create mode 100644 src/app/molecules/image-pack/ImagePackUpload.scss
create mode 100644 src/app/molecules/image-pack/ImagePackUsageSelector.jsx
create mode 100644 src/app/molecules/room-emojis/RoomEmojis.jsx
create mode 100644 src/app/molecules/room-emojis/RoomEmojis.scss
create mode 100644 src/app/organisms/sticker-board/StickerBoard.jsx
create mode 100644 src/app/organisms/sticker-board/StickerBoard.scss
diff --git a/public/res/ic/outlined/sticker.svg b/public/res/ic/outlined/sticker.svg
new file mode 100644
index 0000000..bc486e5
--- /dev/null
+++ b/public/res/ic/outlined/sticker.svg
@@ -0,0 +1,4 @@
+
diff --git a/src/app/atoms/button/Button.scss b/src/app/atoms/button/Button.scss
index 7b12195..e1a01bb 100644
--- a/src/app/atoms/button/Button.scss
+++ b/src/app/atoms/button/Button.scss
@@ -26,10 +26,10 @@
&--icon {
@include dir.side(padding, var(--sp-tight), var(--sp-loose));
- .ic-raw {
- @include dir.side(margin, 0, var(--sp-extra-tight));
- flex-shrink: 0;
- }
+ }
+ .ic-raw {
+ @include dir.side(margin, 0, var(--sp-extra-tight));
+ flex-shrink: 0;
}
}
diff --git a/src/app/molecules/image-pack/ImagePack.jsx b/src/app/molecules/image-pack/ImagePack.jsx
new file mode 100644
index 0000000..725291d
--- /dev/null
+++ b/src/app/molecules/image-pack/ImagePack.jsx
@@ -0,0 +1,469 @@
+import React, {
+ useState, useMemo, useReducer, useEffect,
+} from 'react';
+import PropTypes from 'prop-types';
+import './ImagePack.scss';
+
+import initMatrix from '../../../client/initMatrix';
+import { openReusableDialog } from '../../../client/action/navigation';
+import { suffixRename } from '../../../util/common';
+
+import Button from '../../atoms/button/Button';
+import Text from '../../atoms/text/Text';
+import Input from '../../atoms/input/Input';
+import Checkbox from '../../atoms/button/Checkbox';
+import { MenuHeader } from '../../atoms/context-menu/ContextMenu';
+
+import { ImagePack as ImagePackBuilder } from '../../organisms/emoji-board/custom-emoji';
+import { confirmDialog } from '../confirm-dialog/ConfirmDialog';
+import ImagePackProfile from './ImagePackProfile';
+import ImagePackItem from './ImagePackItem';
+import ImagePackUpload from './ImagePackUpload';
+
+const renameImagePackItem = (shortcode) => new Promise((resolve) => {
+ let isCompleted = false;
+
+ openReusableDialog(
+