Skip to content

Commit

Permalink
Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Mar 13, 2024
1 parent 3fcf7cc commit e7d0890
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useMemo } from 'react'
import { LinearAnimatedProgressBar } from './LinearAnimatedProgressBar'
import { useIntervalTimer } from '@/utils/hooks/useIntervalTimer'

Expand All @@ -12,17 +11,6 @@ export const useEventCountdownProgressBar = (
EventCountdownProgressBar: JSX.Element
} => {
useIntervalTimer(60000)
// const currentDate = new Date()
// const currentTimeInSeconds = currentDate.getTime() / 1000
// const startTimeInSeconds = Math.floor(startDate.getTime() / 1000)
// const endTimeInSeconds = Math.floor(endDate.getTime() / 1000)

// const timeRemainingInSeconds = endTimeInSeconds - currentTimeInSeconds
// const timeRemainingInMinutes = Math.ceil(timeRemainingInSeconds / 60)

// const isStarted = currentTimeInSeconds >= startTimeInSeconds
// const isComplete = timeRemainingInSeconds <= 0
// const isPending = isStarted && !isComplete

const { timeRemainingInMinutes, isComplete, isPending } =
getCountdownTimeStatus(startDate, endDate)
Expand Down Expand Up @@ -83,7 +71,6 @@ export const EventCountdownProgressBar = ({
id="linear-animated-progress-bar"
startDate={startDate}
endDate={endDate}
status={status}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import { memo } from 'react'
import { getTimeMinutesBeforeNow } from '@/utils/time'
import { getCountdownTimeStatus } from './EventCountdownProgressBar'

/**
* @param id unique identifier for progress bar instance
* @param startTime start time in unix seconds
* @param endTime end time in unix seconds
* @param status progress status
*/
export const LinearAnimatedProgressBar = memo(
({
id,
startDate,
endDate,
status,
}: {
id: string
startDate: Date
endDate: Date
status: 'idle' | 'pending' | 'complete'
}) => {
const {
totalTimeInSeconds,
Expand All @@ -27,17 +23,10 @@ export const LinearAnimatedProgressBar = memo(
isComplete,
} = getCountdownTimeStatus(startDate, endDate)

// const currentTime = Math.floor(getTimeMinutesBeforeNow(0))
// const elapsedTimeInSeconds = currentTime - startTime
// const remainingTimeInSeconds = endTime - currentTime
// const totalTimeInSeconds = endTime - startTime

const percentElapsed = Math.floor(
(timeElapsedInSeconds / totalTimeInSeconds) * 100
)

// const isComplete = status === 'complete'

let duration = isComplete ? 0.5 : timeRemainingInSeconds

const synapsePurple = 'hsl(265deg 100% 75%)'
Expand Down

0 comments on commit e7d0890

Please sign in to comment.