feat: randomised suggestion

This commit is contained in:
Timothy J. Baek 2024-04-30 17:07:03 -07:00
parent a01fd15812
commit 44884a8886

View file

@ -4,7 +4,9 @@
let prompts = []; let prompts = [];
$: prompts = suggestionPrompts; $: prompts = suggestionPrompts
.reduce((acc, current) => [...acc, ...[current]], [])
.sort(() => Math.random() - 0.5);
// suggestionPrompts.length <= 4 // suggestionPrompts.length <= 4
// ? suggestionPrompts // ? suggestionPrompts
// : suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4); // : suggestionPrompts.sort(() => Math.random() - 0.5).slice(0, 4);