-
Notifications
You must be signed in to change notification settings - Fork 8
feat(activists): show details in search page #362
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
Open
alexsapps
wants to merge
2
commits into
main
Choose a base branch
from
alex/keep-query-state
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,71 @@ | ||
| 'use client' | ||
|
|
||
| import * as DialogPrimitive from '@radix-ui/react-dialog' | ||
| import Link from 'next/link' | ||
| import { ExternalLink, X } from 'lucide-react' | ||
| import { useState } from 'react' | ||
| import { ActivistDetail } from './[id]/activist-detail' | ||
|
|
||
| interface ActivistSheetProps { | ||
| activistId: number | null | ||
| onClose: () => void | ||
| } | ||
|
|
||
| export function ActivistSheet({ activistId, onClose }: ActivistSheetProps) { | ||
| // Holds the last non-null activistId. Never cleared back to null so content | ||
| // stays mounted and visible while Radix plays the exit animation. | ||
| const [displayActivistId, setDisplayActivistId] = useState<number | null>( | ||
| null, | ||
| ) | ||
| const [prevActivistId, setPrevActivistId] = useState<number | null>(null) | ||
|
|
||
| // React derived-state pattern: update synchronously during render so content | ||
| // is present on the first open paint without waiting for an effect. | ||
| if (activistId !== null && activistId !== prevActivistId) { | ||
| setPrevActivistId(activistId) | ||
| setDisplayActivistId(activistId) | ||
| } | ||
|
|
||
| return ( | ||
| <DialogPrimitive.Root | ||
| modal={false} | ||
| open={activistId !== null} | ||
| onOpenChange={(open) => { | ||
| if (!open) onClose() | ||
| }} | ||
| > | ||
| <DialogPrimitive.Portal> | ||
| <DialogPrimitive.Content className="fixed inset-y-0 right-0 z-50 flex h-full w-full flex-col overflow-hidden border-l bg-background shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-2xl"> | ||
| <DialogPrimitive.Title className="sr-only"> | ||
| Activist Details | ||
| </DialogPrimitive.Title> | ||
| <DialogPrimitive.Description className="sr-only"> | ||
| View and edit activist information | ||
| </DialogPrimitive.Description> | ||
|
|
||
| <div className="flex items-center justify-between border-b px-6 py-3"> | ||
| {displayActivistId !== null && ( | ||
| <Link | ||
| href={`/activists/${displayActivistId}`} | ||
| className="flex items-center gap-1.5 text-sm text-muted-foreground transition-colors hover:text-foreground" | ||
| > | ||
| <ExternalLink className="h-4 w-4" /> | ||
| Full page | ||
| </Link> | ||
| )} | ||
| <DialogPrimitive.Close className="ml-auto rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"> | ||
| <X className="h-4 w-4" /> | ||
| <span className="sr-only">Close</span> | ||
| </DialogPrimitive.Close> | ||
| </div> | ||
|
|
||
| <div className="flex flex-1 flex-col gap-6 overflow-y-auto px-6 pb-6 pt-4"> | ||
| {displayActivistId !== null && ( | ||
| <ActivistDetail activistId={displayActivistId} /> | ||
| )} | ||
| </div> | ||
| </DialogPrimitive.Content> | ||
| </DialogPrimitive.Portal> | ||
| </DialogPrimitive.Root> | ||
| ) | ||
| } | ||
|
alexsapps marked this conversation as resolved.
|
||
This file contains hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.