-
Notifications
You must be signed in to change notification settings - Fork 9
Feat/hackathon team page #67
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
Open
luojiyin1987
wants to merge
51
commits into
main
Choose a base branch
from
feat/hackathon-team-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
af78882
chore: make env sync explicit
luojiyin1987 ebf6972
docs: document explicit env sync
luojiyin1987 7d82b01
fix: stabilize hackathon detail hydration
luojiyin1987 14d64e9
fix: suppress product card hydration mismatch
luojiyin1987 f194794
i18n: add hackathon team showcase label in en-US
luojiyin1987 f30369f
i18n: add hackathon team showcase label in zh-CN
luojiyin1987 d00122b
i18n: add hackathon team showcase label in zh-TW
luojiyin1987 cab62c1
feat: add hackathon team page styles
luojiyin1987 6e4f39e
feat: redesign hackathon team detail page
luojiyin1987 8c12e16
refactor: extract hackathon countdown resolver
luojiyin1987 8ed3e06
refactor: use shared hackathon user helper
luojiyin1987 1c7d4d8
refactor: simplify hackathon detail countdown
luojiyin1987 e00e2eb
refactor: simplify hackathon team countdown
luojiyin1987 e565a66
refactor: clarify hackathon countdown reference time
luojiyin1987 67c97d9
refactor: rename hero countdown client clock
luojiyin1987 e31bfea
refactor: rename hackathon agenda reference time
luojiyin1987 1b47f1a
refactor: rename team agenda reference time
luojiyin1987 ba6607f
fix: align hackathon hero fallback action
luojiyin1987 1e5b881
fix: align team hero fallback action
luojiyin1987 dc8ee07
fix: avoid epoch fallback for missing hackathon times
luojiyin1987 02fd7aa
fix: normalize hackathon time parsing
luojiyin1987 01f3472
feat: add live hackathon countdown state hook
luojiyin1987 aa5f4a6
fix: compute hackathon detail countdown on client
luojiyin1987 180ce0e
fix: compute hackathon team countdown on client
luojiyin1987 fb28d94
fix: remove public creator email links
luojiyin1987 e4d5075
fix: normalize hackathon rich text extraction
luojiyin1987 3351ccb
fix: guard hackathon detail schema access
luojiyin1987 f85c138
fix: harden hackathon team public access
luojiyin1987 0c45861
fix: localize hackathon team breadcrumb label
luojiyin1987 b5a70ed
feat: add english breadcrumb translation
luojiyin1987 729455e
feat: add simplified chinese breadcrumb translation
luojiyin1987 7ca1d72
feat: add traditional chinese breadcrumb translation
luojiyin1987 8d7649e
fix: stabilize live countdown refresh callback
luojiyin1987 26a42d2
fix: return standard hackathon detail notFound
luojiyin1987 72b77bf
fix: return standard hackathon team notFound
luojiyin1987 d30960b
fix: support string product timestamps
luojiyin1987 eb20e2d
fix: sort hackathon detail agenda safely
luojiyin1987 236fee5
fix: sort hackathon team agenda safely
luojiyin1987 79c8b39
refactor: clarify hackathon countdown fallback logic
luojiyin1987 ba51623
fix: require valid hackathon detail form links
luojiyin1987 2fd23a2
fix: require valid hackathon team form links
luojiyin1987 dc2661a
fix: ignore empty product timestamps
luojiyin1987 0e5e716
refactor: reuse hackathon time parsing
luojiyin1987 d14dde3
fix: use grouped hackathon forms consistently
luojiyin1987 e7e5249
fix: require shareable hackathon team forms
luojiyin1987 e8f504f
fix: del no use import
luojiyin1987 f5c705c
fix: ignore boolean hackathon text values
luojiyin1987 7759941
refactor: focus hackathon team page on team content
luojiyin1987 00f8e86
style: compact hackathon team hero layout
luojiyin1987 cb7340e
fix: normalize hackathon countdown target
luojiyin1987 7416884
fix: normalize hackathon team project queries
luojiyin1987 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { TableCellValue } from 'mobx-lark'; | ||
| import { useCallback, useEffect, useMemo, useState } from 'react'; | ||
|
|
||
| import { CountdownWindow, firstTextOf, resolveCountdownState, timeOf } from './utility'; | ||
|
|
||
| export const useLiveCountdownState = <T extends CountdownWindow>( | ||
| items: T[], | ||
| startTime?: TableCellValue, | ||
| endTime?: TableCellValue, | ||
| ) => { | ||
| const [referenceTime, setReferenceTime] = useState<number | null>(null); | ||
| const refreshReferenceTime = useCallback(() => setReferenceTime(Date.now()), []); | ||
|
|
||
| useEffect(() => refreshReferenceTime(), [refreshReferenceTime]); | ||
|
|
||
| const countdownState = useMemo( | ||
| () => | ||
| referenceTime === null | ||
| ? { | ||
| nextItem: undefined as T | undefined, | ||
| countdownTo: firstTextOf(startTime) || firstTextOf(endTime) || undefined, | ||
| } | ||
| : resolveCountdownState(items, referenceTime, startTime, endTime), | ||
| [endTime, items, referenceTime, startTime], | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| if (referenceTime === null) return; | ||
|
|
||
| const targetTime = timeOf(countdownState.countdownTo); | ||
|
|
||
| if (!Number.isFinite(targetTime)) return; | ||
|
|
||
| const delay = Math.min(2_147_483_647, Math.max(1000, targetTime - Date.now() + 1000)); | ||
| const timer = window.setTimeout( | ||
| refreshReferenceTime, | ||
| delay, | ||
| ); | ||
|
|
||
| return () => window.clearTimeout(timer); | ||
| }, [countdownState.countdownTo, referenceTime, refreshReferenceTime]); | ||
|
|
||
| return countdownState; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.