Skip to content

Let's use AI to Earn!

fix: platInfo添加一些非空判断

gaoSir4af579da2624
diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml
index 4c92b555..71f9e938 100644
--- a/.idea/material_theme_project_new.xml
+++ b/.idea/material_theme_project_new.xml
@@ -3,7 +3,9 @@
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
- <option name="userId" value="26a2c763:197e97fae2b:-7125" />
+ <option name="migrated" value="true" />
+ <option name="pristineConfig" value="false" />
+ <option name="userId" value="3bd64bd8:1912071e97e:-7ffe" />
</MTProjectMetadataState>
</option>
</component>
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 9d1d08ad..48061bc9 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,13 +4,12 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 调整 index.tsx 中的日期格式化逻辑">
+ <change beforePath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/material_theme_project_new.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/AvatarPlat/avatarPlat.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/AvatarPlat/avatarPlat.module.scss" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/store/account.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/store/account.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/AvatarPlat/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/AvatarPlat/index.tsx" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -21,9 +20,9 @@
<option name="PUSH_AUTO_UPDATE" value="true" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
- <component name="ProjectColorInfo"><![CDATA[{
- "associatedIndex": 4
-}]]></component>
+ <component name="ProjectColorInfo">{
+ &quot;associatedIndex&quot;: 4
+}</component>
<component name="ProjectId" id="2zamg25p8l4plGQi1IzdkD1GGzA" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
@@ -31,6 +30,22 @@
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder0": "0",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder1": "1",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder2": "2",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatOrder3": "3",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth0": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth1": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth2": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_flatWidth3": "449",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder0": "0",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder1": "1",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder2": "2",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeOrder3": "3",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth0": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth1": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth2": "450",
+ "FileHistory.git4idea.history.GitHistoryProvider_treeWidth3": "449",
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "master",
"ignore.virus.scanning.warn.message": "true",
@@ -61,7 +76,8 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1751977665735</updated>
- <workItem from="1751977666787" duration="3029000" />
+ <workItem from="1751977666787" duration="3372000" />
+ <workItem from="1751981060502" duration="1904000" />
</task>
<task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
<option name="closed" value="true" />
@@ -71,7 +87,15 @@
<option name="project" value="LOCAL" />
<updated>1751978595304</updated>
</task>
- <option name="localTasksCounter" value="2" />
+ <task id="LOCAL-00002" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 调整 index.tsx 中的日期格式化逻辑">
+ <option name="closed" value="true" />
+ <created>1751980771015</created>
+ <option name="number" value="00002" />
+ <option name="presentableId" value="LOCAL-00002" />
+ <option name="project" value="LOCAL" />
+ <updated>1751980771015</updated>
+ </task>
+ <option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -81,6 +105,7 @@
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<option name="CHECK_NEW_TODO" value="false" />
<MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑" />
- <option name="LAST_COMMIT_MESSAGE" value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑" />
+ <MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 调整 index.tsx 中的日期格式化逻辑" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 调整 index.tsx 中的日期格式化逻辑" />
</component>
</project>
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
index 49bdcbce..6fecb3fb 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/AccountSidebar.tsx
@@ -76,7 +76,7 @@ const AccountPopoverInfo = ({
<div className="accountPopoverInfo-item">
<p>平台:</p>
<p>
- <img src={platInfo.icon} />
+ <img src={platInfo?.icon} />
{platInfo.name}
</p>
</div>
@@ -272,8 +272,8 @@ const AccountSidebar = memo(
</div>
<div className="accountList-item-right-footer">
<p className="accountList-item-right-plat">
- <img src={platInfo.icon} />
- <span>{platInfo.name}</span>
+ <img src={platInfo?.icon} />
+ <span>{platInfo?.name}</span>
</p>
<Popover
content={
diff --git a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
index 59e32b8e..709538fd 100644
--- a/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
+++ b/src/app/[lng]/accounts/components/AccountSidebar/UserManageModal.tsx
@@ -125,8 +125,8 @@ const UserManageModal = memo(
const platInfo = AccountPlatInfoMap.get(am.type)!;
return (
<div className="userManage-content-plat">
- <Tooltip title={platInfo.name}>
- <img src={platInfo.icon} />
+ <Tooltip title={platInfo?.name}>
+ <img src={platInfo?.icon} />
</Tooltip>
</div>
);
diff --git a/src/components/AvatarPlat/index.tsx b/src/components/AvatarPlat/index.tsx
index 22227791..2292434a 100644
--- a/src/components/AvatarPlat/index.tsx
+++ b/src/components/AvatarPlat/index.tsx
@@ -34,7 +34,7 @@ const AvatarPlat = memo(
<div className={`${styles.avatarPlat} ${className}`}>
<Avatar src={getAvatar(account.avatar)} size={size} />
<img
- src={plat.icon}
+ src={plat?.icon}
style={{
width: size === "large" ? 16 : size === "default" ? 12.5 : 10,
}}