Skip to content

Commit

Permalink
fix: count down timer not running on main tab
Browse files Browse the repository at this point in the history
  • Loading branch information
KagamiChan committed Jan 5, 2024
1 parent d91dbf2 commit 6bcaad2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion views/components/main/parts/mini-ship/mini-ship-pane.es
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const PaneBodyMini = connect(() => {
})
})(({ fleetId, shipsId, enableAvatar, enableOverviewFleetDetail, width }) => (
<>
<FleetStat fleetId={fleetId} isMini={!enableOverviewFleetDetail} />
<FleetStat fleetId={fleetId} isMini={!enableOverviewFleetDetail} isMainView />
<ShipDetailsMini className="ship-details-mini">
{!enableOverviewFleetDetail
? (shipsId || []).map((shipId, i) => (
Expand Down
12 changes: 8 additions & 4 deletions views/components/ship-parts/fleet-stat.es
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* global ROOT, getStore */
import { connect } from 'react-redux'
import React, { Component } from 'react'
import React, { Component, useId } from 'react'
import PropTypes from 'prop-types'
import { join } from 'path-extra'
import { get, join as joinString, memoize } from 'lodash'
Expand Down Expand Up @@ -35,7 +35,7 @@ import {
InfoTooltipItem,
} from 'views/components/etc/styled-components'

const isActive = () => getStore('ui.activeMainTab') === 'ship-view'
const isActive = () => ['ship-view', 'main-view'].includes(getStore('ui.activeMainTab'))

const FleetStats = styled.div`
white-space: nowrap;
Expand Down Expand Up @@ -224,6 +224,7 @@ export const FleetStat = compose(
condTarget,
canNotify,
t,
isMainView = false,
}) => {
const { saku33, saku33x2, saku33x3, saku33x4 } = saku
const { speed } = fleetSpeed
Expand Down Expand Up @@ -253,6 +254,9 @@ export const FleetStat = compose(
conds.map((cond) => recoveryEndTime(condTick, cond, condTarget)),
)
}

const timerId = useId()

return (
<FleetStats className="fleet-stat">
{isMini ? (
Expand Down Expand Up @@ -332,10 +336,10 @@ export const FleetStat = compose(
</Item>
<Item label={inExpedition ? t('main:Expedition') : t('main:Resting')}>
<CountdownLabel
fleetId={fleetId}
fleetId={`${timerId}-${fleetId}`}
fleetName={fleetName}
completeTime={completeTime}
shouldNotify={!inExpedition && !inBattle && canNotify}
shouldNotify={!inExpedition && !inBattle && !isMainView && canNotify}
/>
</Item>
</Container>
Expand Down

0 comments on commit 6bcaad2

Please sign in to comment.