니디걸오버도즈

This commit is contained in:
암냥 2025-12-19 00:54:03 +09:00
commit 5be9625af3
No known key found for this signature in database
25 changed files with 208 additions and 29 deletions

View file

@ -0,0 +1,40 @@
import { useState, useEffect } from 'react';
export function useReadmeWaka() {
const [wakaContent, setWakaContent] = useState<string>('');
const [isLoading, setIsLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchWakaContent = async () => {
try {
const response = await fetch(
'https://raw.githubusercontent.com/imnyang/imnyang/refs/heads/main/README.md'
);
if (!response.ok) throw new Error('Failed to fetch README');
const text = await response.text();
const startMarker = '<!--START_SECTION:waka-->';
const endMarker = '<!--END_SECTION:waka-->';
const startIdx = text.indexOf(startMarker);
const endIdx = text.indexOf(endMarker);
if (startIdx !== -1 && endIdx !== -1) {
const content = text.slice(startIdx + startMarker.length, endIdx).trim();
setWakaContent(content);
} else {
setError('Could not find waka section');
}
} catch (err) {
setError(err instanceof Error ? err.message : 'Unknown error');
} finally {
setIsLoading(false);
}
};
fetchWakaContent();
}, []);
return { wakaContent, isLoading, error };
}