chore: replace all cn comments of fe to en version by volc api (#320)

This commit is contained in:
tecvan
2025-07-31 10:32:15 +08:00
committed by GitHub
parent 716ec0cba8
commit 71f6245a01
2960 changed files with 15545 additions and 15545 deletions

View File

@@ -20,13 +20,13 @@ import { useDestorySpace } from '@coze-common/auth';
import { useInitSpaceRole } from '@coze-common/auth-adapter';
const SpaceIdContainer = ({ spaceId }: { spaceId: string }) => {
// 空间组件销毁时清空对应space数据
// When the space component is destroyed, empty the corresponding space data
useDestorySpace(spaceId);
// 初始化空间权限数据
// Initialize spatial permission data
const isCompleted = useInitSpaceRole(spaceId);
// isCompleted 的 判断条件很重要确保了在Space空间内能够获取到空间的权限数据。
// isCompleted, the judgment condition is very important to ensure that the permission data of the space can be obtained in the Space space.
return isCompleted ? <Outlet /> : null;
};

View File

@@ -45,7 +45,7 @@ const getSubPath = (type: IntelligenceType | undefined) => {
return 'project-ide';
}
if (type === IntelligenceType.Bot) {
//跳转至 Bot编辑页后续会改成新的URL/space/:spaceId/agent/:agentId
//Jump to the Bot edit page, which will be changed to a new URL/space/: spaceId/agent/: agentId later.
return 'bot';
}
return '';
@@ -63,7 +63,7 @@ export const FavoritesListItem: FC<IntelligenceData> = ({
basic_info = {},
type,
}) => {
// 取消收藏
// Cancel Favorite
const clickToUnfavorite = async () => {
try {
const res: FavoriteProductResponse =
@@ -76,7 +76,7 @@ export const FavoritesListItem: FC<IntelligenceData> = ({
entity_id: id,
});
if (res.code === 0) {
// 取消收藏成功,刷新收藏列表
// Cancel the collection successfully, refresh the collection list
cozeMitt.emit('refreshFavList', {
id,
numDelta: -1,
@@ -113,7 +113,7 @@ export const FavoritesListItem: FC<IntelligenceData> = ({
need_login: true,
have_access: true,
});
//跳转至 Bot编辑页后续会改成新的URL/space/:spaceId/agent/:agentId
//Jump to the Bot edit page, which will be changed to a new URL/space/: spaceId/agent/: agentId later.
window.open(getIntelligenceNavigateUrl({ basic_info, type }), '_blank');
}}
data-testid="workspace.favorites.list.item"

View File

@@ -101,7 +101,7 @@ const getFavoritesList = async ({
};
/**
* ahooks 的 useInfiniteScroll 返回的对象引用会变,本方法返回一个引用不变的对象,仅此而已,不用关注其声明和实现
* The object reference returned by the useInfiniteScroll of ahooks will change. This method returns an object with unchanged references, nothing more, regardless of its declaration and implementation
*/
const useInfiniteScrollRef: typeof useInfiniteScroll = <
T extends { list: unknown[] },
@@ -123,8 +123,8 @@ export const FavoritesList: FC = () => {
const containerRef = useRef<HTMLDivElement>(null);
// 用一个引用不变的 req便于 effect 中的 handler 拿到最新的 loading 状态
// (将 loading 放进 effect 的 deps 中并不能解决问题,因为上一次的闭包中 getFavoritesList 前后的 loading 状态已经固定不会变了,导致上一次执行出错)
// Use an invariant req to make it easier for the handler in the effect to get the latest loading status
// (Putting loading into the deps of effect doesn't solve the problem, because the loading state before and after getFavoritesList in the last closure has been fixed and will not change, resulting in an error in the last execution)
const req = useInfiniteScrollRef<FEIntelligenceListData>(
async dataSource =>
await getFavoritesList({
@@ -143,7 +143,7 @@ export const FavoritesList: FC = () => {
useEffect(() => {
const handler = async (refreshFavListParams: RefreshFavListParams) => {
if (req.loading || req.loadingMore) {
// 处理竞态问题,优先保证列表滚动加载,下同
// Deal with the race problem, give priority to ensuring the rolling loading of the list, the same as below
return;
}
@@ -151,14 +151,14 @@ export const FavoritesList: FC = () => {
const mutateData = await getFavoritesList({
spaceId,
spaceType,
// Q:为什么要专门设置 pageSize
// AuseInfiniteScroll 有个 bug/featuremutate 后不会立即触发高度检测
// 这要从它的 loadmore 触发逻辑讲起,正常是监听 scroll 动作,检测高度,从而判断是否需要 loadmore
// 但假如首次请求回来的数据就不足一屏高度,没有 overflow 无法触发 scroll 动作,怎么办?
// 因此 useInfiniteScroll 会在 run、reload 之类的行为完成后立即做一次高度检测来判断是否要继续 loadmore
// 但是!它却唯独不会在 mutate 后做高度检测,导致 mutate 出来的数据不足一屏,就再也无法 loadmore
// 因此这里手动计算一下需要 mutate 的数据量。
// 如果后续 pageSize 太大有问题,那还可以继续改造一下 useInfiniteScrollRef使 mutate 动作实际执行 reload但拦截其 loading 属性返回 false
// Q: Why set the pageSize specifically?
// A: useInfiniteScroll has a bug/feature that does not trigger height detection immediately after mutating
// This starts with its loadmore trigger logic. Normally, it monitors the scroll action and detects the height to determine whether loadmore is required.
// But what if the data requested for the first time is less than one screen height, and the scroll action cannot be triggered without overflow?
// Therefore, useInfiniteScroll will perform a height check immediately after running, reloading, etc. to determine whether to continue loadmore.
// However! It will not do height detection after mutating, resulting in less than one screen of mutated data, and it can no longer loadmore
// So here we manually calculate the amount of data that needs to be mutated.
// If there is a problem with the subsequent pageSize being too large, you can continue to modify the useInfiniteScrollRef so that the mutate action actually executes reload, but intercepts its loading property and returns false.
pageSize: Math.max(
currLength
? currLength + refreshFavListParams.numDelta
@@ -169,7 +169,7 @@ export const FavoritesList: FC = () => {
if (req.loading || req.loadingMore) {
return;
}
// 使用 mutate 静默加载,直接更新视图,不展示 loading 效果
// Use mutate silent loading to update the view directly without displaying the loading effect
req.mutate(mutateData);
};
cozeMitt.on('refreshFavList', handler);
@@ -177,7 +177,7 @@ export const FavoritesList: FC = () => {
}, [spaceId, spaceType]);
return (
// 这里有一个很坑,滚动蒙层如果直接挂在滚动画布元素上会一起滚动,所以这里需要单独包一层(往上方一层)
// There is a very pit here. If the scrolling overlay is directly hung on the scrolling canvas element, it will scroll together, so it needs to be wrapped in a separate layer (one layer above).
<div className={classNames('w-full h-full flex flex-col')}>
<>
<Space

View File

@@ -1,4 +1,4 @@
/* 定义滚动条默认隐藏样式 styled-scrollbar-hidden */
/* Define the scrollbar default hidden style styled-scrollbar-hidden */
.styled-scrollbar-hidden {
scrollbar-width: none; /* Firefox */
@@ -44,7 +44,7 @@
.list-bottom-mask::after,
.list-top-mask::before {
pointer-events: none; /* 确保伪元素不阻挡用户交互 */
pointer-events: none; /* Make sure that pseudo-elements do not block user interaction */
content: '';
position: absolute;

View File

@@ -77,38 +77,38 @@ export const useInitSpace = ({
return;
}
// 如果未指定spaceId则跳转到兜底的space下的项目开发子路由
// If spaceId is not specified, jump to the project development subroute under the space of the backseat
if (!spaceId) {
// 拉取空间列表
// Pull space list
await useSpaceStore.getState().fetchSpaces(true);
// 获取个人空间Id
// Get Personal Space Id
const personalSpaceID = useSpaceStore.getState().getPersonalSpaceID();
// 空间列表的第一个空间
// The first space in the space list
const firstSpaceID = useSpaceStore.getState().spaceList[0]?.id;
// 未指定spaceId的兜底空间
// SpaceId not specified
const fallbackSpaceID = personalSpaceID ?? firstSpaceID ?? '';
// 检查指定的spaceId是否可以访问
// Checks if the specified spaceId is accessible
const { checkSpaceID } = useSpaceStore.getState();
// 无工作空间,提示创建
// No workspace, prompt to create
if (!fallbackSpaceID) {
Toast.warning(I18n.t('enterprise_workspace_default_tips2_toast'));
} else {
// 获取兜底的跳转URL
// Get the jump URL of the back cover.
const targetURL = await getFallbackWorkspaceURL(
fallbackSpaceID,
'develop',
checkSpaceID,
);
// 跳转
// jump
navigate(targetURL);
}
} else {
// 拉取空间列表
// Pull space list
await fetchSpacesWithSpaceId?.(spaceId);
if (!useSpaceStore.getState().checkSpaceID(spaceId)) {
// 当 space id 在space 列表找不到时,抛出错误
// Throws an error when the space id cannot be found in the space list
capture(
new CustomError(ReportEventNames.errorPath, 'space id error', {
customGlobalErrorConfig: {
@@ -119,7 +119,7 @@ export const useInitSpace = ({
}),
);
} else {
// 更新space storespaceId
// Update space store spaceId
useSpaceStore.getState().setSpace(spaceId);
}
}