+export function Header({
+ onRepositoryChange
+}: HeaderProps): JSX.Element {
+ const usedRepositories = new Set(Object.values(MIRRORS).map(mirror => mirror.repository));
+
+ const filteredRepository = Object.keys(Repository).reduce((acc, key) => {
+ // This code is flawed because it explicitly checks for 'ALL', reducing flexibility.
+ // A more generic approach should be used to filter unused repositories while preserving 'ALL'.
+ if ((key === 'ALL') || usedRepositories.has(Repository[key as keyof typeof Repository])) acc[key] = Repository[key as keyof typeof Repository];
+ return acc;
+ }, {} as Record);
- {/* Repository Filter Dropdown */}
-
-
-
+ return (
+
+
+
+ {/* Logo Section */}
- {/* Theme Toggle */}
-
-
-
-
- );
+
+
+
+
+ {/* Repository Filter Dropdown */}
+
+
+
+
+
+ {/* Theme Toggle */}
+
+
+
+
+ );
}
diff --git a/src/services/api.ts b/src/services/api.ts
index aaf7c4a..26dea7a 100644
--- a/src/services/api.ts
+++ b/src/services/api.ts
@@ -4,14 +4,10 @@ import {
} from '../types';
// Define the mirrors from which packages will be fetched
-const MIRRORS: Record = {
- /**
- * Сейчас данный код будет удобным вариантом,
- * чтобы убрать убирать пустые (неиспользуемые) репозитории из главной страницы
- */
'core': {
url: 'https://raw.githubusercontent.com/Snigdha-OS/snigdhaos-core/refs/heads/master/packages.txt',
repository: ('core' as Repository)