Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

chore(footer): home footer status#1208

Merged
mydearxym merged 2 commits intodevfromhome-footer-status
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletionssrc/containers/content/HaveADrinkContent/demo.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -149,6 +149,11 @@ const demo = [
text: '意指一件产品包含了所有必要的东西,开箱即用,最早来源于 Python 社区。',
reference: 'https://qr.ae/pGmyXB',
},
{
title: 'Snowflake ID',
text: 'Twitter 开发的用于标识 tweets 的分布式算法,特点之一是发布时间相近的 tweet, 其生成的 ID 也相近。',
reference: 'https://en.wikipedia.org/wiki/Snowflake_ID',
},
],
},
{
Expand Down
9 changes: 5 additions & 4 deletionssrc/containers/unit/Footer/DesktopView/HomeLayout.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
import { FC, memo } from 'react'
import { useTheme } from 'styled-components'

import type { TThemeMap, TC11NLayout, TMetric } from '@/spec'
import type { TThemeMap, TC11NLayout, TMetric, TOnlineStatus } from '@/spec'
import { GITHUB, BUILD_VERSION } from '@/config'
import { ROUTE } from '@/constant'
import { siteBirthDay } from '@/utils/helper'
Expand All@@ -24,9 +24,10 @@ import {
type TProps = {
metric: TMetric
layout: TC11NLayout
onlineStatus: TOnlineStatus
}

const HomeView: FC<TProps> = ({ metric, layout }) => {
const HomeView: FC<TProps> = ({ metric, layout, onlineStatus }) => {
const theme = useTheme() as TThemeMap

const linkColors = {
Expand DownExpand Up@@ -119,10 +120,10 @@ const HomeView: FC<TProps> = ({ metric, layout }) => {
<Title>用户</Title>
<Body>
<Item as="span" normal>
注册人数:--
注册人数:{onlineStatus.totalSubscribes}
</Item>
<Item as="span" normal>
在线人数:--
在线人数:{onlineStatus.realtimeVisitors}
</Item>
<Item as="span" normal>
黑洞: --
Expand Down
8 changes: 6 additions & 2 deletionssrc/containers/unit/Footer/DesktopView/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,7 +42,7 @@ const FooterContainer: FC<TProps> = ({
}) => {
useInit(store, metric)

const { viewingArticle, curCommunity, c11n } = store
const { viewingArticle, curCommunity, c11n, onlineStatus } = store
const isHome = curCommunity.raw === HCN
const isGeneral = includes(metric, [
METRIC.WORKS_ARTICLE,
Expand All@@ -59,7 +59,11 @@ const FooterContainer: FC<TProps> = ({
<Wrapper testid={testid} layout={c11n.bannerLayout} metric={metric}>
<JoinModal />
{metric === METRIC.COMMUNITY && isHome && (
<HomeLayout metric={metric} layout={c11n.bannerLayout} />
<HomeLayout
metric={metric}
layout={c11n.bannerLayout}
onlineStatus={onlineStatus}
/>
)}

{metric === METRIC.COMMUNITY && !isHome && (
Expand Down
27 changes: 25 additions & 2 deletionssrc/containers/unit/Footer/store.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,8 +5,15 @@

import { types as T, getParent, Instance } from 'mobx-state-tree'

import type { TRootStore, TAccount, TC11N, TArticle, TCommunity } from '@/spec'
import { METRIC } from '@/constant'
import type {
TRootStore,
TAccount,
TC11N,
TArticle,
TCommunity,
TOnlineStatus,
} from '@/spec'
import { METRIC, HCN } from '@/constant'
import { markStates, toJS } from '@/utils/mobx'

// import { VIEW, TFooterView } from './constants'
Expand DownExpand Up@@ -40,6 +47,22 @@ const FooterStore = T.model('FooterStore', {
return toJS(root.viewing.community)
},

get totalSubscribes(): number {
const slf = self as TStore
const { curCommunity } = slf

if (curCommunity.raw === HCN) {
return curCommunity.subscribersCount
}

return 0
},
get onlineStatus(): TOnlineStatus {
const slf = self as TStore
const { totalSubscribes, realtimeVisitors } = slf

return { totalSubscribes, realtimeVisitors }
},
// get type(): TFooterView {
// const root = getParent(self) as TRootStore
// if (root.viewing.community.raw === HCN) return VIEW.HOME
Expand Down
4 changes: 2 additions & 2 deletionssrc/containers/unit/TagsBar/DesktopView/Folder.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import { FC, useState, useRef, useEffect } from 'react'

import { findIndex } from 'ramda'
import { findIndex, reverse } from 'ramda'

import { ICON } from '@/config'
import { sortByColor } from '@/utils/helper'
Expand DownExpand Up@@ -52,7 +52,7 @@ const Folder: FC<TProps> = ({
const [isFolderOpen, toggleFolder] = useState(true)
const [curDisplayCount, setCurDisplayCount] = useState(initDisplayCount)

const sortedTags = sortByColor(groupTags)
const sortedTags =reverse(sortByColor(groupTags))

const isActiveTagInFolder =
// @ts-ignore
Expand Down
1 change: 1 addition & 0 deletionssrc/spec/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,6 +69,7 @@ export type {
TView,
TUserActivity,
TEditMode,
TOnlineStatus,
} from './utils'

export type { TGQLError } from './graphql'
Expand Down
5 changes: 5 additions & 0 deletionssrc/spec/utils.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -163,3 +163,8 @@ export type TUserActivity = {
action?: string
totalCount?: number
}

export type TOnlineStatus = {
totalSubscribes?: number
realtimeVisitors?: number
}

[8]ページ先頭

©2009-2025 Movatter.jp