Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New blb image #273

Merged
merged 7 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions web/src/components/LaunchForm.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,14 @@
.button {
cursor: pointer;
}

.legalText {
color: #262019;
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: normal;
cursor: pointer;
margin-top: -5px;
margin-bottom: -5px;
}
3 changes: 3 additions & 0 deletions web/src/components/LaunchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ const LaunchForm = ({ onClose }: { onClose: () => void }) => {
/>
</div>
</div>
<a>
<div className={styles.legalText}>Privacy Policy</div>
</a>
</div>
);
};
Expand Down
195 changes: 99 additions & 96 deletions web/src/components/atbat/AtBatView2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,115 +83,118 @@ const AtBatView2: React.FC = () => {
className={styles.container}
style={{ maxHeight: windowHeight ? `${windowHeight}px` : "100vh" }}
>
{isCharacterSelectOpen && (
{isCharacterSelectOpen ? (
<OnboardingCharacter
onClose={() => setIsCharacterSelectOpen(false)}
onChange={(name, image) => {
setName(name);
setImage(image);
}}
/>
)}
<Image
minW={"441px"}
h={"calc(25vh - 27px)"}
position={"absolute"}
src={`${FULLCOUNT_ASSETS_PATH}/stadium.png`}
right={"50%"}
top={"35.5px"}
transform={"translateX(50%)"}
alt={""}
/>
{atBat && showPitchOutcome && atBat.outcome !== 0 && atBat.pitches.length > 0 && (
<div
className={styles.homeButton}
onClick={() => {
playSound("homeButton");
updateContext({ isLaunching: false });
router.push("/");
}}
>
JOIN FULLCOUNT
</div>
)}
) : (
<>
<Image
minW={"441px"}
h={"calc(25vh - 27px)"}
position={"absolute"}
src={`${FULLCOUNT_ASSETS_PATH}/stadium.png`}
right={"50%"}
top={"35.5px"}
transform={"translateX(50%)"}
alt={""}
/>
{atBat && showPitchOutcome && atBat.outcome !== 0 && atBat.pitches.length > 0 && (
<div
className={styles.homeButton}
onClick={() => {
playSound("homeButton");
updateContext({ isLaunching: false });
router.push("/");
}}
>
JOIN FULLCOUNT
</div>
)}

{!isBigView && <Score atBat={atBat} pitch={atBat.pitches[currentSessionIdx]} />}
{isBigView && atBat.outcome === 0 && !showPitchOutcome && (
<ScoreForDesktop atBat={atBat} pitch={atBat.pitches[currentSessionIdx]} openHistory />
)}
{atBat &&
showPitchOutcome &&
atBat.pitches.length > 0 &&
selectedToken &&
atBat.outcome === 0 && (
<div
className={
!outcomeType([selectedToken], atBat)
? styles.othersOutcome
: sessionOutcomeType(
[selectedToken],
atBat,
atBat.pitches[atBat.numberOfSessions - 2],
) === "positive"
? styles.positiveOutcome
: styles.negativeOutcome
}
>
{sessionOutcomes[atBat.pitches[atBat.numberOfSessions - 2].outcome]}!
</div>
)}
{atBat.outcome !== 0 && selectedToken && (
<div
className={
!outcomeType([selectedToken], atBat)
? styles.othersOutcome
: outcomeType([selectedToken], atBat) === "positive"
? styles.positiveOutcome2
: styles.negativeOutcome2
}
>
{outcomeType([selectedToken], atBat) === "positive" ? "you win!" : "you lose!"}
</div>
)}
{atBat.outcome === 0 &&
!showPitchOutcome &&
atBat.pitches[atBat.numberOfSessions - 1].progress !== 2 &&
atBat.pitches[currentSessionIdx].progress !== 6 && (
<div className={styles.playerView}>
{isBigView && atBat.pitcher && <TokenCard token={atBat.pitcher} isPitcher={true} />}
{selectedToken && isSameToken(selectedToken, atBat.pitcher) && (
<PitcherViewMobile
sessionStatus={atBat.pitches.slice(-1)[0]}
token={selectedToken as OwnedToken}
/>
)}
{selectedToken && isSameToken(selectedToken, atBat.batter) && (
<BatterViewMobile2
sessionStatus={atBat.pitches.slice(-1)[0]}
addSwing={handleSwing}
token={selectedToken as OwnedToken}
/>
{!isBigView && <Score atBat={atBat} pitch={atBat.pitches[currentSessionIdx]} />}
{isBigView && atBat.outcome === 0 && !showPitchOutcome && (
<ScoreForDesktop atBat={atBat} pitch={atBat.pitches[currentSessionIdx]} openHistory />
)}
{atBat &&
showPitchOutcome &&
atBat.pitches.length > 0 &&
selectedToken &&
atBat.outcome === 0 && (
<div
className={
!outcomeType([selectedToken], atBat)
? styles.othersOutcome
: sessionOutcomeType(
[selectedToken],
atBat,
atBat.pitches[atBat.numberOfSessions - 2],
) === "positive"
? styles.positiveOutcome
: styles.negativeOutcome
}
>
{sessionOutcomes[atBat.pitches[atBat.numberOfSessions - 2].outcome]}!
</div>
)}
{isBigView && atBat.batter && <TokenCard token={atBat.batter} isPitcher={false} />}
</div>
)}
{atBat && showPitchOutcome && atBat.pitches.length > 0 && (
<>
{atBat && (
<Outcome2
showTips={true}
atBat={atBat}
forToken={selectedToken}
sessionStatus={
atBat.outcome === 0
? atBat.pitches[atBat.numberOfSessions - 2]
: atBat.pitches[atBat.numberOfSessions - 1]
{atBat.outcome !== 0 && selectedToken && (
<div
className={
!outcomeType([selectedToken], atBat)
? styles.othersOutcome
: outcomeType([selectedToken], atBat) === "positive"
? styles.positiveOutcome2
: styles.negativeOutcome2
}
/>
>
{outcomeType([selectedToken], atBat) === "positive" ? "you win!" : "you lose!"}
</div>
)}
{atBat.outcome === 0 &&
!showPitchOutcome &&
atBat.pitches[atBat.numberOfSessions - 1].progress !== 2 &&
atBat.pitches[currentSessionIdx].progress !== 6 && (
<div className={styles.playerView}>
{isBigView && atBat.pitcher && <TokenCard token={atBat.pitcher} isPitcher={true} />}
{selectedToken && isSameToken(selectedToken, atBat.pitcher) && (
<PitcherViewMobile
sessionStatus={atBat.pitches.slice(-1)[0]}
token={selectedToken as OwnedToken}
/>
)}
{selectedToken && isSameToken(selectedToken, atBat.batter) && (
<BatterViewMobile2
sessionStatus={atBat.pitches.slice(-1)[0]}
addSwing={handleSwing}
token={selectedToken as OwnedToken}
/>
)}
{isBigView && atBat.batter && <TokenCard token={atBat.batter} isPitcher={false} />}
</div>
)}
{atBat && showPitchOutcome && atBat.pitches.length > 0 && (
<>
{atBat && (
<Outcome2
showTips={true}
atBat={atBat}
forToken={selectedToken}
sessionStatus={
atBat.outcome === 0
? atBat.pitches[atBat.numberOfSessions - 2]
: atBat.pitches[atBat.numberOfSessions - 1]
}
/>
)}
</>
)}
{!showPitchOutcome && !isBigView && <AtBatFooter atBat={atBat} />}
</>
)}
{!showPitchOutcome && !isBigView && <AtBatFooter atBat={atBat} />}
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/atbat/OnboardingAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AtBatStatus, BatterReveal, PitcherReveal, SessionStatus } from "../../t

export const selectedToken = {
address: "0xf40c0961A9CC5c037B92D2cb48167F7f62Dd7cD0",
id: "2",
id: "155",
image: "https://static.fullcount.xyz/Beer_League_Ballers/p2.png",
isStaked: true,
stakedSessionID: 0,
Expand Down
8 changes: 1 addition & 7 deletions web/src/components/atbat/OnboardingCharacter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import localStyles from "./OnboardingCharacter.module.css";
import React, { useEffect, useState } from "react";
import { blbImage } from "../../constants";
import { useSound } from "../../hooks/useSound";
const NUMBER_OF_IMAGES = 8;
const names = [
"Joe Expo",
"Playtest Celeste",
Expand All @@ -17,11 +16,6 @@ const names = [
"Drew Preview",
];

const images: number[] = [];
for (let i = 0; i < NUMBER_OF_IMAGES; i += 1) {
images.push(i);
}

const OnboardingCharacter = ({
onClose,
onChange,
Expand Down Expand Up @@ -53,7 +47,7 @@ const OnboardingCharacter = ({
<Image width={"161"} height={"161"} src={blbImage(imageIndex)} alt={""} />
<div className={localStyles.name}>{names[imageIndex]}</div>
<div className={styles.images}>
{images.map((_, idx: number) => (
{names.map((_, idx: number) => (
<Image
key={idx}
width={"50"}
Expand Down
8 changes: 7 additions & 1 deletion web/src/components/atbat/Outcome2.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
display: flex;
flex-direction: column;
align-items: center;
max-width: 80px;
max-width: 50px;
}

.actionType {
Expand Down Expand Up @@ -128,6 +128,12 @@
color: #CD7676;
}

@media (min-width: 440px) {
.imageContainer {
max-width: 80px;
}
}

@media (min-width: 1024px) {
.positiveOutcome, .negativeOutcome {
font-size: 30px;
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/atbat/TokenCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DetailedStat from "../playing/DetailedStat";

const TokenCard = ({ token, isPitcher }: { token: Token; isPitcher: boolean }) => {
const pitcherStats = useQuery(
["pitcher_stat", token],
["pitcher_stat", token.id],
async () => {
if (!token) {
return;
Expand All @@ -36,7 +36,7 @@ const TokenCard = ({ token, isPitcher }: { token: Token; isPitcher: boolean }) =
);

const batterStats = useQuery(
["batter_stat", token],
["batter_stat", token.id],
async () => {
if (!token) {
return;
Expand All @@ -61,7 +61,7 @@ const TokenCard = ({ token, isPitcher }: { token: Token; isPitcher: boolean }) =
);

const pitchDistributions = useQuery(
["pitch_distribution", token],
["pitch_distribution", token.id],
async () => {
if (!token) {
return;
Expand Down Expand Up @@ -98,7 +98,7 @@ const TokenCard = ({ token, isPitcher }: { token: Token; isPitcher: boolean }) =
);

const swingDistributions = useQuery(
["swing_distribution", token],
["swing_distribution", token.id],
async () => {
if (!token) {
return;
Expand Down
5 changes: 2 additions & 3 deletions web/src/components/tokens/CreateCharacterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import { TokenSource } from "../../types";
import { useMutation, useQueryClient } from "react-query";
import { mintFullcountPlayerToken } from "../../tokenInterfaces/FullcountPlayerAPI";
import useMoonToast from "../../hooks/useMoonToast";
import { blbImage } from "../../constants";
import { blbImage, NUMBER_OF_BLB_IMAGES } from "../../constants";
import { sendReport } from "../../utils/humbug";
import { useSound } from "../../hooks/useSound";
const NUMBER_OF_IMAGES = 8;

const images: number[] = [];
for (let i = 0; i < NUMBER_OF_IMAGES; i += 1) {
for (let i = 0; i < NUMBER_OF_BLB_IMAGES; i += 1) {
images.push(i);
}

Expand Down
2 changes: 2 additions & 0 deletions web/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@ export const LEADERBOARDS = [

export const blbImage = (idx: number) =>
`https://static.fullcount.xyz/Beer_League_Ballers/small/p${idx}.jpeg`;

export const NUMBER_OF_BLB_IMAGES = 16;
export const HUMBUG_REPORT_VERSION = "0.0.3";
Loading