More changes

This commit is contained in:
Bill 2022-04-03 22:44:57 -04:00
parent 629083664a
commit 285d1ed6d5
4 changed files with 46 additions and 70 deletions

View File

@ -35,11 +35,17 @@
"brace-style": [ "error", "allman" ], "brace-style": [ "error", "allman" ],
"template-curly-spacing": [ "error", "always" ], "template-curly-spacing": [ "error", "always" ],
"no-multi-spaces": [ "error" ], "no-multi-spaces": [ "error" ],
"react/prop-types": [ "off" ],
"jsx-quotes": [ "error" ], "jsx-quotes": [ "error" ],
"react/prop-types": [ "off" ],
"react/jsx-curly-spacing": [ "error", { "when": "always", "children": true } ], "react/jsx-curly-spacing": [ "error", { "when": "always", "children": true } ],
"react/jsx-equals-spacing": [ "error" ], "react/jsx-equals-spacing": [ "error" ],
"@typescript-eslint/object-curly-spacing": [ "error", "always", { "arraysInObjects": true, "objectsInObjects": false } ], "react/jsx-newline": [ "error", { "prevent": true } ],
"@typescript-eslint/object-curly-spacing": [ "error", "always",
{
"arraysInObjects": true,
"objectsInObjects": false
}
],
"@typescript-eslint/ban-types": [ "@typescript-eslint/ban-types": [
"error", "error",
{ {

View File

@ -124,13 +124,9 @@ export const HcCenterView: FC<{}> = props =>
<div>{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData.kickbackPercentage * 100).toString() ]) }</div> <div>{ LocalizeText('hccenter.breakdown.paydayfactor.percent', [ 'percent' ], [ (kickbackData.kickbackPercentage * 100).toString() ]) }</div>
<div>{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData.creditRewardForStreakBonus.toString() ]) }</div> <div>{ LocalizeText('hccenter.breakdown.streakbonus', [ 'credits' ], [ kickbackData.creditRewardForStreakBonus.toString() ]) }</div>
<hr className="w-100 text-black my-1" /> <hr className="w-100 text-black my-1" />
<div>{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), <div>{ LocalizeText('hccenter.breakdown.total', [ 'credits', 'actual' ], [ getHcPaydayAmount(), ((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ]) }</div>
((((kickbackData.kickbackPercentage * kickbackData.totalCreditsSpent) + kickbackData.creditRewardForStreakBonus) * 100) / 100).toString() ]) }</div> <div className="btn btn-link text-primary p-0" onClick={ () => CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage']) }>
<div className="btn btn-link text-primary p-0" onClick={ () => { LocalizeText('hccenter.special.infolink') }
{
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['payday.habbopage'])
} }>{
LocalizeText('hccenter.special.infolink') }
</div> </div>
</Popover.Body> </Popover.Body>
</Popover> </Popover>
@ -162,6 +158,7 @@ export const HcCenterView: FC<{}> = props =>
</Flex> </Flex>
{ GetConfiguration('hc.center')['payday.info'] && { GetConfiguration('hc.center')['payday.info'] &&
<Flex alignItems="center"> <Flex alignItems="center">
<Column className="rounded-start bg-primary p-2 payday-special mb-1"> <Column className="rounded-start bg-primary p-2 payday-special mb-1">
<h4 className="mb-1">{ LocalizeText('hccenter.special.title') }</h4> <h4 className="mb-1">{ LocalizeText('hccenter.special.title') }</h4>
<div>{ LocalizeText('hccenter.special.info') }</div> <div>{ LocalizeText('hccenter.special.info') }</div>
@ -184,33 +181,27 @@ export const HcCenterView: FC<{}> = props =>
</div> </div>
</OverlayTrigger> </OverlayTrigger>
</div> </div>
</div> </div> }
}
</div> </div>
</Flex> </Flex> }
}
{ GetConfiguration('hc.center')['gift.info'] && { GetConfiguration('hc.center')['gift.info'] &&
<div className="rounded bg-success p-2 d-flex flex-row mb-0"> <div className="rounded bg-success p-2 d-flex flex-row mb-0">
<div> <div>
<h4 className="mb-1">{ LocalizeText('hccenter.gift.title') }</h4> <h4 className="mb-1">{ LocalizeText('hccenter.gift.title') }</h4>
<div dangerouslySetInnerHTML={ { __html: unclaimedGifts > 0 ? LocalizeText('hccenter.unclaimedgifts', [ 'unclaimedgifts' ], [ unclaimedGifts.toString() ]) : LocalizeText('hccenter.gift.info') } }></div> <div dangerouslySetInnerHTML={ { __html: unclaimedGifts > 0 ? LocalizeText('hccenter.unclaimedgifts', [ 'unclaimedgifts' ], [ unclaimedGifts.toString() ]) : LocalizeText('hccenter.gift.info') } }></div>
</div> </div>
<button className="btn btn-primary btn-lg align-self-center ms-auto" onClick={ () => <button className="btn btn-primary btn-lg align-self-center ms-auto" onClick={ () => CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.hc_gifts']) }>
{ { LocalizeText(clubStatus === ClubStatus.ACTIVE ? 'hccenter.btn.gifts.redeem' : 'hccenter.btn.gifts.view') }
CreateLinkEvent('catalog/open/' + GetConfiguration('catalog.links')['hc.hc_gifts']) </button>
} }>{ LocalizeText(clubStatus === ClubStatus.ACTIVE ? 'hccenter.btn.gifts.redeem' : 'hccenter.btn.gifts.view') }</button> </div> }
</div>
}
{ GetConfiguration('hc.center')['benefits.info'] && { GetConfiguration('hc.center')['benefits.info'] &&
<div className="benefits text-black py-2"> <div className="benefits text-black py-2">
<h5 className="mb-1 text-primary">{ LocalizeText('hccenter.general.title') }</h5> <h5 className="mb-1 text-primary">{ LocalizeText('hccenter.general.title') }</h5>
<div className="mb-2" dangerouslySetInnerHTML={ { __html: LocalizeText('hccenter.general.info') } } /> <div className="mb-2" dangerouslySetInnerHTML={ { __html: LocalizeText('hccenter.general.info') } } />
<button className="btn btn-link p-0 text-primary" onClick={ () => <button className="btn btn-link p-0 text-primary" onClick={ () => CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['benefits.habbopage']) }>
{ { LocalizeText('hccenter.general.infolink') }
CreateLinkEvent('habbopages/' + GetConfiguration('hc.center')['benefits.habbopage']) </button>
} }>{ LocalizeText('hccenter.general.infolink') }</button> </div> }
</div>
}
</NitroCardContentView> </NitroCardContentView>
</NitroCardView> </NitroCardView>
); );

View File

@ -1,18 +0,0 @@
import { createContext, FC, ProviderProps, useContext } from 'react';
import { IPurse } from './common/IPurse';
interface IPurseContext
{
purse: IPurse;
}
const PurseContext = createContext<IPurseContext>({
purse: null
});
export const PurseContextProvider: FC<ProviderProps<IPurseContext>> = props =>
{
return <PurseContext.Provider value={ props.value }>{ props.children }</PurseContext.Provider>
}
export const usePurseContext = () => useContext(PurseContext);

View File

@ -3,7 +3,6 @@ import { FC, useCallback, useMemo } from 'react';
import { CreateLinkEvent, GetConfiguration, LocalizeText } from '../../api'; import { CreateLinkEvent, GetConfiguration, LocalizeText } from '../../api';
import { Column, Flex, Grid, LayoutCurrencyIcon, Text } from '../../common'; import { Column, Flex, Grid, LayoutCurrencyIcon, Text } from '../../common';
import { usePurse } from '../../hooks'; import { usePurse } from '../../hooks';
import { PurseContextProvider } from './PurseContext';
import { CurrencyView } from './views/CurrencyView'; import { CurrencyView } from './views/CurrencyView';
import { SeasonalView } from './views/SeasonalView'; import { SeasonalView } from './views/SeasonalView';
@ -62,31 +61,29 @@ export const PurseView: FC<{}> = props =>
if(!purse) return null; if(!purse) return null;
return ( return (
<PurseContextProvider value={ { purse } }> <Column alignItems="end" className="nitro-purse-container" gap={ 1 }>
<Column alignItems="end" className="nitro-purse-container" gap={ 1 }> <Flex className="nitro-purse rounded-bottom p-1">
<Flex className="nitro-purse rounded-bottom p-1"> <Grid fullWidth gap={ 1 }>
<Grid fullWidth gap={ 1 }> <Column justifyContent="center" size={ hcDisabled ? 10 : 6 } gap={ 0 }>
<Column justifyContent="center" size={ hcDisabled ? 10 : 6 } gap={ 0 }> <CurrencyView type={ -1 } amount={ purse.credits } short={ currencyDisplayNumberShort } />
<CurrencyView type={ -1 } amount={ purse.credits } short={ currencyDisplayNumberShort } /> { getCurrencyElements(0, 2) }
{ getCurrencyElements(0, 2) } </Column>
</Column> { !hcDisabled &&
{ !hcDisabled && <Column center pointer size={ 4 } gap={ 1 } className="nitro-purse-subscription rounded" onClick={ event => CreateLinkEvent('habboUI/open/hccenter') }>
<Column center pointer size={ 4 } gap={ 1 } className="nitro-purse-subscription rounded" onClick={ event => CreateLinkEvent('habboUI/open/hccenter') }> <LayoutCurrencyIcon type="hc" />
<LayoutCurrencyIcon type="hc" /> <Text variant="white">{ getClubText }</Text>
<Text variant="white">{ getClubText }</Text> </Column> }
</Column> } <Column justifyContent="center" size={ 2 } gap={ 0 }>
<Column justifyContent="center" size={ 2 } gap={ 0 }> <Flex center pointer fullHeight className="nitro-purse-button p-1 rounded" onClick={ event => CreateLinkEvent('help/show') }>
<Flex center pointer fullHeight className="nitro-purse-button p-1 rounded" onClick={ event => CreateLinkEvent('help/show') }> <i className="icon icon-help"/>
<i className="icon icon-help"/> </Flex>
</Flex> <Flex center pointer fullHeight className="nitro-purse-button p-1 rounded" onClick={ event => CreateLinkEvent('user-settings/toggle') } >
<Flex center pointer fullHeight className="nitro-purse-button p-1 rounded" onClick={ event => CreateLinkEvent('user-settings/toggle') } > <i className="icon icon-cog"/>
<i className="icon icon-cog"/> </Flex>
</Flex> </Column>
</Column> </Grid>
</Grid> </Flex>
</Flex> { getCurrencyElements(2, -1, true) }
{ getCurrencyElements(2, -1, true) } </Column>
</Column>
</PurseContextProvider>
); );
} }