このコミットが含まれているのは:
@@ -18,6 +18,7 @@ import { clearPostImportSourceDraft,
|
||||
loadPostImportSession,
|
||||
mergeImportResults,
|
||||
mergeValidatedImportRows,
|
||||
resultSummaryCounts,
|
||||
retryImportRow,
|
||||
savePostImportSession,
|
||||
type PostImportResultRow,
|
||||
@@ -92,13 +93,9 @@ const PostImportResultPage: FC<Props> = ({ user }) => {
|
||||
toast ({ title: '取込状態を保存できませんでした', description: message }))
|
||||
}, [session, sessionId])
|
||||
|
||||
const counts = useMemo (() => ({
|
||||
created: session?.rows.filter (_1 => _1.importStatus === 'created').length ?? 0,
|
||||
skipped: session?.rows.filter (_1 => _1.importStatus === 'skipped').length ?? 0,
|
||||
failed: session?.rows.filter (_1 => _1.importStatus === 'failed').length ?? 0,
|
||||
invalid:
|
||||
session?.rows.filter (_1 => effectivePostImportStatus (_1) === 'error').length ?? 0,
|
||||
}), [session])
|
||||
const counts = useMemo (
|
||||
() => resultSummaryCounts (session?.rows ?? []),
|
||||
[session])
|
||||
|
||||
const retry = async (sourceRow: number) => {
|
||||
if (session == null)
|
||||
@@ -120,11 +117,7 @@ const PostImportResultPage: FC<Props> = ({ user }) => {
|
||||
tagSources: row.tagSources,
|
||||
metadataUrl: row.metadataUrl })),
|
||||
changed_row: -1 })
|
||||
const validatedRows = mergeValidatedImportRows (pendingRows, validated.rows).map (row =>
|
||||
row.sourceRow === sourceRow
|
||||
&& Object.keys (row.validationErrors ?? { }).length > 0
|
||||
? { ...row, importStatus: 'failed' as const }
|
||||
: row)
|
||||
const validatedRows = mergeValidatedImportRows (pendingRows, validated.rows)
|
||||
setSession (current =>
|
||||
current
|
||||
? { ...current, rows: validatedRows }
|
||||
@@ -238,20 +231,21 @@ const PostImportResultPage: FC<Props> = ({ user }) => {
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-2 sm:flex-row">
|
||||
{row.createdPostId && (
|
||||
{(row.createdPostId != null || row.existingPostId != null) && (
|
||||
<Button type="button" variant="outline" asChild>
|
||||
<PrefetchLink to={`/posts/${ row.createdPostId }`}>
|
||||
<PrefetchLink
|
||||
to={`/posts/${ row.createdPostId ?? row.existingPostId }`}>
|
||||
投稿を開く
|
||||
</PrefetchLink>
|
||||
</Button>)}
|
||||
{status === 'error' && (
|
||||
{(status === 'error' || row.importStatus === 'failed') && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() => openRepair (row.sourceRow)}>
|
||||
編輯
|
||||
</Button>)}
|
||||
{row.importStatus === 'failed' && (
|
||||
{row.importStatus === 'failed' && status !== 'error' && (
|
||||
<>
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
新しい課題から参照
ユーザをブロックする