forked from Joystream/pioneer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stake changed Activities (Joystream#3458) (Joystream#3826)
- Add 'Read more' on `StakeSlashedContent` to open `StakeChangedModal` - Rename 'Slashed with' to 'Amount' - Rename 'Status' with 'Action' - Hide Amount if empty - Hide Rationale if empty Co-authored-by: Joystream Stats <dev@joystreamstats.live>
- Loading branch information
1 parent
70983c7
commit d306382
Showing
3 changed files
with
53 additions
and
21 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
37 changes: 31 additions & 6 deletions
37
packages/ui/src/working-groups/components/Activities/StakeSlashedContent.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,24 +1,49 @@ | ||
import React from 'react' | ||
import React, { useState } from 'react' | ||
|
||
import { ActivityContentComponent } from '@/common/components/Activities/ActivityContent' | ||
import { ButtonLink } from '@/common/components/buttons/Buttons' | ||
import { MemberModalLink } from '@/memberships/components/MemberModalLink' | ||
import { StakeSlashedActivity } from '@/working-groups/types' | ||
|
||
import { StakeChangedModal } from './ActivitiesModals/StakeChanged/StakeChangedModal' | ||
|
||
export const StakeSlashedContent: ActivityContentComponent<StakeSlashedActivity> = ({ activity, isOwn }) => { | ||
const { member, groupName } = activity | ||
const { eventType, member, groupName, id } = activity | ||
const [isStakeSlashedModalOpen, setStakeSlashedModalOpen] = useState(false) | ||
|
||
if (isOwn) { | ||
return <>Your stake was reduced by the {groupName} Working Group Lead.</> | ||
return ( | ||
<> | ||
Your stake have been slashed by the {groupName} lead.{' '} | ||
<ButtonLink size="small" inline onClick={() => setStakeSlashedModalOpen(!isStakeSlashedModalOpen)}> | ||
Read more | ||
</ButtonLink> | ||
{isStakeSlashedModalOpen && ( | ||
<StakeChangedModal | ||
onClose={() => setStakeSlashedModalOpen(!isStakeSlashedModalOpen)} | ||
eventType={eventType} | ||
id={id} | ||
/> | ||
)} | ||
</> | ||
) | ||
} | ||
|
||
return ( | ||
<> | ||
<MemberModalLink call={{ modal: 'Member', data: { id: member.id } }}>{member.handle}</MemberModalLink> has been | ||
reduced by the {groupName} Working Group Lead.{' '} | ||
<ButtonLink size="small" inline> | ||
The stake of{' '} | ||
<MemberModalLink call={{ modal: 'Member', data: { id: member.id } }}>{member.handle}</MemberModalLink> was slashed | ||
by the {groupName} lead.{' '} | ||
<ButtonLink size="small" inline onClick={() => setStakeSlashedModalOpen(!isStakeSlashedModalOpen)}> | ||
Read more | ||
</ButtonLink> | ||
{isStakeSlashedModalOpen && ( | ||
<StakeChangedModal | ||
onClose={() => setStakeSlashedModalOpen(!isStakeSlashedModalOpen)} | ||
eventType={eventType} | ||
id={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