Skip to content

Commit

Permalink
use ipfssquare
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Mar 25, 2024
1 parent 6b01a47 commit a043131
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 37 deletions.
18 changes: 7 additions & 11 deletions next/components/postDetail/postDiscussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
removeToast,
} from "store/reducers/toastSlice";
import { timeDuration } from "frontedUtils";
import ExternalLink from "@osn/common-ui/es/ExternalLink";
import { findNetworkConfig } from "services/util";
import HeaderWithNumber from "@/components/postDetail/numberHeader";
import encodeAddressByChain from "../../frontedUtils/chain/addr";
Expand All @@ -27,7 +26,7 @@ import {
MarkdownPreviewer,
renderMentionIdentityUserPlugin,
} from "@osn/previewer";
import { MentionIdentityUser, RichEditor } from "@osn/common-ui";
import { IpfsSquare, MentionIdentityUser, RichEditor } from "@osn/common-ui";
import { useSuggestions } from "./suggestions";

const Item = styled.div`
Expand Down Expand Up @@ -194,15 +193,12 @@ export default function PostDiscussion({
/>
<div>{timeDuration(item.createdAt)}</div>
</DividerWrapper>
{item?.pinHash ? (
<ExternalLink
href={`${process.env.NEXT_PUBLIC_API_END_POINT}api/ipfs/files/${item.pinHash}`}
>
<Square />
</ExternalLink>
) : (
<Square noHover={true} />
)}
<IpfsSquare
href={
item?.pinHash &&
`${process.env.NEXT_PUBLIC_API_END_POINT}api/ipfs/files/${item.pinHash}`
}
/>
</InfoWrapper>
<ContentWrapper>
<Content>
Expand Down
34 changes: 8 additions & 26 deletions next/components/postDetail/postVotesItem.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Fragment } from "react";
import styled, { css } from "styled-components";
import ExternalLink from "@osn/common-ui/es/ExternalLink";
import styled from "styled-components";
import Ellipsis from "@/components/ellipsis";
import { Flex } from "@osn/common-ui";
import { Flex, IpfsSquare } from "@osn/common-ui";
import ValueDisplay from "@/components/valueDisplay";
import Voter from "@/components/role/voter";
import { Tooltip } from "@osn/common-ui";
Expand Down Expand Up @@ -49,20 +48,6 @@ const BalanceWrapper = styled.div`
}
`;

const Square = styled.div`
width: 20px;
height: 20px;
background: url("/imgs/icons/ipfs.svg");
${(p) =>
!p.noHover &&
css`
cursor: pointer;
:hover {
background: url("/imgs/icons/ipfs-active.svg");
}
`}
`;

const EqualWrapper = styled.div`
width: 33%;
display: flex;
Expand Down Expand Up @@ -215,15 +200,12 @@ export default function PostVotesItem({
) : null
}
/>
{data?.pinHash ? (
<ExternalLink
href={`${process.env.NEXT_PUBLIC_API_END_POINT}api/ipfs/files/${data.pinHash}`}
>
<Square />
</ExternalLink>
) : (
<Square noHover={true} />
)}
<IpfsSquare
href={
data?.pinHash &&
`${process.env.NEXT_PUBLIC_API_END_POINT}api/ipfs/files/${data.pinHash}`
}
/>
</BalanceWrapper>
</EqualWrapper>
</InfoWrapper>
Expand Down

0 comments on commit a043131

Please sign in to comment.