Skip to content

Commit 232f827

Browse files
committed
Complete the addendum implementation
Signed-off-by: Akashdeep Dhar <akashdeep.dhar@gmail.com>
1 parent 2e39df8 commit 232f827

6 files changed

Lines changed: 117 additions & 63 deletions

File tree

frontend/src/features/call.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const callUnit = createApi({
2121
"QRInvite",
2222
"Sanction",
2323
"Campaign",
24-
"About",
2524
],
2625
endpoints: (builder) => ({
2726
retrieveIdentity: builder.query({
@@ -274,13 +273,6 @@ export const callUnit = createApi({
274273
}),
275274
invalidatesTags: (result, error, { user_id }) => [{ type: "Identity", id: user_id }, "IdentitySearch"],
276275
}),
277-
retrieveAbout: builder.query({
278-
query: () => ({
279-
url: "about",
280-
method: "GET",
281-
}),
282-
providesTags: ["About"],
283-
}),
284276
}),
285277
});
286278

@@ -309,6 +301,5 @@ export const {
309301
useUpdationIdentityMutation,
310302
useRetrieveCampaignQuery,
311303
useToggleIdentityOptOutMutation,
312-
useRetrieveAboutQuery,
313304
} = callUnit;
314305
export default callUnit.reducer;

frontend/src/main.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import ModeWrap from "./components/modewrap.jsx";
99
import { data } from "./features/data.js";
1010
import Accolade from "./routes/accolade.jsx";
1111
import AccoList from "./routes/accolist.jsx";
12+
import Addendum from "./routes/addendum.jsx";
1213
import Callback from "./routes/callback.jsx";
1314
import Campaign from "./routes/campaign.jsx";
1415
import Category from "./routes/category.jsx";
@@ -22,7 +23,6 @@ import Rankings from "./routes/rankings.jsx";
2223
import Rarities from "./routes/rarities.jsx";
2324
import Recently from "./routes/recently.jsx";
2425
import UserPast from "./routes/userpast.jsx";
25-
import About from "./routes/about.jsx";
2626

2727
createRoot(document.getElementById("root")).render(
2828
<Provider store={data}>
@@ -32,7 +32,7 @@ createRoot(document.getElementById("root")).render(
3232
<Route element={<Callback />} path="/callback" />
3333
<Route element={<MainArea />} path="/">
3434
<Route element={<Homepage />} index />
35-
<Route element={<About />} path="about" />
35+
<Route element={<Addendum />} path="addendum" />
3636
<Route element="" path="/profiles" />
3737
<Route element="" path="/userdata" />
3838
<Route element="" path="/operator" />

frontend/src/routes/about.jsx

Lines changed: 0 additions & 43 deletions
This file was deleted.

frontend/src/routes/addendum.jsx

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { mdiHome } from "@mdi/js";
2+
import Icon from "@mdi/react";
3+
import { useEffect, useState } from "react";
4+
import { Button, Card } from "react-bootstrap";
5+
import Markdown from "react-markdown";
6+
import { useDispatch, useSelector } from "react-redux";
7+
import { Link } from "react-router";
8+
9+
import { hideLoad, showLoad } from "../features/part.js";
10+
11+
export default function Addendum() {
12+
const dispatch = useDispatch();
13+
const vibe = useSelector((data) => data.area.vibe);
14+
const [content, setContent] = useState(null);
15+
16+
useEffect(() => {
17+
dispatch(showLoad());
18+
fetch("/docs/about.md")
19+
.then((resp) => resp.text())
20+
.then((text) => {
21+
setContent(text);
22+
dispatch(hideLoad());
23+
})
24+
.catch(() => {
25+
setContent("Failed to load about page content.");
26+
dispatch(hideLoad());
27+
});
28+
}, [dispatch]);
29+
30+
return (
31+
<div className="row g-2">
32+
<div className="col-12 col-lg-3">
33+
<Card className="mb-2 vibe-border" style={{ "--vibe": vibe }}>
34+
<Card.Body className="p-2">
35+
<Card.Title className="dataelem text-truncate">Fedora Badges</Card.Title>
36+
<Card.Text className="small">
37+
Fedora Badges is an application built to recognize contributors to the Fedora Project, help budding and
38+
existing Fedora Project members discover different ways to get involved, and encourage the general
39+
improvement to free and open source software.
40+
</Card.Text>
41+
</Card.Body>
42+
</Card>
43+
<div className="d-grid gap-2">
44+
<Button
45+
as={Link}
46+
to="/"
47+
variant="outline-secondary"
48+
className="d-grid d-inline-flex align-items-center ps-1 vibe-border"
49+
size="sm"
50+
style={{ "--vibe": vibe }}
51+
>
52+
<Icon path={mdiHome} size={0.875} className="me-1" />
53+
Return home
54+
</Button>
55+
</div>
56+
</div>
57+
<div className="col-12 col-lg-9">
58+
<Card className="mb-2 vibe-border" style={{ "--vibe": vibe }}>
59+
<Card.Body className="ps-0 pe-0 pt-2 pb-0">
60+
<Card.Title className="mb-0 ps-2 dataelem">About this project</Card.Title>
61+
<hr className="mt-2 mb-0" />
62+
<div className="p-2">
63+
{content ? (
64+
<Markdown
65+
components={{
66+
h1: ({ children }) => <h5 className="dataelem fw-bold">{children}</h5>,
67+
h2: ({ children }) => <h5 className="dataelem fw-bold">{children}</h5>,
68+
p: ({ children }) => (
69+
<p className="small" style={{ textAlign: "justify" }}>
70+
{children}
71+
</p>
72+
),
73+
li: ({ children }) => <li className="small">{children}</li>,
74+
img: ({ src, alt }) => (
75+
<div className="text-center">
76+
<img src={src} alt={alt} className="img-fluid" />
77+
</div>
78+
),
79+
a: ({ href, children }) => (
80+
<a href={href} target="_blank" rel="noopener noreferrer">
81+
{children}
82+
</a>
83+
),
84+
}}
85+
>
86+
{content}
87+
</Markdown>
88+
) : null}
89+
</div>
90+
</Card.Body>
91+
</Card>
92+
</div>
93+
</div>
94+
);
95+
}

frontend/src/routes/homepage.jsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import { mdiCrosshairsGps, mdiHeart, mdiHistory, mdiStarFourPoints, mdiTrophy, mdiViewGridPlus } from "@mdi/js";
1+
import {
2+
mdiCrosshairsGps,
3+
mdiHeart,
4+
mdiHistory,
5+
mdiInformationOutline,
6+
mdiStarFourPoints,
7+
mdiTrophy,
8+
mdiViewGridPlus,
9+
} from "@mdi/js";
210
import Icon from "@mdi/react";
311
import dayjs from "dayjs";
412
import relativeTime from "dayjs/plugin/relativeTime";
@@ -128,6 +136,17 @@ export default function Homepage() {
128136
<Icon path={mdiCrosshairsGps} size={0.875} className="me-1" />
129137
Explore badges
130138
</Button>
139+
<Button
140+
as={Link}
141+
to="/addendum"
142+
variant="outline-secondary"
143+
className="d-grid d-inline-flex align-items-center ps-1 vibe-border"
144+
size="sm"
145+
style={{ "--vibe": vibe }}
146+
>
147+
<Icon path={mdiInformationOutline} size={0.875} className="me-1" />
148+
Service information
149+
</Button>
131150
<Button
132151
as="a"
133152
href="https://chat.fedoraproject.org/#/room/#badges:fedoraproject.org"

tahrir/views/explore.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,3 @@ def json_rarities(rare=None):
230230
for rare in data["rarity"]
231231
}
232232
return jsonify(rslt)
233-
234-
235-
@bp.route("/json/about", methods=["GET"])
236-
def json_about():
237-
"""Endpoint that returns the about page content as HTML."""
238-
from tahrir.utils.docs import load_docs
239-
content = load_docs("about")
240-
return jsonify({"content": str(content)})

0 commit comments

Comments
 (0)