()
| 43 | Note over User,GitHub: DeepWiki supports sequence diagrams for visualizing interactions`; |
| 44 | |
| 45 | export default function Home() { |
| 46 | const router = useRouter(); |
| 47 | const { language, setLanguage, messages, supportedLanguages } = useLanguage(); |
| 48 | const { projects, isLoading: projectsLoading } = useProcessedProjects(); |
| 49 | |
| 50 | // Create a simple translation function |
| 51 | const t = (key: string, params: Record<string, string | number> = {}): string => { |
| 52 | // Split the key by dots to access nested properties |
| 53 | const keys = key.split('.'); |
| 54 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 55 | let value: any = messages; |
| 56 | |
| 57 | // Navigate through the nested properties |
| 58 | for (const k of keys) { |
| 59 | if (value && typeof value === 'object' && k in value) { |
| 60 | value = value[k]; |
| 61 | } else { |
| 62 | // Return the key if the translation is not found |
| 63 | return key; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | // If the value is a string, replace parameters |
| 68 | if (typeof value === 'string') { |
| 69 | return Object.entries(params).reduce((acc: string, [paramKey, paramValue]) => { |
| 70 | return acc.replace(`{${paramKey}}`, String(paramValue)); |
| 71 | }, value); |
| 72 | } |
| 73 | |
| 74 | // Return the key if the value is not a string |
| 75 | return key; |
| 76 | }; |
| 77 | |
| 78 | const [repositoryInput, setRepositoryInput] = useState('https://github.com/AsyncFuncAI/deepwiki-open'); |
| 79 | |
| 80 | const REPO_CONFIG_CACHE_KEY = 'deepwikiRepoConfigCache'; |
| 81 | |
| 82 | const loadConfigFromCache = (repoUrl: string) => { |
| 83 | if (!repoUrl) return; |
| 84 | try { |
| 85 | const cachedConfigs = localStorage.getItem(REPO_CONFIG_CACHE_KEY); |
| 86 | if (cachedConfigs) { |
| 87 | const configs = JSON.parse(cachedConfigs); |
| 88 | const config = configs[repoUrl.trim()]; |
| 89 | if (config) { |
| 90 | setSelectedLanguage(config.selectedLanguage || language); |
| 91 | setIsComprehensiveView(config.isComprehensiveView === undefined ? true : config.isComprehensiveView); |
| 92 | setProvider(config.provider || ''); |
| 93 | setModel(config.model || ''); |
| 94 | setIsCustomModel(config.isCustomModel || false); |
| 95 | setCustomModel(config.customModel || ''); |
| 96 | setSelectedPlatform(config.selectedPlatform || 'github'); |
| 97 | setExcludedDirs(config.excludedDirs || ''); |
| 98 | setExcludedFiles(config.excludedFiles || ''); |
| 99 | setIncludedDirs(config.includedDirs || ''); |
| 100 | setIncludedFiles(config.includedFiles || ''); |
| 101 | } |
| 102 | } |
nothing calls this directly
no test coverage detected