(
() =>
items.map((item) => {
const canRestore = Boolean(onRestore) && !item.current && item.restorable !== false;
const asking = confirming === item.id;
const extra = asking ? null : actions?.(item);
const restoreButton =
canRestore && !asking ? (
) : null;
return {
id: item.id,
at: item.at,
actor: item.actor,
actorSrc: item.actorSrc,
icon: item.icon ?? (item.actor ? undefined : ),
details: item.details,
title: (
{item.label}
{item.current && (
{t?.current ?? "รุ่นปัจจุบัน"}
)}
),
action:
restoreButton || extra ? (
{restoreButton}
{extra}
) : undefined,
description: asking ? (
{t?.confirm ?? "กู้คืนรุ่นนี้? รุ่นปัจจุบันจะถูกเก็บไว้เป็นรุ่นหนึ่งในประวัติ"}
) : undefined,
};
}),
[items, onRestore, actions, confirming, pending, t, text.cancel],
);
return (
);
}