-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f413bf4
commit d6a8b9a
Showing
10 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export const AllCategories = 'All'; | ||
export const channelFilterList = ['0x8AAAa9c3a06a4A9FE7C5cCe17d8B5db1E225Eadf']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { channelCategoriesMap, envUtil } from 'common'; | ||
import { ChannelDetails } from 'queries'; | ||
import { Filters } from './hooks/useChannelsFilters'; | ||
import { AllCategories, channelFilterList } from './Channels.constants'; | ||
|
||
export const showFrontendChannels = (filters: Filters) => { | ||
return envUtil.isProd && filters?.category && filters?.category != AllCategories; | ||
}; | ||
|
||
export const filterFrontendChannels = (channels: ChannelDetails[], filter: Filters): Array<string> => { | ||
if (showFrontendChannels(filter)) { | ||
const channelIds = channels.map((channel) => channel.channel); | ||
return Object.keys(channelCategoriesMap).filter( | ||
(channel) => | ||
!channelIds.includes(channel) && | ||
!channelFilterList.includes(channel) && | ||
channelCategoriesMap[channel] === filter.category | ||
); | ||
} | ||
return []; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/modules/channels/components/FrontendChannelListItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useGetChannelDetails } from 'queries'; | ||
import { FC } from 'react'; | ||
import { AllChannelsListItem } from './AllChannelsListItem'; | ||
|
||
export type FrontendChannelListItemProps = { | ||
channelAddress: string; | ||
}; | ||
|
||
const FrontendChannelListItem: FC<FrontendChannelListItemProps> = ({ channelAddress }) => { | ||
const { data: channelDetails, isLoading } = useGetChannelDetails(channelAddress); | ||
|
||
return ( | ||
<AllChannelsListItem | ||
channelDetails={channelDetails} | ||
isLoading={isLoading} | ||
/> | ||
); | ||
}; | ||
|
||
export { FrontendChannelListItem }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters