-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat: add close button to adjudicate notification #564
Open
chen-yanlong
wants to merge
4
commits into
main
Choose a base branch
from
feat/adjudicate-close-button
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
4 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 30 additions & 15 deletions
45
...es/frontend/src/features/reporting/components/AdjudicateNotification/AdjudicateButton.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 |
---|---|---|
@@ -1,26 +1,41 @@ | ||
import { ReactComponent as ArrowRight } from '@/assets/svg/arrow-right.svg' | ||
import { ReactComponent as GavelRaisedIcon } from '@/assets/svg/gavel-raised.svg' | ||
import { ReactComponent as CloseIcon } from '@/assets/svg/close-button.svg' | ||
|
||
export default function AdjudicationButton({ | ||
onClick = () => {}, | ||
onClose = () => {}, | ||
}: { | ||
onClick?: () => void | ||
onClose?: () => void | ||
}) { | ||
return ( | ||
<button | ||
className="relative py-2 pl-12 pr-2 bg-black border border-white rounded-tl-lg rounded-tr rounded-bl rounded-br-lg lg:py-3 lg:pr-4 lg:pl-14 drop-shadow" | ||
onClick={onClick} | ||
> | ||
<GavelRaisedIcon className="absolute bottom-0 -left-3 w-[4.5rem] lg:w-[5.25rem] h-auto" /> | ||
<div className="inline-flex flex-col items-start"> | ||
<span className="text-base font-bold leading-tight tracking-normal text-white lg:tracking-wider lg:text-lg"> | ||
新檢舉案出現 | ||
</span> | ||
<span className="text-xs font-medium leading-tight text-white lg:text-sm"> | ||
<ArrowRight className="inline-block w-3 lg:w-auto mr-0.5 lg:mr-1" /> | ||
立即前往評判! | ||
</span> | ||
</div> | ||
</button> | ||
<div className="relative inline-block"> | ||
{/* Main Button */} | ||
<button | ||
className="relative py-2 pl-12 pr-2 bg-black border border-white rounded-lg lg:py-3 lg:pr-4 lg:pl-14 drop-shadow" | ||
onClick={onClick} | ||
> | ||
<GavelRaisedIcon className="absolute bottom-0 -left-3 w-[4.5rem] lg:w-[5.25rem] h-auto" /> | ||
<div className="inline-flex flex-col items-start"> | ||
<span className="text-base font-bold leading-tight tracking-normal text-white lg:tracking-wider lg:text-lg"> | ||
新檢舉案出現 | ||
</span> | ||
<span className="text-xs font-medium leading-tight text-white lg:text-sm"> | ||
<ArrowRight className="inline-block w-3 lg:w-auto mr-0.5 lg:mr-1" /> | ||
立即前往評判! | ||
</span> | ||
</div> | ||
</button> | ||
|
||
{/* Close Button */} | ||
<button | ||
className="absolute -top-3.5 -right-3.5 w-7 h-7 flex items-center justify-center | ||
bg-white rounded-full border border-gray-300 shadow-md hover:bg-gray-100" | ||
onClick={onClose} | ||
> | ||
<CloseIcon className="w-4 h-4 text-black" /> | ||
</button> | ||
</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
49 changes: 49 additions & 0 deletions
49
.../frontend/src/features/reporting/components/AdjudicateNotification/ConfirmationDialog.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,49 @@ | ||
import { ReactComponent as CloseIcon } from '@/assets/svg/close.svg' | ||
|
||
export default function ConfirmationDialog({ | ||
open, | ||
onConfirm, | ||
onCancel, | ||
onClose, | ||
}: { | ||
open: boolean | ||
onConfirm: () => void | ||
onCancel: () => void | ||
onClose: () => void | ||
}) { | ||
if (!open) return null | ||
|
||
return ( | ||
<div className="fixed inset-0 flex items-center justify-center bg-black/70 z-50"> | ||
<div className="bg-white p-8 rounded-xl shadow-lg max-w-md w-full relative"> | ||
{/* Close Button */} | ||
<button className="absolute top-4 right-4" onClick={onClose}> | ||
<CloseIcon className="w-6 h-6 text-gray-500 hover:text-black" /> | ||
</button> | ||
|
||
{/* Title and Message */} | ||
<p className="text-lg font-bold mb-4">親愛的用戶:</p> | ||
<p className="text-base text-gray-700 leading-relaxed"> | ||
你確定要放棄這個評判機會嗎?協助評判不僅能與其他用戶一同維護平台的自治與健康, | ||
也能提高聲譽分數 1 分。 | ||
</p> | ||
|
||
{/* Action Buttons */} | ||
<div className="mt-6 flex space-x-4"> | ||
<button | ||
className="flex-1 py-2 bg-orange-500 text-white font-bold rounded-md hover:bg-orange-600" | ||
onClick={onConfirm} | ||
> | ||
確認放棄 | ||
</button> | ||
<button | ||
className="flex-1 py-2 bg-orange-500 text-white font-bold rounded-md hover:bg-orange-600" | ||
onClick={onCancel} | ||
> | ||
前往協助評判 | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
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.
The button should be visible again when closing adjudication dialog.
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.
The button's visibility depends on
buttonVisible
, so it should be visible again when closing adjudication dialog now. Please let me know if i misunderstood.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.
The floating button becomes invisible if I close adjudication dialog. You should make it visible again.
Screen.Recording.2024-11-05.at.12.51.20.PM.mov
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.
Got it ! Solved.