Skip to content

Commit

Permalink
feat: WeeklyPage: 浏览模式/编辑模式仅管理员可见。不缩放模式下对齐推送封面 (#2052)
Browse files Browse the repository at this point in the history
* "CleanUp: CoursePage"

* CleanUp: ShareSite

* Weekly界面浏览模式/编辑模式仅管理员可见

* feat: hide Browse/Edit mode bar

* feat: Roughly align with the cover of Weekly page.

---------

Co-authored-by: Yichen You <[email protected]>
  • Loading branch information
JaderOx and youyc22 authored Oct 21, 2024
1 parent b3cbbda commit e1a1512
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/app/ShareSite/WeeklyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
Typography,
message,
Tooltip,
Image,
} from "antd";
import React, { useEffect, useState } from "react";
import * as graphql from "@/generated/graphql";
Expand Down Expand Up @@ -104,10 +105,16 @@ const WeeklyPage: React.FC<PageProps> = ({ mode, user }) => {
const [url, setUrl] = useState("/android-chrome-192x192.png");
fetch_img(props.src, setUrl);
return (
<img
<Image
alt="weekly cover"
src={url}
referrerPolicy="no-referrer"
preview={false}
style={{
objectFit: "cover",
minHeight: 256,
borderRadius: "10px",
}}
onClick={() => {
const w = window.open("loading");
if (w != null) w.location.href = props.src;
Expand Down Expand Up @@ -327,25 +334,22 @@ const WeeklyPage: React.FC<PageProps> = ({ mode, user }) => {
/>
</Row>
</Content>

<Footer>
<table style={{ margin: "0 auto" }}>
<tbody>
<tr>
<td title="仅系统管理员在登录后可进入编辑模式">
<Radio.Group
defaultValue={"browse"}
value={showMode}
onChange={(e) => setShowMode(e.target.value)}
>
<Radio.Button value="browse">浏览模式</Radio.Button>
<Radio.Button
value="edit"
disabled={user.role !== "counselor" && user.role !== "root"}
>
编辑模式
</Radio.Button>
</Radio.Group>
<td>
{user.role == "root" ||
(user.role == "counselor" && (
<Radio.Group
defaultValue={"browse"}
value={showMode}
onChange={(e) => setShowMode(e.target.value)}
>
<Radio.Button value="browse">浏览模式</Radio.Button>
<Radio.Button value="edit">编辑模式</Radio.Button>
</Radio.Group>
))}
</td>
<td>
<Pagination
Expand Down

0 comments on commit e1a1512

Please sign in to comment.