Skip to content

Commit

Permalink
feat: initial support for total_stationed_gmax
Browse files Browse the repository at this point in the history
  • Loading branch information
Mygod committed Nov 18, 2024
1 parent 35b8643 commit 8632cb3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/types/lib/scanner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export interface Station<Parsed extends boolean = false> {
battle_pokemon_move_2: number

total_stationed_pokemon: number
total_stationed_gmax: number
stationed_pokemon: Parsed extends true
? StationPokemon[]
: string | StationPokemon[]
Expand Down
1 change: 1 addition & 0 deletions server/src/graphql/typeDefs/scanner.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ type Station {
end_time: Int
cooldown_complete: Int
total_stationed_pokemon: Int
total_stationed_gmax: Int
is_battle_available: Boolean
is_inactive: Boolean
battle_level: Int
Expand Down
1 change: 1 addition & 0 deletions server/src/models/Station.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Station extends Model {
'start_time',
'end_time',
'total_stationed_pokemon',
'total_stationed_gmax',
]

const query = this.query()
Expand Down
13 changes: 7 additions & 6 deletions src/features/station/StationPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next'
import Card from '@mui/material/Card'
import CardMedia from '@mui/material/CardMedia'
import CardContent from '@mui/material/CardContent'
import CardActions from '@mui/material/CardActions'
import CardHeader from '@mui/material/CardHeader'
import Collapse from '@mui/material/Collapse'
import ExpandMore from '@mui/icons-material/ExpandMore'
Expand Down Expand Up @@ -169,7 +168,7 @@ const Footer = ({ lat, lon }) => {
}

/** @param {import('@rm/types').Station} props */
const ExtraInfo = ({ updated, lat, lon }) => {
const ExtraInfo = ({ updated }) => {
const open = useStorage((s) => s.popups.extras)
const { t } = useTranslation()
const dateFormatter = useFormatStore((s) => s.dateFormat)
Expand Down Expand Up @@ -267,7 +266,6 @@ function StationMenu({

/** @param {import('@rm/types').Station} props */
function StationMedia({
is_battle_available,
battle_pokemon_id,
battle_pokemon_form,
battle_pokemon_alignment,
Expand Down Expand Up @@ -350,7 +348,7 @@ function StationMedia({
}

/** @param {import('@rm/types').Station} station */
function StationAttackBonus({ total_stationed_pokemon }) {
function StationAttackBonus({ total_stationed_pokemon, total_stationed_gmax }) {
const { t } = useTranslation()
return (
<Stack alignItems="center">
Expand All @@ -362,7 +360,11 @@ function StationAttackBonus({ total_stationed_pokemon }) {
max={4}
/>
<Typography variant="caption">
{t('battle_bonus')} &nbsp;({total_stationed_pokemon} / 40)
{t('battle_bonus')} &nbsp;(
{total_stationed_gmax === undefined || total_stationed_gmax === null
? ''
: `${total_stationed_gmax} / `}
{total_stationed_pokemon} / 40)
</Typography>
</Stack>
)
Expand Down Expand Up @@ -459,7 +461,6 @@ function LiveTimeStamp({ start = false, epoch, ...props }) {
function StationTimeStamp({ start = false, epoch, ...props }) {
const { t } = useTranslation()
const relativeTime = useRelativeTimer(epoch || 0)
const pastTense = epoch * 1000 < Date.now()

return (
<Typography variant="subtitle2" {...props}>
Expand Down
1 change: 1 addition & 0 deletions src/services/queries/station.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const core = gql`
start_time
end_time
total_stationed_pokemon
total_stationed_gmax
}
`

Expand Down

0 comments on commit 8632cb3

Please sign in to comment.