Skip to content

Commit

Permalink
fix(frontend): typos & unexpected milliseconds
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Aug 11, 2023
1 parent ebc20ee commit 7209c6c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/GZCTF/ClientApp/src/pages/admin/games/[id]/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ const GameInfoEdit: FC = () => {
.hour(Number(newTime[0]))
.minute(Number(newTime[1]))
.second(Number(newTime[2]))
.millisecond(0)
setStart(newDate)
if (newDate && end < newDate) {
setEnd(newDate.add(2, 'h'))
Expand Down Expand Up @@ -318,6 +319,7 @@ const GameInfoEdit: FC = () => {
.hour(Number(newTime[0]))
.minute(Number(newTime[1]))
.second(Number(newTime[2]))
.millisecond(0)
setEnd(newDate)
}}
error={end < start}
Expand Down
7 changes: 3 additions & 4 deletions src/GZCTF/ClientApp/src/utils/useGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ export const getGameStatus = (game?: DetailedGameInfoModel) => {
const startTime = dayjs(game?.start)
const endTime = dayjs(game?.end)

const duriation = endTime.diff(startTime, 'minute')
const total = endTime.diff(startTime, 'minute')
const current = dayjs().diff(startTime, 'minute')

const finished = current > duriation
const finished = current > total
const started = current > 0
const total = endTime.diff(startTime, 'minute')
const progress = started ? (finished ? 1 : current / duriation) : 0
const progress = started ? (finished ? 1 : current / total) : 0
const status = started ? (finished ? GameStatus.Ended : GameStatus.OnGoing) : GameStatus.Coming

return {
Expand Down
4 changes: 2 additions & 2 deletions src/GZCTF/Services/MailSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public bool SendConfirmEmailUrl(string? userName, string? email, string? confirm
"确认验证邮箱", userName, email, confirmLink);

public bool SendChangeEmailUrl(string? userName, string? email, string? resetLink)
=> SendUrlIfPossible("更改邮箱",
=> SendUrlIfPossible("更换邮箱",
"你正在进行账户邮箱更换操作,请点击下方按钮验证你的新邮箱。",
"确认跟换邮箱", userName, email, resetLink);
"确认更换邮箱", userName, email, resetLink);

public bool SendResetPasswordUrl(string? userName, string? email, string? resetLink)
=> SendUrlIfPossible("重置密码",
Expand Down

0 comments on commit 7209c6c

Please sign in to comment.