-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev blocked projects and block Metakeys copy-cat #4067
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 29 additions & 0 deletions
29
src/components/ProjectDashboard/components/BlockedProjectBanner.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,29 @@ | ||
import { Trans } from '@lingui/macro' | ||
import Banner from 'components/Banner' | ||
import ExternalLink from 'components/ExternalLink' | ||
import { useBlockedProject } from 'hooks/useBlockedProject' | ||
|
||
export function BlockedProjectBanner({ className }: { className?: string }) { | ||
const isBlockedProject = useBlockedProject() | ||
if (!isBlockedProject) return null | ||
|
||
const delistingPolicyLink = | ||
'https://github.com/peeldao/proposals/pull/42/files' | ||
const discordLink = 'https://discord.gg/wFTh4QnDzk' | ||
|
||
return ( | ||
<div className={className}> | ||
<Banner | ||
title={<Trans>Delisted project</Trans>} | ||
body={ | ||
<Trans> | ||
This project has been <strong>delisted</strong> for breaching our{' '} | ||
<ExternalLink href={delistingPolicyLink}>policy</ExternalLink>.{' '} | ||
<ExternalLink href={discordLink}>Get in touch</ExternalLink>. | ||
</Trans> | ||
} | ||
variant="warning" | ||
/> | ||
</div> | ||
) | ||
} |
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,4 @@ | ||
// List of delisted projects | ||
export const BLOCKED_PROJECT_IDS = [ | ||
'564', //copycat of 563 | ||
] |
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,11 @@ | ||
import { BLOCKED_PROJECT_IDS } from 'constants/blocklist' | ||
import { ProjectMetadataContext } from 'contexts/shared/ProjectMetadataContext' | ||
import { useContext } from 'react' | ||
|
||
export const useBlockedProject = () => { | ||
const { projectId } = useContext(ProjectMetadataContext) | ||
const isBlockedProject = projectId | ||
? BLOCKED_PROJECT_IDS.includes(projectId?.toString()) | ||
: false | ||
return isBlockedProject | ||
} |
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,4 +1,5 @@ | ||
import axios from 'axios' | ||
import { BLOCKED_PROJECT_IDS } from 'constants/blocklist' | ||
import { BigNumber } from 'ethers' | ||
import { DBProject, DBProjectQueryOpts, DBProjectRow } from 'models/dbProject' | ||
import { Json } from 'models/json' | ||
|
@@ -68,7 +69,13 @@ export function useDBProjectsInfiniteQuery( | |
pageSize, | ||
})}`, | ||
) | ||
.then(res => (res.data ? res.data.map(parseDBProject) : [])) | ||
.then(res => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adds filters to "all" (same as the "new" query) and "trending" projects queries |
||
res.data | ||
? res.data | ||
.map(parseDBProject) | ||
.filter(project => !BLOCKED_PROJECT_IDS.includes(project.id)) | ||
: [], | ||
) | ||
}, | ||
{ | ||
staleTime: DEFAULT_STALE_TIME, | ||
|
@@ -93,7 +100,9 @@ export function useTrendingProjects(count: number) { | |
'/api/projects/trending?count=' + count, | ||
) | ||
|
||
return res.data.map(parseDBProjectJson) | ||
return res.data | ||
.map(parseDBProjectJson) | ||
.filter(project => !BLOCKED_PROJECT_IDS.includes(project.id)) | ||
}) | ||
} | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll want these to be project
id
s (e.g. "2-564"), notprojectId
s (otherwise this would block a v1 project 564). we also want it to be specific to mainnetThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, we could copy the pattern used for archived projects (storing
V2ArchivedProjectIdsByNetwork
that are all pv == 2), but we need to add thepv == 2
statement in the filter. archived project lists are network-specificThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.