-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add data to requests page (#1786)
- Loading branch information
Showing
9 changed files
with
194 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
import React from 'react'; | ||
import Banner from '../../components/banner'; | ||
import localization from '../../lib/localization'; | ||
|
||
const RequestsPage = () => ( | ||
<main id='content' className='container'> | ||
<Banner title={localization.page.requests} /> | ||
</main> | ||
); | ||
export default RequestsPage; | ||
import React, { FC, useEffect } from 'react'; | ||
import withCommunity, { | ||
Props as CommunityProps | ||
} from '../../components/with-community'; | ||
import { compose } from 'redux'; | ||
import withErrorBoundary from '../../components/with-error-boundary'; | ||
import ErrorPage from '../error-page'; | ||
import SC from './styled'; | ||
import { formatDate } from '../../lib/date-utils'; | ||
|
||
interface Props extends CommunityProps {} | ||
|
||
const RequestsPage: FC<Props> = ({ | ||
requests, | ||
communityActions: { getCommunityRequests } | ||
}) => { | ||
useEffect(() => { | ||
getCommunityRequests(); | ||
}, []); | ||
|
||
return ( | ||
<main id='content' className='container'> | ||
<SC.RequestsTitleRow> | ||
<SC.RequestTitle>Etterspørsler fra Datalandsbyen</SC.RequestTitle> | ||
<SC.RequestInfo>Dato</SC.RequestInfo> | ||
<SC.RequestInfo>Antall stemmer</SC.RequestInfo> | ||
<SC.RequestInfo>Antall visninger</SC.RequestInfo> | ||
</SC.RequestsTitleRow> | ||
{requests?.topics && | ||
requests.topics.map(topic => ( | ||
<SC.RequestRow key={topic.cid}> | ||
<SC.RequestTitle>{topic.title}</SC.RequestTitle> | ||
<SC.RequestInfo> | ||
{formatDate(new Date(topic.timestampISO))} | ||
</SC.RequestInfo> | ||
<SC.RequestInfo>{topic.upvotes}</SC.RequestInfo> | ||
<SC.RequestInfo>{topic.viewcount}</SC.RequestInfo> | ||
</SC.RequestRow> | ||
))} | ||
</main> | ||
); | ||
}; | ||
|
||
const enhance = compose(withCommunity, withErrorBoundary(ErrorPage)); | ||
export default enhance(RequestsPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,44 @@ | ||
export default {}; | ||
import styled from 'styled-components'; | ||
|
||
const RequestRow = styled.div` | ||
display: flex; | ||
background-color: white; | ||
width: 100%; | ||
height: 90px; | ||
margin-bottom: 10px; | ||
border-radius: 8px; | ||
border: solid 1px #d5d7d9; | ||
padding-left: 37px; | ||
padding-right: 37px; | ||
align-items: center; | ||
font-size: 18px; | ||
`; | ||
|
||
const RequestsTitleRow = styled.div` | ||
background-color: #d2eafd; | ||
height: 57px; | ||
border-radius: 8px; | ||
display: flex; | ||
align-items: center; | ||
padding-left: 37px; | ||
padding-right: 37px; | ||
font-weight: bold; | ||
`; | ||
|
||
const RequestTitle = styled.div` | ||
width: 50%; | ||
font-weight: bold; | ||
`; | ||
|
||
const RequestInfo = styled.div` | ||
width: 16%; | ||
display: flex; | ||
justify-content: center; | ||
`; | ||
|
||
export default { | ||
RequestRow, | ||
RequestsTitleRow, | ||
RequestTitle, | ||
RequestInfo | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters