logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

navigation.js (2505B)


  1. // routes that take :username property
  2. export const USERNAME_ROUTES = new Set([
  3. 'dms',
  4. 'interactions',
  5. 'notifications',
  6. 'chat',
  7. 'chats'
  8. ])
  9. // routes that take :name property
  10. export const NAME_ROUTES = new Set([
  11. 'user-profile',
  12. 'legacy-user-profile'
  13. ])
  14. export const TIMELINES = {
  15. home: {
  16. route: 'friends',
  17. icon: 'home',
  18. label: 'nav.home_timeline',
  19. criteria: ['!private']
  20. },
  21. public: {
  22. route: 'public-timeline',
  23. anon: true,
  24. icon: 'users',
  25. label: 'nav.public_tl',
  26. criteria: ['!private']
  27. },
  28. twkn: {
  29. route: 'public-external-timeline',
  30. anon: true,
  31. icon: 'globe',
  32. label: 'nav.twkn',
  33. criteria: ['!private', 'federating']
  34. },
  35. bookmarks: {
  36. route: 'bookmarks',
  37. icon: 'bookmark',
  38. label: 'nav.bookmarks',
  39. criteria: ['!supportsBookmarkFolders']
  40. },
  41. favorites: {
  42. routeObject: { name: 'user-profile', query: { tab: 'favorites' } },
  43. icon: 'star',
  44. label: 'user_card.favorites'
  45. },
  46. dms: {
  47. route: 'dms',
  48. icon: 'envelope',
  49. label: 'nav.dms'
  50. }
  51. }
  52. export const ROOT_ITEMS = {
  53. interactions: {
  54. route: 'interactions',
  55. icon: 'bell',
  56. label: 'nav.interactions'
  57. },
  58. chats: {
  59. route: 'chats',
  60. icon: 'comments',
  61. label: 'nav.chats',
  62. badgeStyle: 'notification',
  63. badgeGetter: 'unreadChatCount',
  64. criteria: ['chats']
  65. },
  66. friendRequests: {
  67. route: 'friend-requests',
  68. icon: 'user-plus',
  69. label: 'nav.friend_requests',
  70. badgeStyle: 'notification',
  71. criteria: ['lockedUser'],
  72. badgeGetter: 'followRequestCount'
  73. },
  74. about: {
  75. route: 'about',
  76. anon: true,
  77. icon: 'info-circle',
  78. label: 'nav.about'
  79. },
  80. announcements: {
  81. route: 'announcements',
  82. icon: 'bullhorn',
  83. label: 'nav.announcements',
  84. badgeStyle: 'notification',
  85. badgeGetter: 'unreadAnnouncementCount',
  86. criteria: ['announcements']
  87. },
  88. drafts: {
  89. route: 'drafts',
  90. icon: 'file-pen',
  91. label: 'nav.drafts',
  92. badgeStyle: 'neutral',
  93. badgeGetter: 'draftCount'
  94. }
  95. }
  96. export function routeTo (item, currentUser) {
  97. if (!item.route && !item.routeObject) return null
  98. let route
  99. if (item.routeObject) {
  100. route = item.routeObject
  101. } else {
  102. route = { name: (item.anon || currentUser) ? item.route : item.anonRoute }
  103. }
  104. if (USERNAME_ROUTES.has(route.name)) {
  105. route.params = { username: currentUser.screen_name }
  106. } else if (NAME_ROUTES.has(route.name)) {
  107. route.params = { name: currentUser.screen_name }
  108. }
  109. return route
  110. }