Skip to content

Let's use AI to Earn!

feat: 添加所有平台

gaoSira42a8e50dbb0
diff --git a/src/app/[lng]/accounts/accountCore.tsx b/src/app/[lng]/accounts/accountCore.tsx
index 0f7255c0..913b43f4 100644
--- a/src/app/[lng]/accounts/accountCore.tsx
+++ b/src/app/[lng]/accounts/accountCore.tsx
@@ -10,6 +10,8 @@ import CalendarTiming from "@/app/[lng]/accounts/components/CalendarTiming";
import AddAccountModal from "@/app/[lng]/accounts/components/AddAccountModal";
import { PlatType } from "@/app/config/platConfig";
import { SocialAccount } from "@/api/types/account.type";
+import AllPlatIcon from "@/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon";
+import { useTransClient } from "@/app/i18n/client";
interface AccountPageCoreProps {
searchParams?: {
@@ -35,6 +37,7 @@ export default function AccountPageCore({
const [addAccountModalOpen, setAddAccountModalOpen] = useState(false);
const [targetPlatform, setTargetPlatform] = useState<PlatType | undefined>();
const [targetSpaceId, setTargetSpaceId] = useState<string | undefined>();
+ const { t } = useTransClient("account");
useEffect(() => {
accountInit();
@@ -82,12 +85,33 @@ export default function AccountPageCore({
<AccountSidebar
activeAccountId={accountActive?.id || ""}
onAccountChange={(account) => {
- if (account.id === accountActive?.id) {
- setAccountActive(undefined);
- } else {
- setAccountActive(account);
- }
+ setAccountActive(account);
}}
+ sidebarTopExtra={
+ <>
+ <div
+ className={[
+ "accountList-item",
+ `${!accountActive?.id ? "accountList-item--active" : ""}`,
+ ].join(" ")}
+ style={{
+ border: "1px solid #d9d9d9",
+ borderRight: "none",
+ borderLeft: "none",
+ }}
+ onClick={async () => {
+ setAccountActive(undefined);
+ }}
+ >
+ <AllPlatIcon size={38} />
+ <div className="accountList-item-right">
+ <div className="accountList-item-right-name">
+ {t("allPlatforms")}
+ </div>
+ </div>
+ </div>
+ </>
+ }
/>
<CalendarTiming />
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
index 0f459eb9..2d5c6e53 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.module.scss
@@ -17,6 +17,7 @@
display: flex;
flex-direction: column;
min-height: 0;
+ overflow-y: auto;
}
.ant-collapse {
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
index 43c229a1..be1a6289 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
@@ -55,6 +55,8 @@ export interface IAccountSidebarProps {
onAccountChange: (info: SocialAccount) => void;
// 排除的平台类型
excludePlatforms?: PlatType[];
+ // 侧边栏内容顶部扩展内容
+ sidebarTopExtra?: React.ReactNode;
}
const AccountStatusView = ({ account }: { account: SocialAccount }) => {
@@ -142,6 +144,7 @@ const AccountSidebar = memo(
activeAccountId,
onAccountChange,
excludePlatforms = [],
+ sidebarTopExtra,
}: IAccountSidebarProps,
ref: ForwardedRef<IAccountSidebarRef>,
) => {
@@ -412,6 +415,7 @@ const AccountSidebar = memo(
</>
) : (
<div className="accountSidebar-content">
+ {sidebarTopExtra}
<Collapse
key={defaultActiveKey}
defaultActiveKey={defaultActiveKey}
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx b/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
index f7bf1feb..abe7f316 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
+++ b/src/app/[lng]/accounts/components/CalendarTiming/AllPlatIcon.tsx
@@ -4,15 +4,19 @@ import styles from "./calendarTiming.module.scss";
export interface IAllPlatIconRef {}
export interface IAllPlatIconProps {
- width?: number;
+ size?: number;
+ style?: React.CSSProperties;
}
const AllPlatIcon = memo(
forwardRef(
- ({ width = 50 }: IAllPlatIconProps, ref: ForwardedRef<IAllPlatIconRef>) => {
+ (
+ { size = 50, style = {} }: IAllPlatIconProps,
+ ref: ForwardedRef<IAllPlatIconRef>,
+ ) => {
const widthChild = useMemo(() => {
- return width / 5;
- }, [width]);
+ return size / 5;
+ }, [size]);
const childStyle = useMemo(() => {
return {
@@ -24,7 +28,7 @@ const AllPlatIcon = memo(
return (
<div
className={styles.allPlatIcon}
- style={{ width: width + "px", height: width + "px" }}
+ style={{ width: size + "px", height: size + "px", ...style }}
>
<ul>
<li style={childStyle}></li>
diff --git a/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
index d86d75a3..3ed66fe4 100644
--- a/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
+++ b/src/app/[lng]/accounts/components/CalendarTiming/calendarTiming.module.scss
@@ -165,6 +165,7 @@
}
.allPlatIcon {
+ flex-shrink: 0;
width: 50px;
height: 50px;
border: 1px solid var(--grayColor8);