Skip to content

Commit c765ae8

Browse files
committed
add admin special
1 parent 815eab7 commit c765ae8

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/API/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface PatchInfo {
2121
message: string;
2222
}
2323

24-
export type UserGroup = "admin" | "user";
24+
export type UserGroup = "admin" | "user" | "publisher";
2525

2626
export interface UserInfo {
2727
username: string;

src/component/CommentCard/index.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ export function CommentCard(props: CommentCardPropTypes) {
119119
} = props;
120120

121121
const { group: userGroup } = useAppSelector((state) => state.user);
122-
123122
const [showMore, setShowMore] = React.useState<boolean>(false);
124123
const [dialogOpen, setDialogOpen] = React.useState<boolean>(false);
125124
const [childLoading, setChildLoading] = React.useState<boolean>(false);
@@ -183,12 +182,28 @@ export function CommentCard(props: CommentCardPropTypes) {
183182

184183
return (
185184
<>
186-
<div className={classes.commentItem} id={commentId}>
185+
<div
186+
className={classes.commentItem}
187+
id={commentId}
188+
style={{ backgroundColor: `${group.includes("admin") ? "#f0f9ff" : ""}` }}
189+
>
187190
<Avatar className="avatar" group={group} username={username} hasAvatar={hasAvatar} hash={hash} />
188191

189192
<div className="name">
190193
<Typography component="span" variant="h6" color="textPrimary">
191194
{username}
195+
{group.includes("admin") && (
196+
<Chip
197+
label="官方推荐"
198+
size="small"
199+
style={{
200+
backgroundColor: "#e6f4ea",
201+
color: "#1e7e34",
202+
fontWeight: 500,
203+
marginLeft: 8,
204+
}}
205+
/>
206+
)}
192207
{invalid === true && (
193208
<Chip
194209
label="该资源可能已经失效,查看解决方法"

src/component/CommentList/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function CommentList(props: CommentListPropTypes) {
125125

126126
{commentList.map((comment, index) => {
127127
if (hideInvalidComments && comment.invalid) {
128-
return <div />;
128+
return null;
129129
}
130130

131131
return (

0 commit comments

Comments
 (0)