diff --git a/apps/forum/src/components/App.tsx b/apps/forum/src/components/App.tsx
index 36718aad2..7e41f4a0c 100644
--- a/apps/forum/src/components/App.tsx
+++ b/apps/forum/src/components/App.tsx
@@ -10,8 +10,8 @@ import FilterMenu from "./FilterMenu";
import SearchTags from "./SearchTags";
import FeedBackBox from "./FeedBackBox";
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
-
-import RefreshIcon from "@mui/icons-material/Refresh";
+import { API } from "@aws-amplify/api";
+import { getUserAttr, getIdToken } from "wasedatime-ui";
const App = () => {
return (
@@ -31,6 +31,7 @@ const InnerApp = () => {
const { theme, setTheme } = React.useContext(ThemeContext);
const [refresh, setRefresh] = useState(false);
const [board, setBoard] = useState("");
+ const [commentNotify, setCommentNotify] = useState(false);
const navigate = useNavigate();
const handleReset = () => {
@@ -38,6 +39,28 @@ const InnerApp = () => {
setRefresh(!refresh);
};
+ const fetchNotification = async () => {
+ let idToken = "";
+ if (idToken?.length <= 0) {
+ idToken = await getIdToken();
+ if (idToken?.length <= 0) return;
+ }
+ const res = await API.get("wasedatime-dev", `/forum/user`, {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: idToken,
+ },
+ response: true,
+ });
+
+ const commentFlag = res.data.data.new_comment_flag;
+ setCommentNotify(commentFlag);
+ };
+
+ useEffect(() => {
+ fetchNotification();
+ }, []);
+
return (
<>
@@ -52,6 +75,8 @@ const InnerApp = () => {
setTheme={setTheme}
changeLang={(lng: string | undefined) => i18n.changeLanguage(lng)}
boardSlug={board}
+ disabled={true}
+ commentNotify={commentNotify}
/>
diff --git a/apps/forum/src/components/Board.tsx b/apps/forum/src/components/Board.tsx
index b5eb03dc8..77e7bf68b 100644
--- a/apps/forum/src/components/Board.tsx
+++ b/apps/forum/src/components/Board.tsx
@@ -7,7 +7,7 @@ import boards from "@app/constants/boards.json";
import { currentSchoolState, currentTagsState } from "@app/recoil/atoms";
import { API } from "@aws-amplify/api";
import Thread from "@app/types/thread";
-import { getUserAttr } from "wasedatime-ui";
+import { getUserAttr, getIdToken } from "wasedatime-ui";
import ThreadType from "@app/types/thread";
import InfiniteScroll from "react-infinite-scroll-component";
@@ -78,7 +78,6 @@ const Board = ({ triggerRefresh, setBoard }: any) => {
setUserToken(userId);
}
}
-
const apiPath = boardId
? // if board id exists, the db query has better efficiency
`/forum?uid=${userId}&index=${index}&num=${threadCount}&school=${school}&tags=${tags}&board_id=${boardId}`
diff --git a/apps/forum/src/components/Comment.tsx b/apps/forum/src/components/Comment.tsx
index 7c81c3ed2..af9e1e7ae 100644
--- a/apps/forum/src/components/Comment.tsx
+++ b/apps/forum/src/components/Comment.tsx
@@ -84,7 +84,6 @@ const Comment = ({ comment, thread, setComments, setThread }: Props) => {
};
const deleteComment = async () => {
- console.log("Triggered!");
try {
const idToken = await getIdToken();
if (!idToken || idToken.length === 0) {
diff --git a/apps/forum/src/components/CommentForm.tsx b/apps/forum/src/components/CommentForm.tsx
index 66a59a4da..1871b6011 100644
--- a/apps/forum/src/components/CommentForm.tsx
+++ b/apps/forum/src/components/CommentForm.tsx
@@ -24,10 +24,6 @@ const CommentForm: React.FC
= ({
const { boardSlug, threadUuid } = useParams();
const { t } = useTranslation();
- useEffect(() => {
- console.log(thread);
- }, [thread]);
-
const handleFocusForm = async () => {
if (userToken?.length <= 0) {
const idToken = await getIdToken();
diff --git a/apps/forum/src/components/CreateThread.tsx b/apps/forum/src/components/CreateThread.tsx
index 837d48d44..a2a9c980c 100644
--- a/apps/forum/src/components/CreateThread.tsx
+++ b/apps/forum/src/components/CreateThread.tsx
@@ -226,7 +226,7 @@ const CreateThread = ({ onNewThread }: CreateThreadProps) => {
return isExpanded ? (