Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2053-Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Wighus Holtmon
PROG2053-Project
Commits
94e2989d
Commit
94e2989d
authored
3 years ago
by
Martin Wighus Holtmon
Browse files
Options
Downloads
Patches
Plain Diff
projectSecondPart/Problem1: made userDetails display basic information about the selected user.
parent
7ccc5521
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
projectSecondPart/components/userDetail/userDetail.jsx
+19
-10
19 additions, 10 deletions
projectSecondPart/components/userDetail/userDetail.jsx
projectSecondPart/components/userList/userList.jsx
+1
-1
1 addition, 1 deletion
projectSecondPart/components/userList/userList.jsx
with
20 additions
and
11 deletions
projectSecondPart/components/userDetail/userDetail.jsx
+
19
−
10
View file @
94e2989d
import
React
from
'
react
'
;
import
{
Typography
}
from
'
@material-ui/core
'
;
import
'
./userDetail.css
'
;
...
...
@@ -11,17 +8,29 @@ import './userDetail.css';
class
UserDetail
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
//console.log(this.props.match.params.userId);
}
generateUserPreview
()
{
let
user
=
window
.
cs142models
.
userListModel
().
find
(
e
=>
e
.
_id
===
this
.
props
.
match
.
params
.
userId
)
console
.
log
(
user
)
return
(<
div
id
=
"DivUserPreview"
>
<
h2
>
{
user
.
first_name
}
{
user
.
last_name
}
</
h2
>
<
p
>
Occupation:
{
user
.
occupation
}
<
br
/>
From:
{
user
.
location
}
<
br
/>
Description:
{
user
.
description
}
</
p
>
</
div
>
)
}
render
()
{
return
(
<
Typography
variant
=
"body1"
>
This should be the UserDetail view of the PhotoShare app. Since
it is invoked from React Router the params from the route will be
in property match. So this should show details of user:
{
this
.
props
.
match
.
params
.
userId
}
. You can fetch the model for the
user from window.cs142models.userModel(userId).
</
Typography
>
<
div
id
=
"divUserDetail"
>
{
this
.
generateUserPreview
()
}
</
div
>
);
}
}
...
...
This diff is collapsed.
Click to expand it.
projectSecondPart/components/userList/userList.jsx
+
1
−
1
View file @
94e2989d
...
...
@@ -15,7 +15,7 @@ import {Link} from "react-router-dom";
class
UserList
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
console
.
log
(
window
.
cs142models
.
userListModel
())
//
console.log(window.cs142models.userListModel())
}
renderUsers
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment