Skip to content

Commit

Permalink
Add Boolean column, add alert tooltip for isFlagged PBs
Browse files Browse the repository at this point in the history
  • Loading branch information
big213 committed Oct 16, 2021
1 parent cbda639 commit c8a0015
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/components/interface/viewPbCardInterface.vue
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ export default {
attemptsSucceeded: true,
attemptsTotal: true,
setSize: true,
isFlagged: true,
pbClass: {
id: true,
name: true,
Expand Down
15 changes: 15 additions & 0 deletions frontend/components/table/common/booleanColumn.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div>
<v-chip small :color="currentValue ? 'green' : 'red'" text-color="white">
{{ currentValue ? 'Yes' : 'No' }}
</v-chip>
</div>
</template>

<script>
import columnMixin from '~/mixins/column'
export default {
mixins: [columnMixin],
}
</script>
13 changes: 13 additions & 0 deletions frontend/components/table/common/resultColumn.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
<template>
<div v-if="currentValue">
{{ renderedResult }}
<v-tooltip v-if="currentValue.isFlagged" bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon small color="pink" v-bind="attrs" v-on="on">mdi-alert</v-icon>
</template>
<span
>A moderator has flagged this PB as suspicious.
<br />
For the PB creator: If it was mistakenly entered, please delete it and
re-enter the correct time.
<br />If you believe this was flagged in error, please contact us at
[email protected] with supporting evidence.</span
>
</v-tooltip>
</div>
</template>

Expand Down
9 changes: 6 additions & 3 deletions frontend/models/personalBest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import UserColumn from '~/components/table/common/userColumn.vue'
import EventColumn from '~/components/table/common/eventColumn.vue'
import ResultColumn from '~/components/table/common/resultColumn.vue'
import PbTypeColumn from '~/components/table/common/pbTypeColumn.vue'
import BooleanColumn from '~/components/table/common/booleanColumn.vue'
import { serializeTime } from '~/services/base'
import EditPersonalBestInterface from '~/components/interface/crud/special/editPersonalBestInterface.vue'
import ViewRecordTableInterface from '~/components/interface/crud/viewRecordTableInterface.vue'
Expand Down Expand Up @@ -72,7 +73,7 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
primaryField: 'setSize',
},
},
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod': {
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod+isFlagged': {
text: 'Result',
compoundOptions: {
primaryField: 'score',
Expand Down Expand Up @@ -273,11 +274,13 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
text: 'Is Current PB',
inputType: 'switch',
parseQueryValue: (val) => val === 'true',
component: BooleanColumn,
},
isFlagged: {
text: 'Is Flagged',
inputType: 'switch',
parseQueryValue: (val) => val === 'true',
component: BooleanColumn,
},
'createdBy.userUserFollowLink/user.id': {},
publicComments: {
Expand Down Expand Up @@ -348,7 +351,7 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
},
{
field:
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod',
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod+isFlagged',
sortable: true,
width: '150px',
align: 'right',
Expand Down Expand Up @@ -401,7 +404,7 @@ export const PersonalBest = <RecordInfo<'personalBest'>>{
fields: [
'event.id+event.name+event.cubingIcon',
'pbClass.name+setSize',
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod',
'score+timeElapsed+movesCount+attemptsSucceeded+attemptsTotal+event.scoreMethod+isFlagged',
'ranking',
'happenedOn',
'publicComments',
Expand Down

0 comments on commit c8a0015

Please sign in to comment.