Skip to content

Commit

Permalink
fix: update failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mamadoudicko committed Aug 21, 2023
1 parent 95b46ca commit cb08f3c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 201 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { MdRemoveCircleOutline } from "react-icons/md";

import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

type MentionItemProps = {
text: string;
onRemove: () => void;
Expand All @@ -11,8 +9,6 @@ export const BrainMentionItem = ({
text,
onRemove,
}: MentionItemProps): JSX.Element => {
const { setCurrentBrainId } = useBrainContext();

return (
<div className="relative inline-block w-fit-content">
<div className="flex items-center bg-gray-300 mr-2 text-gray-600 rounded-2xl py-1 px-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const MentionInput = ({
<div className="w-full">
<Editor
editorKey={"editor"}
data-testid="chat-input"
editorState={editorState}
onChange={handleEditorChange}
plugins={plugins}
Expand Down Expand Up @@ -70,6 +71,7 @@ export const MentionInput = ({
);
}}
onAddMention={onAddMention}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
entryComponent={({ mention, className, ...otherProps }) => (
<div {...otherProps}>
<BrainSuggestion id={mention.id as string} content={mention.name} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from "next/link";
import { useTranslation } from "react-i18next";

import Button from "@/lib/components/ui/Button";
import { useTranslation } from "react-i18next";

export const AddNewBrainButton = (): JSX.Element => {
const { t } = useTranslation(["chat"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import createMentionPlugin from "@draft-js-plugins/mention";
import { useMemo } from "react";

import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

import { BrainMentionItem } from "../../../BrainMentionItem";

interface MentionPluginProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import {
MentionData,
} from "@draft-js-plugins/mention";
import { UUID } from "crypto";
import { EditorState, getDefaultKeyBinding } from "draft-js";
import { useCallback, useEffect, useRef, useState } from "react";

import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

import { EditorState, getDefaultKeyBinding } from "draft-js";
import { mapMinimalBrainToMentionData } from "../utils/mapMinimalBrainToMentionData";
import { useMentionPlugin } from "./helpers/MentionPlugin";
import { useMentionState } from "./helpers/MentionState";
import { useMentionUtils } from "./helpers/MentionUtils";
import { mapMinimalBrainToMentionData } from "../utils/mapMinimalBrainToMentionData";

import "@draft-js-plugins/mention/lib/plugin.css";
import "draft-js/dist/Draft.css";
Expand Down Expand Up @@ -107,13 +107,11 @@ export const useMentionInput = ({
(item) => item.name === mention.content
);
if (correspondingMention !== undefined) {
if (mention.trigger === "@") {
newEditorState = insertMention(
correspondingMention,
mention.trigger,
newEditorState
);
}
newEditorState = insertMention(
correspondingMention,
mention.trigger,
newEditorState
);
}
}
});
Expand All @@ -123,6 +121,7 @@ export const useMentionInput = ({
const keyBindingFn = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === "Enter" && !e.shiftKey) {
onSubmit();

return "submit";
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import Field from "@/lib/components/ui/Field";
import { Select } from "@/lib/components/ui/Select";
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";

import { BrainRoleType } from "../../../NavBar/components/NavItems/components/BrainsDropDown/components/BrainActions/types";
import { RemoveAccessIcon } from "./components/RemoveAccessIcon";
import { useBrainUser } from "./hooks/useBrainUser";

import { BrainRoleType } from "../../../NavBar/components/NavItems/components/BrainsDropDown/components/BrainActions/types";
type BrainUserProps = {
email: string;
role: BrainRoleType;
Expand Down

0 comments on commit cb08f3c

Please sign in to comment.