mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-12 05:26:46 +00:00
delete account button logs out...
This commit is contained in:
parent
04e337bab0
commit
2238c073b5
1 changed files with 19 additions and 8 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
import React, {FC} from 'react';
|
import React, {FC} from 'react';
|
||||||
// Redux
|
// Redux
|
||||||
|
import {compose} from '@reduxjs/toolkit';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
import {withFirebase, WithFirebaseProps} from 'react-redux-firebase';
|
||||||
import {selectProfile} from '../store/firebase';
|
import {selectProfile} from '../store/firebase';
|
||||||
// Style
|
// Style
|
||||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
|
||||||
|
|
@ -13,17 +15,25 @@ import {faBlackTie} from '@fortawesome/free-brands-svg-icons';
|
||||||
import Header from '../components/Header';
|
import Header from '../components/Header';
|
||||||
// Types
|
// Types
|
||||||
import Dev from '../models/Dev';
|
import Dev from '../models/Dev';
|
||||||
|
import User from '../models/User';
|
||||||
import Experience from '../types/Experience';
|
import Experience from '../types/Experience';
|
||||||
import {getTimePeriod} from '../types/TimePeriod';
|
import {getTimePeriod} from '../types/TimePeriod';
|
||||||
import Education from '../types/Education';
|
import Education from '../types/Education';
|
||||||
|
|
||||||
|
interface IProps extends Dev, WithFirebaseProps<User> {}
|
||||||
/**
|
/**
|
||||||
* Main page from which a Dev can peek and edit its own profile.
|
* Main page from which a Dev can peek and edit its own profile.
|
||||||
*/
|
*/
|
||||||
const Dashboard: FC<Dev> = dev => {
|
const Dashboard: FC<IProps> = ({
|
||||||
|
firebase,
|
||||||
|
displayName,
|
||||||
|
experiences,
|
||||||
|
educations,
|
||||||
|
}) => {
|
||||||
|
const logout = () => firebase.logout();
|
||||||
return (
|
return (
|
||||||
<section className="container">
|
<section className="container">
|
||||||
<Header title="Dashboard" lead={`Welcome ${dev.displayName}`} />
|
<Header title="Dashboard" lead={`Welcome ${displayName}`} />
|
||||||
<div className="dash-buttons">
|
<div className="dash-buttons">
|
||||||
<a href="create-profile.html" className="btn btn-light">
|
<a href="create-profile.html" className="btn btn-light">
|
||||||
<FontAwesomeIcon icon={faUserCircle} /> Edit Profile
|
<FontAwesomeIcon icon={faUserCircle} /> Edit Profile
|
||||||
|
|
@ -47,7 +57,7 @@ const Dashboard: FC<Dev> = dev => {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{/* {dev.experiences.map((exp: Experience, i: number) => (
|
{experiences?.map((exp: Experience, i: number) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>{exp.company}</td>
|
<td>{exp.company}</td>
|
||||||
<td className="hide-sm">{exp.position}</td>
|
<td className="hide-sm">{exp.position}</td>
|
||||||
|
|
@ -56,7 +66,7 @@ const Dashboard: FC<Dev> = dev => {
|
||||||
<button className="btn btn-danger">Delete</button>
|
<button className="btn btn-danger">Delete</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))} */}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
@ -71,7 +81,7 @@ const Dashboard: FC<Dev> = dev => {
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{/* {dev.educations.map((edu: Education, i: number) => (
|
{educations?.map((edu: Education, i: number) => (
|
||||||
<tr key={i}>
|
<tr key={i}>
|
||||||
<td>{edu.school}</td>
|
<td>{edu.school}</td>
|
||||||
<td className="hide-sm">{edu.field}</td>
|
<td className="hide-sm">{edu.field}</td>
|
||||||
|
|
@ -80,11 +90,11 @@ const Dashboard: FC<Dev> = dev => {
|
||||||
<button className="btn btn-danger">Delete</button>
|
<button className="btn btn-danger">Delete</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))} */}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div className="my-2">
|
<div className="my-2">
|
||||||
<button className="btn btn-danger">
|
<button className="btn btn-danger" onClick={logout}>
|
||||||
<FontAwesomeIcon icon={faUserSlash} /> Delete my Account
|
<FontAwesomeIcon icon={faUserSlash} /> Delete my Account
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -92,4 +102,5 @@ const Dashboard: FC<Dev> = dev => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default connect(selectProfile)(Dashboard);
|
const enhance = compose<FC>(connect(selectProfile), withFirebase);
|
||||||
|
export default enhance(Dashboard);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue