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
eb3bdfee
Commit
eb3bdfee
authored
Mar 16, 2021
by
Paul Kaplan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix linting
parent
acedd550
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
106 additions
and
45 deletions
+106
-45
src/views/studio/debug.jsx
src/views/studio/debug.jsx
+16
-10
src/views/studio/studio-activity.jsx
src/views/studio/studio-activity.jsx
+21
-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
+27
-8
src/views/studio/studio-info.jsx
src/views/studio/studio-info.jsx
+9
-3
src/views/studio/studio-projects.jsx
src/views/studio/studio-projects.jsx
+30
-16
src/views/studio/studio.jsx
src/views/studio/studio.jsx
+2
-2
No files found.
src/views/studio/debug.jsx
View file @
eb3bdfee
import
React
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
export
default
function
Debug
({
label
,
data
})
{
return
<
div
style=
{
{
padding
:
'
2rem
'
,
'
border
'
:
'
1px solid red
'
,
margin
:
'
2rem
'
}
}
>
const
Debug
=
({
label
,
data
})
=>
(<
div
style=
{
{
padding
:
'
2rem
'
,
border
:
'
1px solid red
'
,
margin
:
'
2rem
'
}
}
>
<
small
>
{
label
}
</
small
>
<
code
>
<
pre
style=
{
{
fontSize
:
'
0.75rem
'
}
}
>
{
JSON
.
stringify
(
data
,
null
,
'
'
)
}
</
pre
>
</
code
>
</
div
>
}
\ No newline at end of file
</
div
>);
Debug
.
propTypes
=
{
label
:
PropTypes
.
string
,
data
:
PropTypes
.
any
// eslint-disable-line react/forbid-prop-types
};
export
default
Debug
;
src/views/studio/studio-activity.jsx
View file @
eb3bdfee
import
React
,
{
useEffect
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
useParams
}
from
'
react-router
'
;
...
...
@@ -16,20 +18,34 @@ const StudioActivity = ({items, loading, error, onInitialLoad}) => {
<
div
>
<
h2
>
Activity
</
h2
>
{
loading
&&
<
div
>
Loading...
</
div
>
}
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
<
div
>
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Activity Item"
data=
{
item
}
key=
{
index
}
/>
(<
Debug
label=
"Activity Item"
data=
{
item
}
key=
{
index
}
/>)
)
}
</
div
>
</
div
>
);
};
StudioActivity
.
propTypes
=
{
items
:
PropTypes
.
array
,
// eslint-disable-line react/forbid-prop-types
loading
:
PropTypes
.
bool
,
error
:
PropTypes
.
object
,
// eslint-disable-line react/forbid-prop-types
onInitialLoad
:
PropTypes
.
func
};
export
default
connect
(
(
state
)
=>
activity
.
selector
(
state
),
(
dispatch
)
=>
({
onInitialLoad
:
(
studioId
)
=>
dispatch
(
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 @
eb3bdfee
src/views/studio/studio-curators.jsx
View file @
eb3bdfee
import
React
,
{
useEffect
}
from
'
react
'
;
import
React
,
{
useEffect
,
useCallback
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
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
{
curators
,
managers
}
from
'
./lib/redux-modules
'
;
import
{
curatorFetcher
,
managerFetcher
}
from
'
./lib/fetchers
'
;
import
Debug
from
'
./debug.jsx
'
;
const
StudioCurators
=
()
=>
{
...
...
@@ -24,19 +25,37 @@ const MemberList = ({studioId, items, error, loading, moreToLoad, onLoadMore}) =
if
(
studioId
&&
items
.
length
===
0
)
onLoadMore
(
studioId
,
0
);
},
[
studioId
]);
return
<
React
.
Fragment
>
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
const
handleLoadMore
=
useCallback
(()
=>
onLoadMore
(
studioId
,
items
.
length
),
[
studioId
,
items
.
length
]);
return
(<
React
.
Fragment
>
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Member"
data=
{
item
}
key=
{
index
}
/>
(<
Debug
label=
"Member"
data=
{
item
}
key=
{
index
}
/>)
)
}
{
loading
?
<
small
>
Loading...
</
small
>
:
(
moreToLoad
?
<
button
onClick=
{
()
=>
onLoadMore
(
studioId
,
items
.
length
)
}
>
<
button
onClick=
{
handleLoadMore
}
>
Load more
</
button
>
:
<
small
>
No more to load
</
small
>
)
}
</
React
.
Fragment
>
</
React
.
Fragment
>);
};
MemberList
.
propTypes
=
{
studioId
:
PropTypes
.
string
,
items
:
PropTypes
.
array
,
// eslint-disable-line react/forbid-prop-types
loading
:
PropTypes
.
bool
,
error
:
PropTypes
.
object
,
// eslint-disable-line react/forbid-prop-types
moreToLoad
:
PropTypes
.
bool
,
onLoadMore
:
PropTypes
.
func
};
const
ManagerList
=
connect
(
...
...
src/views/studio/studio-info.jsx
View file @
eb3bdfee
...
...
@@ -13,15 +13,21 @@ const StudioInfo = () => {
if
(
!
studioId
)
return
;
infoFetcher
(
studioId
)
.
then
(
data
=>
setState
({
loading
:
false
,
error
:
null
,
data
}))
.
catch
(
error
=>
setState
({
loading
:
false
,
error
,
data
:
null
}))
.
catch
(
error
=>
setState
({
loading
:
false
,
error
,
data
:
null
}))
;
},
[
studioId
]);
return
(
<
div
>
<
h2
>
Studio Info
</
h2
>
{
state
.
loading
&&
<
div
>
Loading..
</
div
>
}
{
state
.
error
&&
<
Debug
label=
"Error"
data=
{
state
.
error
}
/>
}
<
Debug
label=
"Studio Info"
data=
{
state
.
data
}
/>
{
state
.
error
&&
<
Debug
label=
"Error"
data=
{
state
.
error
}
/>
}
<
Debug
label=
"Studio Info"
data=
{
state
.
data
}
/>
</
div
>
);
};
...
...
src/views/studio/studio-projects.jsx
View file @
eb3bdfee
import
React
,
{
useEffect
}
from
'
react
'
;
import
React
,
{
useEffect
,
useCallback
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
useParams
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
import
{
connect
}
from
'
react-redux
'
;
import
{
projectFetcher
}
from
'
./lib/fetchers
'
;
import
{
projects
}
from
'
./lib/redux-modules
'
import
{
projects
}
from
'
./lib/redux-modules
'
;
import
Debug
from
'
./debug.jsx
'
;
const
{
actions
,
selector
}
=
projects
;
...
...
@@ -17,17 +18,26 @@ const StudioProjects = ({
if
(
studioId
&&
items
.
length
===
0
)
onLoadMore
(
studioId
,
0
);
},
[
studioId
]);
const
handleLoadMore
=
useCallback
(()
=>
onLoadMore
(
studioId
,
items
.
length
),
[
studioId
,
items
.
length
]);
return
(
<
div
>
<
h2
>
Projects
</
h2
>
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
{
error
&&
<
Debug
label=
"Error"
data=
{
error
}
/>
}
<
div
>
{
items
.
map
((
item
,
index
)
=>
<
Debug
label=
"Project"
data=
{
item
}
key=
{
index
}
/>
(<
Debug
label=
"Project"
data=
{
item
}
key=
{
index
}
/>)
)
}
{
loading
?
<
small
>
Loading...
</
small
>
:
(
moreToLoad
?
<
button
onClick=
{
()
=>
onLoadMore
(
studioId
,
items
.
length
)
}
>
<
button
onClick=
{
handleLoadMore
}
>
Load more
</
button
>
:
<
small
>
No more to load
</
small
>
...
...
@@ -37,15 +47,19 @@ const StudioProjects = ({
);
};
const
mapStateToProps
=
(
state
)
=>
{
return
selector
(
state
);
StudioProjects
.
propTypes
=
{
items
:
PropTypes
.
array
,
// eslint-disable-line react/forbid-prop-types
loading
:
PropTypes
.
bool
,
error
:
PropTypes
.
object
,
// eslint-disable-line react/forbid-prop-types
moreToLoad
:
PropTypes
.
bool
,
onLoadMore
:
PropTypes
.
func
};
const
mapDispatchToProps
=
(
dispatch
)
=>
{
return
{
const
mapStateToProps
=
state
=>
selector
(
state
);
const
mapDispatchToProps
=
dispatch
=>
({
onLoadMore
:
(
studioId
,
offset
)
=>
dispatch
(
actions
.
loadMore
(
projectFetcher
.
bind
(
null
,
studioId
,
offset
))
)
};
}
});
export
default
connect
(
mapStateToProps
,
mapDispatchToProps
)(
StudioProjects
);
src/views/studio/studio.jsx
View file @
eb3bdfee
import
React
,
{
useEffect
}
from
'
react
'
;
import
React
from
'
react
'
;
import
{
BrowserRouter
as
Router
,
Switch
,
...
...
@@ -22,7 +22,7 @@ import {
curators
,
managers
,
activity
}
from
'
./lib/redux-modules
'
}
from
'
./lib/redux-modules
'
;
const
StudioShell
=
()
=>
{
const
match
=
useRouteMatch
();
...
...
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