Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Emojis 2.0 #1447

Merged
merged 8 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"@ecency/render-helper": "^2.2.26",
"@ecency/render-helper-amp": "^1.1.0",
"@emoji-mart/data": "^1.1.2",
"@firebase/analytics": "^0.8.0",
"@firebase/app": "^0.7.28",
"@firebase/messaging": "^0.9.16",
Expand All @@ -34,6 +35,7 @@
"currency-symbol-map": "^4.0.4",
"debounce": "^1.2.1",
"diff-match-patch": "^1.0.5",
"emoji-mart": "^5.5.2",
"express": "^4.17.3",
"history": "^4.7.2",
"hive-uri": "^0.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Alert, Button, Form, InputGroup, Modal } from "react-bootstrap";
import React, { useContext, useEffect, useState } from "react";
import "./_decks-settings.scss";
import { DeckGrid } from "../types";
import EmojiPicker from "../../emoji-picker";
import EmojiPicker from "../../emoji-picker/index-old";
import { deleteForeverSvg, emoticonHappyOutlineSvg } from "../../../img/svg";
import ClickAwayListener from "../../clickaway-listener";
import * as uuid from "uuid";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
import React from "react";
import React, { useRef } from "react";
import { emojiIconSvg } from "../icons";
import { _t } from "../../../i18n";
import { PopperDropdown } from "../../popper-dropdown";
import Tooltip from "../../tooltip";
import EmojiPicker from "../../emoji-picker";
import { EmojiPicker } from "../../emoji-picker";

interface Props {
onPick: (v: string) => void;
}

export const DeckThreadsFormEmojiPicker = ({ onPick }: Props) => {
const anchorRef = useRef<HTMLDivElement | null>(null);

return (
<div className="deck-threads-form-emoji-picker">
<Tooltip content={_t("editor-toolbar.image")}>
<PopperDropdown toggle={emojiIconSvg}>
<div className="emoji-picker-container">
<EmojiPicker
fallback={(value) => {
onPick(value);
}}
/>
</div>
</PopperDropdown>
</Tooltip>
<div
className="btn btn-link d-flex align-items-center justify-content-center deck-threads-form-emoji-picker"
ref={anchorRef}
>
<Tooltip content={_t("editor-toolbar.image")}>{emojiIconSvg}</Tooltip>
<EmojiPicker anchor={anchorRef.current} onSelect={(value) => onPick(value)} />
</div>
);
};
18 changes: 11 additions & 7 deletions src/common/components/editor-toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { User } from "../../store/users/types";
import { Global } from "../../store/global/types";

import Tooltip from "../tooltip";
import EmojiPicker from "../emoji-picker";
import { EmojiPicker } from "../emoji-picker";
import GifPicker from "../gif-picker";
import Gallery from "../gallery";
import Fragments from "../fragments";
Expand Down Expand Up @@ -65,6 +65,7 @@ interface State {
shGif: boolean;
showVideoUpload: boolean;
showVideoGallery: boolean;
isMounted: boolean;
}

export const detectEvent = (eventType: string) => {
Expand All @@ -86,7 +87,8 @@ export class EditorToolbar extends Component<Props> {
mobileImage: false,
shGif: false,
showVideoUpload: false,
showVideoGallery: false
showVideoGallery: false,
isMounted: false
};

holder = React.createRef<HTMLDivElement>();
Expand Down Expand Up @@ -155,6 +157,9 @@ export class EditorToolbar extends Component<Props> {
window.addEventListener("blockquote", this.quote);
window.addEventListener("image", this.toggleImage);
window.addEventListener("customToolbarEvent", this.handleCustomToolbarEvent);
this.setState({
isMounted: true
});
}

componentWillUnmount() {
Expand Down Expand Up @@ -576,13 +581,12 @@ export class EditorToolbar extends Component<Props> {
</Tooltip>
)}
<Tooltip content={_t("editor-toolbar.emoji")}>
<div className="editor-tool" role="none">
<div className="editor-tool" id="editor-tool-emoji-picker" role="none">
{emoticonHappyOutlineSvg}
{showEmoji && (
{showEmoji && this.state.isMounted && (
<EmojiPicker
fallback={(e) => {
this.insertText(e, "");
}}
anchor={document.querySelector("#editor-tool-emoji-picker")!!}
onSelect={(e) => this.insertText(e, "")}
/>
)}
</div>
Expand Down
74 changes: 74 additions & 0 deletions src/common/components/emoji-picker/_index-old.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
@import "src/style/colors";
@import "src/style/variables";
@import "src/style/bootstrap_vars";
@import "src/style/mixins";

.emoji-picker {
width: 280px;
position: absolute;
right: 0;
z-index: 100;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
padding: 14px 6px;

@media (max-width: $sm-break) {
width: 160px !important;
}

@include themify(day) {
background: darken($white-three, 5);
}

@include themify(night) {
background: $dark-two;
}

.emoji-cat-list {
height: 160px;
overflow: auto;

.emoji-cat {
.cat-title {
font-weight: 500;
font-size: 14px;
margin: 4px 0 6px 0;

@include themify(day) {
color: $charcoal-grey;
}

@include themify(night) {
color: $pinkish-grey;
}
}

.emoji-list {
@include clearfix();
display: flex;
flex-wrap: wrap;

.emoji {
cursor: pointer;
font-size: 18px;
margin: 3px 3px 1px 3px;
align-items: center;
justify-content: center;
display: flex;
font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji";
border-bottom: 2px solid transparent;

&:hover {
@include themify(day) {
border-bottom: 2px solid $white-three;
}

@include themify(night) {
border-bottom: 2px solid lighten($dark-six, 14);
}
}
}
}
}
}
}
88 changes: 22 additions & 66 deletions src/common/components/emoji-picker/_index.scss
Original file line number Diff line number Diff line change
@@ -1,74 +1,30 @@
@import "src/style/colors";
@import "src/style/variables";
@import "src/style/bootstrap_vars";
@import "src/style/mixins";
@import "src/style/vars_mixins";

.emoji-picker {
width: 280px;
.emoji-picker-dialog {
position: absolute;
right: 0;
z-index: 100;
border-bottom-right-radius: 8px;
border-bottom-left-radius: 8px;
padding: 14px 6px;
z-index: 201;

@media (max-width: $sm-break) {
width: 160px !important;
em-emoji-picker {
width: 300px;
}

@include themify(day) {
background: darken($white-three, 5);
}

@include themify(night) {
background: $dark-two;
}

.emoji-cat-list {
height: 160px;
overflow: auto;

.emoji-cat {
.cat-title {
font-weight: 500;
font-size: 14px;
margin: 4px 0 6px 0;

@include themify(day) {
color: $charcoal-grey;
}

@include themify(night) {
color: $pinkish-grey;
}
}

.emoji-list {
@include clearfix();
display: flex;
flex-wrap: wrap;

.emoji {
cursor: pointer;
font-size: 18px;
margin: 3px 3px 1px 3px;
align-items: center;
justify-content: center;
display: flex;
font-family: "Segoe UI Emoji", "Segoe UI Symbol", "Segoe UI", "Apple Color Emoji";
border-bottom: 2px solid transparent;

&:hover {
@include themify(day) {
border-bottom: 2px solid $white-three;
}
@include media-breakpoint-down(sm) {
bottom: 0;
top: unset !important;
left: 0 !important;
width: 100%;
background: #fff;
align-items: center;
justify-content: center;
border-top: 1px solid var(--border-color);
position: fixed;

@include themify(night) {
background-color: rgba(21, 22, 23);
}

@include themify(night) {
border-bottom: 2px solid lighten($dark-six, 14);
}
}
}
}
em-emoji-picker {
width: 100%;
}
}
}
}
Loading