(
async paths => {
actions.initializeStickers(paths);
paths.forEach(path => {
queue.add(async () => {
try {
const stickerImage = await processStickerImage(path);
actions.addImageData(stickerImage);
} catch (e) {
window.SignalContext.log.error(
'Error processing image:',
e?.stack ? e.stack : String(e)
);
actions.removeSticker(path);
actions.addToast({
key:
(e || {}).errorMessageI18nKey ||
'StickerCreator--Toasts--errorProcessing',
});
}
});
});
},
[actions]
);
return (
{ids.length > 0 ? (
<>
{ids.map((p, i) => (
))}
{mode === 'add' && ids.length < stickersDuck.maxStickers ? (
) : null}
>
) : (
)}
);
}
);
export const StickerGrid = SortableContainer((props: Props) => {
const ids = stickersDuck.useStickerOrder();
const actions = stickersDuck.useStickerActions();
const handleSortEnd = React.useCallback(
sortEnd => {
actions.moveSticker(sortEnd);
},
[actions]
);
return (
);
});