diff --git a/config/config.json b/config/config.json index 811af8c..08be48b 100644 --- a/config/config.json +++ b/config/config.json @@ -1,4 +1,9 @@ { "apiUrl": "http://localhost:5000", - "blobUrl": "https://flexordev.blob.core.windows.net/media/" + "blobUrl": "https://flexordev.blob.core.windows.net/media/", + "media": { + "defaultMaxSize": 5242880, + "coverMaxSize": 5242880, + "iconMaxSize": 1048576 + } } diff --git a/src/actions/groups.ts b/src/actions/groups.ts index a22dc23..fa1a7b7 100644 --- a/src/actions/groups.ts +++ b/src/actions/groups.ts @@ -91,7 +91,9 @@ export const fetchGroup = (id: string): AppThunkAction => { path: `/api/group/${id}` }) - dispatch(setEntity(EntityType.Group, group)) + const groups = normalize([group], EntityType.Group) + + dispatch(setEntities(groups.entities)) dispatch(finishRequest(RequestKey.FetchGroup, true)) } catch (err) { dispatch(finishRequest(RequestKey.FetchGroup, false)) diff --git a/src/actions/users.ts b/src/actions/users.ts new file mode 100644 index 0000000..7a6f017 --- /dev/null +++ b/src/actions/users.ts @@ -0,0 +1,25 @@ +import { apiFetch } from 'src/api' +import { setEntities } from 'src/actions/entities' +import { startRequest, finishRequest } from 'src/actions/requests' +import { AppThunkAction, Entity, RequestKey, EntityType } from 'src/types' +import { normalize } from 'src/utils/normalization' + +export const fetchUser = (id: string): AppThunkAction => { + return async dispatch => { + dispatch(startRequest(RequestKey.FetchUser)) + + try { + const user = await apiFetch({ + path: `/api/user/${id}` + }) + + const users = normalize([user], EntityType.User) + + dispatch(setEntities(users.entities)) + dispatch(finishRequest(RequestKey.FetchUser, true)) + } catch (err) { + dispatch(finishRequest(RequestKey.FetchUser, false)) + throw err + } + } +} diff --git a/src/components/app-info.tsx b/src/components/app-info.tsx new file mode 100644 index 0000000..32bc45a --- /dev/null +++ b/src/components/app-info.tsx @@ -0,0 +1,44 @@ +import React, { FC } from 'react' +import moment from 'moment' + +import { App } from 'src/types' + +interface Props { + app: App +} + +const AppInfo: FC = ({ app }) => ( + +) + +export default AppInfo diff --git a/src/components/app.tsx b/src/components/app.tsx index b279a2d..37cbfa1 100644 --- a/src/components/app.tsx +++ b/src/components/app.tsx @@ -16,14 +16,13 @@ import Footer from './footer' import NavigationMenu from './navigation-menu' import NotificationContainer from './notification-container' import Spinner from './spinner' -import UserInfo from './user-info' +import SelfInfo from './self-info' import About from './pages/about' import Apps from './pages/apps' import CreateApp from './pages/create-app' import Developers from './pages/developers' import EditApp from './pages/edit-app' -import Group from './pages/group' import GroupAdmin from './pages/group-admin' import Groups from './pages/groups' import Home from './pages/home' @@ -32,6 +31,8 @@ import Register from './pages/register' import RegisterGroup from './pages/register-group' import Self from './pages/self' import ViewApp from './pages/view-app' +import ViewGroup from './pages/view-group' +import ViewUser from './pages/view-user' import '../styles/app.scss' import '../styles/spinner.scss' @@ -76,7 +77,7 @@ const App: FC = () => { {fetching && } - +