follows.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import React from "react"
  2. import Followers from "misago/components/profile/followers"
  3. export default class extends Followers {
  4. setSpecialProps() {
  5. this.PRELOADED_DATA_KEY = "PROFILE_FOLLOWS"
  6. this.TITLE = gettext("Follows")
  7. this.API_FILTER = "follows"
  8. }
  9. getLabel() {
  10. if (!this.state.isLoaded) {
  11. return gettext("Loading...")
  12. } else if (this.state.search) {
  13. let message = ngettext(
  14. "Found %(users)s user.",
  15. "Found %(users)s users.",
  16. this.state.count
  17. )
  18. return interpolate(
  19. message,
  20. {
  21. users: this.state.count
  22. },
  23. true
  24. )
  25. } else if (this.props.profile.id === this.props.user.id) {
  26. let message = ngettext(
  27. "You are following %(users)s user.",
  28. "You are following %(users)s users.",
  29. this.state.count
  30. )
  31. return interpolate(
  32. message,
  33. {
  34. users: this.state.count
  35. },
  36. true
  37. )
  38. } else {
  39. let message = ngettext(
  40. "%(username)s is following %(users)s user.",
  41. "%(username)s is following %(users)s users.",
  42. this.state.count
  43. )
  44. return interpolate(
  45. message,
  46. {
  47. username: this.props.profile.username,
  48. users: this.state.count
  49. },
  50. true
  51. )
  52. }
  53. }
  54. getEmptyMessage() {
  55. if (this.state.search) {
  56. return gettext("Search returned no users matching specified criteria.")
  57. } else if (this.props.user.id === this.props.profile.id) {
  58. return gettext("You are not following any users.")
  59. } else {
  60. return interpolate(
  61. gettext("%(username)s is not following any users."),
  62. {
  63. username: this.props.profile.username
  64. },
  65. true
  66. )
  67. }
  68. }
  69. }