Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 779014c

Browse files
committed
feat: amalgamate publications into notices
1 parent ec97dd8 commit 779014c

File tree

7 files changed

+41
-206
lines changed

7 files changed

+41
-206
lines changed

apps/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "1.9.0-beta",
3+
"version": "1.9.1-beta",
44
"scripts": {
55
"dev": "npm-run-all --parallel dev:*",
66
"dev:run": "FORCE_COLOR=1 vite",

apps/client/src/consumers/timetablCms/schemas.ts

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

apps/client/src/consumers/timetablCms/useTimetablNews.ts

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

apps/client/src/routes/Main/Announcements/Announcements.tsx

Lines changed: 39 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Empty from "../../../components/Empty";
22
import { NoticeYear, TimetablNotice } from "../../../consumers/sbhsApi/schemas";
3-
// import { useTimetablNews } from "../../../services/timetablCms/useTimetablNews";
43
import { useDailyNotices } from "../../../consumers/sbhsApi/useDailyNotices";
54
import { Search2Icon } from "@chakra-ui/icons";
65
import {
@@ -10,11 +9,6 @@ import {
109
Flex,
1110
Heading,
1211
Skeleton,
13-
Tab,
14-
TabList,
15-
TabPanel,
16-
TabPanels,
17-
Tabs,
1812
useDisclosure,
1913
Text,
2014
Input,
@@ -25,12 +19,15 @@ import {
2519
FormLabel,
2620
Highlight,
2721
FormControl,
22+
Alert,
23+
AlertDescription,
24+
AlertTitle,
25+
Box,
2826
} from "@chakra-ui/react";
2927
import { Prose } from "@nikolovlazar/chakra-ui-prose";
3028
import DOMPurify from "dompurify";
3129
import linkifyHtml from "linkify-html";
3230
import { DateTime } from "luxon";
33-
import { micromark } from "micromark";
3431
import { MegaphoneSimple } from "phosphor-react";
3532
import { useState } from "react";
3633
import { create } from "zustand";
@@ -74,14 +71,12 @@ function Announcement({
7471
authorName,
7572
date,
7673
query,
77-
markdown,
7874
}: {
7975
title: string;
8076
content: string;
8177
authorName?: string;
8278
date?: string;
8379
query: string;
84-
markdown?: boolean;
8580
}) {
8681
const { isOpen, onToggle } = useDisclosure();
8782
const [showShowMoreBtn, setShowShowMoreBtn] = useState(true);
@@ -100,15 +95,12 @@ function Announcement({
10095
<Prose>
10196
<div
10297
ref={(content) =>
103-
setShowShowMoreBtn((content?.offsetHeight ?? 0 / 24) > 1)
98+
setShowShowMoreBtn((content?.offsetHeight ?? 0) / 24 > 1)
10499
}
105100
dangerouslySetInnerHTML={{
106-
__html: linkifyHtml(
107-
DOMPurify.sanitize(markdown ? micromark(content) : content),
108-
{
109-
defaultProtocol: "https",
110-
}
111-
),
101+
__html: linkifyHtml(DOMPurify.sanitize(content), {
102+
defaultProtocol: "https",
103+
}),
112104
}}
113105
/>
114106
</Prose>
@@ -138,44 +130,22 @@ function Announcement({
138130
function DailyNotices({
139131
filter,
140132
query,
141-
tab,
142133
dailyNoticesLoading,
143-
timetablNewsLoading,
144134
dailyNotices,
145-
timetablNews,
146135
}: {
147136
filter: NoticeYear;
148137
query: string;
149-
tab: number;
150-
timetablNewsLoading: boolean;
151138
dailyNoticesLoading: boolean;
152139
dailyNotices?: TimetablNotice[];
153-
timetablNews?: TimetablNotice[];
154140
}) {
155-
const notices = filterNotices(
156-
tab ? timetablNews : dailyNotices,
157-
filter,
158-
query
159-
);
141+
const notices = filterNotices(dailyNotices, filter, query);
160142

161143
return (
162-
<Skeleton
163-
isLoaded={tab ? !timetablNewsLoading : !dailyNoticesLoading}
164-
rounded={5}
165-
minH={10}
166-
minW={40}
167-
>
144+
<Skeleton isLoaded={!dailyNoticesLoading} rounded={5} minH={10} minW={40}>
168145
<Flex direction={"column"} align="center" gap={8}>
169146
{notices?.length ? (
170147
notices?.map((notice, index) => {
171-
return (
172-
<Announcement
173-
key={index}
174-
query={query}
175-
markdown={!!tab}
176-
{...notice}
177-
/>
178-
);
148+
return <Announcement key={index} query={query} {...notice} />;
179149
})
180150
) : (
181151
<Empty
@@ -194,30 +164,39 @@ function DailyNotices({
194164
export default function Announcements() {
195165
const { year, setYear } = useAnnouncementStore();
196166

197-
const timetablNews = undefined;
198-
const timetablNewsLoaded = false;
199-
200167
const { data: dailyNotices, isLoading: dailyNoticesLoading } =
201168
useDailyNotices();
202169

203-
const [tabIndex, setTabIndex] = useState(0);
204-
const handleTabsChange = (index: number) => {
205-
setTabIndex(index);
206-
};
207-
208170
const [query, setQuery] = useState("");
171+
const [isDownloading, setIsDownloading] = useState(false);
209172

210173
return (
211-
<Flex w="full" direction={"column"}>
212-
<Flex align="left" w="full" zIndex={1} p={"5px"}>
174+
<Flex w="full" direction={"column"} px={"30px"} gap={"20px"}>
175+
<Alert status="info" rounded={"md"}>
176+
<Box>
177+
<AlertTitle mb={2} fontFamily={"Poppins, sans-serif"}>
178+
Read the latest edition of the High Notes
179+
</AlertTitle>
180+
<AlertDescription>
181+
<Button
182+
as="a"
183+
href="https://sbhs.co/hnpdf"
184+
onClick={() => setIsDownloading(true)}
185+
isLoading={isDownloading}
186+
loadingText="Downloading PDF..."
187+
>
188+
Download High Notes PDF
189+
</Button>
190+
</AlertDescription>
191+
</Box>
192+
</Alert>
193+
<Flex align="" w="full" zIndex={1}>
213194
<InputGroup maxW="fit-content">
214195
<InputLeftElement pointerEvents="none">
215196
<Search2Icon color="gray.300" />
216197
</InputLeftElement>
217198
<Input
218-
placeholder={`Search ${
219-
tabIndex ? "Timetabl News" : "Daily Notices"
220-
}`}
199+
placeholder={"Search Daily Notices"}
221200
value={query}
222201
variant="filled"
223202
onChange={(event) => setQuery(event.target.value)}
@@ -247,32 +226,12 @@ export default function Announcements() {
247226
</Select>
248227
</FormControl>
249228
</Flex>
250-
<Tabs
251-
variant="solid-rounded"
252-
mt={"10px"}
253-
index={tabIndex}
254-
onChange={handleTabsChange}
255-
>
256-
<TabList>
257-
<Tab>Daily Notices</Tab>
258-
<Tab>Timetabl News</Tab>
259-
</TabList>
260-
<TabPanels>
261-
{[0, 1].map((tab) => (
262-
<TabPanel key={tab}>
263-
<DailyNotices
264-
filter={year}
265-
query={query}
266-
tab={tab}
267-
timetablNews={timetablNews}
268-
dailyNotices={dailyNotices}
269-
timetablNewsLoading={timetablNewsLoaded}
270-
dailyNoticesLoading={dailyNoticesLoading}
271-
/>
272-
</TabPanel>
273-
))}
274-
</TabPanels>
275-
</Tabs>
229+
<DailyNotices
230+
filter={year}
231+
query={query}
232+
dailyNotices={dailyNotices}
233+
dailyNoticesLoading={dailyNoticesLoading}
234+
/>
276235
</Flex>
277236
);
278237
}

apps/client/src/routes/Main/Publications/Publications.tsx

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

apps/client/src/routes/Main/Publications/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/client/src/services/AppRouter/pages.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import SpinnerSuspense from "../../components/SpinnerSuspense";
22
import {
33
Barcode,
4-
BookBookmark,
54
ChatsTeardrop,
65
House,
76
IconWeight,
@@ -88,17 +87,7 @@ export const pages: { pinned: TimetablPage[]; unpinned: TimetablPage[] } = {
8887
mirrored: false,
8988
element: <ComingSoon />,
9089
},
91-
{
92-
path: "publications",
93-
name: "Publications",
94-
icon: BookBookmark,
95-
mirrored: false,
96-
element: (
97-
<Page
98-
component={React.lazy(() => import("../../routes/Main/Publications"))}
99-
/>
100-
),
101-
},
90+
10291
{
10392
path: "feedback",
10493
name: "Feedback",

0 commit comments

Comments
 (0)