Add mentioning for channels

This commit is contained in:
jude
2024-03-04 20:36:37 +00:00
parent 85a114e55c
commit dbe8e8e358
13 changed files with 251 additions and 56 deletions

View File

@ -1,7 +1,8 @@
import { ImagePicker } from "../ImagePicker";
import { Reminder } from "../../../api";
import { useMentions } from "../../App/useMentions";
import { Mentions } from "../../App/Mentions";
import { useRef } from "preact/hooks";
import { useGuild } from "../../App/useGuild";
type Props = {
name: string;
@ -10,8 +11,8 @@ type Props = {
};
export const Author = ({ name, icon, setReminder }: Props) => {
const guild = useGuild();
const input = useRef(null);
useMentions(input);
return (
<div class="embed-author-box">
@ -32,6 +33,7 @@ export const Author = ({ name, icon, setReminder }: Props) => {
</div>
<div class="b">
{guild && <Mentions input={input} />}
<label class="is-sr-only" for="embedAuthor">
Embed Author
</label>

View File

@ -1,12 +1,14 @@
import { useMentions } from "../../App/useMentions";
import { Mentions } from "../../App/Mentions";
import { useRef } from "preact/hooks";
import { useGuild } from "../../App/useGuild";
export const Description = ({ description, onInput }) => {
const guild = useGuild();
const input = useRef(null);
useMentions(input);
return (
<>
{guild && <Mentions input={input} />}
<label class="is-sr-only" for="embedDescription">
Embed Description
</label>

View File

@ -1,9 +1,10 @@
import { useRef } from "preact/hooks";
import { useMentions } from "../../../App/useMentions";
import { Mentions } from "../../../App/Mentions";
import { useGuild } from "../../../App/useGuild";
export const Field = ({ title, value, inline, index, onUpdate }) => {
const guild = useGuild();
const input = useRef(null);
useMentions(input);
return (
<div data-inlined={inline ? "1" : "0"} class="embed-field-box" key={index}>
@ -41,6 +42,7 @@ export const Field = ({ title, value, inline, index, onUpdate }) => {
)}
</div>
{guild && <Mentions input={input} />}
<label class="is-sr-only" for="embedFieldValue">
Field Value
</label>

View File

@ -1,7 +1,8 @@
import { Reminder } from "../../../api";
import { ImagePicker } from "../ImagePicker";
import { useMentions } from "../../App/useMentions";
import { Mentions } from "../../App/Mentions";
import { useRef } from "preact/hooks";
import { useGuild } from "../../App/useGuild";
type Props = {
footer: string;
@ -10,8 +11,8 @@ type Props = {
};
export const Footer = ({ footer, icon, setReminder }: Props) => {
const guild = useGuild();
const input = useRef(null);
useMentions(input);
return (
<div class="embed-footer-box">
@ -31,6 +32,7 @@ export const Footer = ({ footer, icon, setReminder }: Props) => {
<label class="is-sr-only" for="embedFooter">
Embed Footer text
</label>
{guild && <Mentions input={input} />}
<textarea
class="discord-embed-footer message-input autoresize "
placeholder="Embed Footer..."

View File

@ -1,13 +1,14 @@
import { useParams } from "wouter";
import { useRef } from "preact/hooks";
import { useMentions } from "../../App/useMentions";
import { useGuild } from "../../App/useGuild";
import { Mentions } from "../../App/Mentions";
export const Title = ({ title, onInput }) => {
const guild = useGuild();
const input = useRef(null);
useMentions(input);
return (
<>
{guild && <Mentions input={input} />}
<label class="is-sr-only" for="embedTitle">
Embed Title
</label>