Home.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="web-wrapper">
  3. <div v-if="isLoaded" class="container-fluid mt-3">
  4. <div class="row">
  5. <div class="col-md-4 col-lg-3">
  6. <sidebar
  7. :user="profile"
  8. @refresh="shouldRefresh = true" />
  9. </div>
  10. <div class="col-md-8 col-lg-6 px-0">
  11. <story-carousel
  12. v-if="storiesEnabled"
  13. :profile="profile" />
  14. <timeline
  15. :profile="profile"
  16. :scope="scope"
  17. :key="scope"
  18. v-on:update-profile="updateProfile"
  19. :refresh="shouldRefresh"
  20. @refreshed="shouldRefresh = false" />
  21. </div>
  22. <div class="d-none d-lg-block col-lg-3">
  23. <rightbar class="sticky-top sidebar" />
  24. </div>
  25. </div>
  26. <drawer />
  27. </div>
  28. <div v-else class="d-flex justify-content-center align-items-center" style="height:calc(100vh - 58px);">
  29. <b-spinner />
  30. </div>
  31. </div>
  32. </template>
  33. <script type="text/javascript">
  34. import Drawer from './partials/drawer.vue';
  35. import Sidebar from './partials/sidebar.vue';
  36. import Rightbar from './partials/rightbar.vue';
  37. import Timeline from './sections/Timeline.vue';
  38. import Notifications from './sections/Notifications.vue';
  39. import StoryCarousel from './partials/timeline/StoryCarousel.vue';
  40. export default {
  41. props: {
  42. scope: {
  43. type: String,
  44. default: 'home'
  45. }
  46. },
  47. components: {
  48. "drawer": Drawer,
  49. "sidebar": Sidebar,
  50. "timeline": Timeline,
  51. "rightbar": Rightbar,
  52. "story-carousel": StoryCarousel,
  53. },
  54. data() {
  55. return {
  56. isLoaded: false,
  57. profile: undefined,
  58. recommended: [],
  59. trending: [],
  60. storiesEnabled: false,
  61. shouldRefresh: false
  62. }
  63. },
  64. mounted() {
  65. this.init();
  66. },
  67. watch: {
  68. '$route': 'init'
  69. },
  70. methods: {
  71. init() {
  72. this.profile = window._sharedData.user;
  73. this.isLoaded = true;
  74. this.storiesEnabled = window.App?.config?.features?.hasOwnProperty('stories') ? window.App.config.features.stories : false;
  75. },
  76. updateProfile(delta) {
  77. this.profile = Object.assign(this.profile, delta);
  78. }
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. .avatar {
  84. border-radius: 15px;
  85. }
  86. .username {
  87. margin-bottom: -6px;
  88. }
  89. .btn-white {
  90. background-color: #fff;
  91. border: 1px solid #F3F4F6;
  92. }
  93. .sidebar {
  94. top: 90px;
  95. }
  96. </style>