Update PartyHeader
* Fixes the display of numeric properties (button count, turn count, chain count) * Refactors remixed pill/button so that it displays a message if the original party was deleted
This commit is contained in:
parent
422f1b7818
commit
862747ed4a
2 changed files with 41 additions and 25 deletions
|
|
@ -131,7 +131,7 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: $unit;
|
gap: $unit-3x;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: $unit * 94;
|
max-width: $unit * 94;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -146,16 +146,16 @@
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
align-items: center;
|
|
||||||
display: flex;
|
|
||||||
gap: $unit;
|
|
||||||
margin-bottom: $unit;
|
margin-bottom: $unit;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
|
display: inline;
|
||||||
font-size: $font-xlarge;
|
font-size: $font-xlarge;
|
||||||
font-weight: $normal;
|
font-weight: $medium;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
|
line-height: 40px;
|
||||||
|
margin-right: $unit;
|
||||||
|
|
||||||
&.empty {
|
&.empty {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
|
|
@ -224,6 +224,7 @@
|
||||||
& > .right {
|
& > .right {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: $unit-half;
|
gap: $unit-half;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
& > * {
|
& > * {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
|
|
||||||
|
|
@ -235,24 +235,26 @@ const PartyHeader = (props: Props) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
const buttonChainToken = () => {
|
const buttonChainToken = () => {
|
||||||
if (party.buttonCount || party.chainCount) {
|
if (party.buttonCount !== undefined || party.chainCount !== undefined) {
|
||||||
let string = ''
|
let string = ''
|
||||||
|
|
||||||
if (party.buttonCount && party.buttonCount > 0) {
|
if (party.buttonCount !== undefined) {
|
||||||
string += `${party.buttonCount}b`
|
string += `${party.buttonCount}b`
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!party.buttonCount && party.chainCount && party.chainCount > 0) {
|
if (party.buttonCount === undefined && party.chainCount !== undefined) {
|
||||||
string += `0${t('party.details.suffix.buttons')}${party.chainCount}${t(
|
string += `0${t('party.details.suffix.buttons')}${party.chainCount}${t(
|
||||||
'party.details.suffix.chains'
|
'party.details.suffix.chains'
|
||||||
)}`
|
)}`
|
||||||
} else if (
|
} else if (
|
||||||
party.buttonCount &&
|
party.buttonCount !== undefined &&
|
||||||
party.chainCount &&
|
party.chainCount !== undefined
|
||||||
party.chainCount > 0
|
|
||||||
) {
|
) {
|
||||||
string += `${party.chainCount}${t('party.details.suffix.chains')}`
|
string += `${party.chainCount}${t('party.details.suffix.chains')}`
|
||||||
} else if (party.buttonCount && !party.chainCount) {
|
} else if (
|
||||||
|
party.buttonCount !== undefined &&
|
||||||
|
party.chainCount === undefined
|
||||||
|
) {
|
||||||
string += `0${t('party.details.suffix.chains')}`
|
string += `0${t('party.details.suffix.chains')}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -311,7 +313,7 @@ const PartyHeader = (props: Props) => {
|
||||||
|
|
||||||
const remixButton = () => {
|
const remixButton = () => {
|
||||||
return (
|
return (
|
||||||
<Tooltip content={t('tooltips.remix')}>
|
<Tooltip content={t('tooltips.remix.create')}>
|
||||||
<Button
|
<Button
|
||||||
leftAccessoryIcon={<RemixIcon />}
|
leftAccessoryIcon={<RemixIcon />}
|
||||||
className="grow"
|
className="grow"
|
||||||
|
|
@ -322,6 +324,30 @@ const PartyHeader = (props: Props) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const remixedButton = () => {
|
||||||
|
const tooltipString =
|
||||||
|
party.remix && party.sourceParty
|
||||||
|
? t('tooltips.remix.source')
|
||||||
|
: t('tooltips.remix.deleted')
|
||||||
|
|
||||||
|
const buttonAction =
|
||||||
|
party.sourceParty && (() => goTo(party.sourceParty?.shortcode))
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Tooltip content={tooltipString}>
|
||||||
|
<Button
|
||||||
|
blended={true}
|
||||||
|
className="remixed"
|
||||||
|
leftAccessoryIcon={<RemixIcon />}
|
||||||
|
text={t('tokens.remix')}
|
||||||
|
size="small"
|
||||||
|
disabled={!party.sourceParty}
|
||||||
|
onClick={buttonAction}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header className={styles.wrapper}>
|
<header className={styles.wrapper}>
|
||||||
|
|
@ -331,18 +357,7 @@ const PartyHeader = (props: Props) => {
|
||||||
<h1 className={party.name ? '' : styles.empty}>
|
<h1 className={party.name ? '' : styles.empty}>
|
||||||
{party.name ? party.name : t('no_title')}
|
{party.name ? party.name : t('no_title')}
|
||||||
</h1>
|
</h1>
|
||||||
{party.remix && party.sourceParty && (
|
{party.remix && remixedButton()}
|
||||||
<Tooltip content={t('tooltips.source')}>
|
|
||||||
<Button
|
|
||||||
blended={true}
|
|
||||||
className="remixed"
|
|
||||||
leftAccessoryIcon={<RemixIcon />}
|
|
||||||
text={t('tokens.remix')}
|
|
||||||
size="small"
|
|
||||||
onClick={() => goTo(party.sourceParty?.shortcode)}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.attribution}>
|
<div className={styles.attribution}>
|
||||||
{renderUserBlock()}
|
{renderUserBlock()}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue