Skip to content

Commit

Permalink
chore: cumulative update for ux improvements (#39)
Browse files Browse the repository at this point in the history
1. Added more status colors
2. Fixed username length for malicious user
  • Loading branch information
thezzisu authored Jan 23, 2024
1 parent 2a11bd4 commit 3d2e114
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .yarn/versions/2330b447.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
releases:
"@aoi-js/frontend": patch
"@aoi-js/server": patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const stateMap = {
0: ['created', 'mdi-moon-new', 'grey'],
1: ['pending', 'mdi-timer-sand', 'orange'],
2: ['queued', 'mdi-cloud-outline', 'blue'],
3: ['running', 'mdi-play', 'green'],
3: ['running', 'mdi-play', 'indigo'],
4: ['completed', 'mdi-check', 'success']
} as const
const state = computed(() => stateMap[props.state as never] ?? ['unknown', 'mdi-help', 'grey'])
Expand Down
4 changes: 3 additions & 1 deletion apps/frontend/src/components/solution/SolutionStatusChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const knownStatus: Record<string, [string, string]> = {
'Time Limit Exceeded': ['mdi-timer-alert-outline', 'error'],
'Wrong Answer': ['mdi-close', 'error'],
'Compile Error': ['mdi-code-braces', 'error'],
'Internal Error': ['mdi-help-circle-outline', '']
'Internal Error': ['mdi-help-circle-outline', ''],
'Runtime Error': ['mdi-alert-decagram-outline', 'error'],
Running: ['mdi-play', 'indigo']
}
const display = computed(() => knownStatus[props.status] ?? ['mdi-circle-outline', 'warning'])
</script>
10 changes: 8 additions & 2 deletions apps/server/src/auth/mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { cache } from '../cache/index.js'
import { httpErrors } from '@fastify/sensible'

const SEmailPayload = Type.Object({
email: Type.String({ pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$' })
email: Type.String({
maxLength: 128,
pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$'
})
})

const EmailPayload = TypeCompiler.Compile(SEmailPayload)
Expand All @@ -22,7 +25,10 @@ const SCodePayload = Type.Object({
const CodePayload = TypeCompiler.Compile(SCodePayload)

const SLoginPayload = Type.Object({
email: Type.String({ pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$' }),
email: Type.String({
maxLength: 128,
pattern: '^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$'
}),
code: Type.String({ pattern: '^[0-9]{6}$' })
})

Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/schemas/user.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Type, Static } from '@sinclair/typebox'

export const SUserProfile = Type.StrictObject({
name: Type.String(),
email: Type.String({ pattern: '^\\S+@\\S+$' }),
realname: Type.String(),
name: Type.String({ maxLength: 16 }),
email: Type.String({ maxLength: 128, pattern: '^\\S+@\\S+$' }),
realname: Type.String({ maxLength: 16 }),
telephone: Type.Optional(Type.String({ pattern: '^\\d{11}$' })),
school: Type.Optional(Type.String()),
studentGrade: Type.Optional(Type.String()),
school: Type.Optional(Type.String({ maxLength: 32 })),
studentGrade: Type.Optional(Type.String({ maxLength: 32 })),
verified: Type.Optional(Type.Array(Type.String()))
})

Expand Down

0 comments on commit 3d2e114

Please sign in to comment.