Skip to content

Commit

Permalink
Maintenance: Desktop - Provide additional icon aliases for shared com…
Browse files Browse the repository at this point in the history
…ponents/modules.
  • Loading branch information
dvuckovic committed Dec 8, 2023
1 parent b3c3824 commit 831df33
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
Expand Up @@ -4,6 +4,11 @@ export default {
'vip-user': 'crown',
'vip-organization': 'crown-silver',
'input-cancel': 'close-small',
'alert-danger': 'x-circle',
'alert-dismiss': 'close',
'alert-info': 'info-circle',
'alert-success': 'check-circle-outline',
'alert-warning': 'exclamation-triangle',
tooltip: 'info',

'notification-warn': 'info',
Expand Down Expand Up @@ -36,6 +41,9 @@ export default {
'editor-mention-knowledge-base': 'mention-kb',
'editor-mention-text-module': 'snippet',

'2fa-security-keys': 'security-key',
'2fa-authenticator-app': 'mobile-code',

// these aliases are used in shared context, but they refer to the same name
search: 'search',
loading: 'loading',
Expand Down
8 changes: 8 additions & 0 deletions app/frontend/apps/mobile/initializer/mobileIconsAliasesMap.ts
Expand Up @@ -4,6 +4,11 @@ export default {
'vip-user': 'crown',
'vip-organization': 'crown-silver',
'input-cancel': 'close-small',
'alert-danger': 'x-circle',
'alert-dismiss': 'close',
'alert-info': 'info-circle',
'alert-success': 'check-circle-outline',
'alert-warning': 'exclamation-triangle',
tooltip: 'info',

'notification-warn': 'info',
Expand Down Expand Up @@ -36,6 +41,9 @@ export default {
'editor-mention-knowledge-base': 'mention-kb',
'editor-mention-text-module': 'snippet',

'2fa-security-keys': 'security-key',
'2fa-authenticator-app': 'mobile-code',

// these aliases are used in shared context, but they refer to the same name
search: 'search',
loading: 'loading',
Expand Down
13 changes: 6 additions & 7 deletions app/frontend/shared/components/CommonAlert/CommonAlert.vue
Expand Up @@ -18,15 +18,14 @@ const props = withDefaults(defineProps<Props>(), {
const icon = computed(() => {
switch (props.variant) {
case 'success':
return 'desktop-check-circle-outline'
case 'info':
return 'desktop-info-circle'
return 'alert-success'
case 'warning':
return 'desktop-exclamation-triangle'
return 'alert-warning'
case 'danger':
return 'desktop-x-circle'
return 'alert-danger'
case 'info':
default:
return 'desktop-info-circle'
return 'alert-info'
}
})
Expand Down Expand Up @@ -69,7 +68,7 @@ const dismissed = ref(false)
v-if="props.dismissible"
size="small"
decorative
name="mobile-close"
name="alert-dismiss"
class="ltr:mr-2 rtl:ml-2 cursor-pointer"
@click="dismissed = true"
/>
Expand Down
Expand Up @@ -16,8 +16,8 @@ describe('CommonAlert.vue', () => {
expect(alert).toHaveTextContent('Dummy')
expect(alert).toHaveClass('alert-info')

expect(view.getByIconName('desktop-info-circle')).toBeInTheDocument()
expect(view.queryByIconName('mobile-close')).not.toBeInTheDocument()
expect(view.getByIconName('info-circle')).toBeInTheDocument()
expect(view.queryByIconName('close')).not.toBeInTheDocument()
})

it('renders an alert with a specific variant', () => {
Expand All @@ -35,8 +35,8 @@ describe('CommonAlert.vue', () => {
expect(alert).toHaveTextContent('Dummy')
expect(alert).toHaveClass('alert-error')

expect(view.getByIconName('desktop-x-circle')).toBeInTheDocument()
expect(view.queryByIconName('mobile-close')).not.toBeInTheDocument()
expect(view.getByIconName('x-circle')).toBeInTheDocument()
expect(view.queryByIconName('close')).not.toBeInTheDocument()
})

it('renders an dismissible alert', () => {
Expand All @@ -53,7 +53,7 @@ describe('CommonAlert.vue', () => {

expect(alert).toHaveTextContent('Dummy')
expect(alert).toHaveClass('alert-info')
expect(view.getByIconName('mobile-close')).toBeInTheDocument()
expect(view.getByIconName('close')).toBeInTheDocument()
})

it('renders an alert with a link', () => {
Expand Down
Expand Up @@ -8,5 +8,5 @@ export default {
label: __('Authenticator App'),
order: 200,
helpMessage: __('Enter the code from your two-factor authenticator app.'),
icon: 'mobile-code',
icon: '2fa-authenticator-app',
} satisfies TwoFactorPlugin
Expand Up @@ -39,5 +39,5 @@ export default {
}
}
},
icon: 'security-key',
icon: '2fa-security-keys',
} satisfies TwoFactorPlugin

0 comments on commit 831df33

Please sign in to comment.