diff --git a/src/components/app/app.scss b/src/components/app/app.scss index a7d6203..12e758b 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -15,7 +15,7 @@ $white-ter: hsl(0, 0%, 96%); $family-sans-serif: "Open Sans", sans-serif; $primary: $blue; -$title-weight: 400; +// $title-weight: 400; $body-background-color: $white-ter; $body-size: 14px; @@ -37,7 +37,6 @@ $body-size: 14px; div#main-menu { background: linear-gradient(135deg, $primary, darken($primary, 20%)); - // border-left: 1px solid $grey-lighter; bottom: 0; display: flex; flex-direction: column; @@ -59,7 +58,7 @@ div.centered-content { border-radius: $radius; margin: 1rem auto; padding: 2rem; - width: 80%; + width: 95%; div.centered-content-icon { border-radius: 100px; @@ -70,6 +69,11 @@ div.centered-content { } } +.centered-content-narrow { + @extend div.centered-content; + width: 75%; +} + div#navigation { flex-grow: 1; diff --git a/src/components/app/app.tsx b/src/components/app/app.tsx index d413520..760f4b5 100644 --- a/src/components/app/app.tsx +++ b/src/components/app/app.tsx @@ -65,7 +65,7 @@ const App: FC = ({ collapsed, fetching, fetchSelf, setChecked }) => { - + diff --git a/src/components/pages/group-admin/group-admin.tsx b/src/components/pages/group-admin/group-admin.tsx index d614ee6..323dfb6 100644 --- a/src/components/pages/group-admin/group-admin.tsx +++ b/src/components/pages/group-admin/group-admin.tsx @@ -6,7 +6,7 @@ import { faCheckCircle } from '@fortawesome/free-solid-svg-icons' import { useDeepCompareEffect } from 'src/hooks' import { setTitle } from 'src/utils' -import { Group, GroupMembershipType } from 'src/types' +import { Group, GroupMembershipType, Tab } from 'src/types' import PageHeader from 'src/components/page-header' import TextareaField from 'src/components/forms/textarea-field' @@ -15,11 +15,6 @@ import GroupInvitations from 'src/components/group-invitations' import GroupLogs from 'src/components/group-logs' import Loading from 'src/components/pages/loading' -interface Tab { - id: string - label: string -} - interface Params { id: string tab: string diff --git a/src/components/pages/self/index.ts b/src/components/pages/self/index.ts index 65ff4ca..0a5d2ba 100644 --- a/src/components/pages/self/index.ts +++ b/src/components/pages/self/index.ts @@ -2,9 +2,10 @@ import { Dispatch } from 'redux' import { connect } from 'react-redux' import { unauthenticate } from 'src/actions/authentication' import { getAuthenticated, getChecked, getAuthenticatedUser } from 'src/selectors/authentication' -import { AppState } from 'src/types' +import { AppState, User } from 'src/types' import Self from './self' +import { initForm, initField, setFieldValue } from 'src/actions/forms' const mapStateToProps = (state: AppState) => ({ checked: getChecked(state), @@ -13,6 +14,13 @@ const mapStateToProps = (state: AppState) => ({ }) const mapDispatchToProps = (dispatch: Dispatch) => ({ + initForm: (user: User) => { + dispatch(initForm()) + dispatch(initField('name')) + dispatch(initField('about')) + dispatch(setFieldValue('name', user.name as string)) + dispatch(setFieldValue('about', user.about as string)) + }, logout: async () => { localStorage.clear() dispatch(unauthenticate()) diff --git a/src/components/pages/self/self.tsx b/src/components/pages/self/self.tsx index f385953..29359a8 100644 --- a/src/components/pages/self/self.tsx +++ b/src/components/pages/self/self.tsx @@ -1,37 +1,57 @@ -import React, { FC, useEffect } from 'react' -import { RouteComponentProps } from 'react-router-dom' +import React, { FC } from 'react' +import { Link, RouteComponentProps } from 'react-router-dom' import moment from 'moment' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' -import { faDoorOpen } from '@fortawesome/free-solid-svg-icons' +import { faDoorOpen, faCheckCircle, faPlusCircle, faIdCard, faEnvelope } from '@fortawesome/free-solid-svg-icons' -import { useAuthenticationCheck } from 'src/hooks' +import { useAuthenticationCheck, useDeepCompareEffect } from 'src/hooks' import { setTitle } from 'src/utils' -import { User } from 'src/types' +import { User, Tab } from 'src/types' import PageHeader from 'src/components/page-header' +import Loading from 'src/components/pages/loading' +import TextField from 'src/components/forms/text-field' +import TextareaField from 'src/components/forms/textarea-field' -export interface Props extends RouteComponentProps { +interface Params { + tab: string +} + +export interface Props extends RouteComponentProps { checked: boolean authenticated: boolean user?: User + initForm: (user: User) => void logout: () => void } -const Self: FC = ({ checked, authenticated, user, logout, history }) => { +const Self: FC = ({ checked, authenticated, user, initForm, logout, history, match }) => { useAuthenticationCheck(checked, authenticated, history) - useEffect(() => { - if (user) setTitle(`${user.name} (@${user.id})`) + const tab = match.params.tab || '' + const tabs: Tab[] = [ + { + id: '', + label: 'Posts', + }, + { + id: 'settings', + label: 'Settings', + }, + { + id: 'apps', + label: 'Apps', + }, + ] + + useDeepCompareEffect(() => { + if (user) { + setTitle(`${user.name} (@${user.id})`) + initForm(user) + } }, [user]) - if (!user) { - return ( -
- -
-
- ) - } + if (!user) return return (
@@ -47,14 +67,88 @@ const Self: FC = ({ checked, authenticated, user, logout, history }) => {
-

- -

+
+
+
    + {tabs.map(t => ( +
  • + + {t.label} + +
  • + ))} +
+
+ +
+ {tab === '' && +

No Posts.

+ } + + {tab === 'settings' && +
+
+ +
+ + + + +
+
+
+ +
+ +
+ + + + +
+
+
+ + +
+ + +
+ + + +
+ + +
+ } + + {tab === 'apps' && +
+

No Apps.

+ +
+ + +
+ } +
+
) diff --git a/src/types/index.ts b/src/types/index.ts index 96fd027..feee4d1 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -15,6 +15,11 @@ export interface ClassDictionary { [name: string]: boolean } +export interface Tab { + id: string + label: string +} + export * from './entities' export * from './store' diff --git a/src/utils/normalization.ts b/src/utils/normalization.ts index 33be3bb..b745646 100644 --- a/src/utils/normalization.ts +++ b/src/utils/normalization.ts @@ -61,7 +61,7 @@ export function normalize(entities: Entity[], type: EntityType): NormalizeResult return set(type, newStore, { ...invitation, - user: set(EntityType.Group, newStore, invitation.user), + user: set(EntityType.User, newStore, invitation.user), }) }) @@ -72,7 +72,7 @@ export function normalize(entities: Entity[], type: EntityType): NormalizeResult return set(type, newStore, { ...log, - user: set(EntityType.Group, newStore, log.user), + user: set(EntityType.User, newStore, log.user), }) })