Skip to content

Commit

Permalink
Make source list page public
Browse files Browse the repository at this point in the history
Include source list in claim page
  • Loading branch information
pepermao committed Jun 7, 2024
1 parent 204274a commit a09f950
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 16 deletions.
4 changes: 2 additions & 2 deletions public/locales/en/seo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"sourcesDescription": "Claim sources {{claimId}}",
"claimReviewDescription": "See sentence reviews {{sentence}} on AletheiaFact.org",
"siteName": "AletheiaFact.org",
"noPersonalityClaimListTitle": "Claims",
"noPersonalityClaimListDescription": "See claims without a related personality",
"claimListTitle": "Claims",
"claimListDescription": "See claims on AletheiaFact.org",
"createSourceTitle": "Create source",
"createSourceDescription": "Create sources to AletheiaFact.org"
}
1 change: 1 addition & 0 deletions public/locales/en/sources.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sourceListHeader": "Sources",
"sourceReview": "Source reviewed as ",
"sourceCardButton": "Access the source",
"sourceCreateCTAButton": "Create source",
Expand Down
4 changes: 2 additions & 2 deletions public/locales/pt/seo.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"sourcesDescription": "Fontes do discurso {{claimId}}",
"claimReviewDescription": "Veja as revisões da sentença {{sentence}} na AletheiaFact.org",
"siteName": "AletheiaFact.org",
"noPersonalityClaimListTitle": "Declarações",
"noPersonalityClaimListDescription": "Veja declarações sem personalidade associada",
"claimListTitle": "Declarações",
"claimListDescription": "Veja declarações na AletheiaFact.org",
"createSourceTitle": "Adicione uma fonte",
"createSourceDescription": "Adiciona uma fonte na AletheiaFact.org"
}
1 change: 1 addition & 0 deletions public/locales/pt/sources.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sourceListHeader": "Fontes",
"sourceReview": "Fonte avaliada como ",
"sourceCardButton": "Acesse a fonte",
"sourceCreateCTAButton": "Incluir fonte",
Expand Down
2 changes: 1 addition & 1 deletion server/claim/claim.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ export class ClaimController {
await this.viewService.getNextServer().render(
req,
res,
"/image-claims-page",
"/claim-list-page",
Object.assign(parsedUrl.query, {
nameSpace: req.params.namespace,
})
Expand Down
1 change: 1 addition & 0 deletions server/source/source.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class SourceController {
});
}

@IsPublic()
@ApiTags("pages")
@Get("sources")
public async sourcesPage(@Req() req: BaseRequest, @Res() res: Response) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ import { useTranslation } from "next-i18next";
import React from "react";
import Seo from "../Seo";
import ClaimList from "./ClaimList";
import SourceList from "../Source/SourceList";

const ImageClaimListView = () => {
const ClaimListView = () => {
const { t } = useTranslation();

return (
<>
<Seo
title={t("seo:noPersonalityClaimListTitle")}
description={t("seo:noPersonalityClaimListDescription")}
title={t("seo:claimListTitle")}
description={t("seo:claimListDescription")}
/>
<Row justify="center" style={{ marginTop: "64px" }}>
<Col sm={22} md={14} lg={12}>
<ClaimList personality={{ _id: null }} />
</Col>
<Col offset={1} sm={22} md={14} lg={8}>
<SourceList />
</Col>
</Row>
</>
);
};

export default ImageClaimListView;
export default ClaimListView;
12 changes: 10 additions & 2 deletions src/components/Source/SourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useTranslation } from "next-i18next";
import { useAtom } from "jotai";
import { currentNameSpace } from "../../atoms/namespace";

const SourceList = () => {
const SourceList = ({ footer = false }) => {
const { t } = useTranslation();
const [nameSpace] = useAtom(currentNameSpace);

Expand Down Expand Up @@ -43,12 +43,20 @@ const SourceList = () => {
<BaseList
apiCall={SourceApi.get}
filter={{ nameSpace }}
title={t("sources:sourceListHeader")}
renderItem={(source, index) =>
source && <SourceListItem key={index} source={source} />
}
grid={{
gutter: 20,
md: 2,
lg: 1,
xl: 1,
xxl: 2,
}}
skeleton={<SourceSkeleton />}
emptyFallback={SourceCreateCTAButton}
footer={SourceCreateCTAButton}
footer={footer && SourceCreateCTAButton}
/>
);
};
Expand Down
16 changes: 13 additions & 3 deletions src/components/Source/SourceListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useMemo } from "react";
import { Col } from "antd";
import { Col, Typography } from "antd";
import CardBase from "../CardBase";
import ClassificationText from "../ClassificationText";
import AletheiaButton from "../Button";
import { useTranslation } from "next-i18next";
import SourceListItemStyled from "./SourceListItem.style";

const { Paragraph } = Typography;
const DOMAIN_PROTOCOL_REGEX = /^(https?:\/\/)?(www\.)?/;

const SourceListItem = ({ source }) => {
Expand All @@ -28,7 +28,17 @@ const SourceListItem = ({ source }) => {
>
<h4 className="title">{title}</h4>

<span className="summary">{source.props.summary}</span>
<Paragraph
style={{ marginBottom: 0 }}
ellipsis={{
rows: 4,
expandable: false,
}}
>
<cite style={{ fontStyle: "normal" }}>
<p className="summary">{source.props.summary}</p>
</cite>
</Paragraph>

<Col className="footer">
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import React from "react";
import { GetLocale } from "../utils/GetLocale";

import ImageClaimListView from "../components/Claim/ImageClaimListView";
import ClaimListView from "../components/Claim/ClaimListView";
import { NameSpaceEnum } from "../types/Namespace";
import { useSetAtom } from "jotai";
import { currentNameSpace } from "../atoms/namespace";

const ImageClaimsPage: NextPage<any> = (props) => {
const setCurrentNameSpace = useSetAtom(currentNameSpace);
setCurrentNameSpace(props.nameSpace);
return <ImageClaimListView />;
return <ClaimListView />;
};

export async function getServerSideProps({ query, locale, locales, req }) {
Expand Down

0 comments on commit a09f950

Please sign in to comment.