Skip to content

Conversation

@ncarazon
Copy link
Contributor

@ncarazon ncarazon commented Dec 18, 2025

Closes #3952

This PR redesigns tournaments page

image image image image
search_demo.mov
image image image image

@ncarazon ncarazon force-pushed the feat/tournaments-discovery branch from d2bf86e to f6837fd Compare December 26, 2025 14:29
@ncarazon ncarazon deployed to testing_env December 26, 2025 14:29 — with GitHub Actions Active
@ncarazon ncarazon marked this pull request as ready for review December 26, 2025 14:32

return (
<TournamentCardShell item={item}>
<div className="relative h-[64px] w-full bg-blue-100/40 dark:bg-blue-100-dark/20 lg:h-[80px]">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for not using the tw classes for h-16 and h-20?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment in the other remaining places

const LiveTournamentCard: React.FC<Props> = ({ item, nowTs = 0 }) => {
const t = useTranslations();
const prize = useMemo(
() => formatMoneyUSD(item.prize_pool ?? null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor, but formatMoneyUSD seems to accept both null an undefined


if (nowTs == null) {
label = t("tournamentTimelineOngoing");
p = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant p=0 here and below

Comment on lines +308 to +320
const pick = () => {
if (deltaMs < hour)
return { n: Math.round(deltaMs / min), unit: "minute" as const };
if (deltaMs < day)
return { n: Math.round(deltaMs / hour), unit: "hour" as const };
if (deltaMs < week)
return { n: Math.round(deltaMs / day), unit: "day" as const };
if (deltaMs < month)
return { n: Math.round(deltaMs / week), unit: "week" as const };
if (deltaMs < year)
return { n: Math.round(deltaMs / month), unit: "month" as const };
return { n: Math.round(deltaMs / year), unit: "year" as const };
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have truncateDuration in front_end/src/utils/formatters/date.ts - I haven't looked very closely, but maybe it can be used here?

return (
<div
className={cn(
`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting format you chose here - any reason why? Just curious, since it's different from the other places in our code

value={draftQuery}
onChange={handleSearchChange}
onErase={handleSearchErase}
placeholder="search..."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placeholder translation?

Comment on lines +18 to +19
const [draftQuery, setDraftQuery] = useState(searchQuery);
useEffect(() => setDraftQuery(searchQuery), [searchQuery]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear why the extra draftQuery state/setState is needed here. If that's really needed, can you leave a small comment to clarify? Although, at first sight, it looks like it's not needed.


const getInputEl = useCallback(
() =>
rootRef.current?.querySelector<HTMLInputElement>('input[type="search"]'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to keep a ref directly to the search input field instead of doing this?

onChange={onChange}
onErase={() => {
onErase();
if (keepOpenWhenHasValue) setOpen(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first sight (read of the variable names), this seems wrong, but probably it's correct, so ignore this comment if you're sure it's the correct behaviour.

@@ -0,0 +1,19 @@
import { useEffect, useState } from "react";

export function useIsInViewport(el: HTMLElement | null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hook doesn't seem to be used anywhere?

@ncarazon ncarazon requested a review from cemreinanc December 26, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tournament Discovery

3 participants