You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

account.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { SlashCommandHandler } from './types'
  2. import React from 'react'
  3. import { RiUser3Line } from '@remixicon/react'
  4. import i18n from '@/i18n-config/i18next-config'
  5. import { registerCommands, unregisterCommands } from './command-bus'
  6. // Account command dependency types - no external dependencies needed
  7. type AccountDeps = Record<string, never>
  8. /**
  9. * Account command - Navigates to account page
  10. */
  11. export const accountCommand: SlashCommandHandler<AccountDeps> = {
  12. name: 'account',
  13. description: 'Navigate to account page',
  14. async search(args: string, locale: string = 'en') {
  15. return [{
  16. id: 'account',
  17. title: i18n.t('common.account.account', { lng: locale }),
  18. description: i18n.t('app.gotoAnything.actions.accountDesc', { lng: locale }),
  19. type: 'command' as const,
  20. icon: (
  21. <div className='flex h-6 w-6 items-center justify-center rounded-md border-[0.5px] border-divider-regular bg-components-panel-bg'>
  22. <RiUser3Line className='h-4 w-4 text-text-tertiary' />
  23. </div>
  24. ),
  25. data: { command: 'navigation.account', args: {} },
  26. }]
  27. },
  28. register(_deps: AccountDeps) {
  29. registerCommands({
  30. 'navigation.account': async (_args) => {
  31. // Navigate to account page
  32. window.location.href = '/account'
  33. },
  34. })
  35. },
  36. unregister() {
  37. unregisterCommands(['navigation.account'])
  38. },
  39. }