Skip to content

Commit

Permalink
Merge pull request #1393 from thematters/fix/tag-detail
Browse files Browse the repository at this point in the history
[hotfix - master] Fix TagDetail shows incorrect feed and more;
  • Loading branch information
robertu7 authored Aug 4, 2020
2 parents e7640a4 + 871cb63 commit 139ae64
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matters-web",
"version": "3.12.0",
"version": "3.12.1",
"description": "codebase of Matters' website",
"sideEffects": false,
"author": "Matters <[email protected]>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ const SetTagUnselectedButton = ({
variables: { id: tagId, articles: [article.id] },
update: (cache) => {
try {
// FIXME: circular dependencies
const {
TAG_ARTICLES_PUBLIC: query,
} = require('~/components/GQL/queries/tagArticles').default
} = require('~/components/GQL/queries/tagArticles')
const variables = { id: tagId, selected: true }
const data = cache.readQuery<TagArticlesPublic>({ query, variables })
const node = _get(data, 'node', {}) as TagArticlesPublic_node_Tag
Expand Down
8 changes: 5 additions & 3 deletions src/components/DropdownDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
useResponsive,
} from '~/components'

import { KEYCODES, TEXT, TextId } from '~/common/enums'
import { KEYCODES, TEXT, TextId, Z_INDEX } from '~/common/enums'

/**
* This is a responsive component which will show
Expand Down Expand Up @@ -113,12 +113,14 @@ const BaseDropdownDialog = ({
if (isSmallUp) {
return (
<Dropdown
{...dropdown}
trigger={undefined}
content={<Content>{dropdown.content}</Content>}
onHidden={close}
onClickOutside={close}
visible={showDialog}
zIndex={Z_INDEX.OVER_STICKY_TABS}
appendTo={process.browser ? document.body : undefined}
{...dropdown}
content={<Content>{dropdown.content}</Content>}
>
<ForwardChildren open={toggle} children={children} />
</Dropdown>
Expand Down
2 changes: 1 addition & 1 deletion src/components/GQL/updates/userArticles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const update = ({
// FIXME: circular dependencies
const {
USER_ARTICLES_PUBLIC,
} = require('~/components/GQL/queries/userArticles').default
} = require('~/components/GQL/queries/userArticles')

if (!userName) {
return
Expand Down
4 changes: 1 addition & 3 deletions src/components/UserProfile/DropdownActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '~/components'
import { BlockUser } from '~/components/BlockUser'

import { TEXT, Z_INDEX } from '~/common/enums'
import { TEXT } from '~/common/enums'

import { DropdownActionsUserPublic } from './__generated__/DropdownActionsUserPublic'

Expand Down Expand Up @@ -74,8 +74,6 @@ const BaseDropdownActions = ({
dropdown={{
content: <Content isInDropdown />,
placement: 'bottom-end',
zIndex: Z_INDEX.OVER_STICKY_TABS,
appendTo: process.browser ? document.body : undefined,
}}
dialog={{
content: <Content />,
Expand Down
3 changes: 2 additions & 1 deletion src/views/TagDetail/Articles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ const TagDetailArticles = ({ tagId, selected }: TagArticlesProps) => {
location: i,
})
}
inTagDetailLatest
inTagDetailSelected={selected}
inTagDetailLatest={!selected}
/>
</List.Item>
))}
Expand Down
4 changes: 1 addition & 3 deletions src/views/TagDetail/Buttons/AddButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { useMutation } from '~/components/GQL'
import CREATE_DRAFT from '~/components/GQL/mutations/createDraft'

import { ADD_TOAST, Z_INDEX } from '~/common/enums'
import { ADD_TOAST } from '~/common/enums'
import {
analytics,
parseFormSubmitErrors,
Expand Down Expand Up @@ -158,8 +158,6 @@ const BaseDropdownActions = ({
dropdown={{
content: <Content isInDropdown />,
placement: 'bottom-end',
zIndex: Z_INDEX.OVER_STICKY_TABS,
appendTo: process.browser ? document.body : undefined,
}}
dialog={{
content: <Content />,
Expand Down
4 changes: 1 addition & 3 deletions src/views/TagDetail/DropdownActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
useResponsive,
} from '~/components'

import { TEXT, Z_INDEX } from '~/common/enums'
import { TEXT } from '~/common/enums'

type DropdownActionsProps = {
isMaintainer: boolean
Expand Down Expand Up @@ -56,8 +56,6 @@ const BaseDropdownActions = ({
dropdown={{
content: <Content isInDropdown />,
placement: 'bottom-end',
zIndex: Z_INDEX.OVER_STICKY_TABS,
appendTo: process.browser ? document.body : undefined,
}}
dialog={{
content: <Content />,
Expand Down
3 changes: 3 additions & 0 deletions src/views/TagDetail/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export const TAG_DETAIL_PUBLIC = gql`
id
...UserDigestMiniUser
}
selectedArticles: articles(input: { first: 0, selected: true }) {
totalCount
}
...FollowersTag
...ArticleCountTag
...FollowButtonTagPrivate
Expand Down
2 changes: 1 addition & 1 deletion src/views/TagDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const TagDetail = ({ tag }: { tag: TagDetailPublic_node_Tag }) => {
const viewer = useContext(ViewerContext)

// feed type
const hasSelected = (tag?.articles.totalCount || 0) > 0
const hasSelected = (tag?.selectedArticles.totalCount || 0) > 0
const [feed, setFeed] = useState<TagFeedType>(
hasSelected ? 'selected' : 'latest'
)
Expand Down

0 comments on commit 139ae64

Please sign in to comment.