mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 08:30:58 -05:00
feat: test emoji picker design
This commit is contained in:
parent
5dfe72c093
commit
6bf58e8379
3 changed files with 47 additions and 12 deletions
|
@ -73,7 +73,7 @@
|
||||||
"@hcaptcha/react-hcaptcha": "^0.3.6",
|
"@hcaptcha/react-hcaptcha": "^0.3.6",
|
||||||
"@insertish/vite-plugin-babel-macros": "^1.0.5",
|
"@insertish/vite-plugin-babel-macros": "^1.0.5",
|
||||||
"@preact/preset-vite": "^2.0.0",
|
"@preact/preset-vite": "^2.0.0",
|
||||||
"@revoltchat/ui": "1.0.46",
|
"@revoltchat/ui": "1.0.50",
|
||||||
"@rollup/plugin-replace": "^2.4.2",
|
"@rollup/plugin-replace": "^2.4.2",
|
||||||
"@styled-icons/boxicons-logos": "^10.38.0",
|
"@styled-icons/boxicons-logos": "^10.38.0",
|
||||||
"@styled-icons/boxicons-regular": "^10.38.0",
|
"@styled-icons/boxicons-regular": "^10.38.0",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Send, ShieldX } from "@styled-icons/boxicons-solid";
|
import { HappyBeaming, Send, ShieldX } from "@styled-icons/boxicons-solid";
|
||||||
import Axios, { CancelTokenSource } from "axios";
|
import Axios, { CancelTokenSource } from "axios";
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
import { Channel } from "revolt.js";
|
import { Channel } from "revolt.js";
|
||||||
|
@ -6,9 +6,16 @@ import styled, { css } from "styled-components/macro";
|
||||||
import { ulid } from "ulid";
|
import { ulid } from "ulid";
|
||||||
|
|
||||||
import { Text } from "preact-i18n";
|
import { Text } from "preact-i18n";
|
||||||
import { useCallback, useContext, useEffect, useState } from "preact/hooks";
|
import { memo } from "preact/compat";
|
||||||
|
import {
|
||||||
|
useCallback,
|
||||||
|
useContext,
|
||||||
|
useEffect,
|
||||||
|
useMemo,
|
||||||
|
useState,
|
||||||
|
} from "preact/hooks";
|
||||||
|
|
||||||
import { IconButton } from "@revoltchat/ui";
|
import { IconButton, Picker } from "@revoltchat/ui";
|
||||||
|
|
||||||
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
|
import TextAreaAutoSize from "../../../lib/TextAreaAutoSize";
|
||||||
import { debounce } from "../../../lib/debounce";
|
import { debounce } from "../../../lib/debounce";
|
||||||
|
@ -31,9 +38,11 @@ import {
|
||||||
} from "../../../context/revoltjs/FileUploads";
|
} from "../../../context/revoltjs/FileUploads";
|
||||||
import { takeError } from "../../../context/revoltjs/util";
|
import { takeError } from "../../../context/revoltjs/util";
|
||||||
|
|
||||||
|
import { emojiDictionary } from "../../../assets/emojis";
|
||||||
import { useClient } from "../../../controllers/client/ClientController";
|
import { useClient } from "../../../controllers/client/ClientController";
|
||||||
import { modalController } from "../../../controllers/modals/ModalController";
|
import { modalController } from "../../../controllers/modals/ModalController";
|
||||||
import AutoComplete, { useAutoComplete } from "../AutoComplete";
|
import AutoComplete, { useAutoComplete } from "../AutoComplete";
|
||||||
|
import Emoji from "../Emoji";
|
||||||
import { PermissionTooltip } from "../Tooltip";
|
import { PermissionTooltip } from "../Tooltip";
|
||||||
import FilePreview from "./bars/FilePreview";
|
import FilePreview from "./bars/FilePreview";
|
||||||
import ReplyBar from "./bars/ReplyBar";
|
import ReplyBar from "./bars/ReplyBar";
|
||||||
|
@ -127,6 +136,10 @@ const FileAction = styled.div`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
const FloatingLayer = styled.div`
|
||||||
|
position: relative;
|
||||||
|
`;
|
||||||
|
|
||||||
const ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding = styled.div`
|
const ThisCodeWillBeReplacedAnywaysSoIMightAsWellJustDoItThisWay__Padding = styled.div`
|
||||||
width: 16px;
|
width: 16px;
|
||||||
`;
|
`;
|
||||||
|
@ -148,6 +161,7 @@ export default observer(({ channel }: Props) => {
|
||||||
});
|
});
|
||||||
const [typing, setTyping] = useState<boolean | number>(false);
|
const [typing, setTyping] = useState<boolean | number>(false);
|
||||||
const [replies, setReplies] = useState<Reply[]>([]);
|
const [replies, setReplies] = useState<Reply[]>([]);
|
||||||
|
const [picker, setPicker] = useState(false);
|
||||||
const client = useClient();
|
const client = useClient();
|
||||||
const translate = useTranslation();
|
const translate = useTranslation();
|
||||||
|
|
||||||
|
@ -457,6 +471,19 @@ export default observer(({ channel }: Props) => {
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const renderEmoji = useMemo(
|
||||||
|
() =>
|
||||||
|
memo(({ emoji }: { emoji: string }) => (
|
||||||
|
<a
|
||||||
|
onClick={() =>
|
||||||
|
setMessage(`${state.draft.get(channel._id)}\n${emoji}`)
|
||||||
|
}>
|
||||||
|
<Emoji emoji={emoji} />
|
||||||
|
</a>
|
||||||
|
)),
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AutoComplete {...autoCompleteProps} />
|
<AutoComplete {...autoCompleteProps} />
|
||||||
|
@ -498,6 +525,14 @@ export default observer(({ channel }: Props) => {
|
||||||
replies={replies}
|
replies={replies}
|
||||||
setReplies={setReplies}
|
setReplies={setReplies}
|
||||||
/>
|
/>
|
||||||
|
<FloatingLayer>
|
||||||
|
{picker && (
|
||||||
|
<Picker
|
||||||
|
emojis={emojiDictionary}
|
||||||
|
renderEmoji={renderEmoji}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</FloatingLayer>
|
||||||
<Base>
|
<Base>
|
||||||
{channel.havePermission("UploadFiles") ? (
|
{channel.havePermission("UploadFiles") ? (
|
||||||
<FileAction>
|
<FileAction>
|
||||||
|
@ -622,12 +657,12 @@ export default observer(({ channel }: Props) => {
|
||||||
<IconButton>
|
<IconButton>
|
||||||
<Box size={24} />
|
<Box size={24} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Action>
|
</Action>*/}
|
||||||
<Action>
|
<Action>
|
||||||
<IconButton>
|
<IconButton onClick={() => setPicker(!picker)}>
|
||||||
<HappyBeaming size={24} />
|
<HappyBeaming size={24} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Action>*/}
|
</Action>
|
||||||
<Action>
|
<Action>
|
||||||
<IconButton
|
<IconButton
|
||||||
className={
|
className={
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -2231,9 +2231,9 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@revoltchat/ui@npm:1.0.46":
|
"@revoltchat/ui@npm:1.0.50":
|
||||||
version: 1.0.46
|
version: 1.0.50
|
||||||
resolution: "@revoltchat/ui@npm:1.0.46"
|
resolution: "@revoltchat/ui@npm:1.0.50"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@styled-icons/boxicons-logos": ^10.38.0
|
"@styled-icons/boxicons-logos": ^10.38.0
|
||||||
"@styled-icons/boxicons-regular": ^10.38.0
|
"@styled-icons/boxicons-regular": ^10.38.0
|
||||||
|
@ -2246,7 +2246,7 @@ __metadata:
|
||||||
react-device-detect: "*"
|
react-device-detect: "*"
|
||||||
react-virtuoso: "*"
|
react-virtuoso: "*"
|
||||||
revolt.js: "*"
|
revolt.js: "*"
|
||||||
checksum: 6effcb0d44b599fbb50a82e3ef364ab8a706216ff3deb9682c91bddd3ce3ced24e0688833a024e367a56fc0034cf76efcb8fe300a2c1b5ca820163534355df91
|
checksum: 735df2bbdb2b1c56c7c62ba6889d7c75d17f8fbc1cb9ec41b06050470314b04ae6477dabf6dece1bf9b680d451d9cf4d6ecff629025419507fb0410661edb9ff
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
@ -3539,7 +3539,7 @@ __metadata:
|
||||||
"@hcaptcha/react-hcaptcha": ^0.3.6
|
"@hcaptcha/react-hcaptcha": ^0.3.6
|
||||||
"@insertish/vite-plugin-babel-macros": ^1.0.5
|
"@insertish/vite-plugin-babel-macros": ^1.0.5
|
||||||
"@preact/preset-vite": ^2.0.0
|
"@preact/preset-vite": ^2.0.0
|
||||||
"@revoltchat/ui": 1.0.46
|
"@revoltchat/ui": 1.0.50
|
||||||
"@rollup/plugin-replace": ^2.4.2
|
"@rollup/plugin-replace": ^2.4.2
|
||||||
"@styled-icons/boxicons-logos": ^10.38.0
|
"@styled-icons/boxicons-logos": ^10.38.0
|
||||||
"@styled-icons/boxicons-regular": ^10.38.0
|
"@styled-icons/boxicons-regular": ^10.38.0
|
||||||
|
|
Loading…
Reference in a new issue