Skip to content

Commit 84ed90a

Browse files
committed
Add home page / Change feed page
1 parent 57b5035 commit 84ed90a

File tree

11 files changed

+225
-144
lines changed

11 files changed

+225
-144
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<template>
2+
<BasePageContainer
3+
:response-data="feedData"
4+
:is-loading="isLoading"
5+
:error="error"
6+
>
7+
<slot
8+
:feed-data="feedData"
9+
:is-loading="isLoading"
10+
:error="error"
11+
:fetch-data="fetchData"
12+
:refresh="refresh"
13+
/>
14+
</BasePageContainer>
15+
</template>
16+
17+
<script>
18+
import BasePageContainer
19+
from '*/components/containers/pages/BasePageContainer.vue'
20+
import navigationMixin from '*/mixins/navigationMixin'
21+
import {
22+
feed as formatFeedPageNavigation
23+
} from '*/helpers/formatters/navigation'
24+
import {
25+
feed as formatFeedPageTab
26+
} from '*/helpers/formatters/tabs'
27+
import getFeed from '*/helpers/actions/api/feed/get'
28+
29+
export default {
30+
name: 'BaseFeedPageContainer',
31+
components: {
32+
BasePageContainer
33+
},
34+
mixins: [
35+
navigationMixin
36+
],
37+
props: {
38+
limit: Number
39+
},
40+
data () {
41+
return {
42+
feedData: null,
43+
error: null,
44+
isLoading: false
45+
}
46+
},
47+
computed: {
48+
navigationSections () {
49+
return formatFeedPageNavigation()
50+
},
51+
tabData () {
52+
return formatFeedPageTab()
53+
},
54+
feedArgs () {
55+
return {
56+
limit: this.limit
57+
}
58+
}
59+
},
60+
mounted () {
61+
this.setNavigation()
62+
63+
this.fetchData()
64+
},
65+
methods: {
66+
getFeed,
67+
fetchData (
68+
page
69+
) {
70+
this.getFeed(
71+
{
72+
...this.feedArgs,
73+
page
74+
}
75+
)
76+
},
77+
refresh (
78+
page
79+
) {
80+
this.fetchData(
81+
page
82+
)
83+
}
84+
}
85+
}
86+
</script>
87+
88+
<style lang="sass" scoped></style>

src/components/layout/TheBrowserTabs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export default {
235235
getNewTabData () {
236236
return {
237237
uuid: generateKey(),
238-
path: 'feed'
238+
path: 'home'
239239
}
240240
}
241241
}

src/helpers/data/plugins/i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"navigation": {
3+
"home": "Home page",
34
"artists": "Artists",
45
"artist": "Artist",
56
"albums": "Albums",

src/helpers/data/plugins/i18n/locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"navigation": {
3+
"home": "Домашняя страница",
34
"artists": "Исполнители",
45
"artist": "Исполнитель",
56
"albums": "Альбомы",

src/helpers/data/plugins/router/routes.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
const RootPage = () => import(
22
'*/views/RootPage.vue'
33
)
4+
const HomePage = () => import(
5+
'*/views/HomePage.vue'
6+
)
47
const FeedPage = () => import(
58
'*/views/FeedPage.vue'
69
)
@@ -175,6 +178,13 @@ export default [
175178
component: RootPage,
176179
props: true
177180
},
181+
{
182+
path: '/home',
183+
exact: true,
184+
name: 'HomePage',
185+
component: HomePage,
186+
props: true
187+
},
178188
{
179189
path: '/feed',
180190
exact: true,

src/helpers/formatters/navigation.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import formatHomeSection
2+
from '*/helpers/formatters/navigation/sections/home'
13
import formatFeedSection
24
from '*/helpers/formatters/navigation/sections/feed'
35
import formatProfilesSection
@@ -13,6 +15,16 @@ import formatConversationsSection
1315
import formatCommunitiesSection
1416
from '*/helpers/formatters/navigation/sections/communities'
1517

18+
export function home () {
19+
return [
20+
formatHomeSection(
21+
{
22+
isActive: true
23+
}
24+
)
25+
]
26+
}
27+
1628
export function feed () {
1729
return [
1830
formatFeedSection(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import i18n from '*/plugins/i18n'
2+
3+
export default function (
4+
{
5+
isActive
6+
}
7+
) {
8+
return {
9+
name: i18n.global.t(
10+
'navigation.home'
11+
),
12+
isActive
13+
}
14+
}

src/helpers/formatters/tabs.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import i18n from '*/plugins/i18n'
22

3+
export function home () {
4+
const title = i18n.global.t(
5+
'navigation.home'
6+
)
7+
8+
return {
9+
title,
10+
path: 'home',
11+
icon: 'home'
12+
}
13+
}
14+
315
export function feed () {
416
const title = i18n.global.t(
517
'navigation.feed'

src/views/FeedPage.vue

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,46 @@
11
<template>
2-
<div
3-
:class="[
4-
'feed-page-container',
5-
'main-page-segment-container'
6-
]"
2+
<BaseFeedPageContainer
3+
:limit="limit"
74
>
8-
<BaseHeader
9-
class="main-app-title"
10-
tag="h1"
11-
text="muffon"
12-
/>
13-
14-
<FeedSegment />
15-
</div>
5+
<template #default="pageSlotProps">
6+
<BasePaginatedPageContainer
7+
response-data-name="feedData"
8+
:slot-props-data="pageSlotProps"
9+
:scope="scope"
10+
:limit="limit"
11+
>
12+
<template #default="slotProps">
13+
<BasePostsSimpleList
14+
:posts="slotProps[scope]"
15+
/>
16+
</template>
17+
</BasePaginatedPageContainer>
18+
</template>
19+
</BaseFeedPageContainer>
1620
</template>
1721

1822
<script>
19-
import BaseHeader from '*/components/BaseHeader.vue'
20-
import FeedSegment from './FeedPage/FeedSegment.vue'
21-
import navigationMixin from '*/mixins/navigationMixin'
22-
import {
23-
feed as formatFeedPageNavigation
24-
} from '*/helpers/formatters/navigation'
25-
import {
26-
feed as formatFeedPageTab
27-
} from '*/helpers/formatters/tabs'
23+
import BaseFeedPageContainer
24+
from '*/components/containers/pages/feed/BaseFeedPageContainer.vue'
25+
import BasePaginatedPageContainer
26+
from '*/components/containers/pages/BasePaginatedPageContainer.vue'
27+
import BasePostsSimpleList
28+
from '*/components/lists/posts/BasePostsSimpleList.vue'
2829
2930
export default {
3031
name: 'FeedPage',
3132
components: {
32-
BaseHeader,
33-
FeedSegment
33+
BaseFeedPageContainer,
34+
BasePaginatedPageContainer,
35+
BasePostsSimpleList
3436
},
35-
mixins: [
36-
navigationMixin
37-
],
38-
computed: {
39-
navigationSections () {
40-
return formatFeedPageNavigation()
41-
},
42-
tabData () {
43-
return formatFeedPageTab()
37+
data () {
38+
return {
39+
limit: 50,
40+
scope: 'feed'
4441
}
45-
},
46-
mounted () {
47-
this.setNavigation()
4842
}
4943
}
5044
</script>
5145

52-
<style lang="sass" scoped>
53-
.feed-page-container
54-
@extend .d-flex, .flex-column, .align-items-center
55-
padding-top: 5vh
56-
height: 70vh
57-
</style>
46+
<style lang="sass" scoped></style>

src/views/FeedPage/FeedSegment.vue

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)