Commit d47b6744 authored by Tom Quirk's avatar Tom Quirk

Address reviewer feedback

- move avatar shape options to vue shared constants
- improve approver props validator naming
parent 20082d12
...@@ -63,3 +63,6 @@ export const timeRanges = [ ...@@ -63,3 +63,6 @@ export const timeRanges = [
export const defaultTimeRange = timeRanges.find((tr) => tr.default); export const defaultTimeRange = timeRanges.find((tr) => tr.default);
export const getTimeWindow = (timeWindowName) => export const getTimeWindow = (timeWindowName) =>
timeRanges.find((tr) => tr.name === timeWindowName); timeRanges.find((tr) => tr.name === timeWindowName);
export const AVATAR_SHAPE_OPTION_CIRCLE = 'circle';
export const AVATAR_SHAPE_OPTION_RECT = 'rect';
<script> <script>
import { GlButton, GlTooltipDirective, GlAvatarLabeled } from '@gitlab/ui'; import { GlButton, GlTooltipDirective, GlAvatarLabeled } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { AVATAR_SHAPE_OPTION_CIRCLE, AVATAR_SHAPE_OPTION_RECT } from '~/vue_shared/constants';
import { TYPE_USER, TYPE_GROUP, TYPE_HIDDEN_GROUPS } from '../constants'; import { TYPE_USER, TYPE_GROUP, TYPE_HIDDEN_GROUPS } from '../constants';
import HiddenGroupsItem from './hidden_groups_item.vue'; import HiddenGroupsItem from './hidden_groups_item.vue';
const types = [TYPE_USER, TYPE_GROUP, TYPE_HIDDEN_GROUPS]; const VALID_APPROVER_TYPES = [TYPE_USER, TYPE_GROUP, TYPE_HIDDEN_GROUPS];
export default { export default {
components: { components: {
...@@ -19,7 +20,7 @@ export default { ...@@ -19,7 +20,7 @@ export default {
approver: { approver: {
type: Object, type: Object,
required: true, required: true,
validator: ({ type }) => type && types.includes(type), validator: ({ type }) => type && VALID_APPROVER_TYPES.includes(type),
}, },
}, },
computed: { computed: {
...@@ -33,7 +34,7 @@ export default { ...@@ -33,7 +34,7 @@ export default {
return this.isGroup ? this.approver.full_path : this.approver.name; return this.isGroup ? this.approver.full_path : this.approver.name;
}, },
avatarShape() { avatarShape() {
return this.isGroup ? 'rect' : 'circle'; return this.isGroup ? AVATAR_SHAPE_OPTION_RECT : AVATAR_SHAPE_OPTION_CIRCLE;
}, },
}, },
i18n: { i18n: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment