Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
acedd550
Commit
acedd550
authored
Mar 16, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the infinite loading module for all the data
parent
6b87429e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
17 deletions
+139
-17
src/views/studio/lib/redux-modules.js
src/views/studio/lib/redux-modules.js
+10
-0
src/views/studio/studio-activity.jsx
src/views/studio/studio-activity.jsx
+25
-5
src/views/studio/studio-comments.jsx
src/views/studio/studio-comments.jsx
+1
-1
src/views/studio/studio-curators.jsx
src/views/studio/studio-curators.jsx
+47
-5
src/views/studio/studio-projects.jsx
src/views/studio/studio-projects.jsx
+40
-4
src/views/studio/studio.jsx
src/views/studio/studio.jsx
+16
-2
No files found.
src/views/studio/lib/redux-modules.js
0 → 100644
View file @
acedd550
import
InfiniteList
from
'
../../../redux/infinite-list
'
;
const
projects
=
InfiniteList
(
'
projects
'
);
const
curators
=
InfiniteList
(
'
curators
'
);
const
managers
=
InfiniteList
(
'
managers
'
);
const
activity
=
InfiniteList
(
'
activity
'
);
export
{
projects
,
curators
,
managers
,
activity
};
src/views/studio/studio-activity.jsx
View file @
acedd550
import
React
from
'
react
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
useParams
}
from
'
react-router
'
;
const
StudioActivity
=
()
=>
{
import
{
activity
}
from
'
./lib/redux-modules
'
;
import
{
activityFetcher
}
from
'
./lib/fetchers
'
;
import
Debug
from
'
./debug.jsx
'
;
const
StudioActivity
=
({
items
,
loading
,
error
,
onInitialLoad
})
=>
{
const
{
studioId
}
=
useParams
();
useEffect
(()
=>
{
if
(
studioId
&&
items
.
length
===
0
)
onInitialLoad
(
studioId
);
},
[
studioId
]);
return
(
<
div
>
<
h2
>
Activity
</
h2
>
<
p
>
Studio
{
studioId
}
</
p
>
{
loading
&&
<
div
>
Loading...
</
div
>
}
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
<
div
>
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Activity Item"
data=
{
item
}
key=
{
index
}
/>
)
}
</
div
>
</
div
>
);
};
export
default
StudioActivity
;
export
default
connect
(
(
state
)
=>
activity
.
selector
(
state
),
(
dispatch
)
=>
({
onInitialLoad
:
(
studioId
)
=>
dispatch
(
activity
.
actions
.
loadMore
(
activityFetcher
.
bind
(
null
,
studioId
,
0
)))
})
)(
StudioActivity
);
src/views/studio/studio-comments.jsx
View file @
acedd550
...
...
@@ -12,4 +12,4 @@ const StudioComments = () => {
);
};
export
default
StudioComments
;
export
default
StudioComments
;
\ No newline at end of file
src/views/studio/studio-curators.jsx
View file @
acedd550
import
React
from
'
react
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
curators
,
managers
}
from
'
./lib/redux-modules
'
import
{
curatorFetcher
,
managerFetcher
}
from
'
./lib/fetchers
'
import
Debug
from
'
./debug.jsx
'
;
const
StudioCurators
=
()
=>
{
const
{
studioId
}
=
useParams
();
return
(
<
div
>
<
h2
>
Curators
</
h2
>
<
p
>
Studio
{
studioId
}
</
p
>
<
h3
>
Managers
</
h3
>
<
ManagerList
studioId=
{
studioId
}
/>
<
hr
/>
<
h3
>
Curators
</
h3
>
<
CuratorList
studioId=
{
studioId
}
/>
</
div
>
);
};
const
MemberList
=
({
studioId
,
items
,
error
,
loading
,
moreToLoad
,
onLoadMore
})
=>
{
useEffect
(()
=>
{
if
(
studioId
&&
items
.
length
===
0
)
onLoadMore
(
studioId
,
0
);
},
[
studioId
]);
return
<
React
.
Fragment
>
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Member"
data=
{
item
}
key=
{
index
}
/>
)
}
{
loading
?
<
small
>
Loading...
</
small
>
:
(
moreToLoad
?
<
button
onClick=
{
()
=>
onLoadMore
(
studioId
,
items
.
length
)
}
>
Load more
</
button
>
:
<
small
>
No more to load
</
small
>
)
}
</
React
.
Fragment
>
};
const
ManagerList
=
connect
(
state
=>
managers
.
selector
(
state
),
dispatch
=>
({
onLoadMore
:
(
studioId
,
offset
)
=>
dispatch
(
managers
.
actions
.
loadMore
(
managerFetcher
.
bind
(
null
,
studioId
,
offset
)))
})
)(
MemberList
);
const
CuratorList
=
connect
(
state
=>
curators
.
selector
(
state
),
dispatch
=>
({
onLoadMore
:
(
studioId
,
offset
)
=>
dispatch
(
curators
.
actions
.
loadMore
(
curatorFetcher
.
bind
(
null
,
studioId
,
offset
)))
})
)(
MemberList
);
export
default
StudioCurators
;
src/views/studio/studio-projects.jsx
View file @
acedd550
import
React
from
'
react
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
const
StudioProjects
=
()
=>
{
import
{
projectFetcher
}
from
'
./lib/fetchers
'
;
import
{
projects
}
from
'
./lib/redux-modules
'
import
Debug
from
'
./debug.jsx
'
;
const
{
actions
,
selector
}
=
projects
;
const
StudioProjects
=
({
items
,
error
,
loading
,
moreToLoad
,
onLoadMore
})
=>
{
const
{
studioId
}
=
useParams
();
useEffect
(()
=>
{
if
(
studioId
&&
items
.
length
===
0
)
onLoadMore
(
studioId
,
0
);
},
[
studioId
]);
return
(
<
div
>
<
h2
>
Projects
</
h2
>
<
p
>
Studio
{
studioId
}
</
p
>
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
<
div
>
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Project"
data=
{
item
}
key=
{
index
}
/>
)
}
{
loading
?
<
small
>
Loading...
</
small
>
:
(
moreToLoad
?
<
button
onClick=
{
()
=>
onLoadMore
(
studioId
,
items
.
length
)
}
>
Load more
</
button
>
:
<
small
>
No more to load
</
small
>
)
}
</
div
>
</
div
>
);
};
export
default
StudioProjects
;
const
mapStateToProps
=
(
state
)
=>
{
return
selector
(
state
);
};
const
mapDispatchToProps
=
(
dispatch
)
=>
{
return
{
onLoadMore
:
(
studioId
,
offset
)
=>
dispatch
(
actions
.
loadMore
(
projectFetcher
.
bind
(
null
,
studioId
,
offset
))
)
};
}
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
StudioProjects
);
\ No newline at end of file
src/views/studio/studio.jsx
View file @
acedd550
import
React
from
'
react
'
;
import
React
,
{
useEffect
}
from
'
react
'
;
import
{
BrowserRouter
as
Router
,
Switch
,
...
...
@@ -9,6 +9,7 @@ import {
import
Page
from
'
../../components/page/www/page.jsx
'
;
import
render
from
'
../../lib/render.jsx
'
;
import
StudioTabNav
from
'
./studio-tab-nav.jsx
'
;
import
StudioProjects
from
'
./studio-projects.jsx
'
;
import
StudioInfo
from
'
./studio-info.jsx
'
;
...
...
@@ -16,6 +17,13 @@ import StudioCurators from './studio-curators.jsx';
import
StudioComments
from
'
./studio-comments.jsx
'
;
import
StudioActivity
from
'
./studio-activity.jsx
'
;
import
{
projects
,
curators
,
managers
,
activity
}
from
'
./lib/redux-modules
'
const
StudioShell
=
()
=>
{
const
match
=
useRouteMatch
();
...
...
@@ -59,5 +67,11 @@ render(
</
Switch
>
</
Router
>
</
Page
>,
document
.
getElementById
(
'
app
'
)
document
.
getElementById
(
'
app
'
),
{
[
projects
.
key
]:
projects
.
reducer
,
[
curators
.
key
]:
curators
.
reducer
,
[
managers
.
key
]:
managers
.
reducer
,
[
activity
.
key
]:
activity
.
reducer
}
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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