Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodlenet
MoodleNet Frontend
Commits
d8c58a8a
Commit
d8c58a8a
authored
Jun 03, 2020
by
aleclofabbro
Browse files
fixed joined communities limit var binding and restored loadmore on sidebar
parent
bb7826c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/fe/community/myFollowed/myFollowedCommunities.generated.tsx
View file @
d8c58a8a
...
...
@@ -13,7 +13,11 @@ import * as ApolloReactHooks from '@apollo/react-hooks';
export
type
MyCommunityFollowsQueryVariables
=
{};
export
type
MyCommunityFollowsQueryVariables
=
{
limit
?:
Types
.
Maybe
<
Types
.
Scalars
[
'
Int
'
]
>
,
before
?:
Types
.
Maybe
<
Array
<
Types
.
Scalars
[
'
Cursor
'
]
>>
,
after
?:
Types
.
Maybe
<
Array
<
Types
.
Scalars
[
'
Cursor
'
]
>>
};
export
type
MyCommunityFollowsQuery
=
(
...
...
@@ -64,7 +68,7 @@ export const MyCommunityFollowsDataFragmentDoc = gql`
fragment MyCommunityFollowsData on Me {
user {
id
communityFollows {
communityFollows
(limit: $limit, before: $before, after: $after)
{
totalCount
pageInfo {
...FullPageInfo
...
...
@@ -83,7 +87,7 @@ export const MyCommunityFollowsDataFragmentDoc = gql`
${
FullPageInfoFragmentDoc
}
${
MyFollowedCommunityDataFragmentDoc
}
`
;
export
const
MyCommunityFollowsDocument
=
gql
`
query myCommunityFollows {
query myCommunityFollows
($limit: Int, $before: [Cursor!], $after: [Cursor!])
{
me @connection(key: "myCommunityFollows") {
...MyCommunityFollowsData
}
...
...
@@ -102,6 +106,9 @@ export const MyCommunityFollowsDocument = gql`
* @example
* const { data, loading, error } = useMyCommunityFollowsQuery({
* variables: {
* limit: // value for 'limit'
* before: // value for 'before'
* after: // value for 'after'
* },
* });
*/
...
...
src/fe/community/myFollowed/myFollowedCommunities.graphql
View file @
d8c58a8a
query
myCommunityFollows
{
query
myCommunityFollows
(
$limit
:
Int
,
$before
:[
Cursor
!],
$after
:[
Cursor
!])
{
me
@connection
(
key
:
"myCommunityFollows"
){
...
MyCommunityFollowsData
}
...
...
@@ -8,7 +8,7 @@ query myCommunityFollows {
fragment
MyCommunityFollowsData
on
Me
{
user
{
id
communityFollows
{
communityFollows
(
limit
:
$limit
,
before
:
$before
,
after
:
$after
)
{
totalCount
,
pageInfo
{
...
FullPageInfo
}
edges
{
...
...
src/fe/community/myFollowed/myFollowedCommunities.ts
View file @
d8c58a8a
...
...
@@ -3,16 +3,18 @@ import * as GQL from './myFollowedCommunities.generated';
import
{
usePage
}
from
'
fe/lib/helpers/usePage
'
;
// import { DEFAULT_PAGE_SIZE } from 'mn-constants';
const
MY_JOINMED_LIST_LIMIT
=
15
;
// TODO CONFIGURE
export
const
useMyFollowedCommunities
=
()
=>
{
const
myFlwCommunitiesQ
=
GQL
.
useMyCommunityFollowsQuery
({
variables
:
{
limit
:
10
}
// FIXME
variables
:
{
limit
:
MY_JOINMED_LIST_LIMIT
}
});
const
myCommunityFollowsPage
=
usePage
(
myFlwCommunitiesQ
.
data
?.
me
?.
user
.
communityFollows
,
({
cursor
,
update
})
=>
{
return
myFlwCommunitiesQ
.
fetchMore
({
variables
:
{
...
cursor
,
limit
:
10
},
// FIXME CONFIGURE
variables
:
{
...
cursor
,
limit
:
MY_JOINMED_LIST_LIMIT
},
updateQuery
:
(
prev
,
{
fetchMoreResult
})
=>
{
return
fetchMoreResult
?.
me
?.
user
?.
communityFollows
&&
prev
.
me
?.
user
?.
communityFollows
...
...
src/ui/modules/Sidebar/index.tsx
View file @
d8c58a8a
...
...
@@ -12,6 +12,7 @@ import Avatar from 'ui/elements/Avatar';
import
{
my_timeline
,
logo_small_url
}
from
'
../../../mn-constants
'
;
// const MnetLogo = require('static/img/logo-icon.png');
import
{
FormikHook
}
from
'
ui/@types/types
'
;
import
{
LoadMore
}
from
'
../Loadmore
'
;
// import { LoadMore } from 'ui/modules/Loadmore';
export
enum
Status
{
...
...
@@ -225,9 +226,9 @@ export const Sidebar: React.FC<Props> = props => {
</
CommunityLink
>
)
)
}
{
/*
{props.LoadMoreFormik && (
{
props
.
LoadMoreFormik
&&
(
<
LoadMore
LoadMoreFormik
=
{
props
.
LoadMoreFormik
}
/>
)}
*/
}
)
}
</
Nav
>
</>
</
SidebarOverflow
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment