Skip to content

Commit

Permalink
Merge pull request #1528 from ecency/bugfix/outgoing-modal
Browse files Browse the repository at this point in the history
Bugfix/outgoing modal
  • Loading branch information
feruzm authored Jan 9, 2024
2 parents 67dd8a7 + d0f2a89 commit 798b896
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/common/components/discussion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export const Item = (props: ItemProps) => {
entry,
onSuccess: deleted,
children: (
<a title={_t("g.delete")} className="delete-btn ml-0 pr-3">
<a title={_t("g.delete")} className="delete-btn !ml-0 pr-3">
{deleteForeverSvg} {_t("g.delete")}
</a>
)
Expand Down
10 changes: 5 additions & 5 deletions src/common/components/entry-read-time/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import Tooltip from "../tooltip";
import { StyledTooltip } from "../tooltip";
import { _t } from "../../i18n";
import { informationVariantSvg } from "../../img/svg";
import UserAvatar from "../user-avatar";
Expand Down Expand Up @@ -51,7 +51,7 @@ export const ReadTime = (props: any) => {

return toolTip ? (
<div className="post-info">
<Tooltip
<StyledTooltip
content={
_t("entry.post-word-count") +
" " +
Expand All @@ -67,7 +67,7 @@ export const ReadTime = (props: any) => {
<span className="flex items-center">
<span className="info-icon w-[24px] mr-0 mr-md-2">{informationVariantSvg}</span>
</span>
</Tooltip>
</StyledTooltip>
</div>
) : (
<>
Expand All @@ -82,13 +82,13 @@ export const ReadTime = (props: any) => {
{topCurator && (
<div className="top-curator">
{_t("entry.post-top-curator")}
<Tooltip content={topCurator}>
<StyledTooltip content={topCurator}>
<Link to={`/@${topCurator}`}>
<div className="curator">
<UserAvatar username={topCurator} size="small" />
</div>
</Link>
</Tooltip>
</StyledTooltip>
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/rc-delegations-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const RcDelegationsList = (props: any) => {
{listMode === "out" && (
<>
{outGoingList.length > 0 ? (
<List defer={true} inline={true}>
<List scrollable={true} defer={true} inline={true}>
{outGoingList
?.slice(0, loadList)
.filter(
Expand Down
7 changes: 6 additions & 1 deletion src/common/components/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ReactNode, useState } from "react";
import { createPortal } from "react-dom";
import { usePopper } from "react-popper";
import { useMountedState } from "react-use";

interface Props {
content: string | JSX.Element;
Expand All @@ -22,9 +23,11 @@ export function StyledTooltip({ children, content }: StyledProps) {
const [popperElement, setPopperElement] = useState<any>();
const [show, setShow] = useState(false);

const isMounted = useMountedState();

const popper = usePopper(ref, popperElement);

return (
return isMounted() ? (
<div
ref={setRef}
className="styled-tooltip"
Expand Down Expand Up @@ -57,5 +60,7 @@ export function StyledTooltip({ children, content }: StyledProps) {
document.querySelector("#popper-container") ?? document.createElement("div")
)}
</div>
) : (
<></>
);
}
4 changes: 3 additions & 1 deletion src/common/features/ui/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface Props {
defer?: boolean;
inline?: boolean;
grid?: boolean;
scrollable?: boolean;
}

export function List(props: HTMLProps<HTMLDivElement> & Props) {
Expand All @@ -15,12 +16,13 @@ export function List(props: HTMLProps<HTMLDivElement> & Props) {
<div
{...nativeProps}
className={classNameObject({
"flex overflow-hidden": !props.grid ?? true,
flex: !props.grid ?? true,
"grid grid-cols-2": props.grid ?? false,
"gap-3": props.defer ?? false,
"flex-row flex-wrap": props.inline ?? false,
"flex-col rounded-xl border border-[--border-color] bg-gray-100 dark:bg-gray-900":
!props.inline,
"overflow-hidden": !props.scrollable,
[props.className ?? ""]: !!props.className
})}
/>
Expand Down

0 comments on commit 798b896

Please sign in to comment.