-
Notifications
You must be signed in to change notification settings - Fork 2
added icon, renamed 2025 to 2026, fixed rollouts #373
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
Changes from all commits
3fbed80
813a67c
58e1ef4
cd7f1fb
b3a3dec
d07a969
e07fcee
7eb17a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| { | ||
| "title": "HackDavis Hub", | ||
| "description": "For all hackers and judges at HackDavis 2025", | ||
| "description": "For all hackers and judges at HackDavis 2026", | ||
| "icons": { | ||
| "icon": "/icons/icon.ico" | ||
| "icon": "/icons/icon-hd26.ico" | ||
|
michelleyeoh marked this conversation as resolved.
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,26 +1,42 @@ | ||
| import checkFeatureAvailability from '@actions/rollouts/checkFeatureAvailability'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { useEffect, useState, useCallback, useRef } from 'react'; | ||
|
|
||
| export function useFeatureAvailability(featureId: string) { | ||
| const [loading, setLoading] = useState(true); | ||
| const [ok, setOk] = useState(true); | ||
| const [error, setError] = useState<string | null>(null); | ||
| const [available, setAvailable] = useState<any>(null); | ||
| const [available, setAvailable] = useState(false); | ||
| const [rollout, setRollout] = useState<any>(null); | ||
|
|
||
| const fetchAvailability = async (featureId: string) => { | ||
| setLoading(true); | ||
| const { ok, body, error } = await checkFeatureAvailability(featureId); | ||
| setOk(ok); | ||
| setAvailable(body?.available); | ||
| setRollout(body?.rollout); | ||
| setError(error); | ||
| setLoading(false); | ||
| }; | ||
| const lastFetchedId = useRef<string | null>(null); | ||
|
|
||
| const fetchAvailability = useCallback( | ||
| async (id: string, force = false) => { | ||
| if (!force && lastFetchedId.current === id && rollout !== null) return; | ||
|
|
||
| setLoading(true); | ||
| setError(null); | ||
| try { | ||
| const { ok, body, error } = await checkFeatureAvailability(id); | ||
| if (ok && body) { | ||
| setAvailable(body.available); | ||
| setRollout(body.rollout); | ||
| lastFetchedId.current = id; | ||
| } else { | ||
| setError(error); | ||
| } | ||
|
michelleyeoh marked this conversation as resolved.
|
||
| } catch (err: any) { | ||
| console.error('Failed to fetch feature availability:', err); | ||
| setError(err instanceof Error ? err.message : String(err)); | ||
| } finally { | ||
| setLoading(false); | ||
| } | ||
| }, | ||
| [rollout] | ||
|
michelleyeoh marked this conversation as resolved.
|
||
| ); | ||
|
Comment on lines
+34
to
+35
|
||
|
|
||
| useEffect(() => { | ||
| fetchAvailability(featureId); | ||
| }, [featureId]); | ||
| }, [featureId, fetchAvailability]); | ||
|
|
||
| return { ok, loading, available, rollout, error, fetchAvailability }; | ||
| return { loading, available, rollout, error, fetchAvailability }; | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
The year "2025" should be updated to "2026" in the displayed date text to match other year updates in this PR. This appears in multiple hero components but was only updated in the Devpost URL here. The date "APRIL 19-20 2025" is shown to users at line 31.