-
Notifications
You must be signed in to change notification settings - Fork 42
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
✨ Takedown policy association #261
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
137ff03
:sparkles: Allow associating policies with takedowns
foysalit 0fc2445
:sparkles: Add policy manager area
foysalit fd92f82
:sparkles: Add policy filter to events tab
foysalit e6b988f
Merge branch 'main' of github.com:bluesky-social/ozone-ui into takedo…
foysalit f7770b4
:arrow_up: Update @atproto/ozone and @atproto/api version
foysalit 70a6072
:sparkles: Add takedown policy association with bulk takedown
foysalit c52f4f5
:sparkles: Replace react hook based pathname with browser api
foysalit 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
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,101 @@ | ||
import { ActionButton, LinkButton } from '@/common/buttons' | ||
import { Input } from '@/common/forms' | ||
import { PolicyEditor } from '@/setting/policy/Editor' | ||
import { PolicyList } from '@/setting/policy/List' | ||
import { usePolicyListSetting } from '@/setting/policy/usePolicyList' | ||
import { createPolicyPageLink } from '@/setting/policy/utils' | ||
import { useServerConfig } from '@/shell/ConfigurationContext' | ||
import { ToolsOzoneTeamDefs } from '@atproto/api' | ||
import { PlusIcon, MagnifyingGlassIcon } from '@heroicons/react/24/outline' | ||
import { useRouter, useSearchParams } from 'next/navigation' | ||
|
||
export function PoliciesConfig() { | ||
const router = useRouter() | ||
const searchParams = useSearchParams() | ||
const searchQuery = searchParams.get('search') | ||
const { role } = useServerConfig() | ||
const canManagePolicies = role === ToolsOzoneTeamDefs.ROLEADMIN | ||
const showPoliciesCreateForm = searchParams.has('create') | ||
|
||
return ( | ||
<div className="pt-4"> | ||
<div className="flex flex-row justify-between mb-4"> | ||
{typeof searchQuery === 'string' ? ( | ||
<> | ||
<Input | ||
type="text" | ||
autoFocus | ||
className="w-3/4" | ||
placeholder="Search policies..." | ||
value={searchQuery} | ||
onChange={(e) => { | ||
const url = createPolicyPageLink({ search: e.target.value }) | ||
router.push(url) | ||
}} | ||
/>{' '} | ||
<LinkButton | ||
size="sm" | ||
className="ml-1" | ||
appearance="outlined" | ||
href={createPolicyPageLink({})} | ||
> | ||
Cancel | ||
</LinkButton> | ||
</> | ||
) : ( | ||
<> | ||
<div className="flex flex-row items-center"> | ||
<h4 className="font-medium text-gray-700 dark:text-gray-100"> | ||
Manage Policies | ||
</h4> | ||
</div> | ||
{!showPoliciesCreateForm && ( | ||
<div className="flex flex-row items-center"> | ||
{canManagePolicies && ( | ||
<LinkButton | ||
size="sm" | ||
appearance="primary" | ||
href={createPolicyPageLink({ create: 'true' })} | ||
> | ||
<PlusIcon className="h-3 w-3 mr-1" /> | ||
<span className="text-xs">Add New Policy</span> | ||
</LinkButton> | ||
)} | ||
|
||
<LinkButton | ||
size="sm" | ||
className="ml-1" | ||
appearance="outlined" | ||
href={createPolicyPageLink({ search: '' })} | ||
> | ||
<MagnifyingGlassIcon className="h-4 w-4" /> | ||
</LinkButton> | ||
</div> | ||
)} | ||
</> | ||
)} | ||
</div> | ||
{showPoliciesCreateForm && ( | ||
<div className="mb-4"> | ||
<PolicyEditor | ||
onCancel={() => { | ||
const url = createPolicyPageLink({}) | ||
router.push(url) | ||
}} | ||
onSuccess={() => { | ||
const url = createPolicyPageLink({}) | ||
router.push(url) | ||
}} | ||
/> | ||
</div> | ||
)} | ||
|
||
<PolicyList | ||
{...{ | ||
searchQuery, | ||
canEdit: canManagePolicies, | ||
}} | ||
/> | ||
</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
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.
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.
This is unrelated to the objective of this PR but wanted to add it in since it's been requested by mods a few times in the past.