-
Notifications
You must be signed in to change notification settings - Fork 24
Tournament Discovery #3955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Tournament Discovery #3955
Conversation
66ca630 to
eaf749b
Compare
eaf749b to
d2bf86e
Compare
d2bf86e to
f6837fd
Compare
|
|
||
| return ( | ||
| <TournamentCardShell item={item}> | ||
| <div className="relative h-[64px] w-full bg-blue-100/40 dark:bg-blue-100-dark/20 lg:h-[80px]"> |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
| 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 }; | ||
| }; |
There was a problem hiding this comment.
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( | ||
| ` |
There was a problem hiding this comment.
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..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
placeholder translation?
| const [draftQuery, setDraftQuery] = useState(searchQuery); | ||
| useEffect(() => setDraftQuery(searchQuery), [searchQuery]); |
There was a problem hiding this comment.
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"]'), |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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) { | |||
There was a problem hiding this comment.
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?
Closes #3952
This PR redesigns tournaments page
search_demo.mov