Skip to content

Commit 010653e

Browse files
committed
feat(timeline): show all when finished
1 parent 4238c5e commit 010653e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/GZCTF/ClientApp/src/components/TimeLine.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ const TimeLine: FC<TimeLineProps> = ({ organization }) => {
2020

2121
const { game } = useGame(numId)
2222

23-
const { startTime, endTime, progress } = getGameStatus(game)
23+
const { startTime, endTime, progress, finished } = getGameStatus(game)
2424

2525
const totDuration = endTime.diff(startTime, 'd')
2626
const longGame = totDuration > 14
27+
2728
const weekProgress = (7 / totDuration) * 100
29+
const weekStart = progress - weekProgress
30+
const weekEnd = progress
2831

29-
const scaleStart = progress - weekProgress
30-
const scaleEnd = progress
32+
const drawStart = longGame && !finished ? weekStart : 0
33+
const drawEnd = longGame && !finished ? weekEnd : 100
3134

3235
const [now, setNow] = useState<Date>(new Date())
3336
const [chartData, setChartData] = useState<any>()
@@ -151,14 +154,14 @@ const TimeLine: FC<TimeLineProps> = ({ organization }) => {
151154
dataZoom: [
152155
{
153156
type: 'inside',
154-
start: longGame ? scaleStart : 0,
155-
end: longGame ? scaleEnd : 100,
157+
start: drawStart,
158+
end: drawEnd,
156159
xAxisIndex: 0,
157160
filterMode: 'none',
158161
},
159162
{
160-
start: longGame ? scaleStart : 0,
161-
end: longGame ? scaleEnd : 100,
163+
start: drawStart,
164+
end: drawEnd,
162165
xAxisIndex: 0,
163166
showDetail: false,
164167
},

0 commit comments

Comments
 (0)