-
-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Innei <[email protected]>
- Loading branch information
Showing
5 changed files
with
42 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
import type { FC } from 'react' | ||
|
||
import { useCurrentRoomCount } from '~/atoms/hooks' | ||
import { FloatPopover } from '~/components/ui/float-popover' | ||
|
||
import { useRoomContext } from '../activity' | ||
import { useMaybeInRoomContext } from '../activity' | ||
|
||
export const CurrentReadingCountingMetaBarItem: FC<{ | ||
leftElement?: React.ReactNode | ||
}> = ({ leftElement }) => { | ||
const roomCtx = useMaybeInRoomContext() | ||
|
||
export const CurrentReadingCountingMetaBarItem = () => { | ||
const { roomName } = useRoomContext() | ||
const count = useCurrentRoomCount(roomName || '') | ||
const count = useCurrentRoomCount(roomCtx?.roomName || '') | ||
|
||
if (!roomName || !count) return null | ||
if (!roomCtx || !count) return null | ||
|
||
return ( | ||
<FloatPopover | ||
asChild | ||
type="tooltip" | ||
triggerElement={ | ||
<span> | ||
当前<span className="mx-1 font-medium">{count}</span>人正在阅读 | ||
</span> | ||
} | ||
> | ||
当前的实时阅读人数,可以通过左侧时间线查看其他人的阅读进度(手机上无法查看) | ||
</FloatPopover> | ||
<> | ||
{leftElement} | ||
<FloatPopover | ||
asChild | ||
type="tooltip" | ||
triggerElement={ | ||
<span> | ||
当前<span className="mx-1 font-medium">{count}</span>人正在阅读 | ||
</span> | ||
} | ||
> | ||
当前的实时阅读人数,可以通过左侧时间线查看其他人的阅读进度(手机上无法查看) | ||
</FloatPopover> | ||
</> | ||
) | ||
} |