mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat(boards list): add filter by tag
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { useMemo } from 'react';
|
||||
|
||||
// Add this helper function to collect unique tags from subplebbits
|
||||
const getUniqueTags = (multisub: any) => {
|
||||
const allTags = new Set<string>();
|
||||
Object.values(multisub).forEach((sub: any) => {
|
||||
if (sub?.tags?.length) {
|
||||
sub.tags.forEach((tag: string) => allTags.add(tag));
|
||||
}
|
||||
});
|
||||
return Array.from(allTags).sort();
|
||||
};
|
||||
|
||||
// Export tags as a derived value where it's needed
|
||||
export const useDefaultSubplebbitTags = (subplebbits: any) => {
|
||||
return useMemo(() => getUniqueTags(subplebbits), [subplebbits]);
|
||||
};
|
||||
Reference in New Issue
Block a user