refactor: dayjs and tippy setting

This commit is contained in:
Tristan Yang
2022-07-17 22:02:57 +08:00
parent 963fd9a0a3
commit 37ad42170e
9 changed files with 36 additions and 53 deletions
-4
View File
@@ -1,6 +1,5 @@
import { FC, ReactElement } from "react";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import Styled from "./styled";
import {
VideoPreview,
@@ -14,9 +13,6 @@ import { getFileIcon, formatBytes } from "../../utils";
import IconDownload from "../../../assets/icons/download.svg";
import { useAppSelector } from "../../../app/store";
// todo: move to root file
dayjs.extend(relativeTime);
interface Data {
file_type: string;
name: string;
@@ -1,6 +1,5 @@
import { FC, useEffect, useState } from "react";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
import Styled from "./styled";
import ImageMessage from "./ImageMessage";
import useRemoveLocalMessage from "../../hook/useRemoveLocalMessage";
@@ -8,15 +7,10 @@ import useUploadFile from "../../hook/useUploadFile";
import useSendMessage from "../../hook/useSendMessage";
import Progress from "./Progress";
import { getFileIcon, formatBytes, isImage, getImageSize, ImageSize } from "../../utils";
// import { ReactComponent as IconDownload } from "../../../assets/icons/download.svg";
// import { ReactComponent as IconClose } from "../../../assets/icons/close.circle.svg";
import { useAppSelector } from "../../../app/store";
import IconDownload from "../../../assets/icons/download.svg";
import IconClose from "../../../assets/icons/close.circle.svg";
// todo: move to root file
dayjs.extend(relativeTime);
const isLocalFile = (content: string) => {
return content.startsWith("blob:");
};
+1 -5
View File
@@ -1,7 +1,6 @@
import React, { useRef, useState, useEffect, FC } from "react";
import dayjs from "dayjs";
import isToday from "dayjs/plugin/isToday";
import isYesterday from "dayjs/plugin/isYesterday";
import useInView from "./useInView";
import Tippy from "@tippyjs/react";
import Reaction from "./Reaction";
@@ -18,9 +17,6 @@ import useContextMenu from "../../hook/useContextMenu";
import usePinMessage from "../../hook/usePinMessage";
import { useAppSelector } from "../../../app/store";
// todo: move to root file
dayjs.extend(isToday);
dayjs.extend(isYesterday);
interface IProps {
readOnly?: boolean;
contextId: number;
-10
View File
@@ -1,10 +0,0 @@
import tippy, { followCursor } from "tippy.js";
export default function TippyDefault() {
tippy.setDefaultProps({
duration: 0,
delay: [0, 0],
plugins: [followCursor]
});
return null;
}