Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kszkepzes-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
JetBrains YouTrack
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
KSZK
DevTeam
kszkepzes
old
kszkepzes-frontend
Commits
a6bcef70
Commit
a6bcef70
authored
7 years ago
by
Tamás Szabó
Browse files
Options
Downloads
Patches
Plain Diff
profile page functionality and design
parent
2f020a7f
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/actions/auth.js
+38
-0
38 additions, 0 deletions
src/actions/auth.js
src/actions/index.js
+1
-0
1 addition, 0 deletions
src/actions/index.js
src/components/Main.js
+20
-21
20 additions, 21 deletions
src/components/Main.js
src/components/pages/Profile.js
+75
-15
75 additions, 15 deletions
src/components/pages/Profile.js
with
134 additions
and
36 deletions
src/actions/auth.js
0 → 100644
+
38
−
0
View file @
a6bcef70
import
ax
from
'
axios
'
;
import
{
GET_USERDATA
,
PROFILE_CHANGE
,
GROUP_CHANGE
}
from
'
./types
'
;
const
axios
=
ax
.
create
({
xsrfCookieName
:
'
csrftoken
'
,
xsrfHeaderName
:
'
X-CSRFToken
'
,
});
export
const
getUserData
=
()
=>
(
async
(
dispatch
)
=>
{
const
user
=
await
axios
.
get
(
'
/api/v1/profiles/me
'
);
const
{
id
,
join_date
:
joinDate
,
nick
,
motivation
,
signed
,
groups
}
=
user
.
data
;
dispatch
({
type
:
GET_USERDATA
,
payload
:
{
id
,
joinDate
,
nick
,
motivation
,
signed
,
groups
}
});
}
);
export
const
textChange
=
({
target
:
{
name
,
value
}
})
=>
(
(
dispatch
)
=>
{
dispatch
({
type
:
PROFILE_CHANGE
,
payload
:
value
,
target
:
name
});
}
);
export
const
groupChange
=
groups
=>
(
dispatch
=>
(
dispatch
({
type
:
GROUP_CHANGE
,
payload
:
groups
}))
);
export
const
submitRegistration
=
({
nick
,
groups
,
signed
,
motivation
,
id
})
=>
(
async
(
dispatch
)
=>
{
const
response
=
await
axios
.
patch
(
`/api/v1/profiles/
${
id
}
/`
,
{
nick
,
groups
,
signed
,
motivation
,
});
if
(
response
.
data
.
id
===
id
)
{
alert
(
'
Sikeres mentés!
'
);
}
else
{
alert
(
'
Mentés nem sikerült!
'
);
}
}
);
This diff is collapsed.
Click to expand it.
src/actions/index.js
+
1
−
0
View file @
a6bcef70
export
*
from
'
./auth
'
;
This diff is collapsed.
Click to expand it.
src/components/Main.js
+
20
−
21
View file @
a6bcef70
import
React
from
"
react
"
;
import
React
from
'
react
'
;
import
{
Switch
,
Route
,
Redirect
}
from
"
react-router-dom
"
;
import
{
Switch
,
Route
,
Redirect
}
from
'
react-router-dom
'
;
import
Home
from
"
./pages/Home
"
;
import
{
withRouter
}
from
'
react-router
'
import
Trainers
from
"
./pages/Trainers
"
;
import
Home
from
'
./pages/Home
'
;
import
Schedule
from
"
./pages/Schedule
"
;
import
Trainers
from
'
./pages/Trainers
'
;
import
NotFound
from
"
./pages/NotFound
"
;
import
Schedule
from
'
./pages/Schedule
'
;
import
Profile
from
"
./pages/Profile
"
;
import
NotFound
from
'
./pages/NotFound
'
;
import
Statistics
from
"
./pages/Statistics
"
;
import
Profile
from
'
./pages/Profile
'
;
import
Circles
from
"
./pages/Circles
"
;
import
Statistics
from
'
./pages/Statistics
'
;
import
Circles
from
'
./pages/Circles
'
;
const
Main
=
()
=>
(
const
Main
=
()
=>
(
<
main
>
<
Switch
>
<
Switch
>
<
Redirect
exact
from
=
'
/
'
to
=
'
/home
'
/>
<
Redirect
exact
from
=
"
/
"
to
=
"
/home
"
/>
<
Route
exact
path
=
'
/home
'
component
=
{
Home
}
/
>
<
Route
exact
path
=
"
/home
"
component
=
{
Home
}
/
>
<
Route
path
=
'
/trainers
'
component
=
{
Trainers
}
/
>
<
Route
path
=
"
/trainers
"
component
=
{
Trainers
}
/
>
<
Route
path
=
'
/schedule
'
component
=
{
Schedule
}
/
>
<
Route
path
=
"
/schedule
"
component
=
{
Schedule
}
/
>
<
Route
path
=
'
/profile
'
component
=
{
withRouter
(
Profile
)}
/
>
<
Route
path
=
"
/profile
"
component
=
{
Profile
}
/
>
<
Route
path
=
'
/statistics
'
component
=
{
Statistics
}
/
>
<
Route
path
=
"
/statistics
"
component
=
{
Statistics
}
/
>
<
Route
path
=
'
/circles
'
component
=
{
Circles
}
/
>
<
Route
path
=
"
/circles
"
component
=
{
Circles
}
/
>
<
Route
component
=
{
NotFound
}
/
>
<
Route
component
=
{
NotFound
}
/
>
<
/Switch
>
<
/Switch
>
<
/main
>
);
);
export
default
Main
;
export
default
Main
;
This diff is collapsed.
Click to expand it.
src/components/pages/Profile.js
+
75
−
15
View file @
a6bcef70
import
React
,
{
Component
}
from
"
react
"
;
import
React
,
{
Component
}
from
'
react
'
;
import
{
Container
,
Header
,
Segment
}
from
"
semantic-ui-react
"
;
import
{
Container
,
Segment
,
Form
,
Dropdown
,
Divider
}
from
'
semantic-ui-react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
textChange
,
submitRegistration
,
groupChange
}
from
'
../../actions
'
;
const
options
=
[
{
key
:
'
DT
'
,
text
:
'
DevTeam
'
,
value
:
'
DT
'
},
{
key
:
'
NET
'
,
text
:
'
NeTeam
'
,
value
:
'
NET
'
},
{
key
:
'
ST
'
,
text
:
'
SecurITeam
'
,
value
:
'
ST
'
},
{
key
:
'
SYS
'
,
text
:
'
SysAdmin
'
,
value
:
'
SYS
'
},
{
key
:
'
HAT
'
,
text
:
'
Hallgatói Tudásbázis
'
,
value
:
'
HAT
'
},
];
class
Profile
extends
Component
{
componentWillMount
()
{
if
(
!
this
.
props
.
id
)
{
this
.
props
.
history
.
push
(
'
/home
'
);
}
}
export
default
class
Profile
extends
Component
{
render
()
{
render
()
{
const
{
nick
,
groups
,
motivation
,
signed
,
id
}
=
this
.
props
;
return
(
return
(
<
div
>
<
div
>
<
Segment
inverted
textAlign
=
"
center
"
vertical
>
<
Segment
textAlign
=
'
center
'
vertical
>
<
Container
>
<
Container
>
<
Header
<
Form
>
as
=
"
h1
"
<
Divider
horizontal
>
Becenév
<
/Divider
>
content
=
"
Profil - TODO
"
<
Form
.
Input
inverted
fluid
style
=
{{
name
=
'
nick
'
fontSize
:
"
3em
"
,
onChange
=
{
e
=>
this
.
props
.
textChange
(
e
)}
fontWeight
:
"
normal
"
,
placeholder
=
'
Becenév
'
marginBottom
:
0
,
value
=
{
nick
}
marginTop
:
"
0.5em
"
/
>
}}
<
Divider
horizontal
>
Motivációs
levél
<
/Divider
>
/
>
<
Form
.
TextArea
rows
=
{
10
}
name
=
'
motivation
'
onChange
=
{
e
=>
this
.
props
.
textChange
(
e
)}
placeholder
=
'
Miért szeretnék jelentkezni...
'
value
=
{
motivation
}
/
>
<
Divider
horizontal
>
Érdekelt
Körök
<
/Divider
>
<
Dropdown
fluid
multiple
selection
placeholder
=
'
DevTeam, ...
'
onChange
=
{(
_
,
v
)
=>
this
.
props
.
groupChange
(
v
.
value
)}
options
=
{
options
}
defaultValue
=
{
groups
}
/
>
<
br
/>
<
Form
.
Checkbox
name
=
'
signed
'
label
=
'
Szeretnék jelentkezni a KSZK-ba
'
onChange
=
{(
_
,
v
)
=>
this
.
props
.
textChange
({
target
:
{
name
:
v
.
name
,
value
:
v
.
checked
}
})}
checked
=
{
signed
}
/
>
<
Form
.
Button
onClick
=
{()
=>
this
.
props
.
submitRegistration
({
nick
,
motivation
,
signed
,
groups
,
id
})}
>
Mentés
<
/Form.Button
>
<
/Form
>
<
/Container
>
<
/Container
>
<
/Segment
>
<
/Segment
>
<
/div
>
<
/div
>
);
);
}
}
}
}
const
mapStateToProps
=
({
user
:
{
nick
,
groups
,
motivation
,
signed
,
id
}
})
=>
{
return
{
nick
,
groups
,
motivation
,
signed
,
id
,
};
};
export
default
connect
(
mapStateToProps
,
{
textChange
,
submitRegistration
,
groupChange
})(
Profile
);
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