-
-
Notifications
You must be signed in to change notification settings - Fork 772
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 <i@innei.in>
- Loading branch information
Showing
9 changed files
with
79 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
'use client' | ||
|
||
import { useOnlineCount } from '~/atoms' | ||
import { withNoSSR } from '~/components/hoc/with-no-ssr' | ||
import { FloatPopover } from '~/components/ui/float-popover' | ||
|
||
export const GatewayCount = () => { | ||
return useOnlineCount() | ||
export const GatewayCount = withNoSSR(() => { | ||
return ( | ||
<FloatPopover TriggerComponent={GatewayCountTrigger} type="tooltip"> | ||
<div className="space-y-2 leading-relaxed"> | ||
<p className="flex items-center space-x-1 opacity-80"> | ||
<i className="icon-[mingcute--question-line]" /> | ||
<span className="font-medium">这是如何实现的?</span> | ||
</p> | ||
<p> | ||
当你打开这个页面时,会自动建立 WebSocket | ||
连接,当成功连接后服务器会推送当前浏览页面的人数。 | ||
</p> | ||
<p> | ||
WebSocket | ||
用于通知站点,站长在站点的实时活动,包括不限于文章的发布和更新。 | ||
</p> | ||
</div> | ||
</FloatPopover> | ||
) | ||
}) | ||
const GatewayCountTrigger = () => { | ||
const count = useOnlineCount() | ||
return <span>正在被 {count} 人看爆</span> | ||
} |
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
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