Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix course: add teacher auth, disable manager delete comment, undispl… #2179

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Development: https://api-dev.eesast.com
# Development with localhost: http://localhost:28888
REACT_APP_API_URL=https://api.eesast.com
REACT_APP_API_DEV_URL=https://api-dev.eesast.com
REACT_APP_API_DEV_URL=http://localhost:28888

# Static resources like pictures in COS
REACT_APP_STATIC_URL=https://static.eesast.com
Expand Down
2 changes: 1 addition & 1 deletion src/app/Components/Authenticate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface AuthenticateProps {

export const userRoles = ["user", "student", "teacher", "counselor"];
export const tsinghuaRoles = ["student", "teacher", "counselor"];
export const courseRoles = ["student", "admin"];
export const courseRoles = ["student", "teacher", "counselor"];

const Authenticate: React.FC<AuthenticateProps> = ({
user,
Expand Down
61 changes: 38 additions & 23 deletions src/app/ShareSite/CoursePage/DiscussDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -826,17 +826,19 @@ const DiscussDrawer: React.FC<CourseProps> = ({
}}
/>
) : (
<IconText
icon={() => (
<Badge
status={item.display ? "success" : "processing"}
text={item.display ? "已精选" : "未精选"}
/>
)}
text=" "
/>
item.user_uuid === user.uuid && (
<IconText
icon={() => (
<Badge
status={item.display ? "success" : "processing"}
text={item.display ? "已精选" : "未精选"}
/>
)}
text=" "
/>
)
)}
{(isManager || item.user_uuid === user.uuid) && (
{item.user_uuid === user.uuid && (
<IconText
icon={DeleteOutlined}
text=""
Expand Down Expand Up @@ -868,7 +870,13 @@ const DiscussDrawer: React.FC<CourseProps> = ({
src={item.avatar_url}
></Avatar>
}
title={<>{item.username ?? "anonymous"}</>}
title={
<>
{item.user_uuid === user.uuid
? "Me"
: (item.username ?? "anonymous")}
</>
}
description={
<div>
<span
Expand Down Expand Up @@ -1058,18 +1066,19 @@ const DiscussDrawer: React.FC<CourseProps> = ({
}}
/>
) : (
<IconText
icon={() => (
<Badge
status={item.display ? "success" : "processing"}
text={item.display ? "已精选" : "未精选"}
/>
)}
text=""
/>
item.user_uuid === user.uuid && (
<IconText
icon={() => (
<Badge
status={item.display ? "success" : "processing"}
text={item.display ? "已精选" : "未精选"}
/>
)}
text=" "
/>
)
)}
{(user.role === "admin" ||
item.user_uuid === user.uuid) && (
{item.user_uuid === user.uuid && (
<IconText
icon={DeleteOutlined}
text=""
Expand Down Expand Up @@ -1102,7 +1111,13 @@ const DiscussDrawer: React.FC<CourseProps> = ({
key={item.avatar_url}
></Avatar>
}
title={item.username ?? "anonymous"}
title={
<>
{item.user_uuid === user.uuid
? "Me"
: (item.username ?? "anonymous")}
</>
}
description={
<div>
<span
Expand Down
18 changes: 12 additions & 6 deletions src/app/ShareSite/CoursePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React, { useState, useEffect } from "react";
import { Layout, message } from "antd";
// import { PlusOutlined } from "@ant-design/icons";
//import { useUrl } from "../../../api/hooks/url";
import { Card, Layout, message } from "antd";
import { WarningOutlined, ClockCircleOutlined } from "@ant-design/icons";
import * as graphql from "@/generated/graphql";
import { ProColumns, ProTable } from "@ant-design/pro-components";
//import { Link } from "react-router-dom";
import { PageProps } from "../..";
import DiscussDrawer from "./DiscussDrawer";
import CourseRating from "./CourseRating";
Expand All @@ -18,7 +16,7 @@ export interface CourseProps extends PageProps {
}

/* ---------------- 主页面 ---------------- */
const CoursesPage: React.FC<PageProps> = ({ mode, user }) => {
const CoursePage: React.FC<PageProps> = ({ mode, user }) => {
/* ---------------- States 和常量 Hooks ---------------- */
//const url = useUrl();

Expand Down Expand Up @@ -219,6 +217,14 @@ const CoursesPage: React.FC<PageProps> = ({ mode, user }) => {
margin: 30px;
`}
>
<Card>
<ClockCircleOutlined /> <strong>公告:</strong>
科协同学寒假放假了,新的讨论留待开学后审查,评分区可正常食用,祝大家新年快乐!
<br />
<WarningOutlined /> <strong>提示:</strong>
讨论区中的内容仅代表同学个人观点,仅供参考
</Card>
<br />
<ProTable<graphql.GetCourseQuery["course"][0]>
columns={columns}
request={dataRequest}
Expand All @@ -241,4 +247,4 @@ const CoursesPage: React.FC<PageProps> = ({ mode, user }) => {
);
};

export default CoursesPage;
export default CoursePage;
Loading