diff --git a/src/routes/chat/ChannelChat/PinList.tsx b/src/routes/chat/ChannelChat/PinList.tsx index 2f3396c0..1fd03df3 100644 --- a/src/routes/chat/ChannelChat/PinList.tsx +++ b/src/routes/chat/ChannelChat/PinList.tsx @@ -67,14 +67,6 @@ const Styled = styled.div` display: flex; background: none; border: none; - svg { - width: 16px; - height: 16px; - path { - fill-opacity: 1; - fill: #667085; - } - } } } &:hover .opts { @@ -112,7 +104,7 @@ const PinList: FC = ({ id }: Props) => {
{canPin && ( )}
diff --git a/src/routes/chat/FavList.tsx b/src/routes/chat/FavList.tsx index b60c2683..81cceeb4 100644 --- a/src/routes/chat/FavList.tsx +++ b/src/routes/chat/FavList.tsx @@ -7,81 +7,16 @@ import useFavMessage from "../../common/hook/useFavMessage"; import { useTranslation } from "react-i18next"; const Styled = styled.div` - padding: 16px; - background: #f9fafb; - filter: drop-shadow(0px 25px 50px rgba(31, 41, 55, 0.25)); - border-radius: 12px; - min-width: 500px; - max-height: 500px; - overflow: auto; - > .head { - font-weight: 600; - font-size: 16px; - line-height: 24px; - color: #344054; - margin-bottom: 16px; - } - > .none { - padding: 16px; - width: 100%; - display: flex; - flex-direction: column; - gap: 8px; - align-items: center; - .tip { - width: 240px; - font-weight: 600; - font-size: 16px; - line-height: 24px; - text-align: center; - color: #475467; - } - } - > .list { - display: flex; - flex-direction: column; - gap: 8px; - .fav { - position: relative; - border: 1px solid #f2f4f7; - border-radius: var(--br); - .favorite { - background: none; - .down img { - width: 100% !important; - height: auto !important; - } + .favorite { + background: none; + &:hover{ + background: #f5f6f7; } - > .opts { - visibility: hidden; - display: flex; - align-items: center; - gap: 4px; - position: absolute; - top: 8px; - right: 8px; - padding: 4px; - border: 1px solid rgba(0, 0, 0, 0.08); - border-radius: 6px; - .btn { - display: flex; - background: none; - border: none; - svg { - width: 24px; - height: 24px; - path { - fill: #667085; - fill-opacity: 1; - } - } - } - } - &:hover .opts { - visibility: visible; + .down img { + width: 100% !important; + height: auto !important; } } - } `; type Props = { cid?: number; uid?: number }; const FavList: FC = ({ cid = null, uid = null }) => { @@ -94,22 +29,22 @@ const FavList: FC = ({ cid = null, uid = null }) => { }; const noFavs = favorites.length == 0; return ( - -

{t('fav_msg')}({favorites.length})

+ +

{t('fav_msg')}({favorites.length})

{noFavs ? ( -
+
-
{t("fav_empty_tip")}
+
{t("fav_empty_tip")}
) : ( -
    +
      {favorites.map(({ id }) => { return ( -
    • +
    • -
      -
    • diff --git a/src/routes/favs/index.tsx b/src/routes/favs/index.tsx index afebe83a..08af05ba 100644 --- a/src/routes/favs/index.tsx +++ b/src/routes/favs/index.tsx @@ -1,5 +1,4 @@ -import { useState, useEffect } from "react"; -import Styled from "./styled"; +import { useState, useEffect, MouseEvent } from "react"; import FavoredMessage from "../../common/component/Message/FavoredMessage"; import dayjs from "dayjs"; import IconAudio from "../../assets/icons/file.audio.svg"; @@ -7,34 +6,38 @@ import IconVideo from "../../assets/icons/file.video.svg"; import IconUnknown from "../../assets/icons/file.unknown.svg"; import IconImage from "../../assets/icons/file.image.svg"; import IconChannel from "../../assets/icons/channel.svg"; +import IconRemove from "../../assets/icons/close.svg"; import { ContentTypes } from "../../app/config"; import { useAppSelector } from "../../app/store"; import { Favorite } from "../../app/slices/favorites"; import { useTranslation } from "react-i18next"; +import clsx from "clsx"; +import useFavMessage from "../../common/hook/useFavMessage"; type filter = "audio" | "video" | "image" | ""; function FavsPage() { const { t } = useTranslation("fav"); const [filter, setFilter] = useState(""); const [favs, setFavs] = useState([]); + const { removeFavorite } = useFavMessage({}); const Filters = [ { - icon: , + icon: , title: t("all_items"), filter: "" }, { - icon: , + icon: , title: t("image"), filter: "image" }, { - icon: , + icon: , title: t("video"), filter: "video" }, { - icon: , + icon: , title: t("audio"), filter: "audio" } @@ -109,26 +112,30 @@ function FavsPage() { } } }, [filter, favorites]); - + const handleRemove = (evt: MouseEvent) => { + const { id = "" } = evt.currentTarget.dataset; + // console.log("remove fav", id); + removeFavorite(id); + }; return ( - -
      -
        +
        +
        +
          {Filters.map(({ icon, title, filter: f }) => { return (
        • {icon} - {title} + {title}
        • ); })}
        -
        +
        {favs.map(({ id, created_at, messages }) => { if (!messages || messages.length == 0) return null; const [ @@ -136,27 +143,28 @@ function FavsPage() { source: { gid, uid } } ] = messages; - const tip = gid ? ( - - {channelData[gid]?.name} - - ) : ( - - From {userData[uid]?.name} - - ); + const tip = + {gid ? <> {channelData[gid]?.name} : <> + From {userData[uid]?.name} + } + ; return ( -
        -

        +
        +

        {tip} {dayjs(created_at).format("YYYY-MM-DD")}

        - +
        + + +
        ); })}

        - +
        ); } export default FavsPage; diff --git a/src/routes/favs/styled.tsx b/src/routes/favs/styled.tsx deleted file mode 100644 index aa8cf9cc..00000000 --- a/src/routes/favs/styled.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import styled from "styled-components"; -const Styled = styled.div` - height: 100vh; - display: flex; - background-color: #fff; - margin: 8px 24px 10px 0; - border-radius: 16px; - overflow: auto; - .left { - padding: 8px; - min-width: 268px; - box-shadow: inset -1px 0px 0px rgba(0, 0, 0, 0.1); - .filters { - display: flex; - flex-direction: column; - gap: 2px; - .filter { - cursor: pointer; - display: flex; - align-items: center; - gap: 8px; - padding: 8px; - border-radius: var(--br); - .icon { - width: 15px; - height: 20px; - } - .txt { - font-weight: 600; - font-size: 14px; - line-height: 20px; - color: #667085; - } - &:hover, - &.active { - background: rgba(116, 127, 141, 0.2); - } - } - } - } - .right { - width: 100%; - padding: 16px; - display: flex; - flex-direction: column; - gap: 32px; - overflow-y: scroll; - .container { - max-width: 600px; - display: flex; - flex-direction: column; - gap: 4px; - > .favorite { - background: #f2f4f7; - } - .tip { - display: inline-flex; - align-items: center; - font-style: normal; - font-weight: 500; - font-size: 12px; - line-height: 18px; - color: #bfbfbf; - .from { - display: inline-flex; - align-items: center; - gap: 4px; - margin-right: 8px; - &.channel, - &.user strong { - font-weight: 600; - color: #344054; - .icon { - width: 12px; - height: 12px; - } - } - } - } - } - } -`; - -export default Styled;