Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
860
Issues
860
List
Boards
Labels
Service Desk
Milestones
Merge Requests
55
Merge Requests
55
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
c545917f40fa0438e152d8551c63120d39080865...754b5bf02089e6ce7adacec012be9d30361637e4
Source
754b5bf02089e6ce7adacec012be9d30361637e4
Select Git revision
...
Target
c545917f40fa0438e152d8551c63120d39080865
Select Git revision
Compare
Commits (2)
(feat): introduced "all" category
· c809c2b3
Marcelo Rivera
authored
1 hour ago
c809c2b3
(feat): hashtag filtering via url
· 754b5bf0
Marcelo Rivera
authored
31 minutes ago
(feat): check child route params via service subscription
754b5bf0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
46 deletions
+68
-46
channel.component.ts
src/app/modules/pro/channel/channel.component.ts
+43
-25
channel.service.ts
src/app/modules/pro/channel/channel.service.ts
+12
-8
donate.component.ts
src/app/modules/pro/channel/donate/donate.component.ts
+1
-0
list-modal.component.ts
...pp/modules/pro/channel/list-modal/list-modal.component.ts
+3
-4
list.component.ts
src/app/modules/pro/channel/list/list.component.ts
+7
-9
signup.component.ts
src/app/modules/pro/channel/signup/signup.component.ts
+2
-0
No files found.
src/app/modules/pro/channel/channel.component.ts
View file @
754b5bf0
...
...
@@ -8,10 +8,10 @@ import {
OnDestroy
,
OnInit
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
,
Router
,
NavigationEnd
,
NavigationStart
}
from
"
@angular/router
"
;
import
{
ActivatedRoute
,
NavigationEnd
,
Router
}
from
"
@angular/router
"
;
import
{
Session
}
from
"
../../../services/session
"
;
import
{
Subscription
}
from
"
rxjs
"
;
import
{
MindsUser
,
Tag
}
from
"
../../../interfaces/entities
"
;
import
{
MindsUser
}
from
"
../../../interfaces/entities
"
;
import
{
Client
}
from
"
../../../services/api/client
"
;
import
{
MindsTitle
}
from
'
../../../services/ux/title
'
;
import
{
ProChannelService
}
from
'
./channel.service
'
;
...
...
@@ -39,6 +39,8 @@ export class ProChannelComponent implements OnInit, OnDestroy {
params$
:
Subscription
;
childParams$
:
Subscription
;
searchedText
:
string
;
routerSubscription
:
Subscription
;
...
...
@@ -83,13 +85,6 @@ export class ProChannelComponent implements OnInit, OnDestroy {
}
this
.
currentURL
=
navigationEvent
.
urlAfterRedirects
;
const
segments
=
this
.
currentURL
.
split
(
'
/
'
);
let
lastSegment
=
segments
[
segments
.
length
-
1
];
let
paramIndex
=
lastSegment
.
indexOf
(
'
;
'
);
const
type
=
paramIndex
!==
-
1
?
lastSegment
.
substring
(
0
,
paramIndex
)
:
lastSegment
;
this
.
shouldShowCategories
(
type
);
this
.
setTitle
();
}
}
catch
(
e
)
{
...
...
@@ -102,14 +97,14 @@ export class ProChannelComponent implements OnInit, OnDestroy {
this
.
username
=
params
[
'
username
'
];
}
if
(
this
.
route
.
children
.
length
>
0
)
{
this
.
shouldShowCategories
(
this
.
route
.
children
[
0
].
snapshot
.
params
.
type
);
}
if
(
this
.
username
&&
(
!
this
.
channel
||
this
.
channel
.
username
!=
this
.
username
))
{
this
.
load
();
}
});
this
.
childParams$
=
this
.
channelService
.
childParamsChange
.
subscribe
((
params
)
=>
{
this
.
shouldShowCategories
(
params
.
type
);
});
}
setTitle
()
{
...
...
@@ -131,6 +126,7 @@ export class ProChannelComponent implements OnInit, OnDestroy {
ngOnDestroy
()
{
this
.
params$
.
unsubscribe
();
this
.
childParams$
.
unsubscribe
();
this
.
routerSubscription
.
unsubscribe
();
}
...
...
@@ -164,7 +160,7 @@ export class ProChannelComponent implements OnInit, OnDestroy {
}
this
.
channel
.
subscribed
=
true
;
this
.
client
.
post
(
'
api/v1/subscribe/
'
+
this
.
channel
.
guid
,
{})
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
error
)
{
...
...
@@ -244,15 +240,7 @@ export class ProChannelComponent implements OnInit, OnDestroy {
}
search
()
{
if
(
!
this
.
currentURL
)
{
this
.
currentURL
=
`/pro/
${
this
.
channel
.
username
}
/articles`
;
//TODO ADD /TOP when algorithm is enabled
}
else
{
if
(
this
.
currentURL
.
includes
(
'
query
'
))
{
this
.
currentURL
=
this
.
currentURL
.
split
(
'
;
'
)[
0
];
}
}
this
.
router
.
navigate
([
this
.
currentURL
,
{
query
:
this
.
searchedText
,
period
:
'
24h
'
}]);
this
.
router
.
navigate
([
this
.
getCurrentURL
(),
{
query
:
this
.
searchedText
,
period
:
'
24h
'
}]);
}
clearSearch
()
{
...
...
@@ -266,12 +254,42 @@ export class ProChannelComponent implements OnInit, OnDestroy {
}
selectTag
(
clickedTag
:
any
)
{
this
.
channelService
.
setSelectedHashtag
(
clickedTag
);
for
(
let
tag
of
this
.
channel
.
pro_settings
.
tag_list
)
{
tag
.
selected
=
tag
.
tag
==
clickedTag
.
tag
;
}
const
params
=
{
...
this
.
getCurrentURLParams
()
};
params
[
'
hashtag
'
]
=
clickedTag
.
tag
;
this
.
router
.
navigate
([
this
.
getCurrentURL
(),
params
]);
this
.
detectChanges
();
}
getCurrentURL
()
{
let
currentURL
=
this
.
currentURL
;
if
(
!
currentURL
)
{
currentURL
=
`/pro/
${
this
.
channel
.
username
}
/articles`
;
//TODO ADD /TOP when algorithm is enabled
}
else
if
(
currentURL
.
includes
(
'
;
'
))
{
currentURL
=
this
.
currentURL
.
split
(
'
;
'
)[
0
];
}
return
currentURL
;
}
getCurrentURLParams
()
{
const
params
=
{};
if
(
this
.
currentURL
)
{
const
paramsArray
=
this
.
currentURL
.
split
(
'
;
'
);
for
(
let
i
:
number
=
1
;
i
<
paramsArray
.
length
;
++
i
)
{
const
p
=
paramsArray
[
i
];
let
pp
=
p
.
split
(
'
=
'
);
params
[
pp
[
0
]]
=
pp
[
1
];
}
}
return
params
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/channel.service.ts
View file @
754b5bf0
import
{
EventEmitter
,
Injectable
}
from
'
@angular/core
'
;
import
{
MindsChannelResponse
}
from
'
../../../interfaces/responses
'
;
import
{
MindsUser
,
Tag
}
from
'
../../../interfaces/entities
'
;
import
{
MindsUser
}
from
'
../../../interfaces/entities
'
;
import
{
Client
}
from
'
../../../services/api/client
'
;
import
{
EntitiesService
}
from
'
../../../common/services/entities.service
'
;
import
normalizeUrn
from
'
../../../helpers/normalize-urn
'
;
...
...
@@ -10,16 +10,18 @@ export class ProChannelService {
currentChannel
:
MindsUser
;
selectedHashtag
:
Tag
;
childParams
:
any
;
childParamsChange
:
EventEmitter
<
any
>
=
new
EventEmitter
<
any
>
();
selectedHashtagChange
:
EventEmitter
<
Tag
>
=
new
EventEmitter
<
Tag
>
();
protected
featuredContent
:
Array
<
any
>
|
null
;
constructor
(
protected
client
:
Client
,
protected
entitiesService
:
EntitiesService
,
)
{
}
)
{
}
async
load
(
id
:
string
)
{
try
{
...
...
@@ -28,6 +30,7 @@ export class ProChannelService {
const
response
:
MindsChannelResponse
=
await
this
.
client
.
get
(
`api/v1/channel/
${
id
}
`
)
as
MindsChannelResponse
;
this
.
currentChannel
=
response
.
channel
;
this
.
currentChannel
.
pro_settings
.
tag_list
.
unshift
({
tag
:
'
all
'
,
label
:
'
All
'
,
selected
:
false
});
this
.
featuredContent
=
null
;
return
this
.
currentChannel
;
...
...
@@ -66,14 +69,15 @@ export class ProChannelService {
return
this
.
featuredContent
;
}
set
SelectedHashtag
(
value
:
Tag
)
{
this
.
selectedHashtag
=
value
;
this
.
selectedHashtagChange
.
emit
(
this
.
selectedHashtag
);
set
ChildParams
(
params
:
any
)
{
this
.
childParams
=
params
;
this
.
childParamsChange
.
emit
(
this
.
childParams
);
}
linkTo
(
to
,
query
,
algorithm
?)
{
let
route
=
[
'
/pro
'
,
this
.
currentChannel
.
username
,
to
];
if
(
algorithm
)
{
if
(
algorithm
)
{
route
.
push
(
algorithm
);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/donate/donate.component.ts
View file @
754b5bf0
...
...
@@ -15,6 +15,7 @@ export class ProChannelDonateComponent {
constructor
(
public
channelService
:
ProChannelService
)
{
this
.
channelService
.
setChildParams
({});
}
onWireCompleted
()
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/list-modal/list-modal.component.ts
View file @
754b5bf0
...
...
@@ -4,7 +4,6 @@ import { FeedsService } from '../../../../common/services/feeds.service';
import
{
ProContentModalComponent
}
from
'
../content-modal/modal.component
'
;
import
{
OverlayModalService
}
from
'
../../../../services/ux/overlay-modal
'
;
import
{
OverlayModalComponent
}
from
'
../../../../common/components/overlay-modal/overlay-modal.component
'
;
import
{
Tag
}
from
"
../../../../interfaces/entities
"
;
@
Component
({
selector
:
'
m-pro--channel-list-modal
'
,
...
...
@@ -20,7 +19,7 @@ export class ProChannelListModal {
query
:
string
;
hashtag
:
Ta
g
;
hashtag
:
strin
g
;
parent
:
HTMLDivElement
;
...
...
@@ -62,8 +61,8 @@ export class ProChannelListModal {
params
.
push
(
`query=
${
this
.
query
}
`
);
}
if
(
this
.
hashtag
)
{
params
.
push
(
`hashtags=
${
this
.
hashtag
.
tag
}
`
);
if
(
this
.
hashtag
&&
this
.
hashtag
!==
'
all
'
)
{
params
.
push
(
`hashtags=
${
this
.
hashtag
}
`
);
}
if
(
params
.
length
>
0
)
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/list/list.component.ts
View file @
754b5bf0
...
...
@@ -31,7 +31,7 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
displaySeeMoreTile
:
boolean
=
false
;
selectedHashtag
:
Ta
g
;
selectedHashtag
:
strin
g
;
selectedHashtag$
:
Subscription
;
...
...
@@ -48,12 +48,6 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
ngOnInit
()
{
this
.
listen
();
this
.
selectedHashtag$
=
this
.
channelService
.
selectedHashtagChange
.
subscribe
((
tag
)
=>
{
this
.
selectedHashtag
=
tag
;
this
.
load
(
true
);
})
}
private
listen
()
{
...
...
@@ -84,6 +78,9 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
this
.
algorithm
=
params
[
'
algorithm
'
]
||
'
top
'
;
this
.
query
=
params
[
'
query
'
]
||
''
;
this
.
period
=
params
[
'
period
'
]
||
''
;
this
.
selectedHashtag
=
params
[
'
hashtag
'
];
this
.
channelService
.
setChildParams
(
params
);
this
.
load
(
true
);
});
...
...
@@ -116,6 +113,7 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
async
load
(
refresh
:
boolean
=
false
)
{
if
(
refresh
)
{
this
.
entities
=
[];
this
.
feedsService
.
clear
();
}
...
...
@@ -125,8 +123,8 @@ export class ProChannelListComponent implements OnInit, OnDestroy {
let
params
=
[];
if
(
this
.
selectedHashtag
)
{
params
.
push
(
`hashtags=
${
this
.
selectedHashtag
.
tag
}
`
);
if
(
this
.
selectedHashtag
&&
this
.
selectedHashtag
!==
'
all
'
)
{
params
.
push
(
`hashtags=
${
this
.
selectedHashtag
}
`
);
}
if
(
this
.
query
&&
(
this
.
query
!==
''
))
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/signup/signup.component.ts
View file @
754b5bf0
...
...
@@ -48,6 +48,8 @@ export class ProChannelSignupComponent {
if
(
this
.
session
.
isLoggedIn
())
{
this
.
router
.
navigate
([
'
/pro
'
,
this
.
username
]);
}
this
.
service
.
setChildParams
(
params
);
});
}
...
...
This diff is collapsed.
Click to expand it.