feat(ui/ux): add timeline, hero, and NeoFetch components + data/hooks
- Add timeline route helper
- src/app/timeline/route.ts
- simple helper to navigate to #timeline
- Add NeoFetch component (client)
- src/components/NeoFetch.tsx
- Displays avatar iframe, uptime calculation, experience count, WakaTime stats, terminal/ip, locale and colour palette
- Uses custom hooks useIpData and useWakaTimeData, and events data
- Add Top (hero) component (client)
- src/components/Top.tsx
- Full-screen hero with randomized background, parallax on mouse, device orientation & motion handlers, requestPermission trigger on image click
- Includes Sidebar import and optimized Image usage
- Add Timeline UI component (client)
- src/components/timeline.tsx
- Year selector + filtered event list with links and icons
- Handles initial selection and rendering grouped by year
- Add reusable Timeline primitives (client)
- src/components/ui/timeline.tsx
- Timeline context and composable parts: Timeline, TimelineItem, Indicator, Separator, Date, Title, Content, Header
- Orientation support and controlled/uncontrolled API
- Add data & hooks
- src/lib/events.ts
- Seeded events array (education/awards/conference entries) used by timeline and NeoFetch
- src/hooks/use-ip-data.ts
- Fetches terminal/ip info from https://api.imnya.ng/ip
- src/hooks/use-wakatime-data.ts
- Fetches WakaTime summary from https://api.imnya.ng/wakatime
Notes:
- All new components are client-side ("use client")
- Adds device motion/orientation listeners with cleanup
- Provides basic error handling for network hooks
- Improves homepage/UX with interactive hero and timeline data visualization
This commit is contained in:
parent
2e1f6a7ec4
commit
96a43a9a3c
34 changed files with 771 additions and 63 deletions
21
src/hooks/use-ip-data.ts
Normal file
21
src/hooks/use-ip-data.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useIpData() {
|
||||
const [ipData, setIpData] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
const fetchIpData = async () => {
|
||||
try {
|
||||
const response = await fetch("https://api.imnya.ng/ip");
|
||||
const data = await response.text();
|
||||
setIpData(data);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch IP data:", error);
|
||||
}
|
||||
};
|
||||
|
||||
fetchIpData();
|
||||
}, []);
|
||||
|
||||
return ipData;
|
||||
}
|
||||
21
src/hooks/use-wakatime-data.ts
Normal file
21
src/hooks/use-wakatime-data.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { useEffect, useState } from "react";
|
||||
|
||||
export function useWakaTimeData() {
|
||||
const [wakaTimeData, setWakaTimeData] = useState<any>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchWakaTimeData = async () => {
|
||||
try {
|
||||
const response = await fetch("https://api.imnya.ng/wakatime");
|
||||
const data = await response.json();
|
||||
setWakaTimeData(data);
|
||||
} catch (error) {
|
||||
console.error("Failed to fetch WakaTime data:", error);
|
||||
}
|
||||
};
|
||||
|
||||
fetchWakaTimeData();
|
||||
}, []);
|
||||
|
||||
return wakaTimeData;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue