Trigger tip counter refresh on change (#3945)
* trigger for refresh * trigger onSuccess for close or cancel * remove stray import * Apply suggestions from code review Co-authored-by: Jaco Greeff <jacogr@gmail.com> * alpha ordering Co-authored-by: Jaco Greeff <jacogr@gmail.com>
This commit is contained in:
parent
fc985cb3e0
commit
dfc87bd7bd
@ -22,6 +22,7 @@ interface Props {
|
||||
hash: string;
|
||||
isMember: boolean;
|
||||
members: string[];
|
||||
onRefresh: () => void;
|
||||
onSelect: (hash: string, isSelected: boolean, value: BN) => void;
|
||||
onlyUntipped: boolean;
|
||||
tip: OpenTip | OpenTipTo225;
|
||||
@ -75,7 +76,7 @@ function extractTipState (tip: OpenTip | OpenTipTo225, hash: string, allAccounts
|
||||
};
|
||||
}
|
||||
|
||||
function Tip ({ bestNumber, className = '', defaultId, hash, isMember, members, onSelect, onlyUntipped, tip }: Props): React.ReactElement<Props> | null {
|
||||
function Tip ({ bestNumber, className = '', defaultId, hash, isMember, members, onRefresh, onSelect, onlyUntipped, tip }: Props): React.ReactElement<Props> | null {
|
||||
const { t } = useTranslation();
|
||||
const { allAccounts } = useAccounts();
|
||||
|
||||
@ -150,6 +151,7 @@ function Tip ({ bestNumber, className = '', defaultId, hash, isMember, members,
|
||||
icon='times'
|
||||
isDisabled={!isFinder}
|
||||
label={t('Cancel')}
|
||||
onSuccess={onRefresh}
|
||||
params={[hash]}
|
||||
tx='treasury.retractTip'
|
||||
/>
|
||||
@ -171,6 +173,7 @@ function Tip ({ bestNumber, className = '', defaultId, hash, isMember, members,
|
||||
accountId={councilId}
|
||||
icon='times'
|
||||
label={t<string>('Close')}
|
||||
onSuccess={onRefresh}
|
||||
params={[hash]}
|
||||
tx='treasury.closeTip'
|
||||
/>
|
||||
|
||||
@ -19,6 +19,7 @@ interface Props {
|
||||
hashes?: string[] | null;
|
||||
isMember: boolean;
|
||||
members: string[];
|
||||
onRefresh: () => void;
|
||||
onSelectTip: (hash: string, isSelected: boolean, value: BN) => void,
|
||||
}
|
||||
|
||||
@ -43,7 +44,7 @@ function extractTips (optTips?: Option<OpenTip>[], hashes?: string[] | null): Ti
|
||||
);
|
||||
}
|
||||
|
||||
function Tips ({ className = '', defaultId, hashes, isMember, members, onSelectTip }: Props): React.ReactElement<Props> {
|
||||
function Tips ({ className = '', defaultId, hashes, isMember, members, onRefresh, onSelectTip }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const [onlyUntipped, setOnlyUntipped] = useState(false);
|
||||
@ -89,6 +90,7 @@ function Tips ({ className = '', defaultId, hashes, isMember, members, onSelectT
|
||||
isMember={isMember}
|
||||
key={hash}
|
||||
members={members}
|
||||
onRefresh={onRefresh}
|
||||
onSelect={onSelectTip}
|
||||
onlyUntipped={onlyUntipped}
|
||||
tip={tip}
|
||||
|
||||
@ -77,6 +77,7 @@ function TipsEntry ({ className, hashes, isMember, members, trigger }: Props): R
|
||||
hashes={hashes}
|
||||
isMember={isMember}
|
||||
members={members}
|
||||
onRefresh={trigger}
|
||||
onSelectTip={_selectTip}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user