logo

pleroma-fe

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

navigation.js (2033B)


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