公开作品详情页不再显示占位作者名「创作者」,按作者 ID 补查真实昵称
Project CI / Backend tests (pull_request) Failing after 30s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m27s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m23s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m15s
Project CI / Repository checks (pull_request) Failing after 33s
Project CI / Frontend tests (pull_request) Successful in 3m59s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m10s
Project CI / Native shell tests (pull_request) Successful in 8m37s
Project CI / Backend tests (pull_request) Failing after 30s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 2m27s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 5m23s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 4m15s
Project CI / Repository checks (pull_request) Failing after 33s
Project CI / Frontend tests (pull_request) Successful in 3m59s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m10s
Project CI / Native shell tests (pull_request) Successful in 8m37s
- useGameAuthorName.ts(新增):useGameAuthorDisplayName —— 回包名是占位词(「创作者」/「未知作者」)或空时,按 author.id 调 GET /api/auth/public-users/by-id/{id} 取 displayName;查询中返回 null(避免先闪占位词),查不到返回空串、不编造名字
- GameDetailPage.tsx:详情页用解析后的作者名装配展示对象(displayGame),替代直接用公开投影里的 author.name
- packages/shared/src/components/GameDetailDisplay/index.tsx:作者名为空时不渲染「由 X 制作」那一行;头像首字改用 Array.from(name)[0](避免 emoji 代理对被截断);作者行补 title 悬浮显示完整名字
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import './index.css';
|
||||
|
||||
import { Maximize2, Smartphone, Sparkles } from 'lucide-react';
|
||||
import { type ReactElement, type ReactNode,useState } from 'react';
|
||||
import { type ReactElement, type ReactNode, useState } from 'react';
|
||||
|
||||
/** 详情展示里素材出现的位置:hero 大图与缩略图条。 */
|
||||
export type GameDetailAssetRole = 'cover' | 'thumb';
|
||||
@@ -210,6 +210,8 @@ export function GameDetailDisplay({
|
||||
}: GameDetailDisplayProps) {
|
||||
const controls = (controlsLabel ?? '').trim();
|
||||
const version = (versionLabel ?? '').trim();
|
||||
/** 作者名由宿主解析(公开详情会按作者 ID 补查真实昵称);空名不渲染,避免出现「由 — 制作」。 */
|
||||
const authorName = (game.author.name ?? '').trim();
|
||||
return (
|
||||
<div
|
||||
className={['game-detail-display', className].filter(Boolean).join(' ')}
|
||||
@@ -232,12 +234,14 @@ export function GameDetailDisplay({
|
||||
{rating ? (
|
||||
<div className="game-detail-hero__rating">{rating}</div>
|
||||
) : null}
|
||||
<div className="game-detail-hero__author">
|
||||
<span className="game-detail-avatar">
|
||||
{game.author.name.slice(0, 1)}
|
||||
</span>
|
||||
<span>由 {game.author.name} 制作</span>
|
||||
</div>
|
||||
{authorName ? (
|
||||
<div className="game-detail-hero__author">
|
||||
<span className="game-detail-avatar" aria-hidden="true">
|
||||
{Array.from(authorName)[0]}
|
||||
</span>
|
||||
<span title={authorName}>由 {authorName} 制作</span>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="game-detail-hero__actions">
|
||||
{actions}
|
||||
{typeof game.playCount === 'number' ? (
|
||||
|
||||
Reference in New Issue
Block a user