diff --git a/packages/web/src/views/Life/LifeQuote.tsx b/packages/web/src/views/Life/LifeQuote.tsx index 8238060cd..85aa05e24 100644 --- a/packages/web/src/views/Life/LifeQuote.tsx +++ b/packages/web/src/views/Life/LifeQuote.tsx @@ -1,26 +1,11 @@ -import { ShuffleIcon } from "@phosphor-icons/react"; -import { useState } from "react"; -import { TooltipWrapper } from "@web/components/Tooltip/TooltipWrapper"; import { getRandomLifeQuote } from "./life-quotes"; export function LifeQuote() { - const [quote, setQuote] = useState(getRandomLifeQuote); + const quote = getRandomLifeQuote(); return ( -
-
- {quote} -
- - - +
+
{quote}
); } diff --git a/packages/web/src/views/Life/LifeView.test.tsx b/packages/web/src/views/Life/LifeView.test.tsx index 4dd454674..1a0c9e673 100644 --- a/packages/web/src/views/Life/LifeView.test.tsx +++ b/packages/web/src/views/Life/LifeView.test.tsx @@ -169,6 +169,9 @@ describe("LifeView", () => { screen.queryByRole("button", { name: /zoom/i }), ).not.toBeInTheDocument(); expect(screen.queryByText(/ctrl\+scroll|pinch/i)).not.toBeInTheDocument(); + expect( + screen.queryByRole("button", { name: "Shuffle life quote" }), + ).not.toBeInTheDocument(); }); it("opens the birth date picker when Enter is pressed on the focused field", async () => { diff --git a/packages/web/src/views/Life/life-quotes.test.ts b/packages/web/src/views/Life/life-quotes.test.ts index 12b462383..3dec94b4f 100644 --- a/packages/web/src/views/Life/life-quotes.test.ts +++ b/packages/web/src/views/Life/life-quotes.test.ts @@ -3,13 +3,6 @@ import { describe, expect, it } from "bun:test"; describe("life quotes", () => { it("chooses from the supplied quotes", () => { - expect(getRandomLifeQuote(undefined, () => 0)).toBe(LIFE_QUOTES[0]); - }); - - it("chooses a different quote when shuffled", () => { - expect(getRandomLifeQuote(LIFE_QUOTES[0], () => 0)).toBe(LIFE_QUOTES[1]); - expect(getRandomLifeQuote(LIFE_QUOTES[0], () => 1)).not.toBe( - LIFE_QUOTES[0], - ); + expect(getRandomLifeQuote(() => 0)).toBe(LIFE_QUOTES[0]); }); }); diff --git a/packages/web/src/views/Life/life-quotes.ts b/packages/web/src/views/Life/life-quotes.ts index 18b9224ba..29b3280b1 100644 --- a/packages/web/src/views/Life/life-quotes.ts +++ b/packages/web/src/views/Life/life-quotes.ts @@ -53,16 +53,10 @@ export const LIFE_QUOTES = [ "“Life moves pretty fast. If you don’t stop and look around once in a while, you could miss it.” (Ferris Bueller’s Day Off)", ] as const; -export function getRandomLifeQuote( - currentQuote?: string, - random = getSecureRandomNumber, -) { - const quotes = currentQuote - ? LIFE_QUOTES.filter((quote) => quote !== currentQuote) - : LIFE_QUOTES; +export function getRandomLifeQuote(random = getSecureRandomNumber) { const index = Math.min( - quotes.length - 1, - Math.floor(random() * quotes.length), + LIFE_QUOTES.length - 1, + Math.floor(random() * LIFE_QUOTES.length), ); - return quotes[index] ?? LIFE_QUOTES[0]; + return LIFE_QUOTES[index] ?? LIFE_QUOTES[0]; }