Skip to content

Commit

Permalink
Hide Bazaar button for alts, add no-oracle flag
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Jan 25, 2024
1 parent a9f344d commit 85a4ff0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
3 changes: 3 additions & 0 deletions src/views/Alts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export default function Alts() {
<>
<ExitBtn x={12} y={12} />
<div style="margin-top:72px">
<label style="display:block">
<input type="checkbox" ref={flags['no-oracle']} /> no-oracle
</label>
<label style="display:block">
<input type="checkbox" ref={flags['no-shop']} /> no-shop
</label>
Expand Down
32 changes: 21 additions & 11 deletions src/views/MainMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ function logout() {
store.doNav(store.Login);
}

function noflags(user) {
return !user || !user.flags || !user.flags.length;
}

function hasflag(user, flag) {
return user?.flags?.includes?.(flag);
}

export default function MainMenu(props) {
const rx = store.useRx();
const foename = () => (rx.opts.foename ?? '').trim(),
Expand Down Expand Up @@ -397,7 +405,7 @@ export default function MainMenu(props) {
{`Deck: ${rx.user?.selectedDeck}`}
</div>
<div style="text-align:center">{quickslots}</div>
{!rx.user?.flags?.includes?.('no-shop') && (
{!hasflag(rx.user, 'no-shop') && (
<input
type="button"
value="Shop"
Expand All @@ -416,16 +424,18 @@ export default function MainMenu(props) {
onMouseOver={[setTip, 'Upgrade or sell cards']}
style="position:absolute;left:102px;top:108px"
/>
<input
type="button"
value="Bazaar"
onClick={() => store.doNav(import('./Bazaar.jsx'))}
onMouseOver={[
setTip,
"Put up cards for sale & review other players' offers",
]}
style="position:absolute;left:102px;top:132px"
/>
{noflags(rx.user) && (
<input
type="button"
value="Bazaar"
onClick={() => store.doNav(import('./Bazaar.jsx'))}
onMouseOver={[
setTip,
"Put up cards for sale & review other players' offers",
]}
style="position:absolute;left:102px;top:132px"
/>
)}
</div>
<div style="position:absolute;left:616px;top:300px;width:206px;height:130px">
<div class="maintitle">Players</div>
Expand Down

0 comments on commit 85a4ff0

Please sign in to comment.