Skip to content

Commit

Permalink
refactor: rm useless threadSidebar (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
mydearxym authored Nov 21, 2023
1 parent 6bce5f0 commit c7e4f22
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 321 deletions.
1 change: 0 additions & 1 deletion src/containers/thread/DashboardThread/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const DashboardThread: FC = () => {
const {
curTab,
overviewData,
curCommunity,
baseInfoSettings,
seoSettings,
enableSettings,
Expand Down
11 changes: 5 additions & 6 deletions src/containers/thread/DashboardThread/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ const DashboardThread = T.model('DashboardThread', {
allRootRules: T.opt(T.str, '{}'),
})
.views((self) => ({
get curCommunity(): TCommunity {
const root = getParent(self) as TRootStore

return toJS(root.viewing.community)
},
get overviewData(): TOverview {
return toJS(self.overview)
},
Expand Down Expand Up @@ -185,12 +190,6 @@ const DashboardThread = T.model('DashboardThread', {
enable: init.enable,
}
},
get curCommunity(): TCommunity {
const root = getParent(self) as TRootStore

return toJS(root.viewing.community)
},

get cmsContents(): TCMSContents {
const slf = self as TStore
const { batchSelectedIDs, docTab, editingFAQIndex } = slf
Expand Down
25 changes: 14 additions & 11 deletions ...ead/ThreadSidebar/ClassicLayout/index.tsx → ...iners/thread/PostThread/ThreadSidebar.tsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import { FC, Fragment } from 'react'
import { observer } from 'mobx-react-lite'

import useAvatarLayout from '@/hooks/useAvatarLayout'
import useCommunityDigestViewport from '@/hooks/useCommunityDigestViewport'
import EVENT from '@/constant/event'
import { ARTICLE_CAT } from '@/constant/gtd'

import { buildLog } from '@/logger'
import { send } from '@/signal'
import { send, callGEditor, callSyncSelector } from '@/signal'
import { mockUsers } from '@/mock'

import ImgFallback from '@/widgets/ImgFallback'
Expand All @@ -34,17 +35,13 @@ import {
MoreNum,
CommunityNoteWrapper,
PublishWrapper,
} from '../styles/classic_layout'
import { onPublish } from '../logic'
} from './styles/thread_sidebar'

/* eslint-disable-next-line */
const log = buildLog('w:ClassicSidebar')

export type TProps = {
showCommunityBadge: boolean
}

const ClassicLayout: FC<TProps> = ({ showCommunityBadge }) => {
const ThreadSidebar: FC = () => {
const { inView: showCommunityBadge } = useCommunityDigestViewport()
const avatarLayout = useAvatarLayout()

return (
Expand Down Expand Up @@ -86,8 +83,14 @@ const ClassicLayout: FC<TProps> = ({ showCommunityBadge }) => {
<PublishWrapper $show={showCommunityBadge}>
<PublishButton
text="参与讨论"
onClick={() => onPublish(ARTICLE_CAT.FEATURE)}
onMenuSelect={onPublish}
onClick={() => {
// callGEditor()
// setTimeout(() => callSyncSelector({ cat, tag: store.activeTag }), 500)
// onPublish(ARTICLE_CAT.FEATURE)
}}
onMenuSelect={() => {
console.log('## TODO')
}}
left={-2}
offset={[0, 5]}
/>
Expand All @@ -104,4 +107,4 @@ const ClassicLayout: FC<TProps> = ({ showCommunityBadge }) => {
)
}

export default observer(ClassicLayout)
export default observer(ThreadSidebar)
3 changes: 2 additions & 1 deletion src/containers/thread/PostThread/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import useBannerLayout from '@/hooks/useBannerLayout'
import usePagedPosts from '@/hooks/usePagedPosts'
import { THREAD } from '@/constant/thread'

import ThreadSidebar from '@/containers/thread/ThreadSidebar'
import PagedPosts from '@/widgets/PagedPosts'
import TagNote from '@/widgets/TagNote'
import ViewportTracker from '@/widgets/ViewportTracker'
import ArticlesFilter from '@/widgets/ArticlesFilter'
// import LavaLampLoading from '@/widgets/Loading/LavaLampLoading'

import ThreadSidebar from './ThreadSidebar'

import { Wrapper, MainWrapper, SidebarWrapper, FilterWrapper } from './styles'
import { inAnchor, outAnchor, onFilterSelect } from './logic'

Expand Down
File renamed without changes.
30 changes: 0 additions & 30 deletions src/containers/thread/ThreadSidebar/index.tsx

This file was deleted.

129 changes: 0 additions & 129 deletions src/containers/thread/ThreadSidebar/logic.ts

This file was deleted.

29 changes: 0 additions & 29 deletions src/containers/thread/ThreadSidebar/schema.ts

This file was deleted.

79 changes: 0 additions & 79 deletions src/containers/thread/ThreadSidebar/store.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/containers/thread/ThreadSidebar/tests/index.test.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/containers/thread/ThreadSidebar/tests/store.test.js

This file was deleted.

Loading

0 comments on commit c7e4f22

Please sign in to comment.