Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
820
Issues
820
List
Boards
Labels
Service Desk
Milestones
Merge Requests
47
Merge Requests
47
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
Commits
575782fe
Commit
575782fe
authored
2 hours ago
by
Emiliano Balbuena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(wip): Pro Subscription component
parent
0aa1f4e1
epic/minds-pro
1 merge request
!459
WIP: (feat): Minds Pro
Pipeline
#72477591
passed with stages
in 33 minutes and 7 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
150 additions
and
4 deletions
+150
-4
marketing.component.html
src/app/modules/pro/marketing.component.html
+1
-1
marketing.component.ts
src/app/modules/pro/marketing.component.ts
+1
-1
pro.module.ts
src/app/modules/pro/pro.module.ts
+3
-2
pro.service.ts
src/app/modules/pro/pro.service.ts
+24
-0
subscription.component.html
src/app/modules/pro/subscription.component.html
+30
-0
subscription.component.ts
src/app/modules/pro/subscription.component.ts
+91
-0
subscription.components.scss
src/app/modules/pro/subscription.components.scss
+0
-0
No files found.
src/app/modules/pro/marketing.component.html
View file @
575782fe
...
...
@@ -16,7 +16,7 @@
</div>
<div
class=
"m-marketing--hero--actions m-marketing--action-button"
>
<
!--<m-plus--subscription></m-plus--subscription>--
>
<
m-pro--subscription></m-pro--subscription
>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/marketing.component.ts
View file @
575782fe
...
...
@@ -3,7 +3,7 @@ import { Component, ChangeDetectionStrategy } from '@angular/core';
@
Component
({
selector
:
'
m-pro--marketing
'
,
templateUrl
:
'
marketing.component.html
'
,
changeDetection
:
ChangeDetectionStrategy
.
OnPush
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
export
class
ProMarketingComponent
{
minds
=
window
.
Minds
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/pro.module.ts
View file @
575782fe
...
...
@@ -5,6 +5,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import
{
CommonModule
}
from
'
../../common/common.module
'
;
import
{
ProService
}
from
'
./pro.service
'
;
import
{
ProMarketingComponent
}
from
'
./marketing.component
'
;
import
{
ProSubscriptionComponent
}
from
'
./subscription.component
'
;
const
routes
:
Routes
=
[
{
...
...
@@ -26,9 +27,9 @@ const routes: Routes = [
],
declarations
:
[
ProMarketingComponent
,
ProSubscriptionComponent
,
],
exports
:
[
],
exports
:
[],
entryComponents
:
[
ProMarketingComponent
,
],
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/pro.service.ts
View file @
575782fe
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Client
}
from
'
../../services/api/client
'
;
@
Injectable
()
export
class
ProService
{
constructor
(
protected
client
:
Client
,
)
{
}
async
isActive
():
Promise
<
boolean
>
{
const
result
:
any
=
await
this
.
client
.
get
(
'
api/v2/pro
'
);
if
(
!
result
||
typeof
result
.
isActive
===
'
undefined
'
)
{
throw
new
Error
(
'
Unable to check your Pro status
'
);
}
return
Boolean
(
result
.
isActive
);
}
async
enable
():
Promise
<
boolean
>
{
// TODO: Payments
await
this
.
client
.
post
(
'
api/v2/pro/enable
'
);
return
true
;
}
async
disable
():
Promise
<
boolean
>
{
await
this
.
client
.
delete
(
'
api/v2/pro
'
);
return
true
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/pro/subscription.component.html
0 → 100644
View file @
575782fe
<div
*
ngIf=
"isLoggedIn"
>
<ng-container
*
ngIf=
"!inProgress; else inProgressSpinner"
>
<button
*
ngIf=
"!active"
class=
"mdl-button mdl-button--colored mdl-color--green"
[
disabled
]="
inProgress
||
criticalError
"
(
click
)="
enable
()"
>
Become Pro
</button>
<button
*
ngIf=
"active"
class=
"mdl-button mdl-button--colored mdl-color--red"
[
disabled
]="
inProgress
||
criticalError
"
(
click
)="
disable
()"
>
Cancel Pro
</button>
<span
*
ngIf=
"error"
class=
"m-pro-subscription--error"
>
{{ error }}
</span>
</ng-container>
<ng-template
#
inProgressSpinner
>
<div
class=
"m-pro-subscription--in-progress"
>
<div
class=
"mdl-spinner mdl-js-spinner is-active"
[
mdl
]
></div>
</div>
</ng-template>
</div>
This diff is collapsed.
Click to expand it.
src/app/modules/pro/subscription.component.ts
0 → 100644
View file @
575782fe
import
{
ChangeDetectionStrategy
,
ChangeDetectorRef
,
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Session
}
from
'
../../services/session
'
;
import
{
ProService
}
from
'
./pro.service
'
;
@
Component
({
selector
:
'
m-pro--subscription
'
,
templateUrl
:
'
subscription.component.html
'
,
changeDetection
:
ChangeDetectionStrategy
.
OnPush
,
})
export
class
ProSubscriptionComponent
implements
OnInit
{
isLoggedIn
:
boolean
=
false
;
inProgress
:
boolean
=
false
;
active
:
boolean
;
criticalError
:
boolean
=
false
;
error
:
string
=
''
;
constructor
(
protected
service
:
ProService
,
protected
session
:
Session
,
protected
cd
:
ChangeDetectorRef
,
)
{
}
ngOnInit
()
{
this
.
isLoggedIn
=
this
.
session
.
isLoggedIn
();
if
(
this
.
isLoggedIn
)
{
this
.
load
();
}
}
async
load
()
{
this
.
inProgress
=
true
;
this
.
error
=
''
;
this
.
detectChanges
();
try
{
this
.
active
=
await
this
.
service
.
isActive
();
}
catch
(
e
)
{
this
.
criticalError
=
true
;
this
.
error
=
(
e
&&
e
.
message
)
||
'
Unknown error
'
;
}
this
.
inProgress
=
false
;
this
.
detectChanges
();
}
async
enable
()
{
this
.
inProgress
=
true
;
this
.
error
=
''
;
this
.
detectChanges
();
try
{
await
this
.
service
.
enable
();
this
.
active
=
true
;
}
catch
(
e
)
{
this
.
active
=
false
;
this
.
error
=
(
e
&&
e
.
message
)
||
'
Unknown error
'
;
}
this
.
inProgress
=
false
;
this
.
detectChanges
();
}
async
disable
()
{
this
.
inProgress
=
true
;
this
.
error
=
''
;
this
.
detectChanges
();
try
{
await
this
.
service
.
disable
();
this
.
active
=
false
;
}
catch
(
e
)
{
this
.
active
=
true
;
this
.
error
=
(
e
&&
e
.
message
)
||
'
Unknown error
'
;
}
this
.
inProgress
=
false
;
this
.
detectChanges
();
}
detectChanges
()
{
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/pro/subscription.components.scss
0 → 100644
View file @
575782fe
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment