mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-04-05 17:33:31 -04:00
Added streak counter
This commit is contained in:
@@ -4,13 +4,12 @@ export function generateShareText(params: {
|
||||
guesses: Guess[];
|
||||
correctBookId: string;
|
||||
dailyVerseDate: string;
|
||||
grade: string;
|
||||
chapterCorrect: boolean;
|
||||
isLoggedIn: boolean;
|
||||
userStreak?: number;
|
||||
streak?: number;
|
||||
origin: string;
|
||||
}): string {
|
||||
const { guesses, correctBookId, dailyVerseDate, grade, chapterCorrect, isLoggedIn, userStreak, origin } = params;
|
||||
const { guesses, correctBookId, dailyVerseDate, chapterCorrect, isLoggedIn, streak, origin } = params;
|
||||
|
||||
const emojis = guesses
|
||||
.slice()
|
||||
@@ -35,15 +34,14 @@ export function generateShareText(params: {
|
||||
|
||||
const bookEmoji = isLoggedIn ? "📜" : "📖";
|
||||
|
||||
const guessWord = guesses.length === 1 ? "guess" : "guesses";
|
||||
const streakPart = streak !== undefined && streak > 1 ? `, ${streak} days 🔥` : "";
|
||||
|
||||
const lines = [
|
||||
`${bookEmoji} Bibdle | ${formattedDate} ${bookEmoji}`,
|
||||
`${grade} (${guesses.length} ${guesses.length === 1 ? "guess" : "guesses"})`,
|
||||
`${guesses.length} ${guessWord}${streakPart}`,
|
||||
];
|
||||
|
||||
if (isLoggedIn && userStreak !== undefined) {
|
||||
lines.push(`🔥 ${userStreak} day streak`);
|
||||
}
|
||||
|
||||
lines.push(
|
||||
`${emojis}${guesses.length === 1 && chapterCorrect ? " ⭐" : ""}`,
|
||||
origin,
|
||||
|
||||
Reference in New Issue
Block a user