From 8f0d11ceffb57547a751047be4f3a8ddb6e63d75 Mon Sep 17 00:00:00 2001 From: Hege Aalvik Date: Fri, 6 Oct 2023 15:56:33 +0200 Subject: [PATCH] feat: make requests clickable --- src/pages/requests/index.tsx | 19 +++++++++++++++---- src/pages/requests/styled.ts | 10 +++++++++- src/types/domain.d.ts | 2 ++ 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/pages/requests/index.tsx b/src/pages/requests/index.tsx index 3663d0689..41e4ce27a 100644 --- a/src/pages/requests/index.tsx +++ b/src/pages/requests/index.tsx @@ -1,12 +1,15 @@ import React, { FC, useEffect } from 'react'; +import { compose } from 'redux'; 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'; +import env from '../../env'; + +const { FDK_COMMUNITY_BASE_URI } = env; interface Props extends CommunityProps {} @@ -18,6 +21,10 @@ const RequestsPage: FC = ({ getCommunityRequests(); }, []); + const notDeletedRequests = requests?.topics?.filter( + topic => topic.deleted === 0 + ); + return (
@@ -26,10 +33,14 @@ const RequestsPage: FC = ({ Antall stemmer Antall visninger - {requests?.topics && - requests.topics.map(topic => ( + {notDeletedRequests && + notDeletedRequests.map(topic => ( - {topic.title} + + {topic.title} + {formatDate(new Date(topic.timestampISO))} diff --git a/src/pages/requests/styled.ts b/src/pages/requests/styled.ts index 625ee773b..45a6c52f9 100755 --- a/src/pages/requests/styled.ts +++ b/src/pages/requests/styled.ts @@ -23,12 +23,19 @@ const RequestsTitleRow = styled.div` padding-left: 37px; padding-right: 37px; font-weight: bold; + margin-bottom: 5px; `; const RequestTitle = styled.div` width: 50%; font-weight: bold; `; +const RequestLink = styled.a` + width: 50%; + font-weight: bold; + text-decoration: underline; + color: #111 !important; +`; const RequestInfo = styled.div` width: 16%; @@ -40,5 +47,6 @@ export default { RequestRow, RequestsTitleRow, RequestTitle, - RequestInfo + RequestInfo, + RequestLink }; diff --git a/src/types/domain.d.ts b/src/types/domain.d.ts index ea0f257b1..9b87387c0 100644 --- a/src/types/domain.d.ts +++ b/src/types/domain.d.ts @@ -1038,6 +1038,8 @@ export interface CommunityRequest { postercount: number; downvotes: number; upvotes: number; + deleted: 1 | 0; + slug: string; } export interface CommunityTeaser {