Browse Source

fix:文案修改 上传中优化 logo跳转调整

version/1.2.13
leiyuee 6 hours ago
parent
commit
bc54798e55
  1. 8
      src/components/AssetGalleryTile/index.tsx
  2. 1
      src/dialog/asset-details/index.scss
  3. 2
      src/layouts/Layout/Layout.tsx
  4. 2
      src/locales/zh-CN.json
  5. 32
      src/pages/Create/panels/MyCreationsPanel/index.tsx
  6. 1
      打包dist.command

8
src/components/AssetGalleryTile/index.tsx

@ -16,7 +16,6 @@ interface AssetGalleryTileBaseProps extends Omit<HTMLAttributes<HTMLElement>, "c
interface AssetGalleryTilePendingProps extends AssetGalleryTileBaseProps { interface AssetGalleryTilePendingProps extends AssetGalleryTileBaseProps {
kind: "pending"; kind: "pending";
pendingLabel: string; pendingLabel: string;
pendingImageSrc?: string;
} }
interface AssetGalleryTileImageProps extends AssetGalleryTileBaseProps { interface AssetGalleryTileImageProps extends AssetGalleryTileBaseProps {
@ -53,7 +52,6 @@ type AssetGalleryTileOmittedProps = {
onTileClick?: () => void; onTileClick?: () => void;
kind: AssetGalleryTileProps["kind"]; kind: AssetGalleryTileProps["kind"];
pendingLabel?: string; pendingLabel?: string;
pendingImageSrc?: string;
imageSrc?: string; imageSrc?: string;
videoSrc?: string; videoSrc?: string;
videoPoster?: string; videoPoster?: string;
@ -75,7 +73,6 @@ export function AssetGalleryTile(props: AssetGalleryTileProps) {
className, className,
kind, kind,
pendingLabel, pendingLabel,
pendingImageSrc,
imageSrc, imageSrc,
videoSrc, videoSrc,
videoPoster, videoPoster,
@ -108,10 +105,9 @@ export function AssetGalleryTile(props: AssetGalleryTileProps) {
}, []); }, []);
if (kind === "pending") { if (kind === "pending") {
const resolvedPendingImageSrc = resolveApiMediaUrl(pendingImageSrc) || ASSET_GALLERY_PENDING_IMAGE_SRC;
return ( return (
<Tag data-asset-gallery-tile data-row-key={rowKey} className={tileClassName} {...domProps}> <Tag data-asset-gallery-tile data-row-key={rowKey} className={tileClassName} {...domProps}>
<img className="assetGalleryTile__pendingImage" src={resolvedPendingImageSrc} alt="" aria-hidden /> <img className="assetGalleryTile__pendingImage" src={ASSET_GALLERY_PENDING_IMAGE_SRC} alt="" aria-hidden />
<img className="assetGalleryTile__pendingIcon" src={ASSET_GALLERY_PENDING_ICON_SRC} alt="" aria-hidden /> <img className="assetGalleryTile__pendingIcon" src={ASSET_GALLERY_PENDING_ICON_SRC} alt="" aria-hidden />
<span className="assetGalleryTile__pendingLabel">{pendingLabel}</span> <span className="assetGalleryTile__pendingLabel">{pendingLabel}</span>
</Tag> </Tag>
@ -134,7 +130,7 @@ export function AssetGalleryTile(props: AssetGalleryTileProps) {
if (kind === "voice") { if (kind === "voice") {
const resolvedVoiceCover = resolveApiMediaUrl(voiceCover) || ASSET_GALLERY_AUDIO_PLACEHOLDER_SRC; const resolvedVoiceCover = resolveApiMediaUrl(voiceCover) || ASSET_GALLERY_AUDIO_PLACEHOLDER_SRC;
const resolvedVoicePrompt = String(voicePrompt ?? "").trim(); const resolvedVoicePrompt = (voicePrompt ?? "").trim();
const resolvedIsVoicePlaying = Boolean(isVoicePlaying); const resolvedIsVoicePlaying = Boolean(isVoicePlaying);
const resolvedVoiceSrc = resolveApiMediaUrl(voiceSrc); const resolvedVoiceSrc = resolveApiMediaUrl(voiceSrc);

1
src/dialog/asset-details/index.scss

@ -601,6 +601,7 @@
.assetDetails__materialSection { .assetDetails__materialSection {
margin-top: 19px; margin-top: 19px;
margin-bottom: 19px;
width: 100%; width: 100%;
.assetDetails__materialLabel { .assetDetails__materialLabel {

2
src/layouts/Layout/Layout.tsx

@ -551,7 +551,7 @@ export function Layout({ children }: LayoutProps) {
className="layoutShell__brand" className="layoutShell__brand"
aria-label={t("layout.brand.aria")} aria-label={t("layout.brand.aria")}
onClick={() => { onClick={() => {
navigate(ROUTES.INDEX); navigate(ROUTES.EXPLORE);
}} }}
> >
<img className="layoutShell__brandLogo" src={LAYOUT_NAV_ASSETS.logo} alt="" /> <img className="layoutShell__brandLogo" src={LAYOUT_NAV_ASSETS.logo} alt="" />

2
src/locales/zh-CN.json

@ -693,7 +693,7 @@
"composer.voiceLibrary.previewPause": "暂停试听", "composer.voiceLibrary.previewPause": "暂停试听",
"composer.voiceLibrary.previewUnavailable": "该音色暂无试听音频", "composer.voiceLibrary.previewUnavailable": "该音色暂无试听音频",
"composer.voiceLibrary.previewPlayFailed": "试听播放失败,请稍后重试", "composer.voiceLibrary.previewPlayFailed": "试听播放失败,请稍后重试",
"composer.voiceAudioUpload.title": "上传音频", "composer.voiceAudioUpload.title": "上传文本",
"composer.voiceAudioUpload.openAria": "上传音频", "composer.voiceAudioUpload.openAria": "上传音频",
"composer.voiceAudioUpload.dropzoneAria": "点击或拖动上传音频", "composer.voiceAudioUpload.dropzoneAria": "点击或拖动上传音频",
"composer.voiceAudioUpload.clickPrefix": "点击 ", "composer.voiceAudioUpload.clickPrefix": "点击 ",

32
src/pages/Create/panels/MyCreationsPanel/index.tsx

@ -151,36 +151,6 @@ function hasMusicCreationAudio(asset: Record<string, unknown>): boolean {
return candidates.some((candidate) => String(candidate ?? "").trim().length > 0); return candidates.some((candidate) => String(candidate ?? "").trim().length > 0);
} }
function isVideoOrAudioCandidate(candidate: Record<string, unknown>): boolean {
const type = String(candidate.type ?? candidate.mediaType ?? candidate.mimeType ?? "").toLowerCase();
const url = String(candidate.url ?? "").toLowerCase();
return type.includes("video") || type.includes("audio") || /\.(mp4|mov|webm|mp3|wav|m4a)(\?.*)?$/.test(url);
}
function pickUrlCandidate(...candidates: unknown[]): string {
for (const candidate of candidates) {
if (Array.isArray(candidate)) {
const nested = pickUrlCandidate(...candidate);
if (nested) return nested;
continue;
}
if (candidate && typeof candidate === "object") {
const row = candidate as Record<string, unknown>;
const nested = pickUrlCandidate(row.thumbUrl, row.coverUrl, row.cover, row.imageUrl, row.image, isVideoOrAudioCandidate(row) ? "" : row.url);
if (nested) return nested;
continue;
}
const value = String(candidate ?? "").trim();
if (value) return value;
}
return "";
}
function getPendingCreationImage(task: Record<string, unknown>): string {
const assetDraft = task.assetDraft && typeof task.assetDraft === "object" ? (task.assetDraft as Record<string, unknown>) : null;
return pickUrlCandidate(assetDraft?.coverUrl, assetDraft?.cover, assetDraft?.thumbUrl, assetDraft?.imageUrl, assetDraft?.image, task.coverUrl, task.cover, task.thumbUrl, task.imageUrl, task.image, task.images, task.referenceSubjectList, task.voiceLibrary);
}
function flattenMusicCreationAssetIds(assetList: any[]): string[] { function flattenMusicCreationAssetIds(assetList: any[]): string[] {
const ids: string[] = []; const ids: string[] = [];
for (const task of assetList) { for (const task of assetList) {
@ -941,14 +911,12 @@ export default function MyCreationsPanel({ tabIdPrefix, setToolbarExtra }: MyCre
{taskList.map((task: any, taskIdx: number) => { {taskList.map((task: any, taskIdx: number) => {
if (task.status == 0 || task.status == 1) { if (task.status == 0 || task.status == 1) {
const taskId = getTaskRowId(task) || `idx-${taskIdx}`; const taskId = getTaskRowId(task) || `idx-${taskIdx}`;
const pendingImageSrc = getPendingCreationImage(task);
return Array.from({ length: Number(task.batchSize || 0) }, (_, slotIdx) => ( return Array.from({ length: Number(task.batchSize || 0) }, (_, slotIdx) => (
<AssetGalleryTile <AssetGalleryTile
key={`pending-${taskId}-${slotIdx}`} key={`pending-${taskId}-${slotIdx}`}
kind="pending" kind="pending"
rowKey={`pending-${taskId}-${slotIdx}`} rowKey={`pending-${taskId}-${slotIdx}`}
pendingLabel={task.status == 0 ? t("pages.create.panels.myCreations.queued") : t("pages.create.panels.myCreations.generating")} pendingLabel={task.status == 0 ? t("pages.create.panels.myCreations.queued") : t("pages.create.panels.myCreations.generating")}
pendingImageSrc={pendingImageSrc}
/> />
)); ));
} }

1
打包dist.command

@ -75,6 +75,7 @@ fi
mkdir "$TMP_DIR/$PACKAGE_NAME" mkdir "$TMP_DIR/$PACKAGE_NAME"
cp -R "$DIST_DIR/." "$TMP_DIR/$PACKAGE_NAME/" cp -R "$DIST_DIR/." "$TMP_DIR/$PACKAGE_NAME/"
rm -f "$OUTPUT_ZIP"
( (
cd "$TMP_DIR" || exit 1 cd "$TMP_DIR" || exit 1

Loading…
Cancel
Save